-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
equation \label and \ref #71
Comments
It is on the list of things to add, but we have been concentrating on performance and bug fixes for the 1.1 release. I have not forgotten about it, and it is one of the things that should be added following version 1.1. Davide |
…s (resolves issue mathjax#71)
I have posted an implementation of automatic equation numbering, along with the \label and \ref macros, in the There are new configuration parameters (see the config/defaults.js file) that control the equation numbering. In particular, The TeX.equationNumbers.autoNumber configuration parameter controls how MathJax handles automatic numbering. By default, no automatic numbering is done (so the default is the same as the current MathJax behavior). But you can set
to get numbering for the AMS environments (equation, align, gather, multline, etc.), with the starred environments suppressing the numbers. You can use \tag to provide your own equation number, and \label and \ref to access the equation number within the text of the page. (The \ref command is now recognized both in and out of math mode.) If you set An issue to keep in mind: the equation numbers are handled using the mlabeledtr MathML element, which is not implemented by Firefox (neither version 3 nor 4), so if you use the NativeMML renderer, the equation numbers will not be shown. Note that the combined configuration files that include "HTMLorMML" will select NativeMML output in Firefox, for example. This can be overridden by specifying
prior to loading I am still working on this branch, so changes my still be made. I'm not happy with the method used to handle forward references, and may be changing how that works (though that will be internal, and won't change how it appears to authors or users). Davide |
That's absolutely fantastic, thanks a lot ! One bug though, typing |
OK, I'll check into it. There must be an index that is off by 1 when the reference is being removed from the text. |
I have fixed the incorrect index that was causing the character following the Davide |
Note: I also updated it so that you don't have to explicitly request the AMSmath extension; if you turn on auto-numbering, it will be loaded automatically now. Davide |
==> Setting to testcase wanted as I plan to add unit tests to cover this feature. |
There are a lot of things to test, here. Forward references, backward references, references to no-existent labels, the use of |
Yes, I'm aware of it. That's why I'm only tagging the issue as testcase wanted and postpone writing these tests. |
I've prepared a couple of tests for this. Configuration/tex2jax/processRefs-1.html ==> In testsuite There is an extra comma in tex2jax.js, line 181, which makes IE crash. |
It seems that the mlabeledtr disappear with Firefox when native MathML is enabled. Consider for example: |
Yes, I already spotted that and have fixed it in the
This is because Firefox doesn't implement |
For Firefox, why do we remove the label? We may leave it, even if it is not well positioned? |
Because the label is the first Davide |
Note that a change for mlabeledtr is targeted for Firefox 9: The content of mlabeledtr is now displayed as a normal row, except the label which is hidden by default (this can be overridden using a CSS rule). For the bug to implement mlabeledtr, see |
Firefox 9 has been released and includes the workaround for mlabeledtr, so MathJax won't need to do it itself for that version. |
Is there any chance of getting For example, at the moment, if I have \begin{align}
F &= m a \label{NewtonsLaw}
\end{align} This will generate an id However, I can't refer to the equation from another HTML document without knowing the equation number. i.e. I can't create an external link to http://www.mywebsite.com/mypage.html#mjx-eqn-NewtonsLaw |
…tionally). Requested in issue mathjax#71.
@GrahamDennis -- good idea. I have modified the Davide |
Thanks @dpvc! |
I'm about to update the tests to take into account the latest change. |
Davide, did you take this comment into account for MathJax 2.0? With MathJax workaround removed, Firefox users will be able to display the label if they want to, using the simple CSS rule |
Yes, the work-around for |
OK, great! Thanks. |
Can I set it to number equations only when \label is added? I don't use \label and \ref very often. I know I can use equation* environment in LaTeX, but unfortunately, I am using Markdown and * is reserved for markdown syntax. Thank you. |
@emptymalei, there is no setting for what you are looking for, but you could use explicit |
@dpvc Thank you. I 'll try \tag{}. |
Hi, Thank you all for the amazing project and this amazing feature. Here I have a small problem. When modifying maths with I believe it can be fixed by removing the label definition in MathJax when replacing the HTML elements. But I haven't find any interface to inform this removing, or any code that can clear the definitions without refreshing the page. Does any have any idea what I can do? Thank you in advance. |
Please don't re-use threads. You'll want to read the documentation on resetting equation numbers. |
Alright I thought it is an incomplete feature rather than bug. I'll start a new issue. The equation numbers can be resetted, but the labels cannot. |
The labels are reset as well by |
Thank you very much! It must be my wrong usage leading to the failure. Thank you again. Sorry for disturbing. |
It seems |
Feature request! Can we have \label and \ref facilities for equations?
This may be a popular one indeed, but I couldn't find it on issue list (or mention of it in the documentation). And is basically been discussed long back: http://sourceforge.net/projects/mathjax/forums/forum/948700/topic/3817124
Thank you!
The text was updated successfully, but these errors were encountered: