Beni Cherniavsky-Paskin
Beni Cherniavsky-Paskin
Turns out MathJax has stateful support for \newcommand, and it works. However it depends on the order they're typeset, which might not correspond to document order To make it usable:...
- [x] Also pass `\[re]newcommand...` without any `$` etc delimiters to mathjax. [Pandoc does this](http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html#latex-macros).
Undocumented: `\newcommand` alters `MathJax.InputJax.TeX.Definitions.macros` and `MathJax.InputJax.TeX.Definitions.environment`. Could try to save/restore them instead of re-typesetting all following math. However, it's rare enough that re-typesetting should be acceptable.
Simular (but worse?) issues of rendering order sensitivity happen with `\begin{equation}` numbering. See https://github.com/mathjax/MathJax/issues/422. This is going to be more acute if I optimize initial pass (#14) to be partial/out-of-order....
http://jsfiddle.net/89r6p/3/ demonstates mathjax running again (click) on labels, numbers & refs.
Numbering state is in `MathJax.Extension["TeX/AMSmath"].number` and `MathJax.Extension["TeX/AMSmath"].startNumber`; there is a host of other variables to handle labels&refs: https://github.com/mathjax/MathJax/blob/master/unpacked/extensions/TeX/AMSmath.js#L562
- [ ] syntax highlight \begin...\end - [ ] syntax highlight \newcommand...} - [ ] avoid "label foo multiply defined" which makes labels completely unusable
- [ ] handle `\DeclareMathOperator` not wrapped in $...$ - [ ] handle any tex macros not wrapped in math? Probably WONTFIX. Should check how pandoc handles those.
Or just feed it into a "version sorting" algorithm, e.g. the [naturally](https://github.com/public-law/naturally) gem :)
Feedback from @stiller-leser, not sure why it disappeared: > Some initial feedback from my side. I just tried `create_entity` and noticed a couple of things: > > - Isn't it...