2

I am trying to apply the typography rules I read here and there on the stackexchange network (vertical rules by no means, horizontal rules are often over-used, etc), and managed to do pretty well until here. Now I have a tabular which represents the results of different tests, on different platforms. Here is what I would have done with Excel : Excel version

It's not really sexy, yet it's readable, and the vertical lines do help a lot for reading in such case. How should I proceed in LaTeX, using longtable and booktabs, so have such an easily-readable array, whilst respecting the typography rules ? If I don't print vertical and horizontal lines, it is just no readable, the eyes get lost throughout reading , especially when cells of the same color are standing next to eachother (horizontally, but in particular vertically).

So I am looking for ideas on how to make such arrays readable. I am not against the idea of throwing away cellcolors if it helps by any means.

  • 3
    That's more of a “matrix” or “grid”. I really think vertical rules have their place on such constructions. – Manuel Oct 23 '14 at 7:46
  • I concur with Manuel: this is a worksheet, not a table. – egreg Oct 23 '14 at 7:47
  • 1
    I would use \arrayrulecolor{white} to get white rules. – Ulrike Fischer Oct 23 '14 at 8:22
  • 1
    I agree with Ulrike Fischer. I also would use pastel hues, and less tight vertical spacing for cells, with the cellspace package. – Bernard Oct 23 '14 at 8:39
  • 1
    @ChristianHupfer So, if I understand you right, one may avoid applying the rule by applying a \rule? – Steven B. Segletes Oct 23 '14 at 11:21
7

If you want to stick to the typographical rules you find on this site, you should not use cell colours but some symbol or alike. Please see my example as a start for you. If you don't like the symbol, you might find pleasure in other possibilities I listed here. But I preferred to give a PDFLaTeX solution here.

% arara: pdflatex

\documentclass{article}
\usepackage{xcolor}
\usepackage{array}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{rotating}
\usepackage{pifont}
\newcommand*{\ap}{\textcolor{green}{\ding{51}}}
\newcommand*{\nap}{\textcolor{red}{\ding{55}}}
\newcommand{\inconc}{\textcolor{cyan}{\textbf{--}}}

\begin{document}
    \begin{sidewaystable}
        \centering
        \begin{threeparttable}
        \caption{Results of different tests}
        \begin{tabular}{>{\bfseries}l*{13}l}
            \toprule
            &A&B&C&D&E&F&G&H&I&J&K&L&M \\
            \midrule
            Test&\ap&\inconc&\inconc&\nap&\nap&\nap&\nap&\nap&\nap&\nap&\nap&\nap&\nap \\
            Test&\inconc&\ap&\inconc&\ap&\ap&\ap&\ap&\ap&\ap&\ap&\ap&\ap&\ap \\
            Test&\inconc&\nap\begin{tabular}{l}bug id: $332$\\bug id: $335$\end{tabular}&\ap&\nap\begin{tabular}{l}bug id: $334$\\bug id: $331$\end{tabular}&\ap&\nap&\nap&\ap&\nap&\nap&\ap&\nap&\nap \\
            Test&\ap&\nap\begin{tabular}{l}bug id: $337$\\bug id: $336$\end{tabular} &\inconc&\nap&\ap&\ap&\ap&\ap&\ap&\ap&\ap&\ap&\ap \\
            Test&\inconc&\ap&\inconc&\ap&\ap&\nap&\nap&\ap&\nap&\nap&\ap&\nap&\nap \\
            Test&\ap&\nap&\ap&\nap&\nap&\ap&\ap&\nap&\ap&\ap&\nap&\ap&\ap \\
            Test&\ap&\nap&\ap&\nap&\ap&\nap&\nap&\ap&\nap&\nap&\ap&\nap&\nap \\
            Test&\ap&\nap&\ap&\ap&\ap&\nap&\nap&\ap&\nap&\nap&\ap&\nap&\nap \\
            Test&\ap&\ap&\nap&\nap&\nap&\nap&\ap&\nap&\nap&\ap&\nap&\nap&\ap \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[\ap] Approved (successful)
            \item[\nap] Not approved (unsuccessful)
            \item[\inconc] Inconclusive
        \end{tablenotes}
        \end{threeparttable}
    \end{sidewaystable}
\end{document}

enter image description here

  • 1
    Haven't tested it, but I guess that google.translate would start beatboxing when reading my table rows ;-) – LaRiFaRi Oct 23 '14 at 11:30
  • 1
    Some suggestions: (1) Could perhaps the green color be a bit darker? It strains the eye on this white background (2) I would also prefer the blue dash to be much thicker - it's hard to spot. (3) It might be a bit superfluous to mark every single cell as approved or not approved. One of them could be left unmarked. (4) Given (3), it might not be necessary to use colors at all. – Sverre Oct 23 '14 at 13:22
  • 1
    @Sverre totally agree with all you are saying. But it's just a start-with-that and the main issue was to get it booktabed, I guess. I spent enough time on this and will just leave it. Thanks for your comment (and of course feel free to edit my answer, its herewith set under the WTFPLicense)! – LaRiFaRi Oct 23 '14 at 13:28
  • 2
    @cfr Yeah, true if it stays like this. I was suggesting that it will get filled up with more text (bug IDs...). I don't know. The rules are harsh... that's for sure, but the question was, how to adapt them here. EddaSnorra, the command for middle rules is \midrule. Just use that as you please. – LaRiFaRi Oct 23 '14 at 13:33
  • 2
    @LaRiFaRi My suggestions were meant more as a tag-on to yours, especially for the OP in case (s)he wants to use your table as a starting point. I didn't really except you to bother to implement them here and now. But I'm glad to see you agree with my suggestions ;) – Sverre Oct 23 '14 at 14:03
2

I am so basic in Latex but I tried and built your original table in Latex, which may also be useful to you. Of course, @LaRiFaRi's answer is better than mine.

% pdflatex

\documentclass[margin=2mm]{standalone}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor

\def \pos {\cellcolor{green}}
\def \non {\cellcolor{blue}}
\def \neg {\cellcolor{red}}

\begin{document}
        \begin{tabular}{c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
            &A&B&C&D&E&F&G&H&I&J&K&L&M \\
\hline
            Test&\pos&\neg&\neg&\non&\non&\non&\non&\non&\non&\non&\non&\non&\non \\
            Test&\neg&\pos&\neg&\pos&\pos&\pos&\pos&\pos&\pos&\pos&\pos&\pos&\pos \\
            Test&\neg&\non\begin{tabular}{l}bug id: $332$\\bug id: $335$\end{tabular}&\pos&\non\begin{tabular}{l}bug id: $334$\\bug id: $331$\end{tabular}&\pos&\non&\non&\pos&\non&\non&\pos&\non&\non \\
            Test&\pos&\non\begin{tabular}{l}bug id: $337$\\bug id: $336$\end{tabular} &\neg&\non&\pos&\pos&\pos&\pos&\pos&\pos&\pos&\pos&\pos \\
            Test&\neg&\pos&\neg&\pos&\pos&\non&\non&\pos&\non&\non&\pos&\non&\non \\
            Test&\pos&\non&\pos&\non&\non&\pos&\pos&\non&\pos&\pos&\non&\pos&\pos \\
            Test&\pos&\non&\pos&\non&\pos&\non&\non&\pos&\non&\non&\pos&\non&\non \\
            Test&\pos&\non&\pos&\pos&\pos&\non&\non&\pos&\non&\non&\pos&\non&\non \\
            Test&\pos&\pos&\non&\non&\non&\non&\pos&\non&\non&\pos&\non&\non&\pos \\
        \end{tabular}
\end{document}

enter image description here

Your Answer

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