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

Previewer is non functional with zathura method #3003

Open
Felipe-9 opened this issue Sep 24, 2024 · 18 comments
Open

Previewer is non functional with zathura method #3003

Felipe-9 opened this issue Sep 24, 2024 · 18 comments
Labels

Comments

@Felipe-9
Copy link

Felipe-9 commented Sep 24, 2024

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 Felipe-9 added the bug label Sep 24, 2024
@Felipe-9 Felipe-9 changed the title Previewer is non functional Previewer is non functional with zathura method Sep 24, 2024
@lervag
Copy link
Owner

lervag commented Sep 25, 2024

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
Copy link
Owner

lervag commented Sep 25, 2024

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.

@Felipe-9
Copy link
Author

Felipe-9 commented Sep 25, 2024

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

@lervag
Copy link
Owner

lervag commented Sep 25, 2024

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.

@Felipe-9
Copy link
Author

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.

@lervag
Copy link
Owner

lervag commented Sep 26, 2024

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

@Felipe-9
Copy link
Author

Felipe-9 commented Sep 26, 2024

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

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

@lervag
Copy link
Owner

lervag commented Sep 26, 2024

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'

@Felipe-9
Copy link
Author

i get this error

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

@Felipe-9
Copy link
Author

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

@Felipe-9
Copy link
Author

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.

@lervag
Copy link
Owner

lervag commented Sep 26, 2024

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

@Felipe-9
Copy link
Author

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

@user202729
Copy link

user202729 commented Oct 13, 2024

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

@Felipe-9
Copy link
Author

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

@lervag
Copy link
Owner

lervag commented Oct 13, 2024

@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.

@Felipe-9
Copy link
Author

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

@lervag
Copy link
Owner

lervag commented Oct 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants