Yotam
Yotam

Reputation: 10675

exporting vertical lines in org mode table to LaTeX

I'm using emacs as my editor and I am toying with org-mode which looks rather useful.

I'm generating a table (spreadsheet) in org mode and it is exported correctly to LaTeX apart from the vertical lines. Is there a way to export them? I want to have a way to define some of the vertical lines as visible.

Upvotes: 18

Views: 10044

Answers (4)

rvf0068
rvf0068

Reputation: 1389

You can give the format to the table for LaTeX with #+attr_latex:, say:

#+attr_latex: :align |c|c|c|
|------+-----+-----|
|    A |   B |   C |
|------+-----+-----|
| 2.34 | 2.7 | 8.9 |
| 3.67 | 4.5 | 8.9 |
|------+-----+-----|

In older versions this used to be:

#+attr_latex: align=|c|c|c|

but this no longer works.

Upvotes: 27

SkydiveMike
SkydiveMike

Reputation: 111

You should use Column Groups

can use a special row where the first field contains only ‘/’. The further fields can either contain ‘<’ to indicate that this column should start a group, ‘>’ to indicate the end of a column, or ‘<>’ to make a column a group of its own. Boundaries between column groups will upon export be marked with vertical lines.

This has the advantage of working in HTML export as well as LaTeX export.

Upvotes: 6

cm2
cm2

Reputation: 1815

You want to use the #+attr_latex attribute to the table environment. Here you can specify various features like the alignment and width. See http://orgmode.org/manual/Tables-in-LaTeX-export.html for the manual information.

Upvotes: 1

choroba
choroba

Reputation: 241758

Vertical lines in latex are defined by the | character in table definition. So, just separate the l's and r's with |'s in the \tabular definition before running latex, for example like this in Perl:

perl -pe 's/(\\begin{tabular}{)(.*)}/$1 . join("|", split m{}, $2) . "}"/ge' < table.tex

Update: Oh I see. According to the documentation, you should be able to indicate column groups by

| / | < |   |   | > | <> | < | > |

But, when I try it in my version of emacs and org-mode, nothing happens.

Upvotes: 1

Related Questions