Parish Archive

Formulas

Formulas with KaTeX and MathJax, and formulas inside a sentence

Formulas are written in LaTeX, the language of mathematics. The LaTeX tab shows only the formula; the other tabs show how to put it in a page. Useful for school support activities, quizzes and games with points.

Formula on its own line (KaTeX)

KaTeX is fast and covers almost every formula.

A = \pi r^2
A = \pi r^2
::block-katex{caption="Area of a circle"}
```latex
A = \pi r^2
```
::
[block-katex, caption="Area of a circle"]
====
[source,latex]
----
A = \pi r^2
----
====
<block-katex caption="Area of a circle">
<pre><code class="language-latex">A = \pi r^2</code></pre>
</block-katex>

Fractions, roots and sums

\frac{3}{4} + \frac{1}{4} = 1 \qquad \sqrt{144} = 12 \qquad \sum_{i=1}^{12} i = 78
\frac{3}{4} + \frac{1}{4} = 1 \qquad \sqrt{144} = 12 \qquad \sum_{i=1}^{12} i = 78
::block-katex{align="left"}
```latex
\frac{3}{4} + \frac{1}{4} = 1 \qquad \sqrt{144} = 12 \qquad \sum_{i=1}^{12} i = 78
```
::
[block-katex, align="left"]
====
[source,latex]
----
\frac{3}{4} + \frac{1}{4} = 1 \qquad \sqrt{144} = 12 \qquad \sum_{i=1}^{12} i = 78
----
====

MathJax

MathJax is slower but understands more, including chemistry with \ce{}.

\ce{6CO2 + 6H2O -> C6H12O6 + 6O2}
\ce{6CO2 + 6H2O -> C6H12O6 + 6O2}
::block-mathjax{caption="Photosynthesis"}
```latex
\ce{6CO2 + 6H2O -> C6H12O6 + 6O2}
```
::
[block-mathjax, caption="Photosynthesis"]
====
[source,latex]
----
\ce{6CO2 + 6H2O -> C6H12O6 + 6O2}
----
====

Formula inside a sentence

Put the formula between $` and `$. A dollar sign alone stays a dollar sign, so prices are safe.

Each team scores 3 \times 5 = 15 points, and the prize costs $5.
3 \times 5 = 15
Each team scores $`3 \times 5 = 15`$ points, and the prize costs $5.