Hla Hla Htay's Notes


Latex : Longtable sample -1
June 19, 2008, 6:16 am
Filed under: Latex, Writing | Tags: ,

I like to use \package{longtable} for using table in the text. It can break table automatically to a new page. The example shows “Continued on next page” will be shown at the bottom of the table and “continued from previous page” will be shown the next page’s table header.



\documentclass[a4paper,12pt]{article}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{float}
\usepackage{setspace,supertabular}
\usepackage{longtable}
\begin{document}
\begin{center}
\begin{longtable}{|p{1in}@{}|p{1in}@{}|p{.4in}@{}|p{.4in}@{}|p{.4in}@{}|p{.4in}@{}|p{.4in}@{}|}
\hline \textbf{A}&\textbf{B}& \multicolumn{5}{|c|}{\textbf{C}}\\
\cline{3-7} &&\textbf{
i}&\textbf{ii}&\textbf{iii}&\textbf{iv}&\textbf{v}\\\hline
\endfirsthead
\multicolumn{7}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \textbf{A}&\textbf{B}& \multicolumn{5}{|c|}{\textbf{C}}\\
\cline{3-7} &&\textbf{
i}&\textbf{ii}&\textbf{iii}&\textbf{iv}&\textbf{v}\\\hline
\endhead
\hline \multicolumn{7}{|r|}{{Continued on next page}} \\ \hline
\endfoot
%************************************************
\hline \textbf{Blah}&\textbf{Blah}&\small{1}&\small{2}&\small{3}&\small{4}&\small{5}\\
\cline{2-7}
\textbf{Blah1}&\textbf{Blah1}&\small{1}&\small{2}&\small{3}&\small{4}&\small{5}\\
\hline
\textbf{Blah1}&\textbf{Blah1}&\small{1}&\small{2}&\small{3}&\small{4}&\small{5}\\
\cline{2-7}
\textbf{Blah1}&\textbf{Blah1}&\small{1}&\small{2}&\small{3}&\small{4}&\small{5}\\
\hline
\caption[ABC]{\label{tab:something}Table about something}
\endlastfoot
\end{longtable}
\end{center}
\end{document}