Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am sure the answer to this exists somewhere here, but I am just not able to find it. I have many multipage figures/tables etc. in my document. I would like to be able to refer to a specific page of a multipage object. Using ~\pageref{somelabel}, I am able to refer to the first page of the object. If I know that my reference of interest is say, on the 5th page, how do I get ~\pageref{somelabel} to link to the 5th page of this multipage object. Thanks in advance for any help!

share|improve this question
1  
Do you only want the number or also a working hyperlink which jumps to this page? The first can be done by extracting the page number of the first page and adding 4. –  Martin Scharrer May 28 '12 at 16:45
2  
it depends a bit how you are getting multipage tables and figures, as by default LaTeX does not support either. But basically for example with longtable you should be able to go \label{here} at an arbitrary cell in the table and access \pagref{here} as usual, and should get the page number that that row lands on. –  David Carlisle May 28 '12 at 16:46
    
@MartinScharrer: I would like it to be a working hyperlink. @DavidCarlisle, that is an excellent tip, thanks! I have many longtables. I also have multipage figures. They are basically many plots that are included in the document (as one figure) via the ~\pdfpages option. –  Ariel May 28 '12 at 16:51

1 Answer 1

up vote 6 down vote accepted

Here's a mock-up of how you could go about obtaining your hyper-linked page references.

Assume the following is your multi-page image (or table):

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\lipsum[1-50]
\end{document}

This creates a 10-page document containing "stuff." Now you can include this in your main document in the following hypothetical way using pdfpages:

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{pdfpages}% http://ctan.org/pkg/pdfpages
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\newcounter{myimage}
\begin{document}
\lipsum[1-2]
See page~\pageref{myimage-5} for more details.
\includepdf[pages=-,pagecommand={\stepcounter{myimage}\label{myimage-\themyimage}}]{lipsum50}
\lipsum[1-2]
\end{document}

The above creates a 12-page document with the 10-page image on pages 2-11. Page X receives the label myimage-X via pagecommand. pagecommand steps some counter (myimage) and also inserts a unique label. Then you can refer to the specific page of a multi-page image using \pageref{myimage-<page>} like in my example:

enter image description here

\pageref{myimage-5} refers to page 6. For multiple multi-page images/tables, you need to reset the counter before each inclusion (\setcounter{myimage}{0}) and also provide a unique label for each image/table. The latter requirement is usually the default when working with labels, so shouldn't influence your workflow.

The above discussion involves the inclusion of multi-page "images." Using multi-page tables in the longtable sense you can insert \label inside the table where you want to obtain the exact reference you need for the page it's on.

share|improve this answer
    
+1 I'm doing it almost identical in my thesis, but for a different reason. –  Martin Scharrer May 28 '12 at 17:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.