Skip to main content

Section C.4 PreTeXt Setup

Subsection C.4.1 Overview

by William Haynes @weh

We will be authoring the Engineering Statics book using PreTeXt, storing the text, images and interactives on GitHub using git, and converting everything into a website and a pdf book using XSLT. Finally we will post everything it on our website for students to use.

PreTeXt consists of two pieces, the XML markup and the XSLT processor.

The source documents for the book are text files marked up using XML tags, similar to the way HTML documents are marked up, but the tags are specific to the requirements of academic textbooks. We will be using the extension .ptx to indicate PreTeXt files. The PreTeXt tags are formally defined by an XML Schema, which specifies what are legal tags and where they can be used.

Most likely you will want to see what the final result of your writing looks like. In order to see it in its final version, you can compile it with XSLT to create a local copy of the final version

Subsection C.4.2 Workflow

The main components necessary to make this all work are:

  • Local copies of the PreTeXt and Engineering Statics files
  • An XML aware text editor to edit the PreTeXt source.
  • The command line program git and a GitHub account.
  • An XSLT processor to convert the source text to html

When you have these installed and working on your computer, you will have everything you need to produce a local copy of the entire book. That way, you can edit something and then test it to see what it will look like in its final form. When you are satisfied with your work, you will use git to send it to the GitHub, where Dan or Will will integrate it into its proper place in the book, publish and upload to the website.

If this sounds daunting to you, don't worry! You don't have to do any of this while you create your first draft. Please just write! Use any tools you are comfortable with, and I (@weh) will do the initial markup to PreTeXt for you. However, marking up the the draft is a one way trip. After that, any further edits and improvements must be made on the PreTeXt source. Don't spend any effort trying to make your draft look pretty because all styling will be handled by PreTeXt.

Subsection C.4.3 Getting set up

The PreTeXt website has plenty of information on how to get started with PreTeXt. You will find quickstart instructions on the homepage which may be all you need as well as more detailed instructions and walkthrough videos.

Subsection C.4.4 Demos

Subsubsection Video Demo

You can include video hosted at YouTube, or anywhere else on the internet.

Figure C.4.1. Our fearless leader.

Subsubsection Sage Demo

Sage is an open-source mathematics system which uses a Python-based syntax, which can be used to do complex calculation right in the browser. In the pdf version, a sample result is shown.

Subsubsection Numbas

Here are some examples of Numbas problems. This is only supported in the html version.

Numbas 1.
Numbas 2.
Numbas 3.