Skip to content

Fix TeX.Environment() to use the correct end environment. #1455

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

Merged
merged 1 commit into from
May 11, 2016

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented May 3, 2016

There is no issue number for this. It turned up when I was checking another bug, but was unrelated to it. You are supposed to be able to use

MathJax.InputJax.TeX.Environment(name,prefix,suffix,n,default)

(after loading the TeX newcommand extension) in order to define a new command, where prefix is the TeX code to insert at the beginning of the environment, suffix is the TeX to insert at the end, n is the number of arguments required for the environment, and default is the default for the argument. The n and default are not required.

This works as advertised, except for one thing: if the prefix includes a \begin{...} and the suffix includes an \end{...}, MathJax issues an error about the nesting being wrong. With this fix, the begin and end work properly. E.g.,

MathJax.InputJax.TeX.Environment("nested","\\begin{matrix}","\\end{matrix}");

would cause \begin{nested} a& b \end{nested} to produce the message '\begin{matrix} ended by \end{nested}` without the patch. With the patch, you should get a matrix as expected.

@zorkow
Copy link
Member

zorkow commented May 11, 2016

LGTM (afaict)

@dpvc dpvc merged commit 1d84967 into mathjax:develop May 11, 2016
@dpvc dpvc deleted the environment-fix branch May 11, 2016 21:08
@pkra pkra added this to the MathJax v2.x.x milestone May 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants