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


3.2 Column Width and Alignment

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

Editing a field may modify alignment of the table. Moving a contiguous row or column—i.e., using TAB or RET—automatically re-aligns it. If you want to disable this behavior, set org-table-automatic-realign to nil. In any case, you can always align manually a table:

C-c C-c (org-table-align)

Align the current table.

Setting the option org-startup-align-all-tables re-aligns all tables in a file upon visiting it. You can also set this option on a per-file basis with:

#+STARTUP: align
#+STARTUP: noalign

Sometimes a single field or a few fields need to carry more text, leading to inconveniently wide columns. Maybe you want to hide away several columns or display them with a fixed width, regardless of content, as shown in the following example.

|---+---------------------+--------|           |---+-------…|…|
|   | <6>                 |        |           |   | <6>   …|…|
| 1 | one                 | some   |   ----\   | 1 | one   …|…|
| 2 | two                 | boring |   ----/   | 2 | two   …|…|
| 3 | This is a long text | column |           | 3 | This i…|…|
|---+---------------------+--------|           |---+-------…|…|

To set the width of a column, one field anywhere in the column may contain just the string ‘<N>’ where N specifies the width as a number of characters. You control displayed width of columns with the following tools:

C-c TAB (org-table-toggle-column-width)

Shrink or expand current column.

If a width cookie specifies a width W for the column, shrinking it displays the first W visible characters only. Otherwise, the column is shrunk to a single character.

When called before the first column or after the last one, ask for a list of column ranges to operate on.

C-u C-c TAB (org-table-shrink)

Shrink all columns with a column width. Expand the others.

C-u C-u C-c TAB (org-table-expand)

Expand all columns.

To see the full text of a shrunk field, hold the mouse over it: a tool-tip window then shows the full contents of the field. Alternatively, C-h . (display-local-help) reveals them, too. For convenience, any change near the shrunk part of a column expands it.

Setting the option org-startup-shrink-all-tables shrinks all columns containing a width cookie in a file the moment it is visited. You can also set this option on a per-file basis with:

#+STARTUP: shrink

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>’ or ‘<l>’ in a similar fashion. You may also combine alignment and field width like this: ‘<r10>’.

Lines which only contain these formatting cookies are removed automatically upon exporting the document.


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