12

I am sure that this has been asked before, but I don't seem to be able to find the answer.

I need to make a reference to a page. That is, I would like to use \pageref{}. I specifically need to make a reference to an equation that is in \begin{align*} \end{\align}.

When I insert a \label in the align* I get an error. How can I do this?

So I want to do something like this

\documentclass[12pt]{report}
...

Texts

\begin{align*}
e = mc^2\label{eqn}
\end{align*}
...
Text the equation on page \pageref{eqn} is ...

I need to make a page reference to the page that contains E=mc^2.

5
  • 2
    align* is intended to not have equation numbers. That is exactly the difference between align* and align. So, use align instead, and use \nonumber for those equations that you don't want an equation number. Jun 18, 2014 at 4:22
  • @PeterGrill: Ok, I am not good at articulating myself. I need to make a reference to a page (not an equation) that contains only align* enviroments. How do I do that?
    – Thomas
    Jun 18, 2014 at 4:23
  • If you are trying to reference a page, why are you trying to \label an equation? I suggest that instead of describing the problem, you compose a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. That way those trying to help can focus on the solution as opposed to setting up the problem test case, and also makes it clear exactly what the problem is. Jun 18, 2014 at 4:27
  • @PeterGrill: My question is: How do I refer to a page that contains only text?
    – Thomas
    Jun 18, 2014 at 4:27
  • 1
    two glitches in the example: the \end{align} should have align*, and instead of \ref you (said you) want \pageref. Jun 18, 2014 at 12:51

3 Answers 3

14

It suffices to place the \label "anchor" somewhere on the page you need to cross-reference. Just don't place the label inside an environment which, by design, won't take a numbering anchor.

To minimize the chances that an unfortunate page break will happen between the equation and the label (and therefore not getting the page reference right), be sure to place the \label instruction immediately before the equation whose page number you want to cross-reference. As @egreg has pointed out in a comment, that's a safe placement option, because inserting a page break immediately before a display equation isn't a legitimate move for LaTeX.

The following MWE

\documentclass{article}
\begin{document}
\label{page:emc2}  % place the \label instruction immediately before the unnumbered equation
\[  % an unnumbered display-style equation
E=mc^2
\]
\clearpage
A famous equation is shown on page \pageref{page:emc2}.
\end{document}

produces this output on page 2:

A famous equation is shown on page 1.

3
  • Great. Thanks. Simple answer for a simple question.
    – Thomas
    Jun 18, 2014 at 4:50
  • 1
    The \label should go immediately before the display, since that is not a legitimate page break point.
    – egreg
    Jun 18, 2014 at 7:49
  • @egreg - Thanks for this, I'll modify the answer accordingly.
    – Mico
    Jun 18, 2014 at 8:14
7

You can use the standard \label command in disguise:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\let\pagelabel\ltx@label
\makeatother

\begin{document}
\begin{align*}
E&=mc^2\pagelabel{page:emc2}\\
F&=nd^2
\end{align*}
\clearpage
A famous equation is shown on page \pageref{page:emc2}. 
Which one, you will ask? Indeed, it is a puzzle for the readers
to solve.

\end{document}

However, it's better either to \tag the equation or to number it, for the reason I add in the code above.

1

For your example, instead of using align*, you can use equation with \nonumber.

...
\begin{equation}
\nonumber
\label{eqn}
e = mc^2
\end{equation}
...
Text the equation on page \pageref{eqn} is ...

This solution works both for page numbering and hyperref clickable references.

If you want to point out to a place in your document that is not an equation, a partial workaround is to insert \label in the place you want to point out to, and change your single-lined no-numbered equations to the above format. The page number should work correctly and hyperref will send the viewer to the last anchor before that position. (Doesn't work well with \qedhere.)

3
  • Somewhere where?
    – egreg
    Mar 1, 2017 at 8:29
  • Edited for clarity
    – user4929
    Mar 4, 2017 at 0:33
  • @egreg anywhere :-)
    – user4929
    Jun 19, 2020 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .