vimtex icon indicating copy to clipboard operation
vimtex copied to clipboard

Previewer is non functional with zathura method

Open Felipe-9 opened this issue 1 year ago • 22 comments

Description

Previewer is not working, whenever i try to do \lv or :VimtexView nothing happens, neither zathura nor zathura_simple is working, zathura seems to be installed alright on my computer

zathura --version

zathura 0.5.2
girara 0.4.0 (runtime: 0.4.0)
(plugin) pdf-poppler (0.3.0) (/opt/homebrew/Cellar/zathura/0.5.2/lib/zathura/libpdf-poppler.dylib)

Steps to reproduce

Have my config:

Vimtex.lua

return {
  "lervag/vimtex",
  lazy = false,
  init = function()
    local g = vim.g
    g.vimtex_view_method = "zathura"
    -- g.vimtex_view_method = "zathura_simple"
    g.vimtex_compiler_latexmk_engines = { ["_"] = '-lualatex'}
    g.vimtex_compiler_latexmk = {
      aux_dir = ".build",
      -- out_dir = "",
      options = {
        "-shell-escape",
        "-verbose",
        "-file-line-error",
        "-synctex=1",
        "-interaction=nonstopmode",
      }
    }
    g.vimtex_quickfix_mode = 0
    g.vimtex_mappings_enable = 0
    g.vimtex_log_ignore = ({
      "Underfull",
      "Overfull",
      "specifier changed to",
      "Token not allowed in PDF string",
    })
  end
}

Expected behavior

open pdf previewer on compiling and after pressing the shortucts or the command :VimtexView

Actual behavior

nothing happens, no error, no anything

Do you use a latexmkrc file?

no

VimtexInfo

System info:
  OS: macOS 14.6.1 (23G93)
  Vim version: NVIM v0.10.1
  Has clientserver: true
  Servername: /var/folders/5f/hn34hzl13y907124_kr68p380000gn/T/nvim.felipepinto/jsx9et/nvim.94442.0

VimTeX project: MWE
  base: MWE.tex
  root: /Users/felipepinto/.config/nvim.mwe/MWE
  tex: /Users/felipepinto/.config/nvim.mwe/MWE/MWE.tex
  main parser: current file verified
  document class: minipage
  packages: calc ctablestack expl3 fontenc fontsize fontspec fontspec-luatex ifluatex iftex import infwarerr ltxcmds luacode luatex85 luatexbase pdftexcmds shellesc subfiles xfp xkeyval xparse
  compiler: latexmk
    engine: -lualatex
    options:
      -shell-escape
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    aux_dir: .build
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 8
      output: /var/folders/5f/hn34hzl13y907124_kr68p380000gn/T/nvim.felipepinto/jsx9et/0
      cmd: max_print_line=2000 latexmk -shell-escape -verbose -file-line-error -synctex=1 -interaction=nonstopmode  -lualatex -emulate-aux-dir -auxdir=.build -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'MWE.tex'
      pid: 95005
  viewer: Zathura
    xwin id: 0
    cmd_start: zathura  -x "/opt/homebrew/Cellar/neovim/0.10.1/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 13:1:'/Users/felipepinto/.config/nvim.mwe/MWE/MWE.tex' 'MWE.pdf'&
  qf method: LaTeX logfile

Felipe-9 avatar Sep 24 '24 22:09 Felipe-9

First, I notice that you are testing this on a file with a very long name. Is that relevant here, or do you have the same problem with regular (short) file names?

lervag avatar Sep 25 '24 19:09 lervag

Also, just for curiosity: Why do you want to alias g to vim.g? I don't see the benefit here. Yes, you are saving a few characters, but the lines are pretty short anyway, and now you can't really immediately copy those lines around since they rely on this initial alias.

lervag avatar Sep 25 '24 19:09 lervag

on the alias, i dont really have such strong opinion on maintaining it or not. on the file name, no it just happens to be the same file as the other issue, i should probably just have used a new MWE, my bad i already edited the mwe to a regular name/path

Felipe-9 avatar Sep 25 '24 20:09 Felipe-9

on the file name, no it just happens to be the same file as the other issue, i should probably just have used a new MWE, my bad

Ok, so, the issue is still there regardless? Does it work if you open a file from a terminal with zathura test.pdf?

Btw: On MacOS I think Skim is the most popular PDF viewer and I think it should be quite good.

lervag avatar Sep 25 '24 20:09 lervag

Zathura does work fine when i use the terminal: zathura test.pdf, i could check it out, i had chosen zanthura cause the vim navigation and it would be the same tool with my linux computer.

Felipe-9 avatar Sep 25 '24 20:09 Felipe-9

Ok, great. If you open you mwe.tex file, compile it, then do :!zathura mwe.pdf - does it open now?

lervag avatar Sep 26 '24 20:09 lervag

Alright lemme try.... yup, working alright.

Screenshot 2024-09-26 at 21 43 10 Screenshot 2024-09-26 at 21 43 25

Felipe-9 avatar Sep 26 '24 20:09 Felipe-9

Cool, now, again in the terminal, what happens if you do this?

zathura  -x "/opt/homebrew/Cellar/neovim/0.10.1/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 13:1:'/Users/felipepinto/.config/nvim.mwe/MWE/MWE.tex' 'MWE.pdf'

lervag avatar Sep 26 '24 20:09 lervag

i get this error

error: Built without synctex support, but synctex specific option was specified.

Felipe-9 avatar Sep 26 '24 20:09 Felipe-9

maybe the problem is the missing synctex support im going to re-install zathura with the --with-synctex option

Felipe-9 avatar Sep 26 '24 20:09 Felipe-9

im getting a new error...

zathura  -x "/opt/homebrew/Cellar/neovim/0.10.1/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 13:1:'/Users/felipepinto/.config/nvim.mwe/MWE/MWE.tex' 'MWE.pdf'
error: Could not connect to session bus: Cannot autolaunch D-Bus without X11 $DISPLAY
error: Got no usable data from SyncTeX or D-Bus failed in some way.

Felipe-9 avatar Sep 26 '24 21:09 Felipe-9

Ok, the next step now is to read :help vimtex-faq-zathura-macos.

lervag avatar Sep 26 '24 21:09 lervag

Alright i will get to it, thanks for leading the way. will report on it later

Felipe-9 avatar Sep 26 '24 21:09 Felipe-9

@lervag On the "libsynctex not linked" issue, we do have code to check its existence:

  " Check if Zathura has libsynctex
  if g:vimtex_view_zathura_check_libsynctex && executable('ldd')
    let l:shared = vimtex#jobs#capture('ldd $(which zathura)')
    if v:shell_error == 0
          \ && empty(filter(l:shared, 'v:val =~# ''libsynctex'''))
      call vimtex#log#warning('Zathura is not linked to libsynctex!')
      if has_key(a:viewer, 'has_synctex')
        let a:viewer.has_synctex = 0
      endif
    endif
  endif

However (from some online search, I don't have a Mac) ldd doesn't exist on Mac.

Maybe it's a more robust to grep for the error message from zathura from inside the

  call vimtex#jobs#run(self.cmd_forward_search)

call? (or check the process' return code but I don't know if this one work)

user202729 avatar Oct 13 '24 03:10 user202729

However (from some online search, I don't have a Mac) ldd doesn't exist on Mac.

yes, you are right macos doesnt have ldd.

Maybe it's a more robust to grep for the error message from zathura from inside the

i tried running the command but i got this error Screenshot 2024-10-13 at 12 57 48

Felipe-9 avatar Oct 13 '24 12:10 Felipe-9

@lervag On the "libsynctex not linked" issue, we do have code to check its existence: …

However (from some online search, I don't have a Mac) ldd doesn't exist on Mac.

Yes, that's right. In my opinion, users who want to use Zathura on a MacOS are more or less "on their own". I don't mind helping by improving the docs, but I don't use MacOS and I don't want to make more code than necessary to support users on systems where I can't actively test things myself.

Maybe it's a more robust to grep for the error message from zathura from inside the

  call vimtex#jobs#run(self.cmd_forward_search)

call? (or check the process' return code but I don't know if this one work)

Well, I'm not sure how to do that in a reliably and easy manner that would work on both Vim and Neovim. It seems at the very best to be non-trivial.

So, as above, I instead want to give this burden to the users. If you want to use VimTeX and you are using MacOS, and if you insist on using Zathura, then the best thing that I can do is to keep the faq section up to date based on user input.

Obviously, if I get help from MacOS users to implement and improve things, then I would be glad to merge PR's!


@Felipe-9

Let me know if or when you have looked at the faq section and if you have some followup questions. It could be possible to drag some other users into this discussion that may be able to help.

lervag avatar Oct 13 '24 14:10 lervag

i havent checked rightfully yet, as i can simply open with zanthura without using vimtex. the workaround has been good enough for now, the other problems im trying to solve take priority

Felipe-9 avatar Oct 13 '24 16:10 Felipe-9

Cool; then we'll leave this open for now.

lervag avatar Oct 13 '24 17:10 lervag

Any update on this? I’m starting my LaTeX journey this week, and it would be great to have this working?

steinbrueckri avatar Feb 13 '25 15:02 steinbrueckri

Any update on this? I’m starting my LaTeX journey this week, and it would be great to have this working?

The original issue poster has already solved their problem, if you have a new problem you need to describe it.

Are you using Mac? If so have you read the vimtex Mac FAQ?

user202729 avatar Feb 13 '25 15:02 user202729

Any update on this? I’m starting my LaTeX journey this week, and it would be great to have this working?

@user202729's comment is spot on, but I'll also just add that, since you are new to LaTeX, you should (in my humble opinion) just settle with Skim as a pdf viewer. It should just work and it'll let you focus on other things for now.

lervag avatar Feb 13 '25 20:02 lervag

Any update on this? I’m starting my LaTeX journey this week, and it would be great to have this working?

@user202729's comment is spot on, but I'll also just add that, since you are new to LaTeX, you should (in my humble opinion) just settle with Skim as a pdf viewer. It should just work and it'll let you focus on other things for now.

Thx for the input of both of you and yes I will try also skim. ✌️🤗

steinbrueckri avatar Feb 13 '25 20:02 steinbrueckri