## 2009-01-09

### Using Makefile to ease the repeated compilaton of LaTeX source

I like LaTeX, but it can be tedious if you want "instant" check of the produced output. Usually, there is no need to check the output very often - basically you can write the whole article/report, ... and then compile the LaTeX source. However, when I create a presentation, I often check what does it look like. LyX can also be very handy with "instant" checking! Two days ago I gave a LaTeX Beamer package a try and I use the following Makefile for the process of several compilations of the Sweave source file (fusing LaTeX for the creation of the presentation and R for doing the computations and plotting) - here are the PDF and the source file.
You need to be carefull with formatting of the Makefile, i.e., the lines bellow the target (say line two) needs to start with a TAB and not with spaces!
`all:      Sweave.sh --latex2pdf talk.Rnw; make rmtex: # Sweave --> LaTeX      Sweave.sh talk.Rnw; make rmrm: # Remove some other files      rm -f .pdf Rplots.pdf *.out *.nav *.snm *.log *.tex *.aux *.toc`
Using this Makefile I only needed to type make or better pressing the "up" key to repeat the previous (make) command in the terminal to compile the Sweave source file.