10

IS there a way to 'texify' an ASCII table written with Emacs' orgtabl-mode. Creating tables in this mode is extremely simple.

E.g. suppose I have this table

|------+-----+-----|
|    A |   B |   C |
|------+-----+-----|
| 2.34 | 2.7 | 8.9 |
| 3.67 | 4.5 | 8.9 |
|------+-----+-----|

If in EMACS, I could highlight this region and do soething like M-x texify or whatver to generate the latex code for that table that would save me a lot of pain.

Any non-emacs suggestion is also welcome.

Múna
  • 312
  • 3
  • 11
smilingbuddha
  • 14,334
  • 33
  • 112
  • 189
  • Is the table in question too large to convert it to the LaTeX `tabular` environment manually? – David Z Dec 15 '11 at 01:35
  • 1
    Yes. But even for small tables if such a functionality is possible that would be helpful. Making tables in latex is such drudgery. :D – smilingbuddha Dec 15 '11 at 01:38

3 Answers3

16

You could use orgtbl-mode. In your latex buffer, do M-xorgtbl-mode, add

% BEGIN RECEIVE ORGTBL thenameofthetable
% END RECEIVE ORGTBL thenameofthetable

where you want the table to be.

add

#+ORGTBL: SEND thenameofthetable orgtbl-to-latex :splice nil :skip 0
|------+-----+-----|
|    A |   B |   C |
|------+-----+-----|
| 2.34 | 2.7 | 8.9 |
| 3.67 | 4.5 | 8.9 |
|------+-----+-----|

after the \end{document}

and do C-cC-c on the org-mode table

The other solution is already given by Michael Hoffman: use org-mode export capability with C-cC-el

Rémi
  • 8,172
  • 2
  • 27
  • 32
5

C-cC-el should do it.

Michael Hoffman
  • 32,526
  • 7
  • 64
  • 86
  • This won't work for orgtbl-mode tables, since they aren't in their own org-buffer. Rémi's suggestion is how you include orgtble into a latex document. – Jonathan Leech-Pepin Dec 15 '11 at 15:34
0

In org-mode, put your cursor in the table, and M-x org-table-export exports the table in a file.

Anthony Scemama
  • 1,563
  • 12
  • 19