-
Notifications
You must be signed in to change notification settings - Fork 407
Zathura fails for symbolic links (physical vs. absolute logical paths) #2865
Description
Description
This is an observation I made - I found ways to get around it, but it might be interesting to fix it anyways.
If a tex-document is compiled in a directory with symbolic links in the path (and opened by that absolute path in the command) and should be opened with Zathura, zathura could try to open the file in the wrong directory.
Steps to reproduce
The issue is probably a problem of how the paths are handled (and how symbolic links work on linux) and therefore mainly dependent on the file-structure. It should work with any minimal configuration, provided that let g:vimtex_view_method = 'zathura' (or minimal) is set.
Directory setting (bash)
My setting is quite complex, but I think this is the essence of the problem:
In practice, a device should of course be mounted.
cd /home/myusername/
mkdir /mnt/mydrive/
ln -s /mnt/mydrive
cd mydrive
nvim /home/myusername/mydrive/test.texThen paste minimal example, write file and compile.
Call :VimxtexView
Comments on the setting
Vimtex-Root
If I call (in /home/myusername/mydrive)
nvim test.tex, then the Vimtex-Root is /mnt/mydrive/
If I use nvim /home/myusername/mydrive/test.tex, then the Vimtex-Root for the same file is /home/myusername/mydrive (using the symbolic link).
Note, that in that case, :pwd and !pwd return different paths, the first the physical path /mnt/mydrive (can be called in bash by pwd -P) and the second one the 'logical path' /home/myusername/mydrive (pwd -L).
Problems in Vimtex:
- I think at that place there have been issues before ( Reverse and forward search with zathura suddenly stopped working #2573 Vimtex is not using full path anymore when calling synctex #2575) - the actual problem starts at
vimtex/autoload/vimtex/view/zathura.vim
Line 55 in f9b19d0
\ . vimtex#util#shellescape(vimtex#paths#relative(a:outfile, getcwd())) - In the second case (
nvim /home/myusername/mydrive/test.tex), outfile will be/home/myusername/mydrive/test.pdf, while getcwd() will be/mnt/mydrive/. The result is then something like../../home/home/myusername/mydrive/test.pdf(not sure about the exact numers of.., but the problem is the doublehome:
- In the second case (
Expected behavior
Zathura window opens and shows test.pdf
Actual behavior
Zathura document opens and shows no file (tries to open the file in the wrong directory).
Do you use a latexmkrc file?
No
VimtexInfo
Hope the problem is clear like that.