PhysicistSouravDas

Writing LaTeX on this website

How equations are displayed on this website?

Posted on: July 16, 2022

Updated on: July 16, 2022

math
latex

PhysicistSouravDas

Owner of this site

In this article, I will describe about writing . Using this, you can write mathematical symbols and equations. It is a remarkable tool!

What is ?

Suppose I want to write one of the most famous equation, the Einstein mass-energy equivalence equation. In text, someone would write it like this: E = mc2. But how to raise that 2 to the power? Let us use now. . How's it? Amazing, isn't it?

Some more equations below:

The above equations are Maxwell's equations. The code you have to right to generate above equations will look like this,

$$
\begin{align*}
\nabla\cdot\textbf{E} &= \frac{\rho}{\epsilon_{0}} \\
\nabla\cdot\textbf{B} &= 0 \\
\nabla\times\textbf{E} &= -\frac{\partial{\textbf{B}}}{\partial{t}} \\
\nabla\times\textbf{B} &= \mu_{0}\textbf{j} + \frac{1}{c^{2}}\frac{\partial{\textbf{E}}}{\partial{t}}
\end{align*}
$$

Displaying on websites

If any website does not have the software to compile , or the software fails to compile, then, instead of the formulae, you would see dollar signs $$$. It is because these dollar signs are used to write .

As you may already know, this website is created using the Nuxt framework, which is a JavaScript framework. To display in this website, I use MathJax via remark-math@4.0.0 and rehype-mathjax@3.1.0. Note that version of these packages later than these won't work with Nuxt v2 (which I am currently using), because the later version of remark packages are ESM package, which cannot be require()'d from CommonJS. An alternative to MathJax is KaTeX, created by developers at Khan Academy. KaTeX is faster than MathJax, but MathJax has complete support for , and used more widely on the internet.

Back to Blog Home