1

I am having a problem using longtable \caption. The captions are not set to \textlength and run into the margins. I would like the multi-line captions to be restricted to \textlength and centred under the table itself.

screenshot 1

screenshot 2

I have tried:

\usepackage{caption} \captionsetup[table]{singlelinecheck=false}
\usepackage{caption} \captionsetup[longtable]{singlelinecheck=false}

\LTcapwidth=\textwidth

All to no avail.

A sample table is:

\LTcapwidth=\textwidth
\begin{longtable}[c]{l c c c c c c}
 & $p < 0.05$ & $p < 0.01$ & $p < 0.001$ & $p < 10^{-6}$ & $p < 10^{-7}$ & $p <                 p_{\text{genome}}$\\
SNP p-value & 80 & 80 & 80 & 0 & 0 & 0\\
SNP p-value Inverse & 80 & 80 & 80 & 0 & 0 & 0\\
Tree Min p-value & 80 & 80 & 80 & 4 & 1 & 0\\
Tree Min p-value Inverse & 80 & 80 & 80 & 0 & 0 & 0\\
\label{tab:nullpop}
\caption{A summary of the minimum p-value results for the trees built with     \possessivecite{RefWorks:116} null population data. The value used for $p <     p_{\text{genome}}$ is the value derived from the 1000 Genomes Data of $p < 10^{-8.86}$.}
\end{longtable}

migrated from stackoverflow.com Aug 11 '14 at 6:50

This question came from our site for professional and enthusiast programmers.

  • 2
    please make your example a complete document that shows the effect. what is \centerize ? it is not a command I recognise. – David Carlisle Aug 11 '14 at 6:52
  • Put \label inside the caption not before it. – David Carlisle Aug 11 '14 at 6:53
  • great, thank you! If you want to make it an answer I will mark it. – Thaddeus Aid Aug 11 '14 at 12:37
  • I have removed \centerize it was used in a table that I copied the structure from. – Thaddeus Aid Aug 11 '14 at 13:09
  • @ThaddeusAid By complete, we mean from \documentclass to \end{document}. That we can copy and compile to reproduce your problem. – Manuel Aug 11 '14 at 13:14
2

\label should never be before \caption and in particular a \caption in a longtable has to be the complete row, so it is best to put \label in the caption argument.

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.