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

TeX input, amsmath: change \sideset implementation to generate multiscripts #1217

Closed
pkra opened this issue Jul 23, 2015 · 4 comments
Closed
Labels
Accepted Issue has been reproduced by MathJax team

Comments

@pkra
Copy link
Contributor

pkra commented Jul 23, 2015

As per F2F and additional feedback from AMS math folks, multiscripts seem to be the desired output.

@pkra pkra added the Accepted Issue has been reproduced by MathJax team label Jul 23, 2015
@pkra pkra added this to the MathJax v3.0 milestone Jul 23, 2015
@pkra
Copy link
Contributor Author

pkra commented Jul 23, 2015

(Maybe try to push it into 2.6...)

@pkra pkra self-assigned this Jul 23, 2015
@dpvc
Copy link
Member

dpvc commented Jul 23, 2015

Does the self-assignment mean you are planning to implement it yourself? If so, I could give some suggestions about one approach that should work fairly easily.

@pkra
Copy link
Contributor Author

pkra commented Jul 23, 2015

Does the self-assignment mean you are planning to implement it yourself?

Yes. Since I realized my other plan is basically done. But I don't mind being beaten to it.

If so, I could give some suggestions about one approach that should work fairly easily.

That'd be great!

@dpvc
Copy link
Member

dpvc commented Jul 24, 2015

My suggestion is to use ParseArg() to get the arguments and parse them as MathML. This should give you a MathML element for each argument. Since the prescript and postscript arguments should look like (_a^b), you should get back an msubsup (or potentially an msup or msub, or possibly just an empty mrow if the argument is empty). You can check this using the type property of the returned MathML, or via instanceof. The children of the mml element are in its data property, and its sub and sup properties give the indices into the array for the proper element (since they differ for msubsup, msub, and msup). E.g.,

SideSet: function (name) {
  var sub, sup, presub, presup;
  var mml = this.ParseArg(name);
  if (mml instanceof MML.msubsup) {sub = mml.data[mml.sub], sup = mml.data[mml.sup]}
    else this.Error(["SideSetArg","Argument should include only super- and subscripts"]);
  ...
}

(Here MML = MathJax.ElementJax.mml that can be set globally.)

I think that should give you a good start.

As for the multi scripts macro that you cite above, it is part of the mhchem package, and only handles a single pre sup, pre sub, sup, and subscript, so is not a completely general solution. The tensor package and \prescript from math tools both allow multiple scripts on either side. Doing that is a bit more complicated, and my technique from above can't really be used for that. So there is still work to be done for a complete mmultiscripts implementation.

@pkra pkra removed their assignment Jun 20, 2017
@pkra pkra closed this as completed Feb 8, 2021
dpvc added a commit to mathjax/MathJax-src that referenced this issue Feb 9, 2022
dpvc added a commit to mathjax/MathJax-src that referenced this issue Feb 9, 2022
dpvc added a commit to mathjax/MathJax-src that referenced this issue Feb 25, 2022
Re-implement \sideset using mmultiscripts.  (mathjax/MathJax#1217)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team
Projects
None yet
Development

No branches or pull requests

2 participants