Skip to content

Ampersand (&) in path for vimtex-compile #2405

@HuidaeCho

Description

@HuidaeCho

Description

When there is an ampersand (&) in the file path either in the directory or filename, vimtex-compile fails to open the compiled PDF in okular. For example, compiling /home/user/tmp/a & b/test.tex gives this error message "Could not open file:///home/user/tmp/a @pdf b/test.pdf%23src:1/home/user/tmp/a @pdf b/test.tex"

Steps to reproduce

  1. vim "a&b.tex"
  2. Hit \ll to compile the file

a&b.tex

\documentclass{minimal}
\begin{document}
Hello world!
\end{document}

Expected behavior

Compile the file and open PDF in okular without an error.

Actual behavior

Compile the file, but fail to open PDF.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Linux 5.15.38
  Vim version: VIM 8.2 (1-4649)
  Has clientserver: true
  Servername: VIM2

VimTeX project: a&b
  base: a&b.tex
  root: /home/user/tmp
  tex: /home/user/tmp/a&b.tex
  main parser: current file verified
  document class: article
  packages: array atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook bigintcalc bitset color enumitem etexcmds gettitlestring hycolor hyperref iftex infwarerr intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro longtable ltxcmds nameref pdfescape pdftexcmds refcount rerunfilecheck ulem uniquecounter url vmargin
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions