nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.51k stars 214 forks source link

Latex-rendering error #1183

Open mdietrich16 opened 1 year ago

mdietrich16 commented 1 year ago

Prerequisites

Neovim Version

0.10.0

Neorg setup

opts = {
        load = {
            ["core.defaults"] = {},
            ["core.concealer"] = {
                config = {
                    folds = true,
                    init_open_folds = "always",
                    icon_preset = "diamond",
                },
            },
            ["core.dirman"] = {
                config = {
                    default_workspace = "notes",
                    workspaces = {
                        notes = "~/Documents/Sync/neorg/",
                    },
                },
            },
            ["core.completion"] = {
                config = {
                    engine = "nvim-cmp",
                },
            },
            ["core.summary"] = {},
            ["core.integrations.telescope"] = {},
            ["core.integrations.image"] = {},
            ["core.latex.renderer"] = {},
        },
    }

Actual behavior

With image.nvim installed, the intagrations enabled and rendering another image, upon running :Neorg render-latex I get the following message

Error executing Lua callback: ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:172: attempt to index field 'image' (a nil value)
stack traceback:
    ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:172: in function 'on_event'
    .../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:709: in function 'broadcast_event'
    ...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:286: in function <...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:193>

After deleting the .image /some/path.png I now get (weird) latex rendering but also

Error executing Lua callback: ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:153: bad argument #1 to 'rep' (number expected, got nil)
stack traceback:
    [C]: in function 'rep'
    ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:153: in function 'render_inline_math'
    ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:174: in function 'on_event'
    .../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:709: in function 'broadcast_event'
    ...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:286: in function <...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:193>

Weird latex rendering means multiple instances of the same image after scrolling, the neorg src for latex still gets rendered and the locations are not in sync.

Expected behavior

Render latex instead of neorg src i guess?

Steps to reproduce

Well, try to render latex with another image rendered and also try to render latex on its own.

Potentially conflicting plugins

No response

Other information

No response

Help

None

Implementation help

No response

juniorsundar commented 10 months ago

Rather than going down the render image route, is there any benefit in rendering LaTeX equations using pure ASCII characters as achieved by jbyuki/nabla.nvim

Since it is purely ASCII characters, there is no need for it to be run on a GPU accelerated Terminal emulator.

It is working quite well for me and isn't conflicting with Neorg.