batch conversion of TeX

Roland Smith rsmith at
Fri Oct 12 09:35:23 PDT 2007

On Fri, Oct 12, 2007 at 09:44:44AM +0000, Aryeh M. Friedman wrote:
> Those who have followed my openoffice to TeX conversion know I am brand
> new to TeX and want to know how to do the following conversions
> (hopefully via some non-interactive process [eg. Make files]):
> TeX-->plain text


> TeX-->HTML


> TeX-->PDF


> TeX-->PS

tex + dvips

All these programs come with a modern TeX distribution (I use texlive).

How to use these in a makefile depends on what you have. For a simple
document, processing with the command in question suffices.

But if you use footnotes and references, you need multiple passes to
sort everything out. If your document has an index and a bibliography,
you'll need to use makeindex and bibtex.

Here's an example of a Makefile for a long document of mine;

DOCSRC = logboek_RFS_II.tex
DOCPDF = $(DOCSRC:.tex=.pdf)

SUBDIR = grafieken figuren raytrace lam calc

$(DOCPDF): ${SUBDIR} $(DOCSRC) lbref.bib
        @echo -n "Regenerating the logbook... "
        @! pdflatex --interaction nonstopmode -file-line-error $*.tex | grep -A 1 '^l\.'
        @makeindex -c -s $*.idx 2>/dev/null
        @bibtex $* >/dev/null
        @pdflatex --interaction batchmode -file-line-error $*.tex >/dev/null
        @makeindex -c -s $*.idx 2>/dev/null
        @pdflatex  --interaction nonstopmode -file-line-error $*.tex >/dev/null
        @! pdflatex  --interaction nonstopmode -file-line-error $*.tex |grep Warning
        @rm -f $*.lo* $*.aux $*.ilg $*.ind $*.toc $*.bbl $*.blg
        @echo "Done."

        @cd ${.TARGET}; make ${.TARGETS}

clean: ${SUBDIR}
        @rm -f *.lo* *.aux *.ilg *.ind *.toc *.bbl *.blg
        @rm -f $(DOCPDF)

This Makefile also runs make in several subdirectories.

[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list