Compiling LaTeX Documents using Makefiles

I usually don’t use a clumsy IDE for creating documents with LaTeX, but rather write them with a simple text editor like VIM or SciTe. To avoid typing the same commands for compiling a PDF file over and over again, I’ using a very simple and primitive Makefile:


    rm -f *.dvi *.log *.bak *.aux *.bbl *.blg *.idx *.ps *.eps *.pdf *.toc *.out *~

    rm -f *.log *.bak *.aux *.bbl *.blg *.idx *.toc *.out *~

To use this Makefile you need to define a project name, which should be the name of your LaTeX file (without the .tex suffix) containing the \begin{document} and end{document} tags. Just add this name to the first line of the make script. If you don’t use BibTeX, you’ll need to uncomment the line $(BIBTEX) $(PROJECT).
Now run the “make” command to create a PDF file and “make clean” to remove the temporary files created by pdflatex.


2 Responses to “Compiling LaTeX Documents using Makefiles”

  1. 1 Hans-Gunther Schmidt March 20, 2009 at 7:41 pm

    A very nice idea, never thought about that although working with Makefiles all the time. Doing the same thing with a bash script (maketex) … but your solution is, of course, way shorter :-)

  2. 2 Amit December 6, 2010 at 6:46 am

    I usually use my file name as ‘paper.tex’ (atleast for papers) and hence there is hardly anything to change in your Makefile! Nice stuff :-)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: