28

I'm using booktabs to make most of the tables in my thesis. However, I'm not sure if that is the best solution for tables with more than 6-7 rows, as it can be difficult to read (there is no line seperating the rows).

If you feel you are good at making visually good tables, I'd like you to make a proposal for the following table (made in Word to illustrate the content and size):

enter image description here

The table is meant to illustrate different simulation cases. The Y illustrates that the specific case make use of the method mentioned in the first row in each column.

44

I suggest you read the booktabs package documentation. Very good advices are given in there about table formatting and I think it is a good introduction on the subject.

About your example, the reference mentioned above provides the following guidelines:

  1. Never, ever use vertical rules.
  2. Never use double rules.

You may also add some zebra stripes to guide the eye horizontally with the command rowcolors using the package xcolor. This practice is however often unnecessary for tables that are completely filled with values. There is an interesting discussion on Edward Tufte’s Web forum about this subject as well as in this thread on TeX.SX.

When dealing with float numbers instead of letters, they should be align with the decimal using either the dcolumn or siunitx package. The precision of the float numbers within a same column should be kept as consistent as possible.

Here is proposition of a MWE for the example you provided :

\documentclass{article}

\usepackage{booktabs}
\usepackage[svgnames,table]{xcolor}
\usepackage[tableposition=above]{caption}
\usepackage{pifont}

\newcommand*\CHECK{\ding{51}}

\begin{document}
\begin{table}
    \centering
    \caption{MWE of a table using booktabs}
    \rowcolors{5}{}{gray!10}
    \begin{tabular}{*4c}
        \toprule
        & \multicolumn{3}{c}{methods tested} \\
        \cmidrule(lr){2-4}
        Case & Heat  & Exhaust & Outdoor \\    
        \#   & Wheel & Air     & Air     \\
        \midrule
        1 &        & \CHECK &        \\
        2 &        &        & \CHECK \\
        3 &        & \CHECK & \CHECK \\
        4 & \CHECK &        &        \\
        5 & \CHECK & \CHECK &        \\
        6 & \CHECK &        & \CHECK \\
        7 & \CHECK & \CHECK & \CHECK \\
        \bottomrule
    \end{tabular}
\end{table}
\end{document}

Which results in this table:

enter image description here

  • I've broken the column titles in two lines to reduce the width of the columns. In addition to make the table looks better, it also helps the horizontal readability.
  • I replaced the horizontal lines by light toned zebra lines. In my opinion, for this example, this is totally acceptable to add zebra lines since rows are independent from each other.
  • I replaced the 'Y' symbol by a checkmark symbol as suggested by @moose.
  • I removed the word 'Case' before each number to avoid unecessary repetition of the information.
  • I added the meta-title 'methods tested' and the title 'Case' for the first column. I believe that a table should be relatively standalone. A reader should be able to grasp the structure and have an idea of the meaning of every elements of the table just by looking at it. Details could be added in the title or as a table note. If the reader have to go within the text to understand the table, it is a no-go in my opinion. This practice also allows to more easily refer to the various elements of the table in the text.

Here is another example of a table I have produced for my thesis that gives an example with float numbers using the siunitx package:

\documentclass{article}

\usepackage{booktabs, siunitx}
\usepackage[svgnames,table]{xcolor}
\usepackage[tableposition=above]{caption}

\begin{document}
\begin{table}
    \centering
    \caption{MWE of a table using booktabs and siunitx with floats}
    \begin{tabular}{
        l
        S[table-format = 3]
        S[table-format = 2]
        S[table-format = 1.3]
        S[table-format = -2.2]
        S[table-format = 1.3]
        S[table-format = 1.3]
        S[table-format = 2.2]
        }
        \toprule
        \multicolumn{3}{c}{} & 
        \multicolumn{5}{c}{Brooks-Corey model parameters}\\
        \cmidrule(lr){4-8}        
        & {Sand} & {Clay} & {$\lambda$} & {$\psi_e$} & {$\theta_r$} & {$\theta_{sat}$} & {$K_{sat}$} \\
        Texture Class & {(\si{\percent})} & {(\si{\percent})} & {(-)} & {(\si{cm})} & {(\si{m^3/m^3})} & {(\si{m^3/m^3})} & {(\si{cm/h})} \\
        \midrule
        Sand       & 100 & 0  & 0.592 & -7.26 & 0.020 & 0.437 & 21.00 \\
        Loamy Sand &  85 & 5  & 0.474 & -8.69 & 0.035 & 0.437 &  6.11 \\
        Sandy Loam &  65 & 10 & 0.322 &-14.66 & 0.041 & 0.453 &  2.59 \\
        \bottomrule
    \end{tabular}
\end{table}
\end{document}

Which results in this table:

enter image description here

  • 2
    Here's the same example without the \rowcolors command. Personally, I think the zebra striping is superfluous (or at least far too strong there). But that's a matter of taste and could also depend on the actual table content. – wchargin Apr 14 '15 at 14:06
  • 1
    Two additions: use \captionsetup[table]{postion=above} to get proper spacing between the caption and the table. Mention, that package siunitx provides the feature of package dcolumn as well. – Johannes_B Apr 14 '15 at 15:34
  • 3
    I believe Edward Tufte recommends to color every 3 rows rather than every other row using the following argument: it is less noisy, and reading a row one recognises whether the row is at top, middle, or bottom of such a colouring. – Christian Lindig Apr 14 '15 at 20:31
  • 1
    Please note that I'm not attacking, I am genuinely curios to know: Where did you/they come by those three rules? I.e., no vertical rule, no double rule and alignment on decimal point. Are there any graphic design discipline for that? I am also curios to know about the decimal alignment when the numbers have different precision (e.g. how would it look like to align 123.45 and 3.141596 at the decimal point.). – Pouya Apr 15 '15 at 9:41
  • 1
    @Pouya The no-vertical-line guideline is discussed in the booktabs documentation, which I found very useful as an introductory read on the subject. – Jean-Sébastien Apr 15 '15 at 13:43
20

I would swap columns and rows -- at least if the content of the cell are so short as shown in your example. And I would also try to avoid "rules" in the form of color backgrounds -- in most cases a bit more space is enough. And I would always try to have column titles which are not much longer than the content of the cells.

\documentclass{scrartcl}
\usepackage{booktabs}
\begin{document}

\begin{table}\centering
\caption{Use of xxxx methods in simulation cases 1--7}
\begin{tabular}[t]{lccccccc}\toprule
            &   1  &   2 &  3   & 4   & 5   & 6   & 7 \\ \midrule
Heat wheel  &      &     &      & Y   & Y   & Y   & Y \\\addlinespace
Exhaust air &   Y  &     &  Y   &     & Y   &     & Y \\\addlinespace
Outside air &      &   Y &  Y   &     &     & Y   & Y \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

  • Although this is a nice approach for the example as given it will rapidly fall down if the cases are identified by name rather than a single-character index, as the table will be too wide for the page. It may be appropriate to define the cases nearby to allow the use of an index, but not always. – Chris H Apr 14 '15 at 20:52
  • 6
    @ChrisH sure, other content will perhaps need another layout. There is no general solution that works in all cases. – Ulrike Fischer Apr 14 '15 at 21:06
  • @ChrisH You could also rotate the cases name as demonstrated here tex.stackexchange.com/questions/98388/… – Jean-Sébastien Apr 15 '15 at 14:38
  • @UlrikeFischer Adding a title Cases over the numbers and maybe a title Processes next to the methods could maybe improve further the design. See the link I've posted in my comment above. – Jean-Sébastien Apr 15 '15 at 14:42
  • @JSGosselin: I would avoid (full) rotation, and I would rotate the other way round: people tend to hold books in the left hand to switch pages with the right one and so clockwise rotation is more natural. And I wouldn't add unneeded noise like "cases". – Ulrike Fischer Apr 15 '15 at 14:43
15

I'd use booktabs together with xcolor to shade alternating rows:

enter image description here

The code:

\documentclass{article}
\usepackage[svgnames,table]{xcolor}% note the table option
\usepackage{booktabs}
\begin{document}

\rowcolors{2}{White}{LightBlue!30}% colors to shade rows withs
\begin{tabular}{*4c}\toprule
  & \textbf{Heat Wheel} & \textbf{Exhaust air} & \textbf{Outdoor air}\\\midrule
 Case 1&            &      Y      &             \\
 Case 2&            &             &      Y      \\
 Case 3&            &      Y      &      Y      \\
 Case 4&    Y       &             &             \\
 Case 5&    Y       &      Y      &             \\
 Case 6&    Y       &             &      Y      \\
 Case 7&    Y       &      Y      &      Y      \\\bottomrule
\end{tabular}

\end{document}

Btw, a mwe would have been helpful, with or without booktabs.

  • Thank you for your answer. Will this change the layout for all tables in the report, or only the ones having \rowcolors{2}{White}{LightBlue!30}% colors to shade rows withs in front of it? – ROLF Apr 14 '15 at 13:32
  • @ROLF A \rowcolors command will change all subsequent tables. Of course, you can write \rowcolors{2}{}{} to turn off the row colouring. – Andrew Apr 15 '15 at 3:39
12

Coding for beauty is not always easy and is time-consuming, but I think using booktabs is very sufficient and its output is decent. You can also consider using colortbl if you want some colors. Here I initially post the first solution using booktabs to give you some insight.

\documentclass{article}
\usepackage{booktabs}
\begin{document}

\begin{table}\centering
\begin{tabular}{cccc}\toprule
        &   Heat wheel  &   Exhaust air &   Outside air \\ \midrule
Case 1  &               &   Y           &               \\
Case 2  &               &               &   Y           \\
Case 3  &               &   Y           &   Y           \\
Case 4  &   Y           &               &               \\
Case 5  &   Y           &   Y           &               \\    
Case 6  &   Y           &               &   Y           \\
Case 7  &   Y           &   Y           &   Y           \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

If you decide to go the second approach, you may try this:

\documentclass{article}
\usepackage{booktabs}
\usepackage{colortbl}
\begin{document}

\begin{table}\centering
\begin{tabular}{cccc}\toprule
        & \bf{Heat wheel}   & \bf{Exhaust air}  &\bf{Outside air} \\ \midrule \rowcolor[gray]{.95}
Case 1  &               &   Y           &                   \\ 
Case 2  &               &               &   Y               \\ \rowcolor[gray]{.95}
Case 3  &               &   Y           &   Y               \\
Case 4  &   Y           &               &                   \\ \rowcolor[gray]{.95} 
Case 5  &   Y           &   Y           &                   \\   
Case 6  &   Y           &               &   Y               \\ \rowcolor[gray]{.95}
Case 7  &   Y           &   Y           &   Y               \\ \bottomrule
\end{tabular}
\end{table}
\end{document}

Which gives:

enter image description here

Your Answer

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

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