Search code examples
latexmathjaxtexamsmath

Typing LateX expression in MathJax without displaying as a Math expression


On an online tutorial page using MathJax, how would we teach students: Type \[x^2+1\] to display enter image description here


Solution

  • There are actually several similar questions but a thorough answer might be a good reference point for SO.

    Ther are two ways of handling this.

    Escape a particular expression

    This is quick and easy and can be done by authors themselves.

    As per the documentation, the TeX pre-processors stops parsing at HTML tags. So wrapping the delimiters in some markup will prevent it from rendering

    E.g.,<span>\[</span>x^2+1<span>\]</span>

    Skip larger blocks

    As per the documentation, the TeX pre-processor has two configuration options to skip parts of the content:

    • skipTags (skip by tag name), default: script,noscript,style,textarea,pre,code
    • ignoreClass (skip by class name), default: tex2jax_ignore

    E.g., <pre>\[ x^2 + 1 \] </pre>