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.

I have a table that is quite long (less than a page, by the way) and quite narrow; to save space I wish to have it, let's say, on two columns. Referring to the following image, I wish to have the first 8 entries side by side with the entries 9-16 (note that the letter "A", "B", and so on are added for code readability purpose, in the original table the column "schema" contains a image that increase the rows height).

Example result

The code of the example is as follows:

\documentclass[a4paper]{report}

\usepackage{booktabs}
\usepackage{fullpage}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage[pdftex]{graphicx}

\begin{document}

\begin{table}[htbp]
  \centering
    \begin{tabular}{llp{0.1cm}p{0.1cm}p{0.1cm}p{0.1cm}lp{3cm}}
    \toprule
& & \multicolumn{4}{c}{Parameter} & & \\
ID & Schema & F & E & P & N & \multicolumn{2}{l}{Cluster}\\
    \midrule
1 & A & H & H & H & H & 1 & High performer\\
2 & B & H & H & H & L & 2 & Cash provider\\
3 & C & H & H & L & H & 3 & Alternative means of financing\\
4 & D & H & H & L & L & 4 & Doubtful case\\
5 & E & H & L & H & H & 5 & Low performer\\
6 & F & H & L & H & L & 5 & Low performer\\
7 & G & H & L & L & H & 6 & Possible AMF\\
8 & H & H & L & L & L & 5 & Low performer\\
9 & I & L & H & H & H & 7 & Cash flow optimization\\
10 & L & L & H & H & L & 7 & Cash flow optimization\\
11 & M & L & H & L & H & 8 & SCF needy\\
12 & N & L & H & L & L & 7 & Cash flow optimization\\
13 & O & L & L & H & H & 4 & Doubtful case\\
14 & P & L & L & H & L & 9 & Potential cash provider\\
15 & Q & L & L & L & H & 5 & Low performer\\
16 & R & L & L & L & L & 5 & Low performer\\
    \bottomrule
    \end{tabular}%
  \caption{Cluster identification.}
  \label{clusteridentification}%
\end{table}%

\end{document}

Ok now I know that there are different solutions to this problem:

  • The first would be to "double" the table, with the header that would look like:

    \toprule
    & & \multicolumn{4}{c}{Parameter} & & & & \multicolumn{4}{c}{Parameter} & & \\
    ID & Schema & F & E & P & N & \multicolumn{2}{l}{Cluster} ID & Schema & F & E & P & N & \multicolumn{2}{l}{Cluster}\\
    \midrule

    Anyway, this solution is not very flexible, and won't be easy to manipulate the table in the future (and it's probable that I'll have to do it, and let's say it: it's ugly)

  • The twocolumn environment is out of discussion, because the rest of the page must be written as the rest of the document, on one column.

  • The minipage structure gives problems with the \table environment: I cannot compile the document!

share|improve this question
3  
You can automatically split the table in two if you use longtable: tex.stackexchange.com/questions/45980/… –  David Carlisle Jul 23 '12 at 9:05
    
@DavidCarlisle thanks, I was convinced that a mulicolumns environment should be set for the whole page (like landscape), but actually with the flexibility of latex it does not make a lot of sense... –  scannerdarkly Jul 23 '12 at 13:33
    
Latex bff´s, I suggest to change \begin{table} to \begin{table}[!ht] –  anlopezl Apr 8 at 17:13
add comment

1 Answer

up vote 9 down vote accepted

While I was writing my question, I came out with the solution. If I understood correctly, it is encouraged for user of this (rather awesome) website to answer their own question, therefore, even if I think that my question is quite trivial, here I go:

The minipage construct is the solution: it just needs to be within the table environment. The correct code to achieve what I wished is:

\begin{table}
\begin{minipage}[t]{0.5\linewidth}
    \begin{tabular}[t]{llp{0.1cm}p{0.1cm}p{0.1cm}p{0.1cm}lp{3cm}}
    \toprule
& & \multicolumn{4}{c}{Parameter} & & \\
ID & Schema & F & E & P & N & \multicolumn{2}{l}{Cluster}\\
    \midrule
1 & A & H & H & H & H & 1 & High performer\\
2 & B & H & H & H & L & 2 & Cash provider\\
3 & C & H & H & L & H & 3 & Alternative means of financing\\
4 & D & H & H & L & L & 4 & Doubtful case\\
5 & E & H & L & H & H & 5 & Low performer\\
6 & F & H & L & H & L & 5 & Low performer\\
7 & G & H & L & L & H & 6 & Possible AMF\\
8 & H & H & L & L & L & 5 & Low performer\\
    \bottomrule
    \end{tabular}%
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}
    \begin{tabular}[t]{llp{0.1cm}p{0.1cm}p{0.1cm}p{0.1cm}lp{3cm}}
    \toprule
& & \multicolumn{4}{c}{Parameter} & & \\
ID & Schema & F & E & P & N & \multicolumn{2}{l}{Cluster}\\
    \midrule
9 & I & L & H & H & H & 7 & Cash flow optimization\\
10 & L & L & H & H & L & 7 & Cash flow optimization\\
11 & M & L & H & L & H & 8 & SCF needy\\
12 & N & L & H & L & L & 7 & Cash flow optimization\\
13 & O & L & L & H & H & 4 & Doubtful case\\
14 & P & L & L & H & L & 9 & Potential cash provider\\
15 & Q & L & L & L & H & 5 & Low performer\\
16 & R & L & L & L & L & 5 & Low performer\\
    \bottomrule
    \end{tabular}%
\end{minipage}
\caption{caption}
\end{table}

Of course small adjustments to properly fit the text are needed, but it works.

share|improve this answer
    
I suggest to change \begin{minipage}[c] to \begin{minipage}[t] and \begin{tabular}{...} to \begin{tabular}[t]{...} so that the two top rules will be aligned anyway. Try and get both tables the same height; if it's not possible, the longest one should be the on the left. –  egreg Jul 23 '12 at 9:02
    
@scannerdarkly note that you can accept your own answer –  JLDiaz Jul 23 '12 at 9:03
    
@egreg Added. It would have been my next question, actually :D –  scannerdarkly Jul 23 '12 at 13:35
add comment

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.