Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Haha... I have a wide table (not longtable) that is very wide in width (many columns),

a b c d e f g h i j k l m n
---------------------------
1 2 3 4 5 6 7 8 9 0 1 2 3 4

Now, I am looking for a smart way to let it automatically be broken into two+ tables (e.g., it could be broken at the vertical position(s) according to the \pagewidth or \linewidth)

a b c d e f g h i j
-------------------
1 2 3 4 5 6 7 8 9 0

k l m n
-------
1 2 3 4

Is this doable? :-)

Edit:

For convenience, here is a tex file showing the WIDE table:

% !TEX TS-program = latex

\documentclass{article}

\usepackage{booktabs, multicol, multirow}
\usepackage[top=1.5in, bottom=1.5in, left=0.1in, right=0.1in]{geometry}

\begin{document}

\begin{table}[htbp]
  \centering
  \caption{Caption}
    \begin{tabular}{cccc|cccc|cccc|cccc|cccc|cccc|cc}
    \toprule
    AA & BB & CC & DD & EE & FF & GG & HH & II & JJ & KK & LL & MM & NN & OO & PP & QQ & RR & SS & TT & UU & VV & WW & XX & YY & ZZ \\
    \midrule
    01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 & 25 & 26 \\
    \bottomrule
    \end{tabular}%
  \label{tab:label}%
\end{table}%

\end{document}
share|improve this question
1  
What about doing this manually using Easiest way to delete a column? You would duplicate the code of the table, but just change the columns to be kept/removed. Somewhat similar to what I've done in Including large tables in a beamer frame. –  Werner Dec 4 '13 at 22:54
    
Thanks. Hide seems to be a workable solution. –  Daniel Dec 4 '13 at 23:19

1 Answer 1

It's easy if you invert the input order and enter the data columnwise rather than row wise (and your data is fairly regular, large entries would mess up the alignment. I used c here but you could fix the column with with p{..}

enter image description here

\documentclass{article}

\newcommand\zcolumn[1]{%
\begin{tabular}[b]{c}#1\end{tabular}\linebreak[0]\ignorespaces}
\begin{document}

\begin{raggedright}\renewcommand\baselinestretch{2}
\zcolumn{ 1\\ \hline a}
\zcolumn{ 2\\ \hline b}
\zcolumn{ 3\\ \hline c}
\zcolumn{ 4\\ \hline d}
\zcolumn{ 5\\ \hline e}
\zcolumn{ 6\\ \hline f}
\zcolumn{ 7\\ \hline g}
\zcolumn{ 8\\ \hline h}
\zcolumn{ 9\\ \hline i}
\zcolumn{10\\ \hline j}
\zcolumn{11\\ \hline k}
\zcolumn{12\\ \hline l}
\zcolumn{13\\ \hline m}
\zcolumn{14\\ \hline n}
\zcolumn{15\\ \hline o}
\zcolumn{16\\ \hline p}
\zcolumn{17\\ \hline q}
\zcolumn{18\\ \hline r}
\zcolumn{19\\ \hline s}
\zcolumn{20\\ \hline t}
\zcolumn{21\\ \hline u}
\zcolumn{22\\ \hline v}
\zcolumn{23\\ \hline w}
\zcolumn{24\\ \hline x}
\zcolumn{25\\ \hline y}
\zcolumn{26\\ \hline z}\unpenalty
\end{raggedright}

\end{document}
share|improve this answer
    
Thank you very much. However, if given an existing big table, it could be cumbersome to type them all over again in this way. –  Daniel Dec 4 '13 at 23:20
    
@Daniel you can't win 'em all:-) –  David Carlisle Dec 4 '13 at 23:21
    
Ah, yes, maybe I can use excel to transpose it! –  Daniel Dec 4 '13 at 23:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.