Katex: Upgrade auto-render extension for AMS environments and Pandoc delimiters

Created on 3 Aug 2020  Â·  9Comments  Â·  Source: KaTeX/KaTeX

The KaTeX main branch now includes eight environments that AMS LaTeX accepts in text mode. That is, in AMS LaTeX, these environments do not not need enclosing \[…\] delimiters. It would be good if the auto-render extension could also recognize those environments and invoke KaTeX without need for \[…\] delimiters.

The relevant environments are:

  • {align}
  • {align*}
  • {alignat}
  • {alignat*}
  • {equation}
  • {equation*}
  • {gather}
  • {gather*}

KaTeX has a new rendering option, called topEnv which has been included for this purpose. If the auto-render extension matches one of these environments, it should call KaTeX with rendering option topEnv: true and then KaTeX will know how to handle it.

While we're at this, I think it would also be good if the $...$ option (if included) be adjusted in line with Pandoc, which imposes the following constraint:

The opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left, and must not be followed immediately by a digit.

Either or both or these improvements may be better if there was a configuration flag that allowed the extension to work in the old manner.

@danielhollas You once expressed a willingness to take this on. Are you still game?

enhancement

All 9 comments

Sure. I guess it depends on your timeline. I'm too busy for at least two weeks, I could take it on after that.
But if you want to charge on, feel free. :-)

It would be nice to upgrade the extension before the next KaTeX release. But we just recently released v0.12.0, so I don't think the next release is imminent. Go ahead and do it on your own schedule.

Small request: could we make topEnv: true also work for $...$ or $$...$$ at the top level? This would make it easier for auto-render (and the many similar calls-to-KaTeX that exist in other software) to just pass in the whole math expression, whether it's a special environment or not -- currently I assume we have to strip the enclosing $s.

@edemaine Just to be sure that I understand, you are asking for an adjustment to core KaTeX so that it would accecpt a string either with or without an enclosing $…$. Is that correct?

@ronkok Right: I think this would make things more uniform, if I understand topEnv: true correctly. Sorry, should probably have opened a separate issue. (Now #2381)

Sure. Also for clarity, I think changes to core KaTeX are separate from what @danielhollas has agreed to do. Another one of us needs to take that on.

@danielhollas I just like to confirm you're still working on the PR.

I'll try to cook something up next weekend if that's okay? Thanks!

Closed via #2679.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbourne picture mbourne  Â·  3Comments

StaloneLab picture StaloneLab  Â·  3Comments

hagenw picture hagenw  Â·  3Comments

mpolyak picture mpolyak  Â·  3Comments

shaunc picture shaunc  Â·  4Comments