smilingbuddha
smilingbuddha

Reputation: 14660

Converting an org-mode table to LaTeX

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.

Upvotes: 10

Views: 4233

Answers (3)

Anthony Scemama
Anthony Scemama

Reputation: 1593

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

Upvotes: 1

Rémi
Rémi

Reputation: 8332

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

Upvotes: 16

Michael Hoffman
Michael Hoffman

Reputation: 34304

C-cC-el should do it.

Upvotes: 6

Related Questions