Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core.latex.renderer: dependency core.integrations.image not satisfied (lazy.nvim) #1398

Open
2 tasks done
fractal-robot opened this issue Apr 19, 2024 · 7 comments
Open
2 tasks done
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@fractal-robot
Copy link

fractal-robot commented Apr 19, 2024

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

v0.10.0-dev

Neorg setup

require("neorg").setup({
	load = {
		["core.defaults"] = {},

		["core.completion"] = {
			config = {
				engine = "nvim-cmp",
			},
		},

		["core.concealer"] = {},

		["core.latex.renderer"] = {
			config = {
				render_on_enter = false,
			},
		},

		["core.autocommands"] = {},
		["core.integrations.treesitter"] = {},
		["core.neorgcmd"] = {},

		["core.dirman"] = {
			config = {
				workspaces = {
					notes = "~/notes",
				},
				default_workspace = "notes",
			},
		},
	},
})

Actual behavior

.../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:307
Unable to load module core.latex.renderer, wanted dependency core.integrations.image was not
 satisfied. Be sure to load the module and its appropriate config too!

Expected behavior

Neorg detecting the installation of image.nvim, installed as follows:

return {
	"3rd/image.nvim",
	dependencies = { "luarocks.nvim" },

	config = function()
		require("image").setup({
			backend = "kitty",
			integrations = {
				neorg = {
					enabled = true,
					clear_in_insert_mode = false,
					download_remote_images = true,
					only_render_image_at_cursor = false,
					filetypes = { "norg" },
				},
			},

			max_width = 80,
		})
	end,
}

Instead, I get the following error:

.../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:307
Unable to load module core.latex.renderer, wanted dependency core.integrations.image was not
 satisfied. Be sure to load the module and its appropriate config too!

Here is how neorg is installed:

return {
	{
		"vhyrro/luarocks.nvim",
		priority = 1000, -- We'd like this plugin to load first out of the rest
		config = true, -- This automatically runs `require("luarocks-nvim").setup()`
	},
	{
		"nvim-neorg/neorg",
		dependencies = { "luarocks.nvim" },
		-- put any other flags you wanted to pass to lazy here!
		config = function()
			require("neorg").setup({
                                      ...........

Steps to reproduce

Using lazy.nvim, try to use the module core.latex.renderer

Potentially conflicting plugins

Other information

No response

Help

Yes, but I don't know how to start. I would need guidance (check question below)

Implementation help

No response

@fractal-robot fractal-robot added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Apr 19, 2024
@pysan3
Copy link
Contributor

pysan3 commented Apr 20, 2024

As it literally says in the error message, you need to add ["core.integrations.image"] = {} to the setup({ load = ... }) as well.

@fractal-robot
Copy link
Author

fractal-robot commented Apr 20, 2024

I through that it was misleading, since there is no integration core.integration.image in the wiki, nor the latex rendering is working when I explicitly add this integration in my config:

Error executing Lua callback: ...al/share/nvim/lazy/image.nvim/lua/image/utils/logger.lua:54: 11:27:24.744156 [image.nvim] image.nvim: file not found: /tmp/nvim.usr/AqmtRU/4
stack traceback:
        [C]: in function 'handler'
        ...al/share/nvim/lazy/image.nvim/lua/image/utils/logger.lua:54: in function 'throw'
        ...sr/.local/share/nvim/lazy/image.nvim/lua/image/image.lua:235: in function 'from_file'
        ...org/lua/neorg/modules/core/integrations/image/module.lua:35: in function 'new_image'
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:78: in function 'callback'
        ...ua/neorg/modules/core/integrations/treesitter/module.lua:729: in function 'execute_query'
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:61: in function 'latex_renderer'
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:198: in function 'on_event'
        .../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:794: in function 'broadcast_event'
        ...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:298: in function <...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:205>

Note that the use of .image render the image correctly using image.nvim

@fractal-robot
Copy link
Author

The error changes when I install the TeX Live suit using sudo pacman -S texlive.

So maybe the error does not come from image.nvim, or the rendering of the image at all, but from the way the latex code is compiled?

Maybe the instructions on how to use the latex preview should be made clear in the wiki page.

If you need more data specific to my system, I can do a more complete report.

@benlubas
Copy link
Contributor

Yes you need latex installed to render latex. I have this requirement added on the branch where I'm updating the renderer.

Want help with the new error? you can add it to the thread.

@fractal-robot
Copy link
Author

Here is the new error:

stack traceback:
	...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:169: in function 'render_inline_math'
	...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:199: in function 'on_event'
	.../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:794: in function 'broadcast_event'
	...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:298: in function <...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:205>
   Error  03:04:26 PM msg_show.lua_error   Neorg render-latex Error executing Lua callback: ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:169: attempt to index a nil value

When trying to render this latex expression: $x = 2$.

neorg.lua

return {
  "nvim-neorg/neorg",
  dependencies = { "max397574/neorg-contexts" },

  config = function()
    require("neorg").setup({
      load = {
        ["core.defaults"] = {},

        ["core.completion"] = {
          config = {
            engine = "nvim-cmp",
          },
        },

        ["core.concealer"] = {},

        ["external.context"] = {},

        ["core.latex.renderer"] = {
          config = {
            render_on_enter = false,
          },
        },

        ["core.autocommands"] = {},
        ["core.integrations.treesitter"] = {},
        ["core.neorgcmd"] = {},
        ["core.integrations.image"] = {},

        ["core.dirman"] = {
          config = {
            workspaces = {
              notes = "~/notes",
            },
            default_workspace = "notes",
          },
        },
      },
    })

    vim.wo.foldlevel = 99
    vim.wo.conceallevel = 2
  end,
}

image.lua

return {
  "3rd/image.nvim",

  config = function()
    require("image").setup({
      backend = "kitty",
      integrations = {
        neorg = {
          enabled = true,
          clear_in_insert_mode = false,
          download_remote_images = true,
          only_render_image_at_cursor = false,
          filetypes = { "norg" },
        },
      },

      window_overlap_clear_enabled = true,
    })
  end,
}

Other informations

  • The full package group texlive is installed on my machine.
  • The nvim plugin nabla.nvim renders latex equations correctly.
    • The latex treesitter parser, thus, works correctly.

@benlubas
Copy link
Contributor

I can look into it but at this point it's probably not worth. Can you test my async latex render branch and see if it still fails? There's a PR up for it.

@fractal-robot
Copy link
Author

"benlubas/neorg",
branch = "feat/async_images_via_nio",

This is working using your async latex render branch.
image

Thanks a lot for this!

I will close the issue once your PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

No branches or pull requests

3 participants