How to reference an in-line equation?

28 views
Skip to first unread message

dcul...@gmail.com

unread,
Jan 8, 2016, 6:52:17 AM1/8/16
to MathJax Users
I'm trying to reference an in-line equation by a method similar to that for a display equation. Code example --

======================
<p>Inline equation \( f(x) = x^2 \label{eq:z123a} \). More text ... </p>

<p>Attempt to reference inline equation \eqref{eq:z123a}.</p>
======================

However, \eqref{eq:z123a} simply displays as (???) so it appears that MathJax thinks that eq:z123a is undefined.

Can this be done? If not by the above method then are there any work-arounds?

Thanks,
Don C.

Davide P. Cervone

unread,
Jan 18, 2016, 8:27:07 AM1/18/16
to mathja...@googlegroups.com
Labels and references can only be used with expressions that have tags or equation numbers.  That means you either have auto-numbering enabled, or use \tag explicitly.  If you use \label without a \tag or auto-produced equation number, there is nothing or the label to refer to.  So \ref can only be used to link to a displayed equation, not an in-line one.

If you want to link to an inline equation, you could add an anchor around an expression, and then use a standard <a> tag to link to it.  But it would not be clear what to use as the text of the link.  E.g.,

======================
<p>Inline equation <a name="eq-z123a">\( f(x) = x^2 \)</a>. More text ... </p>

<p>Attempt to reference inline equation via a <a href="#eq-z123a">link</a>.</p>
======================

Note that the use of colons in such link ID's is a bad idea, so I've swapped it for a dash.

Alternatively, you could add an ID within the expression using \cssId, e.g.,

======================
<p>Inline equation \( \cssId{eq-z123a}{f(x) = x^2} \)</a>. More text ... </p>

<p>Attempt to reference inline equation via a <a href="#eq-z123a">link</a>.</p>
======================

Davide



--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dcul...@gmail.com

unread,
Jan 21, 2016, 10:25:13 PM1/21/16
to MathJax Users, dp...@union.edu
You mentioned that a colon should not be used in a link (e.g., "eq:z123a"). Why is this? (I only started using a colon for MathJax because I found that it was used elsewhere for MathJax -- for instance in the documentation -- http://mathjax.readthedocs.org/en/latest/tex.html?highlight=eqref). Or does this apply only for standard <a> links rather than MathJax links?
Reply all
Reply to author
Forward
0 new messages