I'd like to number multiline equations and reference them, à la MathJax's Align and Gather environments. Can this be accomplished? If so, how?
2 Answers
$\begingroup$ $\endgroup$
8 In the align environment, I use \tag to number. \label is also supported by MathJax. \ref can be used to reference a line using \label and \tag.
For example: $$ \int_{-\infty}^\infty e^{-\pi x^2}\,\mathrm{d}x=1\label{a}\tag{1} $$ and reference it here: $\ref{a}$
- $\begingroup$ Thank you. Why is it that when I use \label in the align environment, the equations don't display but rather the underlying mathjax code? $\endgroup$Evan Aad– Evan Aad2014-04-08 21:32:14 +00:00Commented Apr 8, 2014 at 21:32
- 7$\begingroup$ @EvanAad: There seems to be a problem when editing. I find that when I save the edit and reload the page, things look okay. The same thing happened while I was editing my answer. $\endgroup$2014-04-08 21:33:28 +00:00Commented Apr 8, 2014 at 21:33
- 1$\begingroup$ See this post for some details about why that is the case. Also, see the SOUP script for workarounds to this and many other small issues . $\endgroup$Davide Cervone– Davide Cervone2014-04-08 23:05:11 +00:00Commented Apr 8, 2014 at 23:05
- 5$\begingroup$ But how was this done? I can't edit this answer, so I can't see the source code. $\endgroup$Daniel Martin– Daniel Martin2017-12-02 15:11:56 +00:00Commented Dec 2, 2017 at 15:11
- 4
- $\begingroup$ In the displayed equation you use \tag{1}. To refer to it you use \ref{a}. How does this work? I am not able to refer to \tagged equations. Am I missing the relevant part of MathJaX code? $\endgroup$wdacda– wdacda2020-10-05 05:45:30 +00:00Commented Oct 5, 2020 at 5:45
- $\begingroup$ @wdacda: The
\label{a}is what is referenced by the\ref{a}which is displayed as $\ref{a}$. $\endgroup$2020-10-05 06:13:34 +00:00Commented Oct 5, 2020 at 6:13 - $\begingroup$ @robjohn I get it now! With \tag{1} we control what will show as the "name" of the equation. We need the label to use it in \ref. Wonderful! I was quite slow. But better ever, then never. I prefer using \eqref, it is more like in math texts. Thank you! $\endgroup$wdacda– wdacda2020-10-05 07:01:06 +00:00Commented Oct 5, 2020 at 7:01
$\begingroup$ $\endgroup$
In order to see the tags during edit, the following trick can be used.
$$ \begin{aligned} a & = b & (1) \\ c & = d & (2) \end{aligned} $$
But now the equations cannot be hyperlinked to.