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

:VimtexView and \lv dont do anythin #2577

Closed
LovisR opened this issue Nov 23, 2022 · 11 comments
Closed

:VimtexView and \lv dont do anythin #2577

LovisR opened this issue Nov 23, 2022 · 11 comments
Labels

Comments

@LovisR
Copy link

LovisR commented Nov 23, 2022

Description

when I try to compile and view my latex script, compiling works just fine, and viewing the pdf outside of vim works fine, but when i then do \lv or :VimtexView, nothing happens.

also sorry if i did something wrong, im very new to vim and vimtex, and github not so much to latex
also maybe relevant, im running vim in WSL2

Steps to reproduce

open any .tex doc->\ll (compiles fine)\lv(does nothing)

Expected behavior

show the compiled pdf in zathura

Actual behavior

does nothing

Do you use a latexmkrc file?

no

VimtexInfo

image

System info:
  OS: Ubuntu 22.04.1 LTS
  Vim version: VIM 8.2 (1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919)
  Has clientserver: false

VimTeX project: 05
  base: 05.tex
  root: /mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05
  tex: /mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05/05.tex
  main parser: current file verified
  document class: article
  packages: amsbsy amsfonts amsgen amsmath amsopn amssymb amstext auxhook babel calc epstopdf-base eso-pic fontenc graphics graphicx ifmtarg iftex i  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  qf method: LaTeX logfile
@LovisR LovisR added the bug label Nov 23, 2022
@lervag
Copy link
Owner

lervag commented Nov 23, 2022

when I try to compile and view my latex script, compiling works just fine, and viewing the pdf outside of vim works fine, …

Can you explain exactly what you mean with "viewing the pdf outside of vim"? I mean, do you open the folder in Windows explorer and double click? Do you write zathura 05.pdf?

but when i then do \lv or :VimtexView, nothing happens.

Ok. After you open the document in Vim, do \ll to compile, do \lv to open the viewer: what does the viewer: zathura part of the output of \li look like?

also sorry if i did something wrong, im very new to vim and vimtex, and github not so much to latex

No need to apologize for being new. I hope you enjoy it so far and that you find both Vim and VimTeX to be rewarding experiences!

also maybe relevant, im running vim in WSL2

Definitely relevant.

Steps to reproduce

call plug#begin()
Plug 'lervag/vimtex'
let g:vimtex_view_method = 'zathura'
call plug#end

Notice that this does not indicate any steps. It may feel cumbersome and boring, but it is often extremely useful to type out the exact steps you perform. E.g. something like this:

  1. Start WSL2. This opens a Bash terminal
  2. Run cd /path/to/file
  3. Run vim file.tex
  4. After the file is opened, do \ll to compile
  5. Now do \lv to open the viewer.
System info:
  OS: Ubuntu 22.04.1 LTS
  Vim version: VIM 8.2 (1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919)
  Has clientserver: false

Notice that VimTeX works best when you have the clientserver enabled. See :help vimtex-clientserver for more info. This is not directly related to your issue, though.

@LovisR
Copy link
Author

LovisR commented Nov 23, 2022

Can you explain exactly what you mean with "viewing the pdf outside of vim"? I mean, do you open the folder in Windows explorer and double click? Do you write zathura 05.pdf?

when i run zathura 05.pdf it opens a window with the pdf .

Ok. After you open the document in Vim, do \ll to compile, do \lv to open the viewer: what does the viewer: zathura part of the output of \li look like?

no clue what the zathura part is, but here is the full output here it is

  viewer: Zathura
    xwin id: 0
    cmd_start: zathura  -x "/usr/bin/vim.gtk3 -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 1:2:'/mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05/05.tex' '05.pdf'&
qf method: LaTeX logfile

also i configured my vim to have a clientserver, as you suggested, thanks. not sure what it does though

Edit: also, steps to reproduce are actually exactly what you worte :)

@lervag
Copy link
Owner

lervag commented Nov 23, 2022

The cmd_start is not all of it. That is, the command (zathura -x ...) has been cut off, not sure if it was a problem with your copy-pasting or what. Can you check and possibly update with the full command string?

The clientserver is explained in the docs. The main reason to activate it is because it is required for backward search (from Zathura to VimTeX).

@LovisR
Copy link
Author

LovisR commented Nov 23, 2022

updated it

also here a screenshot of the thing
image

@lervag
Copy link
Owner

lervag commented Nov 24, 2022

Cool, thanks. Now, in a terminal where you've cded to the same location as the output file, please try and run the same command (or any of the variants):

zathura  -x "/usr/bin/vim.gtk3 -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 1:2:'/mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05/05.tex' '05.pdf'&

# Variant 1
zathura  -x "/usr/bin/vim.gtk3 -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line} '%{input}'\"" '05.pdf'&

# Variant 2
zathura  --synctex-forward 1:2:'/mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05/05.tex' '05.pdf'&

Do any of these work?

@LovisR
Copy link
Author

LovisR commented Nov 24, 2022

(KI) lovis@lovisurface:[outputfile location]$ zathura  -x "/usr/bin/vim.gtk3 -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 1:2:'/mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05/05.tex' '05.pdf'&
[2] 1805
(KI) lovis@lovisurface:[outputfile location]$ error: Could not connect to session bus: Cannot spawn a message bus without a machine-id: Invalid machine ID in /var/lib/dbus/machine-id or /etc/machine-id
error: Got no usable data from SyncTeX or D-Bus failed in some way.

first option doesnt work

(KI) lovis@lovisurface:[outputfile location]$ zathura  -x "/usr/bin/vim.gtk3 -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line} '%{input}'\"" '05.pdf'&
[2] 1807

second option opened zathura with the desired pdf

(KI) lovis@lovisurface:[outputfile location]$ zathura  --synctex-forward 1:2:'/mnt/c/Users/rosen/OneDrive/Documents/JLU/s3/Stochastik/Übung/Blatt05/05.tex' '05.pdf'&
[3] 1823
[2]   Done                    zathura -x "/usr/bin/vim.gtk3 -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line} '%{input}'\"" '05.pdf'
(KI) lovis@lovisurface:[outputfile location]$ error: Could not connect to session bus: Cannot spawn a message bus without a machine-id: Invalid machine ID in /var/lib/dbus/machine-id or /etc/machine-id
error: Got no usable data from SyncTeX or D-Bus failed in some way.

third option also didnt work

@lervag
Copy link
Owner

lervag commented Nov 24, 2022

Ok. So, you're on Ubuntu in WSL2, and you want to use Zathura as a viewer. For synctex to work with Zathura, you need dbus. I believe that is the main issue here. I'm not quite sure how to help directly; I don't use Windows and can't really test things.

Still, though, it seems this is very related to issues running Zathura on MacOS. It can be helpful to read :help vimtex-faq-zathura-macos, although you can't really run those commands. Still, perhaps you can get some pointers that may help you figure out how to get dbus up and running in WSL?

@LovisR
Copy link
Author

LovisR commented Nov 24, 2022

alright thanks <3

@lervag
Copy link
Owner

lervag commented Nov 24, 2022

No problem :)

Let me know how things go!

@LovisR
Copy link
Author

LovisR commented Nov 24, 2022

https://x410.dev/cookbook/wsl/sharing-dbus-among-wsl2-consoles/

followed this, created the file and added the command to .profile, and it works now <3 its kinda slow, but that might be beacuse it doesnt have much ram, dont know for sure

thank you very much

@lervag
Copy link
Owner

lervag commented Nov 24, 2022

Great, I'm glad to hear it, and thanks for sharing the resource. Not sure why it is slow; it could also be that the communication between WSL and the X server with dbus is slow. It is probably possible to profile, but as mentioned, I can't since I don't use Windows. :\

In any case, I hope it works well enough!

Should I consider the issue resolved?

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

2 participants