GeneralAutomatically break rows in a table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
tobzter
Posts: 1
Joined: Wed Sep 10, 2008 2:16 pm

Automatically break rows in a table

Post by tobzter »

Hi all!

I searched the Internet for quite some time, but I haven't found anything that could help me. Stil, to me it seems that this problem should have been solved many times so far. So before I try to code myself I wanted to ask you guys for help.

Is there a possibility to break tabular rows automatically when the end of the page is reached? The table rows would be continued in the same order the next line.

Maybe an example clarifies my point:

I have this table as Software Output from R:

Code: Select all

% latex table generated in R 2.7.1 by xtable 1.5-2 package
% Wed Sep 10 14:27:09 2008
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr}
  \hline
 & ARG & AUS & AUT & BHR & BEL & BRA & CAN & CHL & CHN & HRV & CZE & EGY & FRA & DEU & GRC & HKG & HUN & IND & IDN & ISR & ITA & JPN & KAZ & KEN & KOR & KWT & LBN & MUS & MAR & NZL & NGA & NOR & OMN & PAK & PER & PHL & POL & PRT & QAT & ROM & RUS & SGP & SVN & ZAF & ESP & LKA & SWE & CHE & THA & TUN & TUR & UKR & ARE & GBR & USA \\
  \hline
1 & 0.46 & 0.29 & 0.39 &  & 0.27 & 0.45 & 0.38 & 0.42 & 0.05 & 0.40 & 0.75 & 0.39 & 0.27 & 0.20 & $-$0.50 & 0.42 & $-$0.06 & 0.69 & 0.55 & 0.24 & 0.05 & 0.65 &  & $-$0.40 & 0.65 &  & $-$0.80 & 0.40 & 0.40 & 0.56 & $-$1.00 & 0.26 &  & 0.10 & 0.86 & 0.70 & 0.12 & 0.00 &  &  & $-$0.01 & 0.36 & 0.40 & 0.77 & 0.22 & 0.32 & 0.06 & 0.14 & 0.46 & 1.00 & 0.59 &  &  & 0.46 & $-$0.14 \\
   \hline
\end{tabular}
\end{center}
\end{table}
Of course the row is way to large to be displayed.. even in landscape mode..

But as there are only two rows, the best thing to solve the problem seems to me to just break the rows when the columns hit the border e.g.

Code: Select all

% latex table generated in R 2.7.1 by xtable 1.5-2 package
% Wed Sep 10 14:27:09 2008
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr}
  \hline
 & ARG & AUS & AUT & BHR & BEL & BRA & CAN & CHL & CHN & HRV & CZE & EGY & FRA & DEU & GRC & HKG & HUN & IND & IDN & ISR & ITA \\ 
  \hline
1 & 0.46 & 0.29 & 0.39 &  & 0.27 & 0.45 & 0.38 & 0.42 & 0.05 & 0.40 & 0.75 & 0.39 & 0.27 & 0.20 & $-$0.50 & 0.42 & $-$0.06 & 0.69 & 0.55 \\

&JPN & KAZ & KEN & KOR & KWT & LBN & MUS & MAR & NZL & NGA & NOR & OMN & PAK & PER & PHL & POL & PRT & QAT & ROM & RUS & SGP & SVN & ZAF & ESP & LKA & SWE & CHE & THA & TUN & TUR & UKR & ARE & GBR & USA \\
& 0.24 & 0.05 & 0.65 &  & $-$0.40 & 0.65 &  & $-$0.80 & 0.40 & 0.40 & 0.56 & $-$1.00 & 0.26 &  & 0.10 & 0.86 & 0.70 & 0.12 & 0.00 &  &  & $-$0.01 & 0.36 & 0.40 & 0.77 & 0.22 & 0.32 & 0.06 & 0.14 & 0.46 & 1.00 & 0.59 &  &  & 0.46 & $-$0.14 \\
   \hline
\end{tabular}
\end{center}
\end{table}
(don't try to compile it, I didn't test.. just for illustration)

thx
tobi

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply