Skip to content

Practical Work 01 - Maths in LateX

The MathJax extension from Material is activated to provide a beautiful and accessible way to display mathematical content in the browser, and to allow for writing formulas in different notations, including LaTeX, MathML and AsciiMath.

An inline formula must be enclosed in $...$ or \(...\). For instance, \(\sqrt{x^2+1}\) can be obtained with $\sqrt{x^2+1}$.

To get a block formula like

\[ f(t) = \sum_{i=0}^{n} \, B_i^n(t) \, b_i \;;\; B_i^n(t) = {n \choose i}\,(1\!-\!t)^{n-i}\,t^i \;;\; {n \choose i} = \frac{n!}{i!\,(n\!-\!i)!} \]

place the code between $$...$$, here

$$
  f(t) = \sum_{i=0}^{n} \, B_i^n(t) \, b_i \;;\qquad
  B_i^n(t) = {n \choose i}\,(1\!-\!t)^{n-i}\,t^i \;;\qquad
  {n \choose i} = \frac{n!}{i!\,(n\!-\!i)!}
$$

It is possible to write numbered equations like

\[\begin{equation} E = m\,c^2 \end{equation}\]

or

\[\begin{align} a_1& =b_1+c_1\\ a_2& =b_2+c_2-d_2+e_2 \end{align}\]

using

\begin{equation}
E = m\,c^2
\end{equation}

\begin{align} 
a_1& =b_1+c_1\\ 
a_2& =b_2+c_2-d_2+e_2 
\end{align}

A lot of live demos are shown here (see "View Demo" next to each item).

MathJax is configured in skel-mkdocs-et/javascripts/config.js :

window.MathJax = {
  tex: {
    inlineMath: [["\\(", "\\)"]],
    displayMath: [["\\[", "\\]"]],
    processEscapes: true,
    processEnvironments: true,
    tags: 'ams'
  },
  options: {
    ignoreHtmlClass: ".*|",
    processHtmlClass: "arithmatex"
  }
};

and the combined components are loaded in skel-mkdocs-et/mkdocs.yml :

extra_javascript:
  - javascripts/config.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js