KaTeX
How to add KaTeX to your Doks website.
Equation Editor by CodeCogs is an online LaTeX equation editor, where you can create, integrate, and download equations.
1. Enable
KaTeX support is switched off per default. Activate it by setting kaTex = true
in ./config/_default/params.toml
.
2. Copy fonts
Copy KaTeX fonts from ./node_modules/katex/dist/fonts/
to ./static/fonts/
:
npm run copy:katex-fonts
3. Configure
Customize Doks’ default configuration (if needed) in ./assets/js/katex.js
:
document.addEventListener('DOMContentLoaded', function() {
renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true},
],
});
});
Example
Excerpt taken from Supernova Neutrinos by Lei Ma.
Markdown
The average energy of the neutrinos $\langle E \rangle$ emitted during a supernova explosion is of the order of 10MeV, and the neutrino luminosity at the early epoch of the explosion is approximately $10^{52}\mathrm{ergs\cdot s^{-1}}$.
Therefore, the number density of the neutrinos at the radius $R$ is
$$
\begin{equation*}
n \sim 10^{18} \mathrm{cm^{-3}} \left(\frac{100\mathrm{km}}{R}\right)^2 \left(\frac{10\mathrm{MeV}}{\langle E \rangle}\right).
\end{equation*}
$$
HTML
Note, this is an image, because KaTeX support is switched off on this site.