Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Last active August 1, 2019 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maksadbek/6eada0ea2d2f85a45d5828c6396546b4 to your computer and use it in GitHub Desktop.
Save maksadbek/6eada0ea2d2f85a45d5828c6396546b4 to your computer and use it in GitHub Desktop.

Directive for displayed math (math that takes the whole line for itself).

The directive supports multiple equations, which should be separated by a blank line:

.. math::

(a + b)^2 = a^2 + 2ab + b^2 (a - b)^2 = a^2 - 2ab + b^2

In addition, each single equation is set within a split environment, which means that you can have multiple aligned lines in an equation, aligned at & and separated by \\:

.. math::
(a + b)^2 &= (a + b)(a + b) \

&= a^2 + 2ab + b^2

For more details, look into the documentation of the AmSMath LaTeX package.

When the math is only one line of text, it can also be given as a directive argument:


(a + b)2 = a2 + 2ab + b2

$$Normally, equations are not numbered. If you want your equation to get a number, use the ``label`` option. When given, it selects a label for the equation, by which it can be cross-referenced, and causes an equation number to be issued. See :role:`eqref` for an example. The numbering style depends on the output format.$$

$$There is also an option ``nowrap`` that prevents any wrapping of the given math in a math environment. When you give this option, you must make sure yourself that the math is properly set up. For example::$$

$$\begin{aligned} \begin{eqnarray} y & = & ax^2 + bx + c \\\ f(x) & = & x^2 + 2xy + y^2 \end{eqnarray} \end{aligned}$$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment