Skip to main content

The PreTeXt Guide

Subsection 5.2.5 Generating assets: pretext generate

Some PreTeXt elements require special processing: WeBWorK exercises, <latex-image>, <sageplot>, and <asymptote> images, as well as previews for embedded youtube videos or interactive elements. We call these elements “assets” or “generated assets”. To generate the assets, run the following command.
$ pretext generate


You can also generate assets and build at the same time, using pretext build -g web which will generate all assets for the target named “web”.
This will generate all assets in the default formats for the first target in the project manifest. If you need formats for another target, you can specify the target name with the -t flag, as in, for the target named “print”,
$ pretext generate -t print
Generating assets can be time consuming, so likely you will not want to repeat this step unless you have edited one of the elements of a particular asset type. To further speed up the process, you can limit which sorts of assets you generate. For example, if you edit a few <latex-image> elements, you can just generate these (for the first target in the manifest) with,
$ pretext generate latex-image
Valid choices for what types of assets you can generate in this specific way are: webwork, latex-image, sageplot, asymptote, interactive, youtube, codelense, and datafile.
To be even more precise, if the element you wish to generate has an @xml:id, you can generate just that element using the -x flag. For example, if your <latex-image> has id “img-circle”, generate it with,
$ pretext generate -x img-circle
Finally, there might be times you would like to get all output formats for the assets you are generating. You can accomplish this using the --all-formats flag.