Closed LovisR closed 1 year ago
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:
cd /path/to/file
vim file.tex
\ll
to compile\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.
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 :)
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).
updated it
also here a screenshot of the thing
Cool, thanks. Now, in a terminal where you've cd
ed 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?
(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
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?
alright thanks <3
No problem :)
Let me know how things go!
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
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?
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