Reputation: 53
I am usgin latex-suit for gvim
.
I want to use the output-dir option.
I defined:
let g:Tex_MultipleCompileFormats='pdf'
let g:Tex_CompileRule_pdf = 'pdflatex --output-directory=output --synctex=-1 -src-specials -interaction=nonstopmode $*'
The problem is that with the --output-directory
options latex-suit does not compile multiple times if it necesary, only once. And, I have to compile it manually if references changes.
How can I configure latex-suit multiple compile options with the --output-directory
?
Upvotes: 3
Views: 758
Reputation: 3027
You have two options: use a makefile (which I would recommend) or run the command several times inside g:Tex_CompileRule_pdf
.
LaTeX documents, when they become big, may be troublesome to manage:
{draft}
mode,\input
documents.If you try to manage that with a single command line it will quickly become impossible to maintain. Using a Makefile allows for better dependency checking between files and also Vim can compile the LaTeX document with :make
(with the default :makeprg
, which is set to make
). An example Makefile could be like the following:
# Makefile for my LaTeX doc
LATEX = pdflatex -output-directory=output -synctex=-1 -src-specials -interaction=nonstopmode
BIBTEX = bibtex
RM = rm -f
BIB = mybibs.bib
LTFS = *.aux *.lof *.log *.lot *.fls *.out *.toc
DOCS = *.dvi *.pdf
BIBS = *.bbl *.blg
IDXS = *.idx *.ilg *.ind *.ist
OTHER = *.acn *.acr *.glg *.glo *.gls *.brf *.lol
all: document.pdf
%.pdf: %.tex %.bbl
$(LATEX) $<
$(LATEX) $<
.PRECIOUS: %.aux
%.aux: %.tex
$(LATEX) $<
.PRECIOUS: %.bbl
%.bbl: %.aux $(BIB)
$(BIBTEX) $<
.PHONY: clean
clean:
$(RM) $(LTFS) $(DOCS) $(BIBS) $(IDXS) $(OTHER)
This Makefile runs pdflatex
two times by default: once to build the sections and page numbers and a second time to make proper cross references. If a reference changes the .aux
file will be changed and pdflatex
will be run three times.
If you do not use BibTeX you do not need the parts about %.bbl
files.
g:Tex_CompileRule_pdf
I'll once again warn that this will quickly become unmaintainable. Tracking dependencies between files through a very long command line is very difficult.
Anyhow, you can use $*
several times inside an external command in Vim. In essence you can do this:
let g:Tex_CompileRule_pdf = 'pdflatex -output-directory=output '
\. '-synctex=-1 -src-specials -interaction=nonstopmode $*; '
\. 'pdflatex -output-directory=output '
\. '-synctex=-1 -src-specials -interaction=nonstopmode $*'
And it will run pdflatex
twice (note the semicolon) when you press <leader>ll
.
Extra note: we do have the vi.SE section of the website for Vim specific questions. It is often faster to get Vim related answers there.
Upvotes: 2