Skip to content

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

Open

Description

@cben
No description provided.

Activity

  1. cben commented on Sep 14, 2013

    @cben
    OwnerAuthor

    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.
  2. cben commented on Sep 25, 2013

    @cben
    OwnerAuthor
    • Also pass \[re]newcommand... without any $ etc delimiters to mathjax.
      Pandoc does this.
  3. cben commented on Oct 28, 2013

    @cben
    OwnerAuthor

    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.

  4. cben commented on Nov 22, 2013

    @cben
    OwnerAuthor

    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?

    UPDATE: MJ 2.7 added resetEquationNumbers() API https://docs.mathjax.org/en/v2.7/advanced/typeset.html#reset-automatic-equation-numbering, in MJ 3 it's texReset(): https://docs.mathjax.org/en/v3.2/web/typeset.html#resetting-automatic-equation-numbering

  5. cben commented on Nov 22, 2013

    @cben
    OwnerAuthor

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

  6. cben commented on Feb 11, 2014

    @cben
    OwnerAuthor

    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

  7. cben commented on Feb 12, 2014

    @cben
    OwnerAuthor
    • syntax highlight \begin...\end
    • syntax highlight \newcommand...}
    • avoid "label foo multiply defined" which makes labels completely unusable
  8. cben commented on Feb 12, 2014

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

    Should check how pandoc handles those.

  9. added a commit that references this issue on Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions