Skip to content
Martin Baláž edited this page Jul 31, 2023 · 12 revisions

All math mode input passes through pandoc without change and is left to be rendered by XeLaTeX or MathJAX.

General rules

  • pay attention to braces, especially matching left and right ones
  • whitespace is generally ignored in math mode, use it liberally to keep your equations readable. All binary operators and = signs should be surrounded by spaces.
  • if you do not know how to type a symbol, this might help

Fractions

For fractions use $\frac{numerator}{denominator}$. Do not use dfrac unless absolutely necessary, except in Náboj answer.md.

Braces

Please restrict yourself to round braces. For correct sizing, use \left( a \right), except in simple functions like f(x).

$\left(x+y\right)^3 = x^3 + 3x^2y + 3xy^2 + y^3$

Absolute values are written similarly:

$\left|x^2 - 1\right|$

Block mathematics

Always keep block mathematics as blocks. The equation is a part of a sentence, and must use proper punctuation.

...so we now see that
$$
    E = mc^2.
$$ {#eq:mc2}

Equation numbering

Equations are typically numbered by their order within a problem. Use pandoc-crossref notation for cross-references.

...so we now see that
$$
    E = mc^2.
$$ {#eq:mc2}

As we have shown in [-@eq:mc2], ...

will render as "As we have shown in equation 3.2.1, ...".

Long equations

Keep your lines short at all times. Break at = signs or operators and move them to the next line.

So the total impulse is
$$
    \Delta v_{\mathrm{II}}
        = \Delta v_{\mathrm{IIab}} + \Delta v_{\mathrm{IIc}}
        = \left(\sqrt{\frac{2\xi}{\xi + 1}} + \sqrt{\frac{1}{\xi}}
            - \sqrt{\frac{2}{\xi\left(\xi + 1\right)}}\right) v_1.
$$

Aligned mathematics

When you are showing a multitude of similar equations or simplifying an expression, it often looks much better when aligned to the = sign. Use the & symbol for alignment, along with \\ at the end of each of the lines (possibly except the last one).

$$
\begin{aligned}
    c &= \left(a - b\right)^2, \\
    c &= a^2 - 2ab + b^2. \\
\end{aligned}
$$

or an equivalent but non-standard extension of DeGeŠ,

$${
    c &= \left(a - b\right)^2, \\
    c &= a^2 - 2ab + b^2. \\
}$$
Clone this wiki locally