I would like to use \pageref's for a range of pages ie. at one point in my file I have something along the lines of
See pages \pageref{ref1}--\pageref{ref1_end}.
Where ref1 points to some section, and I would like ref1_end to point to the end of that section:
\section{section 1}\label{ref1}
a lot of text.\label{ref1_end} % label does not work: Reference `ref1_end' on page X undefined on input line Y.
\section{section 2}\label{ref2}
more text \label{ref2_end}
Using \pageref{ref1}--\pageref{ref1_end} would be wrong if there is a pagebreak between the two sections.
How can I add a label to the end of the text. Is there some way of doing this using some 0-size environment or phantom section?
Note: this question should be quite related to this and this, but differs in that I want to know what I can attach the label to without the output text and spacing having to look any different.
