34

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.

ROLF
  • 1,296
  • 5
  • 15
  • 22
  • 17
    If you've already made it with booktabs, why not provide that code as a minimal working example (MWE) to save us the typing? – Paul Gessler Apr 14 '15 at 12:36
  • Remove the wild bunch of vertical lines (or at least some of them) ;-) –  Apr 14 '15 at 12:40
  • As mentioned, I am not sure if booktabs is the best solution. What I want to achieve with this questions is tips and proposals for making a visually good table. I guess that it can be achieved using other techniques than booktabs. What I'm trying to say, is that I do not want to limit the suggestions to booktabs suggestions:) – ROLF Apr 14 '15 at 12:41
  • 3
    Once you got rid of the lines and the huge horizontal spacing, make the cells centered. You can add a bit of whitespace using \addlinespace to group items. – Johannes_B Apr 14 '15 at 12:42
  • 8
    This is a gif I like to reference for table design http://imgur.com/gallery/ZY8dKpA – DavidTheWin Apr 14 '15 at 14:33
  • I would swap the exhaust and outdoor columns :) – guillem Apr 15 '15 at 06:45
  • I think reading in a horizontal line is a bit difficult now, because the columns are too wide in relation to their contents. I would try to reduce the width of the columns by reducing the width of their headers, or, if possible, place them diagonal. In that case, your eyes don't have to 'travel' a long distance from left to right and you can get an overview in 'a blink'. –  Apr 15 '15 at 06:15
  • @guillem: Why? :) – ROLF Apr 15 '15 at 08:33
  • 4
    related: http://tex.stackexchange.com/questions/112343/beautiful-table-samples – morbusg Apr 15 '15 at 09:20
  • 3
    You (and all people who answered this question) could use \checkmark (or \checked from wasysym) instead of Y. – Martin Thoma Apr 15 '15 at 18:59
  • It is entirely unimportant, but reading each row as a three bit number with the given ordering (heat, exhaust, outdoor), and taking 'Y' as a '1' and 'blank' as '0', case 1 has a value of 2, case 2 has a value of 1, and so on (cases 3, 4 and 7 have the "correct" value). With the ordering (heat, outdoor, exhaust) each case will have the "correct" value. Note that this only applies if the entries on the table are to be interpreted as yes/no. I also would change the Y for a $\bullet$. – guillem Apr 16 '15 at 05:00

4 Answers4

49

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
  • @WChargin Thanks for your comment. I agree with you, I also rarely use colouring of the rows. I changed the colouring to a lighter tone following your comment. – Jean-Sébastien Apr 14 '15 at 16:01
  • @Johannes_B Thank for your comment. I updated the answer accordingly. – Jean-Sébastien Apr 14 '15 at 16:01
  • 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
  • How do you color every 3 rows? – ROLF Apr 15 '15 at 08:32
  • 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 09:41
  • @ROLF The simplest way is to do it manually like in AboAmmar's answer. I am not aware of a standard way to do it automatically. There are some interesting suggestions here http://tex.stackexchange.com/questions/59250/alternating-row-color-two-at-a-time-in-tables. – Jean-Sébastien Apr 15 '15 at 11:21
  • @Pouya I think the guideline about decimal alignment is to try as much as possible to be consistent with the number of digits of the numbers contained within a same column if they are of the same quantity. This is also a rule in science. If the quantity are unrelated however, I would simply do a center alignment, ignoring the decimal point. – Jean-Sébastien Apr 15 '15 at 11:33
  • 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

Ulrike Fischer
  • 327,261
  • 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
  • 7
    @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 http://tex.stackexchange.com/questions/98388/how-to-make-table-with-rotated-table-headers-in-latex – 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
  • @Ulrike Good points regarding the rotation, thank you. Concerning the title, I wouldn't go as far as to say it's uneeded noise. It is not possible with a quick glance at the table to know what the numbers are referring to and one has to infer it from the title. For the methods, I agree it is not needed. – Jean-Sébastien Apr 15 '15 at 15:25
  • @Jean-SébastienGosselin: The word "cases" is empty. You will need to read/add some explanation anyway. – Ulrike Fischer Apr 15 '15 at 15:35
  • @Ulrike Mmmh, you are right. "simulation cases" maybe? I do not want you to think I'm trying to argue with you, I'm merely learning here and trying to improve my knowledge and practices in the matter. From experience, when I scan scientific papers or assist to presentations, I like when the table is relatively standalone and do not depend too much on the title for the important features. Thanks for bringing another point of view though, I'll continue to think/read about that. – Jean-Sébastien Apr 15 '15 at 15:53
17

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. –  Apr 15 '15 at 03: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

AboAmmar
  • 46,352
  • 4
  • 58
  • 127