1

I am having problems with a longtable, it goes off the side of the page and any attempt to limit the width only seems to work on the first page. Here is a cut down version of my table

% Appendix B
\chapter{Elelments for the MetDB Retrieval}
\label{AppendixB}
\lhead{Appendix B. \emph{Elelments for the MetDB Retrieval}}
\chapter{Elelments for the MetDB Retrieval}
\label{AppendixB}
\lhead{Appendix B. \emph{Elelments for the MetDB Retrieval}}

\begin{center}
\begin{longtable}{|c|c|c|} %try definind the width here
\hline
\textbf{Element Name} & \textbf{Element Description} & \textbf{Units} \\
\hline
\endfirsthead
\hline
\textbf{Element Name} & \textbf{Element Description} & \textbf{Units} \\
\hline
\endhead
\hline

table entries...

\hline
%\end{tabular}
\caption{Elelments for the metDB retrieval}
\end{longtable}
\end{center}

Here is an image:

enter image description here

Any help on this subject would be nice!

migrated from stackoverflow.com Jul 26 '12 at 18:12

This question came from our site for professional and enthusiast programmers.

  • Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jul 26 '12 at 18:14
5

Add

 \usepackage{array}

then you may use an extended preamble syntax.

Then replace

\begin{longtable}{|c|c|c|}

by

\begin{longtable}{|*{3}{>{\centering\arraybackslash}p{3cm}|}}

for 3 3cm wide columns, adjust the width to taste.

2

AFAIK, you cannot limit or otherwise specify the width of centered columns. You have to use justified columns (that is, "p") to accomplish this, as in "p{3cm}".

See also here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy