Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathJax state: \newcommand and friends, numbered eqs #2

Open
cben opened this issue Jul 27, 2013 · 8 comments
Open

MathJax state: \newcommand and friends, numbered eqs #2

cben opened this issue Jul 27, 2013 · 8 comments

Comments

@cben
Copy link
Owner

cben commented Jul 27, 2013

No description provided.

@cben
Copy link
Owner Author

cben commented Sep 14, 2013

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:

  • Leave $\newcommand{...}$ in source form instead of becoming invisible (special case of Dont allow empty formula rendering #10).
  • on change to a $\newcommand...$ formula, re-typeset all (or all following) math.

@cben
Copy link
Owner Author

cben commented Sep 25, 2013

  • Also pass \[re]newcommand... without any $ etc delimiters to mathjax.
    Pandoc does this.

@cben
Copy link
Owner Author

cben commented Oct 28, 2013

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.

@cben
Copy link
Owner Author

cben commented Nov 22, 2013

Simular (but worse?) issues of rendering order sensitivity happen with \begin{equation} numbering. See mathjax/MathJax#422.

This is going to be more acute if I optimize initial pass (#14) to be partial/out-of-order.

  • Learn which phase of MJ updates state (macros, numbers, labels). Preprocess? Process? Render?

@cben
Copy link
Owner Author

cben commented Nov 22, 2013

http://jsfiddle.net/89r6p/3/ demonstates mathjax running again (click) on labels, numbers & refs.

@cben
Copy link
Owner Author

cben commented Feb 11, 2014

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

cben added a commit that referenced this issue Feb 11, 2014
This includes numbered equations, but they're pretty unusable (#2).
@cben
Copy link
Owner Author

cben commented Feb 12, 2014

  • syntax highlight \begin...\end
  • syntax highlight \newcommand...}
  • avoid "label foo multiply defined" which makes labels completely unusable

@cben
Copy link
Owner Author

cben commented Feb 12, 2014

  • handle \DeclareMathOperator not wrapped in $...$
    • handle any tex macros not wrapped in math? Probably WONTFIX.

Should check how pandoc handles those.

cben added a commit that referenced this issue Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant