1

Org tutorial for tables

 1 year ago
source link: https://orgmode.org/worg/org-tutorials/tables.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Creating a table

While typing

The easiest way to create a table is to directly type the "|" character at the beginning of a line, or after any amount of white space. This will put you in the first field of an atomic table.

| This is the content of the first cell

Once you've finished editing this cell, you can jump to the next one by pressing TAB. Since the row you just started only contains one cell, the next cell is really the first cell of the next row.

| This is the content of the first cell |
| < Here I am after pressing TAB        |

By creating the structure and filling it

You can also create a table from scratch with C-c |. You will be asked for the structure of the table, the default being 5x2 (see org-table-default-size), five columns and two rows:

|   |   |   |   |   |
|---+---+---+---+---|
|   |   |   |   |   |

Then you can jump from one field to another with the TAB key (jump to the next cell) or S-<TAB> (jump to the previous cell). RET will jump to the to the next cell in the same colum, and create a new column if there is no such cell (or if the next row is beyond a separator line.)

By converting a region into a table

Org provides useful ways of converting a region into a table. For this, select a region and press C-c |. For example, press C-c | on this:

some, comma, separated, values

will automagically produce this:

| some | comma | separated | values |

Usually, this command should be smart enough to guess what is the field separator for the region. If each line of the active region contains a TAB or a comma, it will assume this is the separator.

  • If you want to force the comma as a field separator, press C-u C-c |.
  • If you want to force TAB as a field separator, press C-u C-u C-c |.
  • If you want to force a specific number of spaces – say 3 – use C-u 3 C-c |.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK