24

What are the general differences between the various table environments that exist for LaTeX? By this I mean: What are their basic purposes? Which ones are the most important ones for new users? Which ones are more advanced and should only be used by advanced LaTeX users? Are there differences in terms of the appearance of the table? How does the booktabs package play into this?

In short, where will you use each of them and what are merits and disadvantages of each of them. This question is especially useful to LaTeX newcomers, for whom the number of options can seem overwhelming.

closed as too broad by percusse, user13907, Bordaigorl, Heiko Oberdiek, Mico Dec 1 '14 at 19:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    For starters, see the posting Difference between tabular and array environment. – Mico Dec 1 '14 at 17:07
  • 1
    Sounds a bit too broad, it almost requires to dump the whole documentation about each in the answer! Could you focus on one specific aspect? For example just "purpose" or "spacing flexibility"... – Bordaigorl Dec 1 '14 at 18:07
  • 1
    When there is such a nice answer to this question, why do you want to put it on hold – Vaibhav Dec 5 '14 at 9:05
  • 1
    See also Differences between longtable and xtab. – Gilles May 18 '16 at 16:39
  • 3
    While this question is broad, it's not too broad, because, well, people are faced with this question exactly. – einpoklum Aug 5 '17 at 9:22
32

The difference between array and tabular is discussed formally in Difference between tabular and array environment, but I'll reference it here as well:

  • array is probably the fundamental tabular structure in TeX that allows for stacking thing horizontally and vertically. You don't need to include the array package in order to use an array. The package merely adds functionality to column specifications.

  • tabular is a text-version of array.

    There is also a starred version tabular* that takes a length as an additional argument, as in

    \begin{tabular*}{<len>}[<vpos>]{<colspec>}
    
    \end{tabular*}
    

    The tabular* is made to fit <len> horizontally. It's often used in conjunction with a @{\extracolsep{<width>}} in the <colspec> (typically where <width> is \fill) to spread out columns within <len>.

    See also tabularx below.

  • table is a float and has no concept of what is contained within it. While most people place a tabular-like structure inside a floating table, it can contain virtually anything. Placement of floats can be tricky, but this is covered in detail in How to influence the position of float environments like figure and table in LaTeX? and Keeping tables/figures close to where they are mentioned. In contrast to this, arrays and tabulars are placed as-is in the text, at the position they are coded.

  • tabularx is a package that extends the starred version tabular* - which requires a length to be specified - through the addition of an X-column. This new column type stretches out the tabular so that it fits within the specified fixed-width boundary. It avoids the user trying to figure out what width a p-column should be so that the resulting tabular width fits within some fixed boundary.

  • longtable provides a mixed-use case for having a too-large table that you want to split across the page boundary. Somewhat similar to wanting a non-floating table environment (in other words, having a \caption) but also allows the table to span multiple pages. That's a definite advantage, since page breaking comes with the bonus that column headers could be repeated automatically. It may require multiple compilations to settle in terms of column widths.

  • supertabular is a predecessor of longtable and remains in (not obsolete) since it provides a alternative syntax.

  • tabu attempts to provide support for all of the aforementioned structures but through a new interface/syntax.

  • longtabu - also provided by the tabu package, is a longtable version of the tabu table.

  • ltxtable pro­vides the func­tion­al­ity of longtable and tab­u­larx to­gether in­side a longtable en­vi­ron­ment.

  • 1
    I'll add some examples and syntax usage later... – Werner Dec 1 '14 at 19:19
  • 3
    booktabs should also be mentioned – MaxNoe Dec 1 '14 at 22:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.