Skip to main content

The PreTeXt Guide

Section 46.2 Processing

At a command prompt in your terminal or console adjust the pathnames for the two files and execute:
xsltproc /path/to/mathbook/xsl/pretext-html.xsl /path/to/quickstart.xml
In the current working directory you should now find the file article-1.html which you can view in a web browser. (You will want an internet connection since various parts of the page come from the network. Someday we will create output for the offline situation.) It will look very plain, but you should be able to read the sentence.
Now, try the following, again with adjusted paths, and all on one line:
xsltproc -o quick.tex /path/to/mathbook/xsl/pretext-latex.xsl
/path/to/quickstart.xml
In the current working directory you should now find the file quick.tex which you can process with pdflatex or xelatex at the command line as below. If you do not have installed on your system, you could process this file within a variety of online services, and CoCalc would be an obvious choice.
pdflatex quick.tex
In the current working directory you should now find the file quick.pdf which you can view or print with standard PDF viewing software. You could even send it to a print-on-demand service to get nice hardback books, though I suspect sales will not be great.
Note that if your project includes multiple files you will need to pass the -xinclude flag to xsltproc, though this is not needed for this simple example. An example of this is the command
xsltproc -xinclude /path/to/mathbook/xsl/pretext-html.xsl /path/to/index.xml
For more on this see Section 4.37 and Section 5.3.
That’s it. You now know all the basics of authoring with PreTeXt , since you have produced two radically different output formats with identical content from the exact same structured input, via two different command lines. Everything you need to author a complete article or textbook, and produce it in many different formats, is just an extension or variation on what you just did. Let us look at a few simple extensions right away before being more methodical.