Equations
The equation renderer is automatically enabled for any pages where maths is detected (currently this is searching the page for any use of the maths delimiters).
You may also choose to set use_math
to true
in the page’s front matter if you wish for maths rendering to be forced on despite page content.
For example, this page’s front matter could appear as follows:
This would ensure that the MathJAX render layer is running on this page even if no equations are detected by the compiler.
Equation support is built directly into AutoNOTE. With these tools, it is simple to add both inline or block-centered equations using the familiar LaTeX maths commands.
Inline equations are denoted using a single $
deliminator, while block-centered equations are denoted using the $$
deliminator in the markdown files.
Inline Equations
To implement an inline equation you can simply include the equation inline with some text, as follows:
Any equation will render as an inline equation unless there is a blank line above the equation block. The above code yields the following result:
Some inline LaTeX: $a^2 + b^2 = c^2$
Display Equation
There are two different ways to implement a standard centered equation. While the first is easy to recall and implement, the second allows far greater control over the final result.
Method 1 - White Space
First, you can simply use the $$
deliminator on a new line, as follows (note the black line above the equation is required):
If used in a page, this command would yield the following results:
The following equation is displayed as a centered block. This is thanks to the empty line between this sentence and the equations definition.
\[\int e^{-kx} \, dx = -\frac{1}{k} e^{-kx}\]This method does not support equation numbering or cross referencing.
Method 2 - Full Equation Block
The second method is really just an expansion of the first. As before we use the $$
special characters to activate the equation parser (note that without these markers the system will often still appear to work - however, here be dragons). We may use any of the standard LaTeX equation commands and syntax, for example:
The above example makes use of the equation
, label
and split
blocks from LaTeX. The equation
block will cause the equation to be numbered, allowing the document to reference the equation via it’s label
using the command \eqref{eq:exampleEquation}
. The split
command acts to divide the equation between two lines, aligning the =
signs accordingly. This code yields the result shown below in Equation \eqref{eq:exampleEquation}.
It is important to note that the label
command is not in the usual place in the above example but rather comes after the equation
block. This, sadly, is a key difference between the AutoNOTE 2 and LaTeX syntax. Labels must come after the block that they are to point to (unlike LaTeX). In this case following either the split
or equation
block would do.
The Align Block
As in LaTeX, the Align block may be used to number each line separately or to specify which equations in a group are numbered. The \nonumber
or \notag
commands are used to skip numbering specific lines. For example:
Once again, the label
tag comes after the equation that it points to. This makes it possible to reference specific lines in an equation group, as shown in Equations \eqref{eq:squareA} and \eqref{eq:squareB}.
Some further examples
You can view the original source markdown for this document in ‘_features/equations.md’. It is easy to reference variables in markdown, such as $x$, $y$, $x_1$ and $y_1$.
You can even use special characters like $|\psi\rangle$, $x’$, $x^*$, however some need escaping with \
.
Just like in LaTeX, you can use equation*
or align*
blocks to stop the system from numbering the equations.
Finally, more complex equations are supported, as shown in equitation \eqref{eq:twodmat}.
\[\begin{equation} A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} \label{eq:twodmat} \end{equation}\]Here is another example, testing the various different styles of matrices supported by the system.
\[\begin{matrix} a & b \\ c & d \end{matrix} \quad \begin{pmatrix} a & b \\ c & d \end{pmatrix} \quad \begin{bmatrix} a & b \\ c & d \end{bmatrix} \quad \begin{vmatrix} a & b \\ c & d \end{vmatrix} \quad \begin{Vmatrix} a & b \\ c & d \end{Vmatrix}\]