9

As a graduate student, I use org-mode to keep track of articles for a lit review. I love tables for their organization, but by default org-mode spreads out tables to fit the content of its fields. How can I fix the width of a column so it doesn't expand if the content gets too long?

10

Per the org-mode manual, you can fix the width of an org-mode table column by putting <width> on a line somewhere in that table. I usually put it in its own line directly under the column headers, but anywhere in the column will work.

For example, here are the first two lines of a table:

| Citekey | Topic | Results |
| <15>    | <20>  | <40>    |

When the columns are next aligned, this will fix the width of the first column to 15 characters, the second to 20, and the third to 40. Content that exceeds the width of the column will be truncated with a => to indicate more content. Mousing over the field will show the full contents.

2
  • 1
    From the manual: 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. – protoboolean Feb 22 '18 at 21:37
  • The column widths for empty columns do not seem to make it into exported PDFs. That is, the widths of columns in the exported files seem to be determined only by the contents of the table cells. – Reb.Cabin Nov 25 '19 at 16:10
2

As mentioned by @Ryan you can use column width cookie <width>. But to make it working in Org 9.2+ you have to put #+startup: shrink in to top of the file or set variable org-startup-align-all-tables to have this behavior in all buffers by default.

(setq org-startup-align-all-tables t)

4
  • 1
    In order for this to take effect, you will need to either revert (i.e. reload) the buffer using M-x revert-buffer or press C-c C-c on the #+startup: shrink line. – Lorem Ipsum Aug 16 '19 at 18:29
  • In 2019 this is the better answer – vfclists Sep 23 '19 at 23:42
  • 1
    There are two mistakes in this answer. 1. org-startup-align-all-table variable should be org-startup-align-all-tables (note the plural) 2. To make org-mode automatically shrink tables, you need to set org-startup-shrink-all-tables instead of org-startup-align-all-tables. – Shou Ya Mar 11 at 10:18
  • @ShouYa thanks I amended the answer. – Navidot Mar 11 at 18:09

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.