Section 5.8 Images and the
We believe it is important to preserve a record of how diagrams and other graphics are produced. This can be easy when a graphics language is employed to describe the graphical elements, rather than creating a bit-mapped image with some other interface. So we have
<sageplot> for elements holding code to produce diagrams or images.
The upside to this is that small edits to the code can easily accomplish minor changes or corrections necessary for the images. The LaTeX macros provided by an author can be used in the text and in a diagram, leading to greater consistency between the two. Finally, starting from source, we can do the best possible job of producing image formats that are compatible with the document output formats and which scale smoothly in PDFs and in web browsers.
The downside to this is that XSL is not a general purpose programming language, and so in particular, cannot call “helper” programs such as
sage. The general strategy is to use XSL to identify and isolate the parts of a document that lie in the elements designed for graphics languages. A Python script, the
pretext script, employs these XSL stylesheets and then feeds each image file to the appropriate helper program.
This script has a variety of options, so we document it fully in Chapter 7.