Graphics, Figures & TablesLongtable and Hyperref

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Longtable and Hyperref

Post by magical marshmallow »

Hi,

I have a really long table (4 pages) in my thesis, so I really need to use the longtable package. It works well aside from one really minor, but annoying problem
When I write my code, the hyperlinks in my LoT and anywhere I cross reference it do not take me to the table, they take me to the very first page of the document instead of the page where the start of the table is (i.e page 50).

I have two tables which are different, but use the longtable environment and this is happening for both of them. I have no idea why. I have tried putting the \label{} command inside the caption, in the same line but outside the caption and also on it's own.
Obviously, the longtable is not within a float as this will not work. Is this a problem with hyperref or is there a problem with my code?

Code: Select all

documentclass{scrreprt}
      \usepackage{booktabs}
      \usepackage{multirow}
      \usepackage[labelfont=bf,justification=raggedright]{caption} 
      \usepackage{longtable, tabu}
      \usepackage[colorlinks]{hyperref}
          \hypersetup{colorlinks,citecolor=blue, linkcolor=black}
      \usepackage{tocloft}
          \begin{document}
          \listoftables
         \clearpage
         
         \footnotesize%
         \begin{center}
           \setlength\LTright{-30pt}           % default: \fill
           \begin{longtable}[l]{>{\raggedright}p{1.1cm}>{\centering}p{2cm}>{\raggedleft\arraybackslash}p{1.5cm}}
          \caption{longtable caption}\label{tab:longtable label}\\
          
          \hline
          Column 1 & Column 2 & Column 3 \\
          \endfirsthead
          \multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- Continued from previous page}} \\
          \hline
          Column 1 & Column 2 & Column 3 \\ \hline
          \endhead
          \multicolumn{3}{r}{{Continued on next page}} \\
          \endfoot

          \endlastfoot
          1 & 2 & 3 \\
          4 & 5 & 6 \\
          7 & 8 & 9 \\
          \end{longtable}
          \end{center}
          \normalsize
          \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.

magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Longtable and Hyperref

Post by magical marshmallow »

This appears to be a conflict with the arydshln package. Removing this package from my preamble sorted me out
Post Reply