# Long Table with captions: “Table 1” (on the first page) and “Table 1 Continued” (on the 2nd page)

I would appreciate if anybody could help me out with fitting my long table into two pages with captions: "Table 1" (on the first page) and "Table 1 Continued" (on the 2nd page).

My MWE is as follows:

\documentclass[preprint, authoryear]{elsarticle}

%\usepackage{lineno,hyperref}
%\modulolinenumbers[5]

\journal{Journal of Transportation Research, Part E}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{textcomp}
\usepackage{textcomp}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{makecell, multirow}

\usepackage{url}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{amsmath}
%% \numberwithin{equation}{subsection}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\usepackage{tikz}
\usepackage{lettrine}
\allowdisplaybreaks
\usepackage{ragged2e}
\usepackage{subfig}
\usepackage{float}
\usepackage{url}
\urlstyle{same}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{tabu}
\usepackage{boldline}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{table}[h]
%\vspace{-6.5em}%
\caption{Notations}
\label{tab: DenoteTabl}
\setlength\extrarowheight{2pt}
\centering
\begin{tabularx}{\linewidth}{|c X|}
\hline
\multicolumn{2}{|c|}{Sets} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Parameters} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Variables} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\end{tabularx}
\end{table}
\end{document}


Moreover, I have seen a code in this link to make use of a longtable package. However, I what I need is a multicolumn of two collumns (one with a short width and the other with a flexible long width), but in that example, it was a multicolumns of four columns. As well, I need to adjust the width of my table with the text block's width \textwidth. So, that sample code was not useful for me.

• are you sure you want a table? 999 times out of 1000 tables with lX are better set as a list, if you set that as a \begin{description} with \item[$B$] zzzzzz then page breaking could happen naturally, even within long descriptions, the exact formatting of the list can be customised using enumitem package. – David Carlisle May 30 '18 at 7:11
• Hi David Carlisle, I actually need a long table, but my problem is that I don't know how to make a long table with various headers on one page. For instance, in the given example, I don't know how to put the "Sets" and "Parameters" on the first page and the "Variables" on the second, while keeping the caption like Table 1 (on the first pages) and Table 1 (continued) on the second page. – B. Bornay May 30 '18 at 7:27
• @B.Bornay: Unrelated to the question, but you do not load packages more than once and generally, hyperref should be the last package you load not the first. – leandriis May 30 '18 at 8:02
• Hi leandriis, I appreciate your comment and I will be taking that into consideration while coding from now on! Thanks! – B. Bornay May 30 '18 at 8:07

In order to achieve the layout you requested, there are many different possibilities with varying 'degree of automation'. All of the below shown examples result in the following output or something very similar:

1: This first example uses tabularx's X column for the second column and additionally loads ltablex which adds longtable features to tabularx tables:

\documentclass[preprint, authoryear]{elsarticle}

\usepackage{tabularx}
\usepackage{ltablex}
\keepXColumns

\begin{document}
{
\setlength\extrarowheight{2pt}
\centering
\begin{tabularx}{\linewidth}{|c X|}
\caption{Notations}
\label{tab: DenoteTabl}
\caption{Notations (continued)}
\hline
\multicolumn{2}{|c|}{Sets} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Parameters} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Variables} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\end{tabularx}
}
\end{document}


2: This second example makes use of the tabu package which offers a longtabu environment when loaded in combination with the longtable package:

\documentclass[preprint, authoryear]{elsarticle}

\usepackage{longtable}
\usepackage{tabu}

\begin{document}
\setlength\extrarowheight{2pt}
\begin{longtabu}to \linewidth{|c X|}
\caption{Notations}
\label{tab: DenoteTabl}
\caption{Notations (continued)}
\hline
\multicolumn{2}{|c|}{Sets} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Parameters} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Variables} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\end{longtabu}

\end{document}


3: This third example makes use of the longtable enviromnent itself. Here, the nessecary width of the second column to make the table fill the linewidth is calculated manually using the calc and the arraypackages.

\documentclass[preprint, authoryear]{elsarticle}

\usepackage{longtable}
\usepackage{array}
\usepackage{calc}

\begin{document}
\setlength\extrarowheight{2pt}
\begin{longtable}{|p{0.4cm} p{\linewidth-0.4cm-4\tabcolsep-2\arrayrulewidth}|}
\caption{Notations}
\label{tab: DenoteTabl}
\caption{Notations (continued)}
\hline
\multicolumn{2}{|c|}{Sets} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Parameters} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Variables} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\end{longtable}

\end{document}


4: This fourth example is an even more manual approach. Since I assume that you want to split the table at a given point and do not want the table to float, you could also split it manually. For the caption I have used the capt-of package's command captionof. To uniformly number both parts of the table, I have stepped the table counter backwards by one inbetweeen the two tabulars.

\documentclass[preprint, authoryear]{elsarticle}
\usepackage{tabularx}
\usepackage{capt-of}

\begin{document}

{\centering
\setlength\extrarowheight{2pt}
\captionof{table}{Notations}
\label{tab: DenoteTabl}
\begin{tabularx}{\linewidth}{|c X|}
\hline

\multicolumn{2}{|c|}{Sets} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\multicolumn{2}{|c|}{Parameters} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\end{tabularx}

\newpage
\captionof{table}{Notations (continued)}
\begin{tabularx}{\linewidth}{|c X|}
\hline
\multicolumn{2}{|c|}{Variables} \\ \hline
$A$ & text text  text text text text  text text  text text $y$\\
$B$ &  text text  ${\left\langle{i,j}\right\rangle}$\\
$C$ &  text text text text   $g$  \\
$D$ &  text text text text  , indexed by $k$  \\
$E$ &  text text text text  , indexed by $r$\\
$F$ &  text text text text  , indexed by $yt$, $yt\in \{cl,tr\}$   \\
$G$ &  text text text text  text text , indexed by $bp$  \\ \hline
\end{tabularx}
}

\end{document}