It would be useful to have a page number like (see page # for more details) that is tied to a specific section or figure, and as a consequence, automatically updates the text to say where that page # of that section or figure is if a change pushes it to a new page. Can this be done?
Asked
Active
Viewed 131 times
1 Answers
1
The magic command you are looking for is \pageref{<label>}.
A short example:
\documentclass{article}
\usepackage{lipsum}% <- only for random text in the example
\begin{document}
\pageref{foo}
\lipsum
\section{title}
\label{foo}
\end{document}
Or you could use the cleveref package which will not only insert the pagenumber but also automatically add the word "page" in front of it:
\documentclass{article}
\usepackage{lipsum}
\usepackage{cleveref}
\begin{document}
\cpageref{foo}
\lipsum
\section{title}
\label{foo}
\end{document}
samcarter_is_at_topanswers.xyz
- 158,329
-
In a later section of the paper, I put " \label{test} ". Then, I went back the paragraph I wanted to reference that section and put " \pageref{test} " but all it produced was ??. Also, what if I don't want the word "page"? – user14554 Jan 03 '19 at 23:53
-
1@user14554 You have to compile two times. – samcarter_is_at_topanswers.xyz Jan 03 '19 at 23:55