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.

  • 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-table to have this behaviour in all buffers by default.

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

  • 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
  • @LoremIpsum yes, thanks for pointing that. – Adam Faryna Aug 16 '19 at 22:00
  • In 2019 this is the better answer – vfclists Sep 23 '19 at 23:42

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.