Katex: Embedding $...$ in \text

Created on 29 Aug 2014  路  3Comments  路  Source: KaTeX/KaTeX

This should work:

\text{for all $x$}
enhancement

Most helpful comment

I would love this so we could switch from MathJax. Any thoughts/progress on this?

All 3 comments

Copying from #121:

We should support embedding math inside a \text command using $...$ delimiters and perhaps also \( ... \). This shouldn't be too hard but there are a couple things to watch out for:

  • It's not enough to do a simple match on /\$.*?\$/ because something like \text{I have $\$20$.} should work and show "I have $20."
  • In a script, the font should be smaller but it seems that the spacing is as if in regular textstyle. For example, 2^{\text{$2x+3$}} + 2^{2x+3} turns into:
    image
    in LaTeX. And if \text is in a \displaystyle context, any embedded math should be \textstyle.

I would love this so we could switch from MathJax. Any thoughts/progress on this?

This is fixed in v0.8.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ylemkimon picture ylemkimon  路  3Comments

q2apro picture q2apro  路  3Comments

StaloneLab picture StaloneLab  路  3Comments

pvnr0082t picture pvnr0082t  路  4Comments

msridhar picture msridhar  路  3Comments