Skip to content

Instantly share code, notes, and snippets.

@danmosergist
Last active August 2, 2022 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danmosergist/be01fd352deb52b624fe to your computer and use it in GitHub Desktop.
Save danmosergist/be01fd352deb52b624fe to your computer and use it in GitHub Desktop.
Latex: longtable example
% \usepackage{longtable} % Problem: longtable do not work on twocolumns mode
\begin{center}
\begin{longtable}{|l|l|l|}
\caption[Short caption]{Long captions for the long table.} \label{tab:long1} \\
% First head
\hline
\multicolumn{1}{|c|}{\textbf{Time (s)}} &
\multicolumn{1}{c|}{\textbf{Triple chosen}} &
\multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endfirsthead
% Standard head
\multicolumn{3}{c}
{{\tablename\ \thetable{} -- continued from previous page.}} \\
\hline
\multicolumn{1}{|c|}{\textbf{Time (s)}} &
\multicolumn{1}{c|}{\textbf{Triple chosen}} &
\multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endhead
% Footnote
\hline \multicolumn{3}{|r|}{{Continued on next page...}} \\ \hline
\endfoot
% Last footnote
\hline
\endlastfoot
% The table
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3 \\
col1 & col2 & col3
\end{longtable}
\end{center}
@cvmiculas
Copy link

Hello,
Would it be possible to maintain the table caption on all pages and to have the word continued in parenthesis on all but the first page?

the above code generates this:
1st page: "Table no: Long captions for the long table."
2nd page: "Table no - continued from previous page "
...

what would be great to have is:
1st page: "Table no: Long captions for the long table."
2nd page: "Table no: Long captions for the long table (Continued)."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment