1

I have a latex file which includes multiple figures. These figures are kept in different directories whose path is given in the latex file using the graphicx package:

\usepackage{graphicx}

\graphicspath{{./path1/}{./path2/}}

I am able to compile this file without any problems from the command prompt using pdflatex file.tex.

Now I have defined a key mapping in my vimrc file:

map \<F10> :!pdflatex % \<CR>

so that I can compile the file from the vim itself. But in this case, pdflatex is unable to find the figure files.

Can someone please help me understand why pdflatex is able to run without any problem from the command line but runs into problems when run using a key mapping.

Thank you.

1 Answer 1

0

The current directory was set to the home directory by vim. Hence it was unable to find the files. By the changing the current directory to the working directory, I was able to get it working. This follows from a comment given in the vim forum of StackExchange.

1
  • 2
    Consider putting set autochdir in your .vimrc so it automatically changes the current directory to the one of the file you're working on.
    – frabjous
    Apr 12, 2022 at 0:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .