If you like pretty tables in plaintext like the one that follows, read on!
|-----------+--------------|
| col a | col b |
|-----------+--------------|
| something | that resizes |
| very | easily |
|-----------+--------------|
Tables are often a great way to present information. They allow you to present a lot of data in a dense format, and to allow easy comparison across distinct dimensions by scanning horizontally and vertically.
There is quite a bit more that goes into layout out data, that I might get to some other day.
For now, let's call out how important it is to be clear and avoid confusing your reader. To do that, you want formatting to be clean and properly done.
For plaintext files, Emacs' org mode is great.
A ton has been written about Emacs' org mode. It has many, many features, allowing you to organize information around topics, agendas, keywords, sections, etc.
Much of that can be overwhelming, but some features such as outlines and collapsing text are very easy to get started with.
Another such feature is tables. Like outlines, it's very useful on its own, without having to integrate into broader systems for you to get value out of them.
To get started, simply type a couple of pipes and start writing inside. Keeping adding text and pipes, then navigate around with tabs. As you add text to cells and move around, the whole thing rearranges. Pretty magical.
Now, you might not want to use the full org mode - there are many features, some keybidings might be different from what you're used to, and it's a relatively heavy mode to use.
Worry not! There is a minor mode you can add anywhere, the orgtbl minor mode.
For example, if you want a table in your code comments, simply enable it with M-x orgtbl-mode and then start writing your table. Easy, fast, and a great editing experience.
Markdown tables are very, very similar - see the Github reference for examples. This is another mode where I very frequently use orgtbl mode.
A few things to watch out for:
+
sign will throw markdown off, so avoid using that and stick to pipes everywhere.Happy tables!
Tags: emacs