Pages

mardi 22 avril 2014

use longtable in Latex

When I have a very long table which can occupy several pages, I need the package longtable for breaking the table and manage it.

When use this package, then we should not use the table package, ie., not to start by \begin{table}. The longtable should also replace the tabular. Then we can add caption and label in the following. We can start for example:
\begin{center}
\begin{longtable} {cccc}
\caption{Captions.}\\
\label{label name.}\\

If we want to adjust the table fontsize, we can:
 \begin{center}
\small{
\begin{longtable} {cccc}
\end{longtable}
}
\end{center}

If we want the same head line to appear in the table in the different pages, then we should for example define the head line of table in the first page:
FTLRS  &a &b  &   &MOBLAS-8 &a  &b \\  \hline
\endfirsthead

Then we need define the head line of table in the next pages:
FTLRS &a &b  & & MOBLAS-8 &a &b \\ \hline

\endhead

A complete example of using longtable is:
\documentclass{article}
\usepackage{longtable}
 \begin{document}

 \begin{center}
 \small{
   \begin{longtable} {ccccccc}
   \caption{Captions.} \\
   \label{label name} \\

  
   FTLRS &a &b  & &MOBLAS-8 & a &b \\ \hline   

   \endfirsthead

   FTLRS & a & b  &   & MOBLAS-8 & a & b \\ \hline   
   \endhead

   data1 & d1 &d2 &   &   data2 & d3 &d4 \\
   ....
   ...
   \end{longtable}
 }
\end{center}


 






Aucun commentaire:

Enregistrer un commentaire