8

I use ltablex package for creating tables. How can i change the caption name for the continuation of the table, as in the picture?

enter image description here

1 Answer 1

12

ltablex combines longtable and tabularx. longtable provides commands to define a first and a general header as well as a general and a last footer. These commands are actually used in the (admittedly brief) ltablex documentation, but a continued caption, which would be used in the general header (or footer), is not part of the example. The header/footer commands are described in the longtable documentation.

The code given below shows their use with ltablex. The continued caption is defined in the general header. I've also added an example using longtabu from the more recent tabu package, which offers a convenient way to define flexible X columns.

enter image description here

\documentclass{article}
\usepackage{lipsum}
\usepackage{booktabs}

\usepackage{ltablex}
%if longtabu is used, longtable needs to be loaded (which ltablex already does in this document)
%\usepackage{longtable} 
\usepackage{tabu}

\textheight4in                      %to force a page break after a few rows
\renewcommand{\arraystretch}{1.5}   %improve spacing

\begin{document}

\begin{tabularx}{\textwidth}{XX}     
        \caption{A Table}\\
        \toprule
        First Header &  \\
        \toprule
    \endfirsthead
        \caption{A Table (continued)}\\
        \toprule        
        Header & \\
        \toprule
    \endhead
        \bottomrule
        Footer &  \\
        \bottomrule
    \endfoot
        \bottomrule
        Last Footer &  \\
        \bottomrule    
    \endlastfoot     

    Text & \lipsum[75]\\
    Text & \lipsum[75]\\
    Text & \lipsum[75]\\
\end{tabularx}

\begin{longtabu} to \textwidth {X[1,l]      %aligned left
                                X[2,l]}     %twice as wide as first column
        \caption{A Table}\\
        \toprule
        First Header &  \\
        \toprule
    \endfirsthead
        \caption{A Table (continued)}\\
        \toprule        
        Header & \\
        \toprule
    \endhead
        \bottomrule
        Footer &  \\
        \bottomrule
    \endfoot
        \bottomrule
        Last Footer &  \\
        \bottomrule    
    \endlastfoot
    Text & \lipsum[75]\\
    Text & \lipsum[75]\\
    Text & \lipsum[75]\\
\end{longtabu}

\end{document}

You must log in to answer this question.

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