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.

Does anybody know if it is possible to have a multipage table with the package ctable (I know that it is possible with longtable)?

My code is the following:

 \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage[english]{babel}
    \usepackage[babel]{csquotes}
    \usepackage{array}
    \usepackage{booktabs}
    \usepackage{caption}
    \usepackage{subfig}
    \usepackage{rotating}
    \usepackage{ctable}

    \begin{document}
    \ctable[
    caption = Data Definitions and Sources,
    label = data,
    sideways
    ]
    {>{\bfseries}l p{0.3\columnwidth} c  c  p{0.3\columnwidth}}
    {
    }
    { \FL
    ....
    }
    \end{document}
share|improve this question
    
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Could you reduce your example only with the needed packages? –  Claudio Fiandrino Dec 27 '12 at 13:42
    
\ctable makes a floating object; you need longtable for this application. –  egreg Dec 27 '12 at 13:53
add comment

2 Answers 2

Sorry, I have just found the answer to a related question and it is the following:

The package doesn't provide such a possibility. The package uses minipage which makes it difficult to change the internal code. However I think switching to longtable isn't very hard.

share|improve this answer
add comment

If you want to keep the ctable input syntax and easily switch between tabularx based formatting and longtable based formatting you could do something like the following which adds a long key to ctable.

enter image description here

\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}
share|improve this answer
    
@Wybo Dekker: For your consideration: I'd love to see this as a regular option in the ctable-Package, precisely to be able to switch easily from one layout to the other! Preferably together with further options (ctable-style) to handle tableheads and -tails etc. This would finally make ctable the one solution as an interface to all table-packages I've ever needed... –  Florian Jul 18 '13 at 14:11
add comment

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.