Help:KaTeX: Difference between revisions
More actions
Tesinormed (talk | contribs) m Protected "Help:KaTeX": High-traffic ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
Tesinormed (talk | contribs) No edit summary Tag: 2017 source edit |
||
| Line 10: | Line 10: | ||
==Tag parameters== |
==Tag parameters== |
||
When using KaTeX, the general format is: |
When using KaTeX, the general format is: |
||
<syntaxhighlight lang="html"> |
|||
<pre> |
|||
<tex mode="display" fleqn>\TeX</tex> |
<tex mode="display" fleqn>\TeX</tex> |
||
</syntaxhighlight> |
|||
</pre> |
|||
The parts of the tag are: |
The parts of the tag are: |
||
*<code><nowiki><tex></nowiki></code> and <code><nowiki></tex></nowiki></code>: These are the markers which tell MediaWiki where your TeX begins and ends. |
*<code><nowiki><tex></nowiki></code> and <code><nowiki></tex></nowiki></code>: These are the markers which tell MediaWiki where your TeX begins and ends. |
||
*<code>mode="display"</code> and <code>fleqn</code>: Parameters which change the way the TeX is rendered. |
*<code>mode="display"</code> and <code>fleqn</code>: Parameters which change the way the TeX is rendered. |
||
* |
*{{code|lang=tex|inline=y|\TeX}}: The TeX to be rendered by KaTeX. |
||
The following parameters are supported: |
The following parameters are supported: |
||
| Line 28: | Line 28: | ||
Refer to the [https://katex.org/docs/supported.html KaTeX supported functions page]. |
Refer to the [https://katex.org/docs/supported.html KaTeX supported functions page]. |
||
< |
<syntaxhighlight lang="html"><math mode="display">x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}</math></syntaxhighlight> |
||
<math mode="display">x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}</math> |
<math mode="display">x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}</math> |
||
==Chemistry== |
==Chemistry== |
||
Refer to the [https://mhchem.github.io/MathJax-mhchem/ mhchem for KaTeX guide]. (specifically, |
Refer to the [https://mhchem.github.io/MathJax-mhchem/ mhchem for KaTeX guide]. (specifically, {{code|lang=tex|inline=y|\ce}}) |
||
< |
<syntaxhighlight lang="html">Some example inline chemistry: <chem>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem></syntaxhighlight> |
||
Some example inline chemistry: <chem>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem> |
Some example inline chemistry: <chem>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem> |
||
< |
<syntaxhighlight lang="html"><chem mode="display">\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem></syntaxhighlight> |
||
<chem mode="display">\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem> |
<chem mode="display">\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem> |
||
< |
<syntaxhighlight lang="html"><chem mode="display" fleqn>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem></syntaxhighlight> |
||
<chem mode="display" fleqn>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem> |
<chem mode="display" fleqn>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem> |
||
==Quantities== |
==Quantities== |
||
Refer to the [https://mhchem.github.io/MathJax-mhchem/ mhchem for KaTeX guide] (specifically, |
Refer to the [https://mhchem.github.io/MathJax-mhchem/ mhchem for KaTeX guide] (specifically, {{code|lang=tex|inline=y|\pu}}) |
||
< |
<syntaxhighlight lang="html">The weight of an apple is around <quantity>100 g*N/n\Omega</quantity>.</syntaxhighlight> |
||
The weight of an apple is around <quantity>100 g*N/n\Omega</quantity>. |
The weight of an apple is around <quantity>100 g*N/n\Omega</quantity>. |
||
< |
<syntaxhighlight lang="html">The weight of an apple is around <quantity>100 A*B/C2/D-4</quantity>.</syntaxhighlight> |
||
The weight of an apple is around <quantity>100 A*B/C2/D-4</quantity>. |
The weight of an apple is around <quantity>100 A*B/C2/D-4</quantity>. |
||
Revision as of 05:47, December 28, 2024
KaTeX (stylised \KaTeX) is a TeX (stylised \TeX) rendering library — put simply, it processes TeX and produces correctly formatted text. It can be used for formatting mathematics, chemistry, and physical quantities.
The following MediaWiki parser tags are supported:
<tex><math><ce><chem><quantity>
Tag parameters
When using KaTeX, the general format is:
<tex mode="display" fleqn>\TeX</tex>
The parts of the tag are:
<tex>and</tex>: These are the markers which tell MediaWiki where your TeX begins and ends.mode="display"andfleqn: Parameters which change the way the TeX is rendered.\TeX: The TeX to be rendered by KaTeX.
The following parameters are supported:
modemode="display": Center the TeX on the page and disable text wrapping.
fleqn: Render the TeX flush left with a2emleft margin.leqno: Render\tagon the left instead of the right.
Math
Refer to the KaTeX supported functions page.
<math mode="display">x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}</math>
x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}
Chemistry
Refer to the mhchem for KaTeX guide. (specifically, \ce)
Some example inline chemistry: <chem>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem>
Some example inline chemistry: \ce{\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}}
<chem mode="display">\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem>
\ce{\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}}
<chem mode="display" fleqn>\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}</chem>
\ce{\ce{^{235}_{92}U -> ^{4}_{2}He + ^{231}_{90}Th}}
Quantities
Refer to the mhchem for KaTeX guide (specifically, \pu)
The weight of an apple is around <quantity>100 g*N/n\Omega</quantity>.
The weight of an apple is around \pu{100 g*N/n\Omega}.
The weight of an apple is around <quantity>100 A*B/C2/D-4</quantity>.
The weight of an apple is around \pu{100 A*B/C2/D-4}.