Where can you use LaTeX
Other Uses for LaTeX
LaTeX can also be used for individual special characters. While Pressbooks supports as wide a range of special characters as possible, it may be that you find a character you need displaying as a question mark in your outputs. To fix this, find the character code you need and wrap it in the latex shortcode.
Math Within Other Book Elements
Math in most syntaxes should be compatible with most elements in your book, including image captions, textboxes, body text, and more. Here are a few exceptions:
- Any shortcode within another shortcode. Shortcode elements will break when placed inside of another shortcode. This means that the [asciimath][/asciimath] and [latex][/latex] shortcodes cannot be nested inside of footnotes, image captions, or any other shortcode element. See Shortcodes for a full list of elements in Pressbooks that are or can be created with shortcodes. However, both AsciiMath and LaTeX offer a non-shortcode syntax, which we recommend using if you're placing math inside of a shortcode element.
- Titles. Equations won't look good inside of a title because the style of the math will override the style of the heading. The code used to create the equation may also display in the table of contents.
- Running content. Similar to titles, the code used to create the equation may display in the running content.
Using Math in H5P Activities
You can draft equations inside of H5P elements in Pressbooks with MathJax LaTeX. You'll first need to add the mathematics library to your book's H5P setup in Pressbooks. To do this:
- Make sure you have H5P activated and have the mathematics library from H5P downloaded to your device
- Go to H5P Content > Libraries from the left sidebar menu
- Click Choose File and add the H5P mathematics library
- Click Upload
To find the H5P mathematics library and read more about how to use LaTeX in H5P, see Mathematical expressions in H5Ps.
For more information about drafting equations in LaTeX, see the MathJax LaTeX section of this chapter.
Using Math in TablePress
You can use MathML or QuickLaTeX to create equations and formulas in the tables you make in TablePress.
Using QuickLaTeX in TablePress
In order to create QuickLaTeX equations in TablePress tables, you must first check that:
- You have QuickLaTex activated
- You have enabled the "Use LaTeX Syntax Sitewide" setting under Settings > QuickLaTeX > Advanced*
*This is recommended but not compulsory. The alternative is to add the [latexpage] shortcode to each individual cell of the table, or to follow the instructions for Using PB LaTeX.
Once you've activated or enabled these settings, you can use any supported QuickLaTeX syntax to create your equation within the table's cells. All content can be edited from within the TablePress interface.
For instance:
Becomes:
Using MathML in TablePress
Write your MathML markup directly into the table cells in TablePress as you would in the text editor. Save the table, add it to your chapter, and you're ready to go.
Other Solutions
If LaTeX is a bit much for you or you'd rather look at other options, you can always use special characters, symbols, and the sub/superscript buttons on the toolbar to compose your equations.
If you are fluent in HTML+CSS, you can also look at constructing and formatting your formulas that way.