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

render-latex not working #1306

Closed
2 tasks done
Radrahil opened this issue Feb 14, 2024 · 3 comments · Fixed by #1499
Closed
2 tasks done

render-latex not working #1306

Radrahil opened this issue Feb 14, 2024 · 3 comments · Fixed by #1499
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@Radrahil
Copy link

Prerequisites

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

Neovim Version

NVIM v0.10.0-dev-2361+ga376d979bd Build type: RelWithDebInfo LuaJIT 2.1.1702233742 Run "nvim -V1 -v" for more info

Neorg setup

  {
    "3rd/image.nvim",
    event = "VeryLazy",
    config = function()
      -- default config
      require("image").setup {
        backend = "kitty",
        integrations = {
          markdown = {
            enabled = true,
            clear_in_insert_mode = false,
            download_remote_images = true,
            only_render_image_at_cursor = false,
            filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
          },
          neorg = {
            enabled = true,
            clear_in_insert_mode = false,
            download_remote_images = true,
            only_render_image_at_cursor = false,
            filetypes = { "norg" },
          },
        },
        max_width = nil,
        max_height = nil,
        max_width_window_percentage = nil,
        max_height_window_percentage = 50,
        window_overlap_clear_enabled = false,                                     -- toggles images when windows are overlapped
        window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
        editor_only_render_when_focused = false,                                  -- auto show/hide images when the editor gains/looses focus
        tmux_show_only_in_active_window = false,                                  -- auto show/hide images in the correct Tmux window (needs visual-activity off)
        hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened
      }
    end,
  },



  {
    "nvim-neorg/neorg",
    event = "VeryLazy",
    build = ":neorg sync-parsers",
    -- tag = "*",
    dependencies = { "nvim-lua/plenary.nvim" },
    config = function()
      require("neorg").setup {
        load = {
          ["core.defaults"] = {},  -- loads default behaviour
          ["core.concealer"] = {}, -- adds pretty icons to your documents
          -- ["core.completion"] = {},
          ["core.integrations.image"] = {},
          ["core.latex.renderer"] = {},
          ["core.dirman"] = { -- manages neorg workspaces
            config = {
              workspaces = {
                notes = "~/notes",
              },
              default_workspace = "notes",
            },
          },
        },
      }
    end,
  },

Actual behavior

Error executing Lua callback: ...al/share/nvim/lazy/image.nvim/lua/image/utils/logger.lua:54: 18:17:31.959091 [image.nvim] image.nv
im: file not found: /tmp/nvim.rahil/IzeS8f/2                                                                                       
stack traceback:                                                                                                                   
        [C]: in function 'handler'                                                                                                 
        ...al/share/nvim/lazy/image.nvim/lua/image/utils/logger.lua:54: in function 'throw'                                        
        ...il/.local/share/nvim/lazy/image.nvim/lua/image/image.lua:231: in function 'from_file'                                   
        ...org/lua/neorg/modules/core/integrations/image/module.lua:31: in function 'new_image'                                    
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:65: in function 'callback'                                     
        ...ua/neorg/modules/core/integrations/treesitter/module.lua:728: in function 'execute_query'                               
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:48: in function 'latex_renderer'                               
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:176: in function 'on_event'                                    
        .../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:786: in function 'broadcast_event'                             
        ...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:286: in function <...im/lazy/neorg/lua/neorg/modules/core/neorg
cmd/module.lua:193>                             

It expects 2 and generates 1. Upon renaming the file to 4 and running Neorg render-latex,

Error executing Lua callback: ...org/lua/neorg/modules/core/integrations/image/module.lua:36: attempt to index local 'image' (a nil 
value)                                                                                                                              
stack traceback:                                                                                                                    
        ...org/lua/neorg/modules/core/integrations/image/module.lua:36: in function 'new_image'                                     
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:65: in function 'callback'                                      
        ...ua/neorg/modules/core/integrations/treesitter/module.lua:728: in function 'execute_query'                                
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:48: in function 'latex_renderer'                                
        ...y/neorg/lua/neorg/modules/core/latex/renderer/module.lua:176: in function 'on_event'                                     
        .../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:786: in function 'broadcast_event'                              
        ...im/lazy/neorg/lua/neorg/modules/core/neorgcmd/module.lua:286: in function <...im/lazy/neorg/lua/neorg/modules/core/neorgc
md/module.lua:193>      

Expected behavior

Rendering latex

Steps to reproduce

Running the render-latex command?

Potentially conflicting plugins

No response

Other information

No response

Help

No

Implementation help

No response

@Radrahil Radrahil added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Feb 14, 2024
@Camerooooon
Copy link

I am also having this issue

Error executing Lua callback: .../pack/packer/start/image.nvim/lua/image/utils/logger.lua:54: 19:41:29.245071 [image.nvim] image.nvim:
 file not found: /tmp/nvim.cameron/x8YR2l/16                                                                                          
stack traceback:                                                                                                                      
        [C]: in function 'handler'                                                                                                    
        .../pack/packer/start/image.nvim/lua/image/utils/logger.lua:54: in function 'throw'                                           
        ...im/site/pack/packer/start/image.nvim/lua/image/image.lua:231: in function 'from_file'                                      
        ...org/lua/neorg/modules/core/integrations/image/module.lua:35: in function 'new_image'                                       
        ...t/neorg/lua/neorg/modules/core/latex/renderer/module.lua:77: in function 'callback'                                        
        ...ua/neorg/modules/core/integrations/treesitter/module.lua:728: in function 'execute_query'                                  
        ...t/neorg/lua/neorg/modules/core/latex/renderer/module.lua:60: in function 'latex_renderer'                                  
        ...t/neorg/lua/neorg/modules/core/latex/renderer/module.lua:197: in function 'on_event'                                       
        .../site/pack/packer/start/neorg/lua/neorg/core/modules.lua:789: in function 'broadcast_event'                                
        ...r/start/neorg/lua/neorg/modules/core/neorgcmd/module.lua:298: in function <...r/start/neorg/lua/neorg/modules/core/neorgcmd
/module.lua:205>

@Camerooooon
Copy link

It looks like this issue is due to latex failing to compile the math. Look in /tmp/nvim.rahil/IzeS8f/2.log for information.

@arminius-smh
Copy link

I had the same issue, looked in my tmp folder and saw that it was failing to compile this tex file:

\documentclass[6pt]{standalone}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
$\frac{1}{2}$
\end{document}%

I tried to compile it manually - and saw I was missing the 'standalone' package, after installing it everything works perfectly now (maybe the required packages for latex to compile could/should be added to the wiki?)

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

Successfully merging a pull request may close this issue.

3 participants