Skip to main content

Section A.3 PreTeXt Tips

It is definitely true that PreTeXt can be overwhelming when you first start. There is a pretty good Basic Reference section of the documentation that is worth checking out. Also look at the documentation page for Paragraphs.

Additionally, here are some common structures you will likely use in this project. Most of these have snippets in VS Code by the same name.

  • Every paragraph must be inside <p> tags.

  • Inline math is indicated with <m> tags. Display style math uses <me> for a single line, or <md> for multiple lines (which uses <mrow> for each row of math).

  • One “gotcha” is that we cannot use < or &, since those are special characters in xml. In math mode, use \lt and \amp (and while you are at it, you might as well use \gt for >). Outside math mode use &lt;, &gt;, and &amp;.

  • There is no bold. Terms are indicated (and styled bold) using <term>. There is also <alert>. Emphasis is achieved with <em>. Quotes are done using <q>. Lots more in the Paragraphs section of the documentation.

  • Lists: you can get an bulleted list with <ul> and an ordered list with <ol>. Each item in the list is enclosed in <li>.

  • If you want to refer to something, you can do so with an <xref>. You might type <xref ref="fig-k5"> to cross reference the element that has id fig-k5. That element gets that id using something like <figure xml:id="fig-k5">. (In the guide, the xml:id="fig-k5" part is called an “attribute” and is indicated using the @ symbol, as in @xml:id.)

  • Images and tables: you will probably want to look at a lengthy example in the document for this. You could search for <image> to see such an example.

I think that is about it. If you want to do something and don't know how, let me know and I'll help.