LaTeX Questions Answered: Pressbooks Special Character Bank and PDF Troubleshooting

The following is an excerpt from the chapter LaTeX Questions Answered in Pressbooks Guide: A reference for open textbook authors using Pressbooks by Lauri M. Aesoph

Can I use characters from the Pressbooks special character bank in LaTeX commands?

No: if special characters are taken from the special character bank and used in a LaTeX command, the command won’t work. Instead, you must use an appropriate LaTeX command to insert the character. See What kind of symbols can I write using LaTeX? for links to resources that detail how to create many characters in LaTeX.

Why won’t my LaTeX render properly in the PDF export of my book when it works fine in the web book?

PDFs in general can be finicky, and LaTeX is no exception to this. If your LaTeX is not displaying properly in a PDF, but renders just fine in the web book, one possible cause is excess spaces between commands: PDFs will often not display LaTeX formulas that are written with more than one space in a row. (Note that this is only the case with LaTeX rendered with MathJax, not QuickLaTeX.)

For example, the equation [latex]A = \dfrac{1}{2} b h[/latex] looks fine in the web book:

algebraic equation "a=1/2bh" the 1 is stacked over the 2

But here’s a screenshot of what it looks like in the PDF:

the equation now reads as A=\dfrac{1}{2}b h

You are not required to put spaces between LaTeX commands in order for them to be rendered in a readable way: equations are appropriately spaced automatically. However, it is common to insert spaces to make equations more readable for humans working in the back end. If you choose to add single spaces between commands for your own readability as a LaTeX writer, be sure to search for excess spaces using the Find feature in your browser and delete them.

Another possible reason for LaTeX not rendering properly in a PDF export is the delimiters used to distinguish LaTeX from regular text.

There are two kinds of delimiters that can be used to mark the boundaries between LaTeX and and regular text: [latex]…[/latex] and $$…$$. The former delimiters can be used for in-line equations (i.e., those that appear in the middle of a sentence), and the latter can be used for standalone equations that appear centred on their own line.

Unfortunately, equations written using $$…$$ delimiters do not render in PDFs. Any LaTeX formulas you write using these delimiters may appear in the web book, but they will appear in the PDF exactly as they appear in editor view in Pressbooks.

To demonstrate, this equation has been written using [latex]…[/latex] delimiters:

algebraic equation "a=1/2bh" the 1 is stacked over the 2

This equation has been written using $$…$$ delimiters:

algebraic equation "a=1/2bh" the 1 is stacked over the 2

And here is a screenshot of a similar section of code in a PDF export:

"this equation has been written using [latex]…[/latex] delimiters:

a=1/2bh

This equation has been written using $$...$$ delimiters:

$$A=\dfrac{1}{2}bh$$"

For this reason, it is best practice to only use [latex]…[/latex] delimiters. If you would like your equation to appear centred and on its own line, simply write the equation in a new paragraph and manually centre it using the “Align centre” button or the shortcut Shift + Alt + C.

If there are no excess spaces in your commands and you’re using [latex]…[/latex]delimiters, there may be a problem with MathJax, the engine that renders LaTeX in Pressbooks.

You can check to see if MathJax is working properly by going to Settings > MathJax on the Pressbooks dashboard. You should see a big integral at the top of the page, like this:

MathJax settings page in Pressbooks. A long math equation is at the top, followed by syntax examples and text options

The MathJax settings page says, “If you can see a big integral, then PB-MathJax [the MathJax plugin] is configured correctly, and all is well.”

However, if there’s a problem with MathJax, you may see this at the top of the page:

MathJax settings page in Pressbooks. A line of unrendered LaTeX runs along the top, indicating that something is wrong

If you see unrendered LaTeX instead of an integral, there is something wrong with the plugin for the BCcampus instance of Pressbooks. Please contact latexsupport@bccampus.ca as soon as possible to let us know about the problem.

Learn more:


The featured image for this post (viewable in the BCcampus News section at the bottom of our homepage) is by Nothing Ahead