How to Make Awesome Latex Tables

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.

9 comments… add one
  • Camila May 17, 2014 @ 16:30

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

  • Klaus Lang Oct 19, 2014 @ 16:15

    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?

  • Joshua Feb 25, 2015 @ 15:38

    Can you put the source code for your table?

    • Klaus Lang Jun 27, 2015 @ 13:08

      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

    • Joshua Aug 31, 2015 @ 14:56

      Hi Klaus,
      My comment wasn’t addressed to you. It was addressed to the original poster of this post. I do not know how to answer your questions, sorry.

  • Abhishek Jun 24, 2015 @ 14:19

    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

  • Mary Barsony Aug 22, 2023 @ 19:07

    Thank you!!!! Whereas AASTex instructions are nearly useless, this was a fantastic example. Even more than a decade later…

Leave a Reply

Your email address will not be published. Required fields are marked *