How to Make Awesome Latex Tables

by Jess K on September 13, 2013

Sometimes the normal tables in LaTeX just don’t do it for you.  You want to do something fancier or customize the table in a way that you just can’t do using the normal tabular environment.  This is why I like using the Deluxetable style in latex.  Deluxetable makes tables that are more flexible, and overall have a nicer look than normal latex tables. Deluxetable can handle multi-page tables, footnoting, multi-column headers, and much more that the tabular environment can’t do. Below is an example of a cool table with some nice features that I made for my thesis using the Deluxetable style package:

Some nice features of this table: adjustable table width, 1 or 2 line column headings are aligned at center, 1 or 2 line data sets are aligned at center, adjustable heights of rows.

Below is the code used to generate the above table.  Note that you need the file deluxetable.sty and the package nicefrac:

\begin{deluxetable}{cccccccc}
\tabletypesize{\footnotesize}
\tablecolumns{8}
\tablewidth{0pt}
\tablecaption{ Cross-correlation Fit Details \label{table:results1}}
\tablehead{
\colhead{QSO} \vspace{-0.2cm} & \colhead{$R$ Range} & & & & & \colhead{Separation} & \colhead{Result}\\ \vspace{-0.2cm}
& &  \colhead{$\langle f \rangle$} & \colhead{$r_0$} &  \colhead{$\gamma$} & $W$ & & \\
\colhead{Division} & \colhead{(Mpc/h)} & \colhead{} & \colhead{} & \colhead{} & & \colhead{(\%)} & \colhead{Strength}}
\startdata
\vspace{-0.2cm} \nicefrac{1}{3} Bright & & $4.24 \cdot 10^{-4}$ & 6.19 & & 96.97 & & \\ \vspace{-0.2cm}
& [0.3,3] & & & 1.77 & &  96.7 & 1.9$\sigma$ \\
\nicefrac{2}{3} Dim & & $4.26 \cdot 10^{-4}$ & 4.48 & & 52.77
\enddata
\vspace{-0.8cm}
\tablecomments{Luminosity dependent quasar clustering using a cross-correlation technique between CS82 galaxies ($M &lt; 23.5$) and SDSS, BOSS, and 2SLAQ quasars \hbox{($0.5 < z < 1.0$)}.  The quasars were broken up into the \nicefrac{1}{3} brightest and \nicefrac{2}{3} dimmest, and a cross-correlation function was calculated between a range of \hbox{$[0.3-3.0]$ Mpc}.  A power-law fit to the data of the form $\xi(r) = (r_0 / r)^\gamma$ found that $\gamma = 1.77$ and $r_0 = 6.19$ for the bright sample and $r_0 = 4.48$ for the dim sample.}
\end{deluxetable}

Here is an example of a more complicated Deluxetable from Charles Danforth at University of Colorado.

{ 5 comments… read them below or add one }

1 Camila May 17, 2014 at 4:30 pm

Many thanks for your example! I was trying to center the caption text and this works excellent :)!

Reply

2 Klaus Lang October 19, 2014 at 4:15 pm

Hello, I get probs with your example with Lyx on Windows 64 bit and Miktex.
Deluxetable.sty seems to be fully ignored
Do I really need deluxetable.sty and where I have to move it to.
Isn´t it sufficient to take aastex?

Reply

3 Joshua February 25, 2015 at 3:38 pm

Can you put the source code for your table?

Reply

4 Klaus Lang June 27, 2015 at 1:08 pm

Hello Joshua, sorry for my delay,
I overlooked my post. Just take the example above (Table 1.4.)
I get a nice result with Inlage 4 but only errormessages with Lyx.
Anny idea why?
And what´s about latexml and htlatex? Can they handle this type of tables at all?
Regards from Germany
Charlyms

5 Abhishek June 24, 2015 at 2:19 pm

Hi-
I have been try to put the table right after text in my paper. It never works. The table is somewhere placed in appendix. I tried using [h] but all it does nothing.
—-
\begin{deluxetable}{lccrr}[h]

I didn’t use the package deluxetable.sty and atleast it works fine. If I use the package, I get several errors like; \newcommand\nodata{ ~$\cdots$~ }% already defined.

Thanks
Abhi

Reply

{ 2 trackbacks }

Leave a Comment

Previous post:

Next post: