LaTeX forum ⇒ Graphics, Figures & TablesLongtable and Hyperref

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

Longtable and Hyperref

Postby magical marshmallow » Tue Jun 24, 2014 11:21 pm

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?
  1. documentclass{scrreprt}
  2. \usepackage{booktabs}
  3. \usepackage{multirow}
  4. \usepackage[labelfont=bf,justification=raggedright]{caption}
  5. \usepackage{longtable, tabu}
  6. \usepackage[colorlinks]{hyperref}
  7. \hypersetup{colorlinks,citecolor=blue, linkcolor=black}
  8. \usepackage{tocloft}
  9. \begin{document}
  10. \listoftables
  11. \clearpage
  12.  
  13. \footnotesize%
  14. \begin{center}
  15. \setlength\LTright{-30pt} % default: \fill
  16. \begin{longtable}[l]{>{\raggedright}p{1.1cm}>{\centering}p{2cm}>{\raggedleft\arraybackslash}p{1.5cm}}
  17. \caption{longtable caption}\label{tab:longtable label}\\
  18.  
  19. \hline
  20. Column 1 & Column 2 & Column 3 \\
  21. \endfirsthead
  22. \multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- Continued from previous page}} \\
  23. \hline
  24. Column 1 & Column 2 & Column 3 \\ \hline
  25. \endhead
  26. \multicolumn{3}{r}{{Continued on next page}} \\
  27. \endfoot
  28.  
  29. \endlastfoot
  30. 1 & 2 & 3 \\
  31. 4 & 5 & 6 \\
  32. 7 & 8 & 9 \\
  33. \end{longtable}
  34. \end{center}
  35. \normalsize
  36. \end{document}

Tags:

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

Postby magical marshmallow » Wed Jun 25, 2014 4:19 pm

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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests