3

I'm writing a long table which spans multiple pages. The look of the table is exactly as I want it to be. However, unfortunately, the caption of the table is listed multiple times for each page in the list of tables.

Is it possible to change this and make sure that the table is only listed once in the list of tables?

Example:

\documentclass{article}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{blindtext}
\usepackage{booktabs}

\begin{document}
\listoftables
\newpage

\begin{tabularx}{\textwidth}{l X}
    \caption{Caption 1}\\
    \toprule
    Nr & text \\
    \midrule
    \endhead
    1 & \blindtext \\
    2 & \blindtext \\
    3 & \blindtext \\
    4 & \blindtext \\
    5 & \blindtext \\
    6 & \blindtext \\
    7 & \blindtext \\
    8 & \blindtext \\
    9 & \blindtext \\
    \bottomrule
\end{tabularx}

\end{document}

Produces a list of tables which looks like this:

1 Caption 1 ....... 2
1 Caption 1 ....... 3
1 Caption 1 ....... 4

I want to have a list of tables which looks like this:

1 Caption 1 ....... 2

or as a bonus like this

1 Caption 1 ....... 2-4

  • Welcome to TeX.SE. – Mico Jul 30 at 8:52
3

I don't think you're using the machinery of the ltablex package correctly. It's important to specify separate chunks of code for \endfirsthead and \endhead -- and not to use a \caption directive in the \endhead chunk. If you believe it's crucial to (more or less) repeat the caption shown on the first page, load the caption package and employ a \caption* directive, as is done in the code below. That, or employ \caption[]{Some caption} in the \endhead group.

With the setup shown below, only one item will be written to the List of Tables for the entire 3-page table.

\documentclass{article}
\usepackage{tabularx,ltablex}
\usepackage{blindtext,booktabs}
\usepackage{caption} % for '\caption*' macro
\captionsetup{skip=0.333\baselineskip} % default is 1\baselineskip

\begin{document}
\listoftables
\newpage

\begin{tabularx}{\textwidth}{@{} l X @{}}

    %% headers and footers

    \caption{Some Caption} \label{tab:yyy}\\
    \toprule
    Nr & text \\
    \midrule
    \endfirsthead

    \caption*{Table \thetable, cont'd}\\
    \toprule
    Nr & text \\
    \midrule
    \endhead

    \midrule
    \multicolumn{2}{r@{}}{\footnotesize (Cont'd on following page)}\\
    \endfoot

    \bottomrule
    \endlastfoot

    %% body of table
    1 & \blindtext \\
    2 & \blindtext \\
    3 & \blindtext \\

    4 & \blindtext \\
    5 & \blindtext \\
    6 & \blindtext \\

    7 & \blindtext \\
    8 & \blindtext \\
    9 & \blindtext \\

\end{tabularx}

\end{document} 
  • Thank you, this did it for me – user7431005 Jul 30 at 9:07
5

As mentioned in the documentation of longtable you can suppress the entry by using an empty optional argument in the follow-up captions:

\documentclass{article}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{blindtext}
\usepackage{booktabs}

\begin{document}
\listoftables
\newpage

\begin{tabularx}{\textwidth}{l X}
   \caption{Caption 1}\\
    \toprule
    Nr & text \\
    \midrule
    \endfirsthead
    \caption[]{Caption 1}\\
    \toprule
    Nr & text \\
    \midrule
    \endhead
    1 & \blindtext \\
    2 & \blindtext \\
    3 & \blindtext \\
    4 & \blindtext \\
    5 & \blindtext \\
    6 & \blindtext \\
    7 & \blindtext \\
    8 & \blindtext \\
    9 & \blindtext \\
    \bottomrule
\end{tabularx}

\end{document}

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.