Salim Fadhley Salim Fadhley - 11 months ago 96
LaTeX Question

How can I build PDF LaTeX documents with ANT (or some other build system if you prefer)?

The team I work for manages a large collection of technical documentation which is written in LaTeX.

Currently all the documentation we have is manually built by the editors and then checked into a version control system. Sometimes people forget to compile their documents so we have a situation where the PDF and .tex files are often out of step. Unfortunately when this happens our users find themselves reading old versions of our document.

I've managed to hack a simple script to build PDFs using Make - it's rather clumsy.

I was wondering if there was a better way to do it? Most people in our department use Eclipse + Pydev for a Python project which means we are all very familiar with this IDE. I know that Ant plays nicely with Eclipse, so might we be able to use this tool for our doc building?

So what's the best way of doing this? I hope I will not have to learn everything there is to know about a new build-system in order to automate the building of some quite simple docs.

Answer Source

There is an external Ant task for LaTeX PDF generation, though the site is in German.

To use it, download the jar to a location on your machine, then define a taskdef as follows:

<taskdef name="latex"    classname="de.dokutransdata.antlatex.LaTeX"  
  classpath="/path/to/ant/lib/ant_latex.jar"/> 

Then to use it, define a target like this:

<target name="doLaTeX">  
  <latex  
    latexfile="${ltx2.file}"  
    verbose="on"  
    clean="on"  
    pdftex="off"  
    workingDir="${basedir}"  
  />  
</target> 

Where ltx2.file is the file to process.

This is a link to the howto page listing the parameters. If you need any more options, my German is just about passable enough to explain, maybe.

There is also a maven plugin for LaTeX, but I can't find any documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download