1

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

nam
  • 21,967
  • 37
  • 158
  • 332
  • If you teach CS, you may be interested in the new [CS Educator's Stack Exchange](http://cseducators.stackexchange.com) (though since it's still in private beta, it's easiest to enter [through here](https://area51.stackexchange.com/proposals/92460/computer-science-educators)) – Ben I. Jun 02 '17 at 19:16

1 Answers1

2

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>

Peter Krautzberger
  • 5,145
  • 19
  • 31
  • Just an observation: `code` tag (as you mentioned in defaults) would work better in cases where we don't want to use `display:block` since `pre` tag has a default style `display: block`. E.g, the sentence `Type \(ax^2+bx+c=0\) to display quadratic equation` will be all in one line (inline). – nam Aug 05 '17 at 15:49
  • True but the OP had a display style equation. – Peter Krautzberger Aug 05 '17 at 15:55
  • Agreed. And thanks to your team for providing us such a powerful tool to display scientific documents on web. I hope [NSF](https://www.nsf.gov/) or some other governmental/private agencies provide some financial support to your team so you can afford to have your own staff support your own [CDN](https://en.wikipedia.org/wiki/Content_delivery_network) as that would benefit everyone. – nam Aug 05 '17 at 16:07