GeneralCross-references Spanning Various Pages

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Cross-references Spanning Various Pages

Post by AleCes »

Hello everybody, I have footnotes repeatedly cross-referencing to a portion of text spanning various pages. Is it possible to automatize the process so that I get page numbers hinting to the portion of text at issue?

Code: Select all

\documentclass{book}

\begin{document}

\chapter{Foreword}
% Portion of text at issue begins here

This is the first page of the foreword

\clearpage

This is the second page of the foreword

% Portion ends here

\chapter{Epilogue}

This is the epilogue\footnote{See pages %Insert here command which spawns page numbers
}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Cross-references Spanning Various Pages

Post by Johannes_B »

You can use label and ref for that. But since this is really really basic stuff, i am not sure i understand the problem at hand correctly.

Code: Select all

\documentclass{book}
\usepackage{blindtext}
\begin{document}
\chapter{Foreword}
		% Portion of text at issue begins here
\label{start}
\blindtext[9]
\label{end}

\chapter{Epilogue}
This is the epilogue\footnote{See
	pages \pageref{start} to \pageref{end}}

\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Re: Cross-references Spanning Various Pages

Post by AleCes »

Thanks Johannes_B, it works wonderfully. If you know a more elegant way to achieve the same result, please let me know, but as far as I'm concerned I'm satisfied with your hint.

Thanks! ;)
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Cross-references Spanning Various Pages

Post by Johannes_B »

Package varioref might be worth a look ;-)

Code: Select all

\documentclass{report}%JB just for the example
\usepackage{blindtext}
\usepackage[english]{babel}
\usepackage{varioref}
\usepackage{nameref}
\begin{document}
\chapter{Foreword}
\label{start}
\blindtext[9]
\label{end}

\chapter{Epilogue}
This is the epilogue See pages \pageref{start} to \pageref{end}

You can find the foreword on \vpagerefrange{start}{end}


See the section on \nameref{chap:sugarSpice} 
\vpagerefrange{singlepagestart}{singlepageend}.

\chapter{Sugar and Spice}
\label{chap:sugarSpice}
\label{singlepagestart}
\blindtext%[7]%JB: not any more on one page, try it out
\label{singlepageend}

See the section on \nameref{chap:sugarSpice} 
\vpagerefrange{singlepagestart}{singlepageend}.
\clearpage
See the section on \nameref{chap:sugarSpice} 
\vpagerefrange{singlepagestart}{singlepageend}.
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply