I've read a couple of questions recently about tabular
environments, and it seems there's a whole bunch of packages that do stuff in this field. I'd really like a summary of what each package does, and which conflict.
For example a quick google (plus my memory) got me tabularx
, booktabs
, multirow
, collcell
, array
, mdwtab
, longtable
, supertabular
…
Which should I be using for what purposes? And more importantly, which conflict?
[Should this be CW? One package per answer sort of thing?]
Best Answer
I would like to start with a small list that used to be part of the tables wiki and is now maintained here. Overview of packages
Basic packages
array
offers more flexible column formatting; fixes to some spacing issues. An almost "must-use" package.booktabs
supports professional looking tables; better vertical spacing; better rules; specifically designed for tables without vertical lines (the norm for publication-quality tables).tabularx
provides a column type which expands to fill the specified width of the table.tabulary
provides column types which are proportional to the natural width of their contents.multirow
lets tabular material span multiple rows.dcolumn
creates columns which align on a decimal marker. Similar packages:numprint
,rccol
,warpcol
. Cf. alsosiunitx
below.tabularht
sets the tabular with a specified height.Multi-page tables
longtable
provides tabulars that can split across pages.ltxtable
combines features oflongtable
andtabularx
.ltablex
also combines features oflongtable
andtabularx
.supertabular
provides tabulars that can split across multiple pages.xtab
extendssupertabular
by some features and improves page breaking.xltabular
improves the behavior ofltablex
and combinesxtabular
convenience withlongtable
.Captioning and notes
threeparttable
typesets tables with captions and notes matching width.threeparttablex
provides the functionality ofthreeparttable
to tables created usinglongtable
.floatrow
(although mainly about customizing layouts of float environments) allows for footnotes and additional explanations in tables.ctable
allows notes/footnotes below tables and figures with the use of a command instead of an environment.Science
siunitx
(although mainly about typesetting values with units) provides theS
column type that aligns on a decimal mark.Color and fancy features
colortbl
is intended for colored rows/columns/cells. Thexcolor
package with thetable
option provides alternating table row colors to extend it.arydshln
can print horizontal and vertical dashed lines.delarray
adds delimiters (braces, parentheses, brackets) to arrays.bigdelim
inserts variable-sized multi-row delimiters into a table.blkarray
splits arrays into blocks and add delimiters for each block.makecell
multiple line cells, better headers, gape in cells, numbered rows, thick lines, diagonally divided cells, etc.diagbox
diagonally divided tabular cell.hhline
better double line producing.tabularkv
adds a key value interface for tabular properties.All-rounder
tabu
is a single package that provides much of the functionality of many of the above packages. It is unmaintained and usage currently not recommended.tabularray
is a newLaTeX3
package that provides much of the functionality oftabu
package. It is an alternative for the outdatedtabu
package.nicematrix
is aLaTeX3
package which constructs matrices and tabulars based on standard environments of LaTeX,array
andamsmath
but constructs also PGF/TikZ nodes under the cells, rows and columns. The final user can use these nodes directly with TikZ but the package provides also functionalities (using these nodes under the hood) for colored rectangles, rules, exterior row and columns, continuous dotted lines in the matrices, etc. It is compatible withbooktabs
but not withlongtable
.Which packages are especially recommendable? A quick guide:
array
is a universal talent for tuning whole columns by commandstabularx
is great for auto-sizing columnsbooktabs
is a must for professional-looking layoutlongtable
is very popular for multi-page tables.Choose further packages depending on the required features.
Package conflicts
xtab
andsupertabular
don't work together. Loading both would cause a conflict.xtab
should be preferred, since it's written as an extension tosupertabular
.According to the manual,
arydshln
has to be loaded afterarray
,longtable
,colortab
, andcolortbl
, respectively. Such a problem occurred in this question: Cannot insert multirow within multicolumnAlso,
arydshln
conflicts withsupertabular
.ltablex
can interfere withtabularx
uses in two-column documents (because it useslongtable
which cannot simply be put in floats), see there.