Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm working on a document that is structured as follows:

/Document/
    |
    |--Chapter1/chap1.tex
    |
    |--Chapter2/chap2.tex
    |
    |--Chapter3/chap3.tex
    |
    \--main.tex

where the file main.tex includes the 3 chapter tex files shown.

Using Vim, I edit each of the files chap1.tex, chap2.tex, and chap3.tex often. I want to configure a shortcut so that within the Vim editor, I can enter something like

:buildme

which will cause the following terminal command will be executed:

$ cd .. ; pdflatex 'main.tex'

share|improve this question
    
Do you use vim-latex-suite? –  m0nhawk May 4 '13 at 17:09
    
@m0nhawk No, I don't. I usually use Winefish for tex, and Vim for general text editing purposes. But I'm thinking about switch my tex editing to Vim. –  synaptik May 4 '13 at 17:11
    
In vim-latex-suite you can use this. That's, I think, the most pretty way to do this. –  m0nhawk May 4 '13 at 18:28
    
@m0nhawk very cool. Thanks. I will definitely give vim-latex-suite a try. Looks very helpful. –  synaptik May 4 '13 at 20:12

1 Answer 1

up vote 0 down vote accepted

User commands need to start with a capital letter; try the following:

 command! Buildme exec('cd ..|!pdflatex main.tex')
share|improve this answer

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.