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.

Since I have only little experience in Latex, I'm not sure how to create a specific table as shown in the example screenshot. Is such a table even possible with Latex and if yes, where do I need to start? Or is the layout maybe not the best choice and I should setup the layout of the table in another way?

Table Layout example

share|improve this question
    
Is the table part of a form and to be filled out manually or are the values simply missing? A form might need more space for individual entries and lines to where to put entries. In that case you might not need the horizontal lines dividing Quality, Time, and Costs but vertical space is sufficient. –  Christian Lindig Jan 4 '13 at 11:19
    
the values are simply missing but the values are quite short (+, -, =) –  Airlike Jan 4 '13 at 13:34
add comment

2 Answers

up vote 5 down vote accepted

A great place to start, when you don't know how to do a table (or something else in LaTeX) is wikibooks.

In the following I'll use the packages booktabs and multirow for they allow me to insert specific rules and cell entries spanning more then one row/column. As your example uses a sans-serif font, I used \renewcommand*\familydefault{\sfdefault} to reproduce this.

The tabular* environment allows to set a specific width, in this case \linewidth; a sidenote, for larger tables you could switch to landscape-mode.

For more information concerning tables, check out the wikibooks link.

Now here how you could realize the table you want in LaTeX.

Code

\documentclass{article}

\usepackage{booktabs}
\usepackage{multirow}
\renewcommand*\familydefault{\sfdefault}

\begin{document}

\begin{tabular*}{\linewidth}{ @{\extracolsep{\fill}} ll *{13}c @{}}
\toprule
Measures & Task & \multicolumn{4}{c}{Method1} &
\multicolumn{4}{c}{Method2} & \multicolumn{4}{c}{Method3} & p-value \\
\midrule \midrule \addlinespace \\
 & & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 & \\
\cmidrule{3-6} \cmidrule{7-10} \cmidrule{11-14} \cmidrule{15-15}
\addlinespace \\
\multirow{3}{*}{Quality} & A  \\
                         & B  \\
                         & C  \\
                         \midrule \addlinespace \\
\multirow{3}{*}{Time}    & A  \\
                         & B  \\
                         & C  \\
                         \midrule \addlinespace \\
\multirow{3}{*}{Costs}   & A  \\
                         & B  \\
                         & C  \\
\bottomrule
\end{tabular*}

\end{document}

Output

Image

share|improve this answer
    
Please do not post code without explanation. –  Marc van Dongen Jan 4 '13 at 14:23
    
@MarcvanDongen I added an explanation, thanks for the advise. –  xfoo Jan 4 '13 at 14:47
add comment

Here is the table:

enter image description here

Here is the code to typeset the table:

\begin{tabular}{@{}lllllllllllllllll@{}}
  \toprule
  Measures & Task &\multicolumn{4}{c}{Method1} & & \multicolumn{4}{c}{Method2} & &\multicolumn{4}{c}{Method3} & p-value \\
  \midrule
  && 1 & 2 & 3 & 4 & & 1 & 2 & 3 & 4 & & 1 & 2 & 3 & 4 & \\
  \cmidrule{3-6} \cmidrule{8-11} \cmidrule{13-16}
  \multirow{3}{*}{Quality} & A \\
  & B \\
  & C \\
  \midrule
  \multirow{3}{*}{Time} & A \\
  & B \\
  & C \\
  \midrule
  \multirow{3}{*}{Cost} & A \\
  & B \\
  & C \\
  \bottomrule
\end{tabular}
\end{document}

Some explanations:

  • Use booktabs package to get better row spacing and rules. Note the different use of \toprule, \bottomrule and \midrule.

  • Let an empty column between the columns that have a partial rule \cmidrule.

  • In the column specification use @{} at the beginning and end. In this way the rules are not longer than the table itself.
  • Use the package multirow to center in multiple rows.
  • Don't use double rules.
share|improve this answer
    
thanks for providing the code! I'll with test both answers which provided code - the output seems to be same! appreciate your help –  Airlike Jan 4 '13 at 13:20
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.