4

I use the following packages related to captioning, tables and hyperlinks:

\usepackage{hyperref,caption}
\usepackage[style=Plaintop]{floatrow}
\usepackage[referable]{threeparttablex}

I have a table and the caption appears ABOVE it. It's made using threeparttable so I can \begin{tablenotes}.

When I follow the link to that table, the view jumps to BELOW the caption - if you scroll just a tiny bit up then you'll see the caption straight away.

Of course, I want the caption to be seen without scrolling. If you remove the \usepackage[...]{floatrow} then it will work as expected.

I've tried using hypcap like most posts mention, but I believe use of caption covers that.

The only question I've found encountering the exact same problem (but with figures instead of tables) is this one: How do I make hyperref show the entire figure when I'm using both caption and floatrow?

As that OP mentioned, most other questions seem to be about the link going to the caption below a figure and hence missing the whole picture - this is not the same case at all. That OP managed to solve his problem by simply not using floatrow - I, however, cannot do that as I need that package for other purposes.

So how can I make the link work as I expected? Here's minimal code:

\documentclass{article}

\usepackage{hyperref,caption}
\usepackage[style=Plaintop]{floatrow}
\usepackage[referable]{threeparttablex}

\begin{document}

\listoftables

\begin{table}
    \begin{threeparttable}

        % Link SHOULD jump here

        \caption{Example}

        % Link ACTUALLY jumps here

        \begin{tabular}{ll}
            A & B \\
            C & D \\
        \end{tabular}
        \begin{tablenotes}
           \item ABCD
        \end{tablenotes}
    \end{threeparttable}
\end{table}

\end{document}

PS: If we can fix this within 4 hours of when the question was asked then I can include it in my Master's application :D

PPS: Made it with 35 minutes to spare thanks to @JohnKormylo!

  • Not sure what to make of that :P I'll change the title at least – Bilal Akil Jun 29 '15 at 9:48
  • 1
    I think your example doesn't help to reproduce the problem. But, in any case, did you try including \label inside \caption, \caption{Example\label{Example}}? – Ignasi Jun 29 '15 at 10:54
  • @Ignasi, if I copy and paste the above snippet into test.tex and pdflatex test.tex && pdflatex test.tex I get a PDF that accurately reproduces the problem in Mac OS X Preview. I tried putting the label inside caption as you recommended (before and after the caption's text) and nothing changed. – Bilal Akil Jun 29 '15 at 11:56
  • 1
    The target should the \refstepcounter in the caption, not the \label. Besides, the \listoftables doesn't use the \label. – John Kormylo Jun 29 '15 at 12:45
  • Good point @JohnKormylo (regarding the label - not sure about the \refstepcounter) - I removed the \label and it still happened. Apropos, I've removed it from the question. – Bilal Akil Jun 29 '15 at 12:50
2

Evidently using \ttabbox put the target back where it belongs.

\documentclass{article}

\usepackage[style=Plaintop]{floatrow}
%\usepackage{threeparttable}
\usepackage[referable]{threeparttablex}
\usepackage{caption}
\usepackage[raiselinks=true]{hyperref}

\begin{document}

\listoftables

\ref{Example}

\begin{table}[t]
    \ttabbox%
        % Link DOES jump here
        {
            \caption{Example}
            \label{Example}
        }
        % Link USED TO jump here
        {
            \begin{threeparttable}
                \begin{tabular}{ll}
                    A & B \\
                    C & D \\
                \end{tabular}
                \begin{tablenotes}
                    \item[a] ABCD
                \end{tablenotes}
            \end{threeparttable}
        }
\end{table}

\end{document}
  • How can I use threeparttable and it's \begin{tablenotes} with this? Sorry, I'll update the question accordingly... – Bilal Akil Jun 29 '15 at 13:09
  • Nevermind, figured that out - it works! Marvelous! I just put the whole threeparttable in the ttabbox's second {} (where you begin tabular) as normal, except with the caption and label as per your example. I'll try and edit it for you, if I can. – Bilal Akil Jun 29 '15 at 13:20
  • That edit is in - just needs peer review. Already accepted your answer though. – Bilal Akil Jun 29 '15 at 13:30
  • 1
    BTW, using \ttabbox[\textwidth] will allow the caption to be wider, assuming you wanted that. – John Kormylo Jun 29 '15 at 14:02
  • Ahh the real table is wider, so that's not a worry. Good mention though. – Bilal Akil Jun 29 '15 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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