Suppose I want to edit a table

moon & 456456456423423534 &  2342523
sun  &             234324 &     3453

You see I have to enter a lot of spaces manually to align stuff. It is ok for a small table but for a large table this is inefficient.

I wonder there there is an editor that I can easily write tables in human readable script. I am familiar with vim and Ultraedit though I don't know which functionality specifically I should use. Perhaps there are software better than vim and Ultraedit for this purpose.

  • Sorry, let me be specific. I understand how to do it in vim. But suppose my work place doesn't have vim , but only ultraedit. Is there a way to do this in using Ultraedit? Commented Mar 1, 2012 at 15:22
  • 10
    No vim on the workstation? Change the employer!
    – Marco
    Commented Mar 1, 2012 at 15:39
  • New question, how to do this in Kile? Commented Mar 6, 2012 at 4:33

9 Answers 9


I am very happy with vim and the tabular plugin. To align the table, place the cursor anywhere inside the (nonaligned) table and type :Tabularize /&. The result is a nicely aligned table.



Then a :Tabularize /&, after:

moon & 456456456423423534 & 2342523
sun  & 234324             & 3453

If you need this often, you can assign a custom shortcut for this.

  • 1
    You beat me by 10 seconds. :) Nice plugin. There's a video tutorial on how to use it. :) Commented Mar 1, 2012 at 14:43
  • Thank you, can you tell me how to assign a this function as 'control-E' in vim. I forgot the syntax of keyboard shortcut in vimrc Commented Mar 1, 2012 at 15:07
  • @ZwingliTannenbaum You can assign a mapping in command mode with :nmap <Leader>at :Tabularize /&<CR> or in insert mode with :imap <Leader>at <ESC>:Tabularize /&<CR>i. I choose <Leader> (which is the backslash by default) to avoid interference with the scrolling (<CTRL>-e). at simply stands for “align table”, but you are free to pick another mnemonic.
    – Marco
    Commented Mar 1, 2012 at 15:33
  • Sorry I have a lot of trouble in installing tabularize.vim as a plugin. I use Mac and Windows and Linux, I want to install tabuliarze.vim on all three, the supposedly autoloaded plugin directory just doesn't get autoloaded, I tried a whole bunch different directories but it just doesn't get loaded, is there a way to "force load" tabularize.vim, say put in vimrc file . "loadplugin /.vim/plugin/after/tabularize.vim" Commented Mar 1, 2012 at 16:01
  • 1
    @ZwingliTannenbaum What about trying either of then and check which one works? A try will not nuke your system.
    – Marco
    Commented Mar 1, 2012 at 20:11

In emacs, AUCTeX includes align.el, which provides the command align-current: select the content of the table, and run M-x align-current, and it will auto-align the columns, producing the same result as in @Marco's answer

  • Sorry I don't use EMACS, how to do it in VI or ultraedit? Commented Mar 1, 2012 at 14:52
  • 3
    @ZwingliTannenbaum, I don't use VI or ultraedit :) Marco's presented one approach in vim, and your question just asked if there was some editor that did table-editing well. If vi or ultraedit are actually requirements in your question, you may want to edit it to clarify that a bit.
    – Ben Lerner
    Commented Mar 1, 2012 at 15:03

On a mac

With Texshop

1) You can use a matrix panel

enter image description here

2) Remark from Alan Munn

In TeXShop you can also use a spreadsheet for the cells and then paste them with Paste Spreadsheet Cells from the Macros menu

With TextMate

enter image description here

1) you begin with a selection like this

  12 15 13
  1 2 3 

then you select "convert selection to table" or you type "shift control command T" to get

12 15 13\\
1 2 3\\

2) you can use "Create Table" and you give the number of rows and column then with TAB you can move from cell to cell

  • 1
    In TeXShop you can also use a spreadsheet for the cells and then paste them with Paste Spreadsheet Cells from the Macros menu.
    – Alan Munn
    Commented Mar 3, 2012 at 14:18
  • @AlanMunn Now I no longer use TexShop also I had forgotten this possibility. I add your remark in my answer Commented Mar 3, 2012 at 15:08
  • How to do this in WinEDT? Commented Mar 3, 2012 at 18:42
  • I don't know WinEdt sorry :( Commented Mar 3, 2012 at 19:50

Disclaimer: I also use the Tabular plugin in Vim (see Marco's answer). :)

There's a similar Vim plugin called Align which behaves pretty much the same as Tabular.

moon & 456456456423423534 & 2342523
sun & 234324 & 3453

By issuing :Align &:

moon & 456456456423423534 &  2342523
sun  &             234324 &     3453

You can also use multiple separators at once, e.g, :Align = + - \* /.

There's also another command called AlignCtrl which has more options, including text alignment (left, right, center). By using the > operator, you can right-justify the table just like the question example.

Lots of examples can be found in the GitHub repo.


When I studied Astronomy over 20 years ago knowledge of Unix was assumed.

$ more myfilename.csv
moon & 456456456423423534 & 2342523
sun  &234324 &        3453

and now

$ cat myfilename.csv | column  -t                     
moon  &  456456456423423534  &  2342523
sun   &  234324              &  3453

With little fiddling you can easily align columns to the right!


The next function uses the tabular plugin in Vim to automatically align table columns as you type them (once you have typed the first row):

function! s:ealign()
    let p = '^.*&\s.*$'
    if exists(':Tabularize') && getline('.') =~# '^.*&' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
        let column = strlen(substitute(getline('.')[0:col('.')],'[^&]','','g'))
        let position = strlen(matchstr(getline('.')[0:col('.')],'.*&\s*\zs.*'))
        normal! 0
        call search(repeat('[^&]*&',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))

To make it work only with tex files add the following to your vimrc file:

augroup ft_tex
    au Filetype tex inoremap <buffer> <silent> & &<Esc>:call <SID>ealign()<CR>a
augroup END

For winedt, there is a plugin: TeXtab. You can find the installtion instructions in the page itself. To quote from there:

The macro formats selected lines with respect to & and \\. It disregards \&

There are two ways to format the selected lines:

formatting with blanks leading and trailing & and \\:


will be changed to

aaaaaaaaaa & bb\&bbbbbb & ccccccc &    & \\
eeee       & fffff      & gggg    & hh & ii  & jjjjjjj & kkkkkkkk \

formatting without blanks between text and separators:

aaaaaaaaaa&bb\&bbbbbb&ccccccc&  &\\
eeee      &fffff     &gggg   &hh&ii &jjjjjjj&kkkkkk\

How do you use the macro:

Select full lines containing lines of a tabular block. Choose in menu Edit one of the menu item Format TeX-Tables with blanks or Format TeX-Tables without blanks (ALT e x or ALT e o).


1. LaTable and Tablas

On Windoz, you can use LaTable

LaTable at CTAN

or Tablas

Tablas 3.0

LaTable may have some small quirks under Win7. Both programs produce LaTex code to copy and paste into a LaTex manuscript, or saved as separate files, which you can input in your manuscript.

2. CSVed and uniCSVed

Sam Francke has written two very potent programs for manipulating CSV-files. You can easily adopted those to a LaTex workflow. Have a look at the home page of CSVed and uniCSVed

CSVed is the most feature rich of the two programs. You can manipulate CSV-files in more of less every thinkable ways. CSVed is especially capable for editing CSV-files with lot of records, which you can inputas table body in a longtable or tabular environment. The author is also looking into the possibility to add options to save to LaTex format (also an option to automatically escape LaTex special characters). Limitation: You cannot save in a UTF8 format (uniCSVedit can). Until the export filter is ready, you have to input the file between suitable table environments in your manuscript, after you have added \\. On the other hand, you can use Nicola Talbot's datatool-package to merge the resulting CSV-file into a LaTex table.

uniCSVed has less features than CSVed, but you can save your file in Unicode (also without BOM). Links to uniCSVed are:

uniCSVed with installer
uniCSVed portable

uniCSVed can save the CSV-files in a format usable for LaTex (i.e. with & and \\).

  1. Open a file to convert (has to be UTF8 with or without BOM), or create a new file
  2. Go to TAB Modify 2 and add the suffix \\ to the last column
  3. Go to first TAB and change separator at Other &
  4. Open menu File - Encode in and select UTF-8 wo BOM
  5. Save your file and is ready for LaTeX


Also, the free cross-platform LaTeX editor TeXmaker has a very capable Table Wizard. But as most Wizards, this is a one-shot. When you have closed the Wizard, you are left with the usual LaTeX-code in the manuscript. It cannot be reloaded in the Wizard for further editing.

  • How to do this in WinEDT? Commented Mar 3, 2012 at 18:42
  • @Zwingli Tannenbaum. The author of Tablas has some WinEDT macros on his homepage. informatica.us.es/~calvo/prog/macros.zip
    – Sveinung
    Commented Mar 3, 2012 at 19:11
  • latable and tablas work with linux/wine! small but excellent for the job.
    – alfC
    Commented Mar 6, 2012 at 22:03

OpenOffice.org allows to use any character as column separator for CSV (comma-separated values file format), so if you write large tables, you can put their data in a separate file and edit it there.

Here is some how-to on this functionality.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .