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.