neorg icon indicating copy to clipboard operation
neorg copied to clipboard

render-latex not working

Open Radrahil opened this issue 1 year ago • 3 comments

Prerequisites

  • [X] I am using the latest stable release of Neovim
  • [X] 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 avatar Feb 14 '24 12:02 Radrahil

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 avatar Feb 25 '24 03:02 Camerooooon

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

Camerooooon avatar Feb 25 '24 03:02 Camerooooon

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?)

arminius-smh avatar Apr 05 '24 00:04 arminius-smh