up vote 0 down vote favorite
share [g+] share [fb]

I am generating a pdf output with pdflatex with the following command in gVim:

:!pdflatex %

This command in turns executes the following in the Command Prompt:

cmd.exe /c pdflatex /testvim.tex

Now, the problem I'm having with this is that the pdf is outputted to the system32 folder:

C:\windows\system32\testvim.pdf

How can I instruct pdflatex to generate the pdf in the folder where the tex file resides?

link|improve this question

62% accept rate
feedback

1 Answer

Apparently you can use

-output-directory <wherever>

To get the directory of the current file, you'll need to use:

expand('%:h')

but you'll need to write a macro or a function that can evaluate that; something like:

map ,,p :exe "!pdflatex -output-directory " . expand('%:h') . " %"<CR>
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.