Skip to main content

The PreTeXt Guide

Section 47.3 Example Use

Here is a typical example of using pretext/pretext. You have several (or many!) diagrams and figures in your PreTeXt source, all authored in the TikZ language, and so packaged up within <latex-image> elements. Your /PDF output looks beautiful, since PreTeXt simply inserts the TikZ code into the right place in the generated *.tex file, and you have done this several times until your figures look just right.
Now you need to generate the SVG versions of your images that will accompany your HTML version of your book and provide nice scalable graphics. This is exactly the sort of chore the pretext/pretext script was designed for. You might run (all on one line)
pretext -vv -c latex-image -f svg
  -d ~/books/aota/images ~/books/aota/animals.xml
Here -c is specifying the “component” of your book to process, and -f is specifying the “format” of what is being produced. The -d argument specifies a directory where the output ends up, in this case a collection of SVG files, one per image. Note that the PreTeXt file, animals.xml in the above example, is the main source file for the document. The script should be run on the entire document, even if all the images are in one file.