0

Here's a hypothetical table that keep tracks of cloud content.

+-----------------------------+----------+-------------------+
| file | server | uname |
+-----------------------------+----------+-------------------+
| file1          | google    | uname1                      |
| file2 | mega | uname2 |
| file3            | dropbox     |   uname3                   |
+-----------------------------+----------+-------------------+
  1. Is there a command to make | align with the respective +?
  2. Better yet, is it possible to automatically set the + to accommodation the largest entry in the corresponding column?

a) I tried org-table-align on each row, and it did not work.

UPDATE:

I've realize that a) meets the requirement 2. So that leaves 1.

1 Answer 1

2

Use orgtbl-mode, unless you are in an org-mode file in which case the tables should just work automatically. If that’s not suitable, then please expand your question to include more relevant information.

Edit: If you’re in an org file, the table syntax that it expects looks like this:

|-------+---------+--------|
| file  | server  | uname  |
|-------+---------+--------|
| file1 | google  | uname1 |
| file2 | mega    | uname2 |
| file3 | dropbox | uname3 |
|-------+---------+--------|

Note that every line, including the rules, starts with a | character.

Pressing tab will reflow the table to make the columns line up, and move you to the next cell. Hitting enter does the same but then moves you down to the next row.

2
  • M-x org-table-align is invokable, just doesn't do the job. I started from an empty *org file to make sure something else wasn't corrupting it. Should the cursor be positioned somewhere in particular?
    – user19777
    Jan 20, 2023 at 5:26
  • 1
    You are showing a table.el table in your question. If you want an Org mode table, you should enter it the way @db48x shows in the answer: | at the beginning and end of each row and in-between columns; I would worry about the contents of the table, not the "rules" (hlines or whatever you want to call them) - you can add those later (e.g. with org-table-insert-hline, although I tend to just open an empy line and type |-TAB).
    – NickD
    Jan 20, 2023 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.