Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 426
smilingbuddha Avatar asked Dec 15 '11 01:12

smilingbuddha


2 Answers

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

like image 103
Rémi Avatar answered Oct 18 '22 05:10

Rémi


C-cC-el should do it.

like image 38
Michael Hoffman Avatar answered Oct 18 '22 06:10

Michael Hoffman