0

All.
In question: multipage tables with ctable package
David Carlisle wrote answer with some nice hack for ctable (adding long as key).

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[babel]{csquotes}
\usepackage[backend=bibtex8, style=authoryear]{biblatex}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{enumitem}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{ctable}
\usepackage{multirow}
\usepackage{pbox}
\usepackage{longtable}

\makeatletter



\newif\if@ctbl@long
\define@key{ctbl}{long}[]{\@ctbl@longtrue}

\long\def\foo#1\sbox#2!!{%
\long\expandafter\def\csname\string\ctable\endcsname[##1]##2##3##4{%
#1\if@ctbl@long\ctbl@long\fi\sbox#2}}



\expandafter\expandafter\expandafter\foo
\csname\string\ctable\endcsname[#1]{#2}{#3}{#4}!!


\def\ctbl@long\fi\sbox#1#2#3\@ctblend{\fi
\ctbl@@long#2%
}


\long\def\ctbl@@long#1#2#3#4#5#6{%
\ctbl@@@long#6%
}

\def\ctbl@@@long#1\begin#2#3#4\end#5{%
\def\@tempa{#5}%
\def\@tempb{tabular}%
\ifx\@tempa\@tempb\else\show\@tempa\ERROR\fi
\begin{longtable}{#3}%
\caption{\@ctblcaption\ifx\@ctbllabel\empty\else\label{\@ctbllabel}\fi}%
\endfirsthead
\caption*{\@ctblcaption\space(continued)}%
\endhead
#4\end{longtable}}

\makeatother

\begin{document}
\ctable[
caption = Data Definitions and Sources,
label = data,
long
]
{>{\bfseries}l p{0.3\columnwidth} c  c  p{0.3\columnwidth}}
{
}
{ \FL
a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\
a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\
a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\
a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\
a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\
a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\a&b&c\\
}
\end{document}

I'd tried this code (without only csquotes, biblatex packages), but I get folow error:

! Package xkeyval Error: `long' undefined in families `CT'.

I'm using: texlive 2015, win7x64

Is this code still usable at anybody?
Thank you.

1 Answer 1

1

First: David uses an older version of ctable: the line

\define@key{ctbl}{long}[]{\@ctbl@longtrue}

should be

\define@key{CT}{long}[]{\@ctbl@longtrue}

But you can not trust on this, because the name of the key group will probably change in the next version as a consequence of possible name clashes with the colortbl package.

Second: even after this correction David's example does not work, because ctable has changed in the mean time. Still, I think it's a good idea to give ctable options like longtable, tabular, tabularx et cetera, which would let ctable create non-floats of the corresponding types. I'll think about that.

Third: for now, you have two options:

  1. break your ctable into multiple ctable calls, using ctable's continued=... option.
  2. Create a regular longtable, but use \FL, \ML, \LL and \NN as row endings.
1
  • Thank you. I found solution with longtable (and xtable too) for my TOC at last. Ctable with continued was uncomfortable in making-up (pagination?) process with variable fontsize and margins.
    – Elisey
    Nov 11, 2015 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .