About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-12-13: Ebook sale (12th December 2024 – 1st January 2025): cybercrime fiction short stories Unsocial Media and Smile for the Camera free; crime fiction short story The Briefcase free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

Multi-Paged Tabulated Material

This code requires country-codes.csv.

\documentclass[captions=tableheading]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{longtable}
\usepackage{datatool}

\DTLloaddb{countries}{country-codes.csv}

\begin{document}

If the data is too large to fit on a single page we need to use the
\texttt{longtable} environment instead. See Table~\ref{tab:countries}.

\begin{longtable}{cl}
% Set up headers and footers
 \caption{A Sample Long Table}
 \label{tab:countries}\\
 \bfseries Country Code & \bfseries Country Name\\
 \endfirsthead
 \caption{A Sample Long Table (Continued)}\\
 \bfseries Country Code & \bfseries Country Name\\
 \endhead
 \multicolumn{2}{r}{\emph{Continued on next page}}\\
 \endfoot
 \endlastfoot
 \DTLforeach*{countries}{\Code=code,\Name=name}{\Code&\Name\\}%
\end{longtable}

\end{document}
Download sample-longtable.tex or sample-longtable.pdf.

You can add horizontal rules using the bookmarks package:

\documentclass[captions=tableheading]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{longtable}
\usepackage{datatool}
\usepackage{booktabs}

\DTLloaddb{countries}{country-codes.csv}

\begin{document}

If the data is too large to fit on a single page we need to use the
\texttt{longtable} environment instead. See Table~\ref{tab:countries}.

\begin{longtable}{cl}
% Set up headers and footers
 \caption{A Sample Long Table}
 \label{tab:countries}\\
 \bfseries Country Code & \bfseries Country Name\\
 \midrule
 \endfirsthead
 \caption{A Sample Long Table (Continued)}\\
 \bfseries Country Code & \bfseries Country Name\\
 \midrule
 \endhead
 \bottomrule
 \multicolumn{2}{r}{\emph{Continued on next page}}
 \endfoot
 \bottomrule
 \endlastfoot
 \DTLforeach*{countries}{\Code=code,\Name=name}%
 {\DTLiffirstrow{}{\\}\Code & \Name}%
\end{longtable}

\end{document}

Download sample-longtable-booktabs.tex or sample-longtable-booktabs.pdf.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs