There are facilities provided by Emacs to align text, comments, assignments, or columns.


Tables can also be used to line up text. The extension table.el, by Takaaki Ota is now available by default with emacs22.

Converting text to table gives access to a number of neat formatting features from TableMode. The next example is obtained by capturing a short text with M-x table-capture, using space as the column delimiter and a newline as the row delimiter (the newline can be entered by hitting C-q C-j or C-o). The table is then removed with M-x table-release, leaving the default left alignment.

 Firstname  Lastname         |Firstname|Lastname|         Firstname Lastname
 Alice Liddell          =>   +---------+--------+    =>                       
   Lewis    Carroll          |Alice    |Liddell |         Alice     Liddell 
                             |Lewis    |Carroll |         Lewis     Carroll