1. About LeTex
LaTeX, a typesetting system based on TeX, was developed by American computer scientist Leslie Lambert in the early 1980s. With the processing of this format system, even users without knowledge of typesetting and programming can To give full play to the powerful functions provided by TeX, you don't have to design or proofread one by one, and you can generate a lot of book-quality prints in a few days or even a few hours.
- Wikipedia
2. Use
In the site, insert:
1 | <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script> |
Plugs into the MathJax library.
If InstantClick/PJAX is used, insert in the callback function:
1 | if (typeof(MathJax) !== 'undefined') { MathJax.Hub.Config({ 'HTML-CSS': {matchFontHeight: false}, SVG: {matchFontHeight: false}, CommonHTML: {matchFontHeight: false} }); MathJax.Hub.Queue(["Typeset",MathJax.Hub]); } |
Config
can be changed to your own configuration, or removed.
3, basic grammar
MathJax uses LaTeX math delimiters, use \(...\)
to display inline formulas, and \[...\]
to display interline formulas.
It also recognizes the TeX delimiters $$...$$
to display interline formulas. Defining $…$
as an inline math delimiter is not supported due to the frequent occurrence of the dollar sign ($) in non-mathematical contexts, which may cause some text to be treated unexpectedly as math.
Therefore need to set:
1 | MathJax = { tex: { inlineMath: [['$', '$'], ['\\(', '\\)']], packages: ['base', 'newcommand', 'configMacros'] }, svg: { fontCache: 'global' } }; |
E.g:
Type | Formula | Effect |
---|---|---|
Inline | Circle area formula: \\(S=\pi r^2\\) | \(S=\pi r^2\) |
Between lines | Area formula of a circle: $$S=\pi r^2$$ | $$S=\pi r^2$$ |
Indicates priority:
Use {...}
E.g:
Type | Formula | Effect |
---|---|---|
None | $$x_i^2$$ | \(x_i^2\) |
priority | $$x_{i^2}$$ | $$x_{i^2}$$ |
LaTex (1) Common Grammar
Comments