8

I'm using LaTeX to write technical reports and datasheets. Due to their nature, the documents often contain all kinds of tables, either big or small, text or numbers, sideways or not, values spanning multiple columns and/or multiple rows, etc. To achieve the results I want, I find I often need to include a large number of packages all for only the tables, such as booktabs, widetable, multirow, makecell, rotating, the tables option from xcolor, tabularx, ctable, longtable, threeparttable, and possible also captionof and tablefootnote. These and more for doing styling of tables only.

After deciding what I want it becomes a puzzle of sorting out which packages could do the job, and if they can be combined together in some way. More often than not there will be some clash or unexpected behaviour, meaning I will need to compromise between the style of my table and the amount of time I can spend on fixing it. I find my time spend on getting the tables right to be dis-proportionally large compared to the amount of time I spend on generating the table content. (Which is exactly the opposite of why I like LaTeX.)

So my question: Why are there so many different packages that all deal with different things you can do with tables and why are they not integrated in one comprehensive package? It would seem to me that "a table" is sufficiently constraint and sufficiently common to merit one complete solution?

Maybe there is such a package? --> Then I would like to know which it is.

Or maybe this structuring is more obvious if you know how LaTeX (and LaTeX package development) works internally? --> Then could someone explain it or maybe provide some pointers to resources that can help me make nicer tables quicker?

Edits

David Carlisle pointed out a similar question: Is there an easy-to-use, all-encompassing table package? (I had not found that one yet.)

That question is better formatted to get a 'good' answer. (The question is less 'opinion based' than how I phrased mine right now.) The main point however remains the same: What overarching package for tables is available? But given that that question and answer is already 7 years old, maybe there are some recent developments? ---> https://ctan.org/pkg/nicematrix seems to be just that. (First appearance ~early 2018)

4
  • 2
    Tables are just difficult. I'm a proponent of ConTeXt, another format based on TeX which doesn't rely on third-party packages for most of its work and provides more versatile tables: wiki.contextgarden.net/TABLE. However, even here we have a lot of mechanisms to do tables because no one fits everyone's needs. The same happens with LaTeX. The "right" package/environment depends on your specific needs, I'm afraid to say – Jairo A. del Rio Feb 4 at 11:26
  • duplicate of this tex.stackexchange.com/questions/139991/… and tex.stackexchange.com/questions/243847/… (although that one clsed as "opinion based") – David Carlisle Feb 4 at 11:35
  • I totally agree with your comment. I don't understand why you need a Master in Tablelogy to do such a basic task. In my case the tables are generated elsewhere (databases, spreadsheets, R, ..) and then transferred to LaTeX to write the report. In my workflow I use the Excel2LaTeX add-in to get a good approximation and upgrade from there, if needed. I recently found that the nicematrix package incorporates many of the functionality of other packages, fixing the issue of out-of-sync updates – Simon Dispa Feb 4 at 12:26
  • I try to use as few packages as possible, and stick with tabular and longtable for the most part. It depends on what features you need to use. – John Kormylo Feb 4 at 16:14
7

If you don't need breakable tabulars nor the x of tabularx, I would suggest my package nicematrix with its environment {NiceTabular}.

3
  • 1
    Hello Pantigny. Thanks for the suggestion, but this feels like just another package to add to the long list of table related packages. Why is this package better than the others? – Rob H. Feb 4 at 12:24
  • (I will check it out though, to see if it does what I want.) – Rob H. Feb 4 at 12:39
  • If just checked out the documentation for nicematrix, and that actually seems to be just what I was looking for! I have not yet tried it in practice, but certainly will do so in the near future. But even just based on the examples in the documentation I am impressed enought to mark this as the correct answer. Thanks @F. Pantigny – Rob H. Feb 4 at 13:03
0

I usually just use table and tabular. I write the tabular inside the table enviroment so I can change the position of the table using the package float. Example:

\documentclass[10pt,a4paper]{article}
\usepackage{float}
\begin{document}
        \begin{table}[H]
            \centering
            \begin{tabular}{lll}
                \textbf{Hi} & \multicolumn{1}{c}{\textbf{I}} & \textbf{hope} \\
                \textbf{my} & \textbf{} & \textbf{answer} \\
                \textbf{is} &  & \textbf{helpful}
            \end{tabular}
        \end{table}
\end{document}

you should also check this page https://www.tablesgenerator.com/ . You can either import a CSV or write in a easier way the table and it will generate the latex code you need. I hope this is helpfull

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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