Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am making one table into two (or more) and would like them to have the same label number for these two tables, but append them with an "a" or "b" to differentiate them. Also, I would like to be able to refer to them in the text by just the number, not as number.a and number.b. And I would like to retain LaTeX's assume table numbering.

For example, a table that LaTeX would later number as 8 is too big to fit on one page, so I split it up manually and want it to be automatically labeled 8a and 8b and referred to as 8 in the text. Does this exist? I am sure that I'm searching the wrong keywords, again.

The back story is that I create tables with scripts in R. I looked for a widetable package here yesterday and there are some good solutions, but not for the scripts I already have (although I'd like to later add them). Plus it sounds like a good skill to have. Thanks!

share|improve this question

2 Answers 2

up vote 4 down vote accepted

The ccaption package allows for "continuation captions". So to implement what you want, you could do the following (adapted from the ccaption documentation.)

Update

Since you wanted the first table to have a letter suffix as well, I've changed the code to allow two commands: \splittablecaption and \splittablecaption*. This also removes the need to manually reset the subtable caption counter. Use the starred version for the first in the series, and the unstarred version for any subsequent ones.

\documentclass{article}
\usepackage{ccaption}
\newcounter{splittab}
\renewcommand{\thesplittab}{\alph{splittab}}
\makeatletter
\newcommand{\splittablecaption}{\@ifstar\splittablecaptionstar\splittablecaptionplain}
\makeatother
\newcommand{\splittablecaptionplain}[1]{\stepcounter{splittab}\captiondelim{\thesplittab: }\contcaption{#1}}
\newcommand{\splittablecaptionstar}[1]{\setcounter{splittab}{0}\stepcounter{splittab}\captiondelim{\thesplittab: }\caption{#1}}

% Usage: for a split table, use \splittablecaption*{} for the initial caption
% and \splittablecaption{} for the subsequent captions
% There is no need to reset the counters manually, as this is done inside the 
% starred version of the \splittablecaption command.


\begin{document}


\begin{table} \centering \splittablecaption*{A multi-part table} \label{tab:m}
 \begin{tabular}{lc} \hline
just a single line & 1 \\ \end{tabular} \end{table}
\begin{table} \centering \splittablecaption{Continued} \begin{tabular}{lc} \hline
just a single line & 2 \\ \end{tabular} \end{table}
\begin{table} \centering \splittablecaption{Concluded} \begin{tabular}{lc} \hline
just a single line & 3 \\ \end{tabular} \end{table}

\begin{table} \centering \splittablecaption*{A multi-part table} \label{tab:m}
 \begin{tabular}{lc} \hline
just a single line & 1 \\ \end{tabular} \end{table}
\begin{table} \centering \splittablecaption{Continued} \begin{tabular}{lc} \hline
just a single line & 2 \\ \end{tabular} \end{table}
\begin{table} \centering \splittablecaption{Concluded} \begin{tabular}{lc} \hline
just a single line & 3 \\ \end{tabular} \end{table}



\end{document}
share|improve this answer
    
Alan FTW, again. Is there a way I can make the tables 1a, 1b, 1c instead of 1, 1a, 1b? In my tinkering I can't figure it out. Thanks! –  Richard Herron Jan 26 '11 at 19:50
    
@Richard I've changed the code to reflect this; it's actually nicer now. –  Alan Munn Jan 26 '11 at 20:21
    
I don't understand what's happened to your code blocks. I just went to edit your answer to put them in but the preview showed the code properly as code. That's bizarre. –  Loop Space Jan 26 '11 at 21:19
    
@Alan -- Perfect! Thanks so much! I always forget that latex is also a programming language. –  Richard Herron Jan 26 '11 at 21:20
1  
@Andrew no it won't become CW unless I edit it more than 10 times, or more than 5 different users edit it. –  Alan Munn Jan 26 '11 at 21:43

You can use the subcaption package in the following way, this package comes now shipped with the caption package, and has similar options.

\begin{table}
     \subcaptionbox{\label{t1a} Caption for table a}%
      {\begin{tabular}<spec>
       <things here>
       \end{tabular}}
     \subcaptionbox{\label{t1b} Caption for table b}%
      {\begin{tabular}<spec>
       <things here>
       \end{tabular}}
     \subcaptionbox{\label{t1c} Caption for table c}%
      {\begin{tabular}<spec>
       <things here>
       \end{tabular}}
     \caption{\label{t} Caption for all tables
\end{table}

In this way, you can reference each table separately, or just the bunch of them with the label t.

share|improve this answer
1  
I don't think this will work for Richard's purposes: his problem is that the subtables span multiple pages. The subfigure package is designed for multiple small figures or tables within a single float. –  Alan Munn Jan 26 '11 at 19:23
    
@Alan You are right. I forgot about the multiple pages part. –  fabikw Jan 26 '11 at 19:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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