A week ago, I wrote about Matt Magire’s use of Emacs and Org mode to prepare notes for the students in his mathematics classes. In his post, Magire mentioned that Org mode was especially useful for producing tables for export to LaTeX.
In a new post, Magire talks a little about how to produce really nice LaTeX tables with Org. Many, many years ago when I was first starting to use Org, I watched a video by Carsten Dominik giving a talk at Google about Org mode and the host mentioned in his introduction how Org made it particularly easy to produce nice tables in HTML. The same thing applies to LaTeX. If you’re familiar with LaTeX you know what a pain producing tables can be. Org simplifies the process considerably.
As a first approximation, you can simply build a table in Org using its excellent table editor and then export it to LaTeX but, as Magire shows, you can do a lot better. Using the tabularray package it’s very easy to provide small tweaks to your table that makes the final exported product much nicer.
The secret is just specifying the necessary parameters in the #+attr_latex:
parameter for the table. You can color certain cells, specify alignment on a column basis, and even create empty cells when it make sense. Take a look at Magire’s post for the details.
Most of us are happy just to take advantage of the benefits Org gives us out of the box but with a tiny bit more effort, you can produce really nice typeset tables.