# Beautiful table samples

I'm interested in learning about some nice-looking table samples. Colors can make a huge difference, and just providing some color to headers, background, or borders can dramatically change presentation. Any samples you're proud to share?

(BTW here's a sample I like, but unfortunately, not TeX...)

-
big-list? CW? But, +1 for the idea. –  kan May 4 '13 at 11:07
Great question! I kind of given up on tables in LaTeX, as they tend to be pretty ugly and hard to maintain most of the time. Almost all examples/how-tos about tables produce results which are kind of embarrasing... just look at the first answer, it is ridiculous! But maybe someone will come along and shows how to do "beautiful" and easy to maintain tables. –  Simon Lehmann May 4 '13 at 13:01
That green is hard to read. Also, more vspacing may make it look better. –  User 17670 May 4 '13 at 18:59
If you want to make a beautiful table that you can actually enjoy with your family and friends, you start by acquiring specimens of fine hardwood, and then apply those woodworking skills. –  Kaz May 5 '13 at 2:52
Some very nice css tables are here (Perhaps somebody could "transform" those to LaTeX) –  moose May 8 '13 at 19:47

I think its worth mentioning the combination tcolorbox-tabularx, which provides an easy way to draw (possibly very much) fancy tables.

Some examples:

\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}

\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}

\tcbset{tab1/.style={fonttitle=\bfseries\large,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=red!75!black,colbacktitle=Salmon!40!white,
coltitle=black,center title,freelance,frame code={
\foreach \n in {north east,north west,south east,south west}
{\path [fill=red!75!black] (interior.\n) circle (3mm); };},}}

\tcbset{tab2/.style={enhanced,fonttitle=\bfseries,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=red!50!black,colbacktitle=Salmon!40!white,
coltitle=black,center title}}

\begin{document}

\begin{tcolorbox}[tab2,tabularx={X||Y|Y|Y|Y||Y}]
Group & One     & Two     & Three    & Four     & Sum      \\\hline\hline
Red   & 1000.00 & 2000.00 &  3000.00 &  4000.00 & 10000.00 \\\hline
Green & 2000.00 & 3000.00 &  4000.00 &  5000.00 & 14000.00 \\\hline
Blue  & 3000.00 & 4000.00 &  5000.00 &  6000.00 & 18000.00 \\\hline\hline
Sum   & 6000.00 & 9000.00 & 12000.00 & 15000.00 & 42000.00
\end{tcolorbox}

\begin{tcolorbox}[tab2,tabularx={X||Y|Y|Y|Y||Y},title=My table,boxrule=0.5pt]
Group & One     & Two     & Three    & Four     & Sum      \\\hline\hline
Red   & 1000.00 & 2000.00 &  3000.00 &  4000.00 & 10000.00 \\
Green & 2000.00 & 3000.00 &  4000.00 &  5000.00 & 14000.00 \\
Blue  & 3000.00 & 4000.00 &  5000.00 &  6000.00 & 18000.00 \\\hline\hline
Sum   & 6000.00 & 9000.00 & 12000.00 & 15000.00 & 42000.00
\end{tcolorbox}

\begin{tcolorbox}[tab1,tabularx={X||YYYY||Y}]
Group & One     & Two     & Three    & Four     & Sum      \\\hline\hline
Red   & 1000.00 & 2000.00 &  3000.00 &  4000.00 & 10000.00 \\
Green & 2000.00 & 3000.00 &  4000.00 &  5000.00 & 14000.00 \\
Blue  & 3000.00 & 4000.00 &  5000.00 &  6000.00 & 18000.00 \\\hline\hline
Sum   & 6000.00 & 9000.00 & 12000.00 & 15000.00 & 42000.00
\end{tcolorbox}

\end{document}


The are endless customization possibilities, and everything is a matter of writing a custom tcb style that suits your needs. The examples (with some modifications) are taken from the tcolorbox manual, section /tcb/tabularx.

-
My dentist has one of those table s similar to the last one in the waiting room. For documents it's a no-go in my opinion. –  percusse May 4 '13 at 12:34
@percusse Well, it depends. Today the word "document" is used in many ways... I see lots of financial reports with extremely fancy tables (much more than that of your dentist - I just remembered one with a deep blue skyline background!) and many people seem to like them so that they're sometimes required. That's why I usually suspend judgment on matters of taste and beauty and just discuss possibilities. –  dcmst May 4 '13 at 12:44
To quote from the booktabs documentation: 1. Never, ever use vertical lines. 2. Never use double lines. I tend to agree. –  Tom Bombadil May 4 '13 at 12:48
@TomBombadil I find the "Never, ever" part to really be nonsense. –  dcmst May 4 '13 at 13:19
@dcmst Maybe it's harsh to say "Never, ever", but I honestly haven't seen any case where it would produce a nice result. It is highly distasteful imho, as are all the tables above –  Xavier May 4 '13 at 18:02

There seems to be a general consensus that booktabs is the way to go, if you want to have a beautifully typeset table. The result is really elegant, but to some it might appear somewhat... Spartan.

Here are a few examples I gathered from the web:

and last but not least, some contributions from our very own site:

And just for completeness' sake, there is the tabu package. I only list it because I subscribe to the opinion that 'beauty is in the eye of the beholder'. Keep in mind, though, that I neither like the results in the documentation (and the documentation itself is IMHO an eye-sore) nor do I recommend using it - it's been reported to be buggy.

(EDIT: A little pun: Using tabu is taboo. :))

Finally, a little example (from a homework on Fourier series and transformation):

## Code

\documentclass{article}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{tabular}{SSSSSSSS} \toprule
{$m$} & {$\Re\{\underline{\mathfrak{X}}(m)\}$} & {$-\Im\{\underline{\mathfrak{X}}(m)\}$} & {$\mathfrak{X}(m)$} & {$\frac{\mathfrak{X}(m)}{23}$} & {$A_m$} & {$\varphi(m)\ /\ ^{\circ}$} & {$\varphi_m\ /\ ^{\circ}$} \\ \midrule
1  & 16.128 & +8.872 & 16.128 & 1.402 & 1.373 & -146.6 & -137.6 \\
2  & 3.442  & -2.509 & 3.442  & 0.299 & 0.343 & 133.2  & 152.4  \\
3  & 1.826  & -0.363 & 1.826  & 0.159 & 0.119 & 168.5  & -161.1 \\
4  & 0.993  & -0.429 & 0.993  & 0.086 & 0.08  & 25.6   & 90     \\ \midrule
5  & 1.29   & +0.099 & 1.29   & 0.112 & 0.097 & -175.6 & -114.7 \\
6  & 0.483  & -0.183 & 0.483  & 0.042 & 0.063 & 22.3   & 122.5  \\
7  & 0.766  & -0.475 & 0.766  & 0.067 & 0.039 & 141.6  & -122   \\
8  & 0.624  & +0.365 & 0.624  & 0.054 & 0.04  & -35.7  & 90     \\ \midrule
9  & 0.641  & -0.466 & 0.641  & 0.056 & 0.045 & 133.3  & -106.3 \\
10 & 0.45   & +0.421 & 0.45   & 0.039 & 0.034 & -69.4  & 110.9  \\
11 & 0.598  & -0.597 & 0.598  & 0.052 & 0.025 & 92.3   & -109.3 \\ \bottomrule
\end{tabular}

\end{document}


## Output

-
I just dug up an example I once did, are you okay with me adding it to your post? –  Tom Bombadil May 4 '13 at 14:00
@TomBombadil: Sure! Be my guest! :) –  Count Zero May 4 '13 at 14:18
+1 for the observation that the tabu package documentation is an eyesore. –  Charles Staats May 4 '13 at 14:59
@MarcvanDongen It aligns on the decimalpoint. Probably using the columntype S from siunitx. –  Munken May 8 '13 at 8:06
@MarcvanDongen It aligns the ones, the tens etc –  Munken May 11 '13 at 20:18

I also favour the guidance given by booktabs, and generally prefer simple, unadorned tables. However, it may be that you want to draw attention to say the highest value for a given row --- e.g., a table of your teaching evaluation scores. (That is, a document that might be able to be 'louder' than something you'd want to put in a book.) In this case, perhaps some colour would be appropriate for an electronic form, but you'd rather just have bold for a printed version. Etc., etc.

Here is a simplified version of what I have done before (meant for fontspec-reliant engines):

\documentclass[12pt, oneside, landscape]{memoir}

\newif\ifblackandwhite
% \blackandwhitetrue

\usepackage{fontspec}%
\defaultfontfeatures{Ligatures=TeX}%
\setmainfont[%
Numbers        = OldStyle ,
ItalicFont     = LinLibertineOI ,
BoldItalicFont = LinLibertineOBI ,
BoldFont       = LinLibertineOB ,
]{LinLibertineO}%

\usepackage[hmargin=2cm,vmargin=2.5cm]{geometry}
\usepackage{etoolbox}
\usepackage{longtable}%
\AtBeginEnvironment{longtable}{%
\addfontfeature{RawFeature=+tnum;-onum}%  <--- requires LuaTeX
}

\usepackage{pdflscape}
\usepackage[svgnames]{xcolor}
\usepackage{colortbl}%
\newcommand{\myrowcolour}{\rowcolor[gray]{0.925}}
\usepackage{booktabs}

\ifblackandwhite
\newcommand{\highest}[1]{\textbf{#1}}% == highest score for question
\else
\newcommand{\highest}[1]{\textcolor{Maroon}{\textbf{#1}}}%
\fi

\begin{document}
\thispagestyle{empty}
\parindent0pt
%

\cheading{Fake Course Evaluation Summary for \textsc{course
1234y}}{Sept.\ 2010 --- May 2011}

\begin{longtable}{@{}l rr rr rr rr rr rr}
% pairs: absolute number (percentage)

\toprule%
\centering%
& \multicolumn{2}{c}{{{\bfseries Excellent}}}
& \multicolumn{2}{c}{{{\bfseries Very Good}}}
& \multicolumn{2}{c}{{{\bfseries Good}}}
& \multicolumn{2}{c}{{{\bfseries Average}}}
& \multicolumn{2}{c}{{{\bfseries Poor}}}
& \multicolumn{2}{c}{{{\bfseries Very Poor}}} \\

\cmidrule[0.4pt](r{0.125em}){1-1}%
\cmidrule[0.4pt](lr{0.125em}){2-3}%
\cmidrule[0.4pt](lr{0.125em}){4-5}%
\cmidrule[0.4pt](lr{0.125em}){6-7}%
\cmidrule[0.4pt](lr{0.125em}){8-9}%
\cmidrule[0.4pt](lr{0.125em}){10-11}%
\cmidrule[0.4pt](l{0.25em}){12-13}%
% \midrule

Some question about the Instructor or Course & 2 & (7.14) & 4 &
(14.29) & \highest{12} & \highest{(42.86)} & 4
& (14.29) & 6 & (21.43) & 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & 3 & (10.71) &
\highest{15} & \highest{(53.57)} & 5 & (17.86) & 5 & (17.86) & 0 &
(0.00) & 0 & (0.00) \\

Some question about the Instructor or Course & 4 & (14.29) & 8 &
(28.57) & \highest{15}
& \highest{(53.57)} & 1 & (3.57) & 0 & (0.00) & 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & 3 & (10.71) & 8 &
(28.57) & \highest{10} & \highest{(35.71)}
& 5 & (17.86) & 2 & (7.14) & 0 & (0.00) \\

Some question about the Instructor or Course & 6 & (21.43) &
\highest{9} & \highest{(32.14)}
& 4 & (14.29) & \highest{9} & \highest{(32.14)} & 0 & (0.00) & 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & \highest{10} &
\highest{(35.71)} & \highest{10} & \highest{(35.71)}
& 3 & (10.71) & 5 & (17.86) & 0 & (0.00) & 0 & (0.00) \\

Some question about the Instructor or Course & \highest{12} &
\highest{(42.86)} & \highest{12} & \highest{(42.86)} & 3
& (10.71) & 1 & (3.57) & 0 & (0.00) & 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & \highest{12} &
\highest{(42.86)} & 3 & (10.71) & 7
& (25.00) & 5 & (17.86) & 1 & (3.57) & 0 & (0.00) \\

Some question about the Instructor or Course & \highest{10} &
\highest{(35.71)} & 6 & (21.43) & 6 & (21.43) & 6 & (21.43)
& 1 & (3.57) & 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & 5 & (17.86) & 5 &
(17.86) & \highest{12} & \highest{(42.86)} & 2 & (7.14)
& 3 & (10.71) & 1 & (3.57)\\

Some question about the Instructor or Course & 3 & (10.71) & 8 &
(28.57) & \highest{11} & \highest{(39.29)} & 3 & (10.71) & 3 & (10.71)
& 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & \highest{18} &
\highest{(64.29)}
& 5 & (17.86) & 3 & (10.71) & 1 & (3.57) & 1 & (3.57) & 0 & (0.00) \\

Some question about the Instructor or Course & \highest{15} &
\highest{(53.57)}
& 7 & (25.00) & 2 & (7.14) & 2 & (7.14) & 2 & (7.14) & 0 & (0.00) \\

\myrowcolour%
Some question about the Instructor or Course & 3 & (10.71) &
\highest{13} & \highest{(46.43)} & 4 & (14.29) & 6 & (21.43) & 2
& (7.14) & 0 & (0.00) \\

\bottomrule

\end{longtable}

\end{document}


Remarks: Uncomment \blackandwhitetrue if you want to disable colour. And the \addfontfeature command in \AtBeginEnvironment requires the fontspec package.

-
While I like the overall layout of this table, I'm disturbed by the fact that bold digits are wider that normal digits, and therefore all digits are not aligned in nice, tidy columns. –  adl May 8 '13 at 18:41
@adl -- This was a concern of mine as well, but I tried colour without the bold and it just didn't look right to me; worse, if you want a black and white version, there is no good way to make the numbers you are interested in stand out; highlighting individual cell backgrounds, e.g., looks terrible. Remember, too, this is an idea I endorse for less formal documents where you are trying to make something stand out ... plus, given the right-alignment, numbers unaligned only on the lefthand side doesn't seem that severe. Of course, to each their own, etc., etc. –  jon May 8 '13 at 18:57
Did you try \npboldmath from the numprint package? It does not seem to work with all fonts, but I have fixed alignment of bold digits in tables with that in the past. –  adl May 8 '13 at 19:53
@adl -- (Sorry for the late response; things got busy.) Thanks for the suggestion. I did not know of this package. It doesn't seem to work well with this font (after a quick test): either it switches the font to CM or the parentheses end up sticking out on the right-hand side instead of the left, but I can see the potential. And I will keep it in mind for the future. Also, if you post a modified/improved example using the package, I'd vote for it! –  jon May 12 '13 at 0:37

One often-quoted typographer, Robert Bringhurst, says about tables in his book The Elements of Typographic Style, pp. 70–71:

### Edit tables with the same attention given to text, and set them as text to be read.

...

1. All text should be horizontal, or in the rare cases oblique. Setting column heads vertically as a space-saving measure is quite feasible if the text is in Japanese or Chinese, but not if it is written in the Latin alphabet.
2. Letterforms too small or too condensed for comfortable reading are not part of the solution.
3. There should be a minimum amount of furniture (rules, boxes, dots and other guiderails for traveling through typographic space) and a maximum amount of information.
4. Rules, tint blocks or other guides and dividers, where they are necessary at all, should run in the predominant reading direction: vertically in the case of lists, indices and some numerical tables, and horizontally otherwise.
5. A rule located at the edge of a table, separating the first or final column from the adjacent empty space, ordinarily serves no function.
6. A table, like any other text in multiple columns, must contain within itself an adequate amount of white space.

On that third point, Edward Tufte has coined the term “data-ink ratio” to mean (reconstructed from The Visual Display of Quantitative Information, p. 93):

Following that, you can usually replace any rules you use in tables with just whitespace. Likewise, when displaying larger amounts of data in a table, instead of “zebra-striping” rows, you can add vertical whitespace (or background color) between groups of rows of, for example, 3 or 5 (provided the rows are evenly divisible) to make it easier to follow the information.

Here's an example set in baselinegrid I've made for a cheatsheet for a game (It's in plain XeTeX-format, so compile with xetex):

\def\mainfont{Myriad Pro}
\font\bodyfont="\mainfont:mapping=tex-text;+onum" at 8bp \let\tenrm\bodyfont
\font\boldfont="\mainfont/B" at 8bp \let\tenbf\boldfont
\bodyfont

\baselineskip=10bp
\smallskipamount=\baselineskip
\medskipamount=2\baselineskip
\setbox\strutbox=\hbox{%
\vrule height .7\baselineskip depth .3\baselineskip width 0pt}

\newcount\rowcount

\noalign{\global\rowcount=0 \medbreak}
\bf #1& LVL& LDR& ATT& DEF& INI& SPD& HP& DMG\crcr
\noalign{\nobreak\smallskip}}

\def\cr{\crcr\noalign{\maybeskip}}

\def\maybeskip{\ifnum\rowcount=2 \global\rowcount=0 \smallbreak
\else \global\advance\rowcount by 1 \fi}

Goblin&         2& 35&  16& 10& 4& 2& 20&  2--4\cr
Furious Goblin& 2& 40&  14& 14& 6& 3& 38&  3--8\cr
Orc&            3& 60&  16& 17& 4& 2& 65&  7--10\cr
Catapult&       3& 120& 33& 15& 4& 2& 80&  5--9\cr
Veteran Orc&    4& 140& 25& 25& 6& 3& 110& 15--20\cr
Shaman&         4& 200& 24& 32& 5& 3& 160& 15--18\cr
Thorn-Hunter&   1& 8&    4&  1& 2& 3& 5&   1--2\cr
Thorn-Warrior&  1& 8&    4&  3& 4& 3& 8&   1--3\cr
Fire Dragonfly& 1& 9&    3&  1& 5& 3& 6&   1--3\cr
Lake Dragonfly& 1& 9&    3&  1& 6& 4& 6&   1--3\cr
Devilfish&      1& 12&   6&  4& 6& 3& 10&  1--3\cr
Venomous Spider&1& 12&   5&  1& 4& 3& 10&  2--3\cr
Cave Spider&    1& 14&   4&  4& 2& 3& 14&  2--4\cr
Hyena&          2& 20&   8&  8& 4& 3& 14&  3--4\cr
Pirate&         2& 25&   8&  4& 4& 3& 20&  3--5\cr
Swamp Snake&    2& 28&  12&  8& 4& 2& 25&  3--5\cr
Fire Spider&    2& 30&  12& 12& 6& 3& 27&  4--5\cr
Snake&          2& 30&  14&  8& 5& 2& 28&  3--6\cr
% ...
}
\bye


-
Looks quite nice and +1 for references to Bringhurst and Tufte. However, I am not sure if I like using grouping instead of 'zebra-striping', as it might read as if those rows grouped together have something in common... and at least for me, it does not separate each row enough. –  Simon Lehmann May 5 '13 at 18:02
Thanks @Simon. I think I remember either Bringhurst or Tufte giving that grouping tip, but I couldn't find a reference to that. –  morbusg May 6 '13 at 9:13

Not a beautiful table yet but I would like some help to make it beautiful :) Here is my attempt at recreating OP's table.

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage[margin=1in]{geometry}
\usepackage{tabularx}
\usepackage{enumitem}

\setlist{nolistsep}
\definecolor{green}{HTML}{66FF66}
\definecolor{myGreen}{HTML}{009900}

\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\arraystretch}{1.5}

\begin{document}

\begin{center}
\begin{tabularx}{\textwidth}[t]{XX}
\arrayrulecolor{green}\hline
\textbf{\textcolor{myGreen}{Goal 1 Eradicate Extreme Poverty}} & \\
\hline
Target 1.A Halve, between 1990 and 2015, the proportion of the people whose income is less than \$1 a day. & \begin{minipage}[t]{\linewidth}% \begin{itemize} \item[1.1] Proportion of population below \$1 purchasing power parity (PPP) a day$^a$
\item[1.2] Poverty Gap ratio [incidence x depth of poverty]
\item[1.3] Share of the poorest quintile in national consumption
\end{itemize}
\end{minipage}\\

\arrayrulecolor{black}\hline

Target 1.B Achieve full and productive employment and decent work for all, including women and young people &
\begin{minipage}[t]{\linewidth}%
\begin{itemize}
\item[1.4] Growth of GDP per person employed
\item[1.5] Employment to population ratio
dec sep align
}
]{ %
Material        & Symbol &  eg  & Type \\
diamond         & C      & 5.46 & i \\
silicon         & Si     & 1.12 & i \\
germanium       & Ge     & 0.67 & i \\
selenium        & Se     & 1.74 & d \\
silicon carbide & SiC 3C & 2.36 & i \\
silicon carbide & SiC 4H & 3.28 & i \\
silicon carbide & SiC 6H & 3.03 & i \\
indium phosphide& InP    & 1.27 & d \\
indium arsenide & InAs   & 0.355& d \\
gallium nitride & GaN    & 3.37 & d \\
gallium arsenide& GaAs   & 1.42 & d \\
aluminium nitride & AlN  & 6.2  & d \\
}
\end{table}
\end{document}


The values are token from wikipedia.

-

An interesting and simple gallery is presented at Wikibooks - LaTeX/Tables

BTW, my contribution is:

\documentclass{beamer}
\usepackage{booktabs}

\begin{document}

\frame{
\frametitle{Simple Table}

\begin{center}

\begin{tabular}{cccc}
\toprule
Dec        & Bin               & Octal         & Hexa \\
\midrule
\midrule
\midrule
\midrule
\bottomrule
\end{tabular}

\end{center}

}

\end{document}


Result:

-
Er... Most of the examples there look really awful :-( –  Stephan Lehmke May 4 '13 at 12:06
For me it looks like a gallery of what is possible - NOT a gallery of what is beautiful. –  Hans-Peter E. Kristiansen May 4 '13 at 12:30
No vertical lines + booktabs is the way to go :) –  Jubobs May 4 '13 at 12:55