Graphics, Figures & Tableswrong reference to sidewaystable

Information and discussion about graphics, figures & tables in LaTeX documents.
boschjesman
Posts: 9
Joined: Sat Nov 06, 2010 8:04 pm

wrong reference to sidewaystable

Post by boschjesman »

I am trying to make a reference in my text to a sidewaystable. but if I click the link in my pdf it keeps sending me to the wrong place. when I changed sidewaystable to table it worked fine. what should I do?

Code: Select all

\documentclass[12pt]{article}
\usepackage{tabularx}
\usepackage{hyperref}

\begin{sidewaystable}
\begin{tabularx}{\textwidth}{XXXXX}
		the contents of my table
\end{tabularx}
\caption{\footnotesize Articles included in the review.} 
\label{IncludedArticles}
\end{sidewaystable}

Recommended reading 2024:

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

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

sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

wrong reference to sidewaystable

Post by sommerfee »

You did something wrong, but since you did not provide a small but *complete* example showing the problem we cannot know what you did wrong.

If I complete your code snipped all works fine:

Code: Select all

\documentclass[12pt]{article}
\usepackage{rotating,tabularx}
\usepackage{hyperref}

\begin{document}
\autoref{IncludedArticles}
\begin{sidewaystable}
\begin{tabularx}{\textwidth}{XXXXX}
      the contents of my table
\end{tabularx}
\caption{\footnotesize Articles included in the review.} 
\label{IncludedArticles}
\end{sidewaystable}
\end{document}
boschjesman
Posts: 9
Joined: Sat Nov 06, 2010 8:04 pm

wrong reference to sidewaystable

Post by boschjesman »

I'm sorry for the incomplete post, I hope this one is better.
I did have the rotating package in my preamble. I made another more simple sidewaystable and it refers me to the wrong place as well. the first sidewaystable is on page 8 but the reference sends me to the top of page 4, the second sidewaystable is on page 9 and the reference sends me to the top of page 5

Code: Select all

\documentclass[12pt]{article}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{hyperref}

\begin{document}

\begin{sidewaystable}
\begin{tabularx}{5cm}{XX}
laskdjf & jfjfj\\
sajf & lksjf\\
\end{tabularx}
\caption{does this one work?}
\label{tryout}
\end{sidewaystable}

\autoref{tryout}

\end{document}
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

wrong reference to sidewaystable

Post by sommerfee »

boschjesman wrote:I'm sorry for the incomplete post, I hope this one is better.
This one works for me as expected. What problem exactly do you have with it? Where does it jump to if you click "Table 1"?
the first sidewaystable is on page 8 but the reference sends me to the top of page 4, the second sidewaystable is on page 9 and the reference sends me to the top of page 5
Your example has only 2 pages so I'm not able to reproduce this.
boschjesman
Posts: 9
Joined: Sat Nov 06, 2010 8:04 pm

wrong reference to sidewaystable

Post by boschjesman »

the table is part of a larger document that I can't post completely. if I click table 3 (the reference to my original table) it jumps to page 4, if I click table 4 (the simplified example I posted) it jumps to page 5.
After you said it worked I made a new document with just the example I posted. then I get two pages, one with the link 'table 1' and one with the table. when I click this link nothing happens. after I added some extra pages it jumps to page 2 when I click table 1.

Code: Select all

\documentclass[12pt]{article}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{hyperref}

\begin{document}

a;lkjf
\newpage
akld
\newpage
lakjdf
\newpage
asjf
\newpage
alkfj
\newpage

\begin{sidewaystable}
\begin{tabularx}{5cm}{XX}
laskdjf & jfjfj\\
sajf & lksjf\\
\end{tabularx}
\caption{does this one work?}
\label{tryout}
\end{sidewaystable}

\autoref{tryout}

\end{document}
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: wrong reference to sidewaystable

Post by frabjous »

When I compile that, I get a 7 page document. There's a link on page 6 "Table 1", and a sideways table on page 7. When I click the link, it takes me to the table on page 7. Is that not what you're seeing? Does compiling an extra time help?
boschjesman
Posts: 9
Joined: Sat Nov 06, 2010 8:04 pm

Re: wrong reference to sidewaystable

Post by boschjesman »

that is exactly what I would expect. but if i run this file I get a 7 page document with 'table 1' as reference on page 6 and the sidewaystable on page 6. however, when is click the link it jumps to page 2. compiling an extra time didn't help
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: wrong reference to sidewaystable

Post by frabjous »

Could you upload the resulting PDF here? I'm curious whether it might be your PDF reader's fault.

Beyond that, you could try upgrading your LaTeX packages in case you have some outdated ones.
boschjesman
Posts: 9
Joined: Sat Nov 06, 2010 8:04 pm

Re: wrong reference to sidewaystable

Post by boschjesman »

I used the pdf within latex itself. When I open it with adobe reader it works just fine :P. still strange that it doesn't work within latex, but their is no real problem anymore.

thanks everone
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

wrong reference to sidewaystable

Post by frabjous »

boschjesman wrote:I used the pdf within latex itself.1
I don't follow that. LaTeX (and pdfLaTeX) are command-line programs which convert a source document into DVI (or PDF). They don't have built in viewers.

You probably mean the built-in PDF viewer of an editor like TeXworks or TeXmaker or TeXshop. Those are not the same thing as "LaTeX itself". It might be worth mentioning which one in case anyone else has the same problem.
Post Reply