Unleashing dynamic LaTeX: latexmk, gnuplot, R (knitr) and pgfplotstables

One of the nice things of LaTeX is that it allows you to separate the content and the formatting/layout of your documents. Need a new column layout? Just add an option in the document class. Your image needs to be wider? Change it, LaTeX adjusts its position in the document. In other words you only need to worry about what you’re doing right now and nothing more.

However, this philosophy doesn’t extend to all aspects of LaTeX. What if you’re writing a technical document and a graphic must be regenerated if the data files change? What if those data files should also be summed up in a table and some key values discussed in the document? You’d probably end up re-running your R and gnuplot scripts, and copy-pasting the results. This isn’t a bad thing if you only have to do it once or twice, but it can get annoying quickly.

The solution: again, separate content and presentation. If you have to do some calculations to get the data you need in your document, write those calculations in the document and let LaTeX (with knitr, as we’ll see later) recreate them if needed. If you have some plots generated by gnuplot or tables from some data file, again, let your document typesetting system take care of filling them.
Continue reading

A continuous compilation system for LaTeX files

A little bit of context: some of the students of the Math-CS degree in the UAM are maintaining a repository with notes of most the subjects we’re studying, written in LaTeX. We wanted to share the compiled PDF files with the other students, but there wasn’t any CI solution for LaTeX. So, I created one. Latex_cd is a Debian service that monitors a Github repository, compiles the LaTeX files and uploads the PDF results to Dropbox. Continue reading