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

2020-11-12 07:57:29 | Maths | 1k+ Reads

First of all, in order for Markdown to be able to parse LaTeX mathematical expressions, under normal circumstances, we need to import the MathJax plugin to work:

<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

Then you 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}.\]

Okay, in fact, I have to show it in Code blocks, otherwise it will be parsed into formulas. The following content is also for this reason, I put them in the code block.


Let me tell you how to use these symbols in the first step.

Code:

\(a \ne 0\)

Mathjax:

\(a \ne 0\)

As you can see, the drawing of a mathematical formula starts with parentheses, and "\" is an escape character.

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

The "{" and "\{" will not be escaped and will only be output normally.

  • "(" will only have one line, and it looks very small if you have fractions in it.
  • "[" will use at least 2 lines to show your formula, and your formula will be centered and the size is more appropriate. We usually use "\[" to start our formula.
  • "{" will not have any response, no matter whether you use the "\" escape character or not.


Okay, you have learned the basic display method. The next blog, I will tell you another display method.

 

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

 

References:

https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference

This article was last edited at 2020-11-12 10:20:29