All Collections
Creating course content
Creating and editing content
Creating formulae in text elements using LaTeX
Creating formulae in text elements using LaTeX

Course authors can format mathematical equations and chemical formulas elegantly using LaTeX.

Caitlin Foran avatar
Written by Caitlin Foran
Updated over a week ago

Did you know that as an author in Create you can use LaTeX markup to create mathematical and chemical formulas ? You can even highlight elements of your formulas to emphasize your explanations.

LaTeX is essentially instructions to tell the text element what to display. Our first step is always to tell the system that what we're about to write is the start of some LaTeX code. We do this with \( or \[

  • \[ and \] for a block of text (it will appear on a new line)

  • \( and \) for inline text (it will appear inline)

We put \) or \] at the end of our string of LaTeX.

How to format a mathematical formula

Maths operation tags include:

  • ^ for powers or superscripts, e.g. x^2 or y^{12}

  • _ for subscripts, e.g. x_i or sum_{i=0}^n

  • \frac for fractions, for example x = \frac{x^2 + 3}{x+1}

  • \left( and \right) for big parenthesis around fractions

  • \{ and \} for curly brackets

  • \alpha, \beta, \gamma, etc. for greek letters

  • curly brackets to group elements

  • \{ and \} to display actual curly brackets, e.g. for sets such as P = \{1, 2, 3, 5, 7, 11, 13, … \}

  • \sum and \int for sums and integrals

  • \sqrt and \sqrt[3] for square roots and other radicals

Try it out

Here are a few examples that you can try entering yourself:

\[ \sqrt{3x-1}+(1+x)^2 \]
\[ x = \frac{x^2+3}{x+1} \]

The probability of getting k heads when flipping n coins is: \( P(E) = {n \choose k} p^k (1-p)^{ n-k} \)

The result will be

Try this online equation editor Host Maths, the Equation Editor to find out how do display the various elements of your formula and equations in LaTeX.

How to format a chemical formula

iQualify also allows you to represent molecular chemistry formula and equations using a LaTeX tool.

This uses the same delimiters as LaTeX, followed by an additional delimiter to tell LaTeX that what follows is for chemistry notation:

  • \ce{ and }

Tags and symbols include:

  • no tag for subscript (any number entered after letters is taken as subscript, e.g. \ce{ O2 } will give O2

  • no tag either for simple ion + or anion - superscript, e.g. \ce{ H+ } will give H+ and \ce{ O- } will give O-

  • ^ for superscript with a number, e.g. \ce{ O^2- } will give O2-

  • -> for reactions, e.g. \ce{ CO2 + C -> 2 CO }

  • \sbond or \bond{-} or - for single bond.

  • \dbond or \bond{--} or = for double bond

  • \tbond or \bond{---} for triple bond

Try it out

Here are a few examples that you can try entering yourself :

The famous water molecule: \[\ce{ H2O }\]

Here is an ion \(\ce{ H+ } \) and here are two anions \(\ce{ O- }\) and \(\ce{ O^2- } \)

Photosynthesis reaction: \[\ce{6 CO2 + 6 H2O + light -> C6H12O6 + 6 O2}\]

Carbon dioxide bonds: \(\ce{ C=O=C }\)

You will get the following result:

A full reference can be found in this Chemistry Notation guide by Martin Hensel (2018).

Highlighting Formulas with \bbox

Use \bbox when you want to highlight only part of a formula. Highlighting an element of a formula using \bbox is simple because it doesn’t have any additional requirements. In addition, it creates an actual box around the element, and allows you to define not only its colour but also its size and even to specify a border.

To highlight any formula using \bbox, you enter

\bbox[name of color, padding size]{the formula}

Note that the padding size is optional, but it does improve the presentation of the formula by adding some space around the element.

For example

The result is \( x = \bbox[lightblue, 4pt] {x^3}+5 \)

produces

Try it out

Copy and paste the following formula (adding the normal LaTeX delimiters on either side) into an iQualify textbox and try highlighting different parts of the formula, or use any formula you already have to try it out.

\frac { \sqrt{ x^{32} - 16} } { x^2+5x+3 }

For example, try to produce this:

You can also find a basic tutorial and quick reference on Maths Stack Exchange.

The following provide comprehensive lists of LaTeX tags:

Did this answer your question?