Next: , Previous: , Up: Tables   [Contents][Index]

3.2 Column width and alignment

The width of columns is automatically determined by the table editor. And also the alignment of a column is determined automatically from the fraction of number-like versus non-number fields in the column.

Sometimes a single field or a few fields need to carry more text, leading to inconveniently wide columns. Or maybe you want to make a table with several columns having a fixed width, regardless of content. To set the width of a column, one field anywhere in the column may contain just the string ‘<N>’ where ‘N’ is an integer specifying the width of the column in characters. The next re-align will then set the width of this column to this value.

|---+------------------------------|               |---+--------|
|   |                              |               |   | <6>    |
| 1 | one                          |               | 1 | one    |
| 2 | two                          |     ----\     | 2 | two    |
| 3 | This is a long chunk of text |     ----/     | 3 | This=> |
| 4 | four                         |               | 4 | four   |
|---+------------------------------|               |---+--------|

Fields that are wider become clipped and end in the string ‘=>’. Note that the full text is still in the buffer but is hidden. To see the full text, hold the mouse over the field—a tool-tip window will show the full content. To edit such a field, use the command C-c ` (that is C-c followed by the grave accent). This will open a new window with the full field. Edit it and finish with C-c C-c.

When visiting a file containing a table with narrowed columns, the necessary character hiding has not yet happened, and the table needs to be aligned before it looks nice. Setting the option org-startup-align-all-tables will realign all tables in a file upon visiting, but also slow down startup. You can also set this option on a per-file basis with:

#+STARTUP: align
#+STARTUP: noalign

If you would like to overrule the automatic alignment of number-rich columns to the right and of string-rich columns to the left, you can use ‘<r>’, ‘<c>21 or ‘<l>’ in a similar fashion. You may also combine alignment and field width like this: ‘<r10>’.

Lines which only contain these formatting cookies will be removed automatically when exporting the document.



Centering does not work inside Emacs, but it does have an effect when exporting to HTML.

Next: , Previous: , Up: Tables   [Contents][Index]