LaTex and MathML can be embedded to display within Learnosity Questions and Passages using the MathJax display engine. MathJax is a library used in Learnosity for rendering mathematics algorithms in the browser.
Loading MathJax
The loading of MathJax is handled by the API if a Question object contains an is_math
attribute that is set to true. See Question attributes for more information. This can be achieved when authoring a Question by selecting the "Contains math" checkbox found in More options. If math expressions are added through the Learnosity Math editor, then is_math
is automatically set to true. Additionally, all Math Question types have is_math
set to true as a default.
For Long Term Support v2023.1.LTS and prior, we load MathJax v2.7.0. Starting with v2023.2.LTS and onwards, we load MathJax v3.2.2.
If you are doing any customization with our version of MathJax, it is important to note that the internal structure of MathJax version 3 is significantly different from that of version 2. See MathJax version 3 documentation for more information.
The automatically handled MathJax has the following configuration values:
For Mathjax version 2.x.x:
{
messageStyle: "none",
showMathMenu: false,
"HTML-CSS": {
minScaleAdjust: 120,
imageFont: null,
matchFontHeight: false
},
}
For Mathjax version 3.x.x:
{
options: {
enableMenu: false
}
chtml: {
minScale: 1,
matchFontHeight: false
}
}
Should you wish to load and configure MathJax on the host page yourself, please follow this guide.
LaTex Support
LaTex can be embedded by surrounding it with either:
\( \)
for math equations to be displayed inline.\[ \]
for math equations to be displayed as a block.
For more information on MathJax LaTex support, see the MathJax LaTex documentation.
MathML Support
MathML tags <math>
and namespaced MathML are supported by the Questions API. To have MathML display in browsers that do not support it, MathJax will need to be loaded by providing a true is_math
attribute in the Question object.
MathML can be embedded with either:
<math></math>
for math equations to be displayed inline.<math display="block"></math>
for math equations to be displayed as a block.
Supported MathML tags:
- math
- maligngroup
- malignmark
- menclose
- merror
- mfenced
- mfrac
- mglyph
- mi
- mlabeledtr
- mlongdiv
- mmultiscripts
- mn
- mo
- mover
- mpadded
- mphantom
- mroot
- mrow
- ms
- mscarries
- mscarry
- msgroup
- msline
- mspace
- msqrt
- msrow
- mstack
- mstyle
- msub
- msup
- msubsup
- mtable
- mtd
- mtext
- mtr
- munder
- munderover