-
Notifications
You must be signed in to change notification settings - Fork 407
Handling of spaces and apostrophes in path #3161
Description
Description
I was setting up vimtex with neovim on my linux machine, when I noticed something peculiar. Generally when compiling a tex file, the PDF viewer would open automatically (I was using Zathura). However, when compiling a tex file with a path containing spaces and apostrophes, the PDF viewer would not open automatically despite successful compilation. When I opened the PDF file through Zathura separately, it was compiled correctly and was updating after compilation. The actual path looked something like:
/home/user/Documents/University/Master's Thesis/thesis.tex
After compilation, I checked vimtex info for cmd_start, and the output was as follows:
cmd_start: zathura -x "/usr/bin/nvim --headless -c \"VimtexInverseSearch %{line}:%{column} '%{input}'\"" --synctex-forward 1:1:'/home/user/Documents/University/Master'\\''s Thesis/thesis.tex' 'thesis.pdf'&
It's possible that the space or the apostrophe results in a broken command, since the very same tex file compiled successfully and opened the PDF viewer automatically when its path did not have a space or apostrophe.
While I understand it is generally considered bad practice to have spaces and special characters in paths and that catering to these cases might be outside of the project's scope, I thought I'd document this problem all the same since it took me a bit to understand what was going on.
Steps to reproduce
- Place any tex file in a path containing a space and/or apostrophe.
- Open tex file in vim/neovim and compile.
Expected behavior
Compile successfully and automatically open PDF viewer.
Actual behavior
Compiles successfully, but PDF viewer does not open automatically. Compiled PDF seems to be updated and correct when opened externally.
Do you use a latexmkrc file?
No
VimtexInfo
cmd_start: zathura -x "/usr/bin/nvim --headless -c \"VimtexInverseSearch %{line}:%{column} '%{input}'\"" --synctex-forward 1:1:'/home/user/Documents/University/Master'\\''s Thesis/thesis.tex' 'thesis.pdf'&