There is a latex directive "tabular", which I was trying to use. Problem with my table was that it was quite long and had to be spread on multiple pages. Tabular does not support this kind of long tables and it simply cuts the table at the end of the page.
I've found example using "longtable" directive for creating tables on multiple pages but I did not have appropriate package installed. I followed this instruction and installed necessary packages. Now it is enough to declaire use of this package
\usepackage{longtable}
and create a longtable.Package installation precedure:
- Download set of additional packages tools.zip from www.ctan.org.
- Extract package's content
- Enter folder with extracted files and run command
latex tools.ins
to create *.sty files - Copy *.sty to folder with latex plugins. In my case it's
/usr/share/texmf-tetex/tex/latex
. - Refresh latex files db by running command
texhash
\begin{longtable}{c|l|p{5cm}}
\hline
content of cell 1 (centered) &
content of cell 2 (aligned left) &
content of cell 3 (multiplerows, 5cm width) \\
\hline
\end{longtable}
PS. Longtable directive helped me with my problem but it still doesn't work as I expected. If a single cell contains a lot of text in multiple rows, so it takes more than one page to render it, it is also cut at the end of the page. I don't know how to fix it (yet :>).
18 comments:
You forgot to mention one has to add
\usepackage{longtable}
to include the proper package :)
Anyway thanks ;)
You obvisly did not read the post careful enough. Please try again :)
upss.. sorry :)
Nice post -- now I know how to do these for my Physics homework :)
Thanks for your instruction. I've managed to fix my problem with my long table.
Thanks! This post helped me out! The package was standard included in my TexLive distribution.
Thanks for the post! :-)
Thanks for longtable, useful... but how to duplicate (automatically) the first row on each new page?
Vlad, it's quite easy to do. I can't remember where I first learn't it, but this is taken from my honours thesis:
\begin{longtable}{l|p{1.5in}|p{2in}}
\caption{Validity Risk Analysis \label{table:riskAnalysis}}\\
%This is the header for the first page of the table...
\hline \hline
{\textbf{Classification}} &
{\textbf{Risk}} &
{\textbf{Precautionary Action}}\\
\hline
\endfirsthead
%This is the header for the remaining page(s) of the table...
\multicolumn{3}{c}{{\tablename} \thetable{} -- Continued} \\[0.5ex]
\hline \hline
{\textbf{Classification}} &
{\textbf{Risk}} &
{\textbf{Precautionary Action}}\\
\hline
\endhead
%This is the footer for all pages except the last page of the table...
\multicolumn{3}{l}{{Continued on Next Page\ldots}} \\
\endfoot
%This is the footer for the last page of the table...
\hline \hline
\endlastfoot
%Now the data...
{History} & {Student could receive private tutoring} & {Survey addressed this question. Students who fell into this category were omitted from the results.}\\
\hline
\end{longtable}
Thanks to both Filip and Renee for this useful post. :)
If you want to be able to use "justified" columns (as in tabularx and tabulary) on several pages, you may use ltxtable (http://tug.ctan.org/tex-archive/help/Catalogue/entries/ltxtable.html)
Note, though (re-Renee's comment), that "The \multicolumn command is suppressed in environments included in this way" (according to the ctan page).
Addendum: in spite of what the ctan page says, \multicolumn seems to work ok with ltxtable.
@Reene: thanks a lot, you saved my day
@renee Thank you for the info. You've saved me a lot of time!
Like it, Reene. Thanks much.
A very useful PDF about this issue: http://www.tug.org/pracjourn/2007-1/mori/mori.pdf
I don´t know why, but I can´t use this package. I´ve instaled the package correctly (at least I think so), but when I write '\begin{longtable}{ll}' it´s like the LEd doesn´t recognize the comand. Does anyone know what could possibly be wrong?
Thanks. This is very helpful. I am trying to implement a table of images with many rows which cross a page. However, this still cuts the table at page end and does not show other images in next page... Is there anything I need to do for table of images?
Post a Comment