Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perform separate compilation of Latex documents

When compiling latex documents the compiler emits a lot of "object" files. This clutters the directories I'm working on and it difficults the use of VCS like SVN. When I work with C++ code I have separate directories for the code and the objects, I can run make on the source directory but the .o files go to the build directory.

Is there a proper way to perform this separate compilation with Latex documents? Can it be done by using Makefiles or by passing options to the latex compiler?

Thanks

like image 207
tonicebrian Avatar asked May 27 '10 05:05

tonicebrian


2 Answers

You can use:

pdflatex --output-directory=tmp file.tex

and all the files will be stored in the folder tmp (pdf included).

Because this is not an optimal solution, I made my own tool, pydflatex, that compiles the LaTeX source by stashing away the auxilliary files (using the trick above), and brings the pdf back to the current directory, so after compiling you only have file.tex and file.pdf in your directory. This plays very well with version control.

like image 124
Olivier Verdier Avatar answered Sep 28 '22 23:09

Olivier Verdier


I can't help much with LaTeX (having last user it seriously 20 years ago;-), but for Subversion, you should read up on the svn:ignore property -- it makes it easy to ignore files with extensions you do not want to version (object files, bytecode files as Python can often put in the same directory as the sources, backup files some text editors use, &c).

like image 36
Alex Martelli Avatar answered Sep 28 '22 23:09

Alex Martelli