Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

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>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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