[Tutorial] Step by step teaches you how to use Mathjax3.0 (Part 1)

| Maths | 1k+ Reads

First of all, in order to render LaTeX mathematical expressions on a web page, we can use MathJax:

<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

Then you can try to output some formulas.

Example:

When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]

MathJax:

When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]

In fact, I have to show the MathJax syntax inside code blocks; otherwise, it will be rendered as a mathematical formula. The following examples are also placed inside code blocks for the same reason.


Let me show you how to use these symbols first.

Code:

\(a \ne 0\)

MathJax:

\(a \ne 0\)

As you can see, MathJax mathematical expressions can be written using delimiters such as \( and \), or \[ and \].

In other words, you can start with "\(" and end with "\)",
or start with "\[" and end with "\]".

The delimiters are used for different types of mathematical expressions:

  • \( ... \) is used for inline mathematical expressions.
  • \[ ... \] is used for display mathematical expressions. The formula is displayed on a separate line and is usually centered.
  • Curly braces such as { } are commonly used inside LaTeX commands to group expressions.


Okay, you have learned the basic display method. In the next blog post, I will introduce another way to display mathematical expressions with MathJax.

 

Next: [Tutorial] Step by step teaches you how to use MathJax 3.0 (Part 2)

 

References:

MathJax basic tutorial and quick reference

This article was last edited at