Unverified Commit ced4f2c2 authored by Zhian N. Kamvar's avatar Zhian N. Kamvar Committed by GitHub
Browse files

Merge pull request #370 from carpentries/document_math_support

Document mathematical expression support
parents 0a171bbe 0abdb9a2
Loading
Loading
Loading
Loading
+55 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ keypoints:
- "Code blocks can have the source, regular output, or error class."
- "Special sections are formatted as blockquotes that open with a level-2 header and close with a class identifier."
- "Special sections may be callouts or challenges; other styles are used by the template itself."
math: true
---

A lesson consists of one or more episodes,
@@ -433,4 +434,56 @@ You can add a drop shadow effect to images by applying the

[jekyll-link-tag]: https://jekyllrb.com/docs/liquid/tags/#link

## Adding Formatted Equations

The template supports rendering of equations via [KaTeX](https://katex.org/).
This option must be activated by adding `math: true` to the `_config.yml` file 
or YAML front matter of the Markdown file where you wish to use it.

Mathematical expressions can then be added to the page content using the LaTeX syntax.

Expressions can be written inline:

~~~
{% raw %}Inline expressions can be added between `$` symbols, e.g. $E = Mc^2$.{% endraw %}
~~~
{: .source}

with the result:

Inline expressions can be added between `$` symbols, e.g. $E = mc^2$.

Or as a block across multiple lines:

~~~
{% raw %}$$
    \lim_{x \rightarrow 0}
    \frac{
        \sin x
    } {
        x
    }
    = 1
$${% endraw %}
~~~
{: .source}

with the result:

$$
    \lim_{x \rightarrow 0}
    \frac{
        \sin x
    } {
        x
    }
    = 1
$$

The example above was taken from the chapter _Typesetting Mathematical Formulae_,
in [The Not So Short Introduction to LaTeX](https://tobi.oetiker.ch/lshort/lshort.pdf).
[The Mathematics chapter of the LaTeX WikiBook](https://en.wikibooks.org/wiki/LaTeX/Mathematics)
is a good reference guide for those wishing to add equations
and mathematical expressions to their lessons.

{% include links.md %}