emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tables with multicolumn in LaTeX export
@ 2015-08-25 14:38 Suvayu Ali
  2015-08-25 15:13 ` Eric S Fraga
  0 siblings, 1 reply; 4+ messages in thread
From: Suvayu Ali @ 2015-08-25 14:38 UTC (permalink / raw)
  To: Emacs Org mode

[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]

Hi,

I was wondering if it is possible to have multicolumn when exporting
tables to LaTeX.  Something like the following:

|                |        | ∈ (5300,5800) |        | ∈ (5320,5420) | <- row with multicolumn
| classifier     | signal |        combi. | signal |        combi. |
|----------------+--------+---------------+--------+---------------|
| old BDT > 0.3  |  70347 |         10885 |  68502 |          4021 |
| BDT v1 > -0.08 |  68458 |         20310 |  66683 |          5853 |
| BDT v1 > -0.09 |  69418 |         22329 |  67617 |          6431 |
| BDT v1 > -0.12 |  71336 |         28674 |  69479 |          8160 |

to

\begin{tabular}{lrrrr}
 &  \multicolumn{2}{c}{∈ (5300,5800)} &  \multicolumn{2}{c}{∈ (5320,5420)}\\
classifier     & signal & combi. & signal & combi.\\
\hline
old BDT > 0.3  & 70347  & 10885  & 68502  & 4021\\
BDT v1 > -0.08 & 68458  & 20310  & 66683  & 5853\\
BDT v1 > -0.09 & 69418  & 22329  & 67617  & 6431\\
BDT v1 > -0.12 & 71336  & 28674  & 69479  & 8160\\
\end{tabular}

I am not too keen on using table.el as it uses too many lines, I would
like it to be minimal (tiny screenshot attached).  Maybe there is a
hack?  I'm not familiar with all the possibilities available via
#+attr_latex properties.  Thanks for any ideas.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: table.png --]
[-- Type: image/png, Size: 5689 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Tables with multicolumn in LaTeX export
  2015-08-25 14:38 Tables with multicolumn in LaTeX export Suvayu Ali
@ 2015-08-25 15:13 ` Eric S Fraga
  2015-08-25 16:14   ` Suvayu Ali
  0 siblings, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2015-08-25 15:13 UTC (permalink / raw)
  To: Emacs Org mode

On Tuesday, 25 Aug 2015 at 16:38, Suvayu Ali wrote:
> Hi,
>
> I was wondering if it is possible to have multicolumn when exporting
> tables to LaTeX.  Something like the following:
>
> | | | ∈ (5300,5800) | | ∈ (5320,5420) | <- row with multicolumn
> | classifier     | signal |        combi. | signal |        combi. |
> |----------------+--------+---------------+--------+---------------|
> | old BDT > 0.3  |  70347 |         10885 |  68502 |          4021 |
> | BDT v1 > -0.08 |  68458 |         20310 |  66683 |          5853 |
> | BDT v1 > -0.09 |  69418 |         22329 |  67617 |          6431 |
> | BDT v1 > -0.12 |  71336 |         28674 |  69479 |          8160 |

A kludge but you can use @@latex:...@@ in the table headings to achieve
what you want.  Not pretty, mind you, and to avoid multiple \cr being
created for the extra rows on the first line, this will only work if the
last column is part of a multicolumn.

#+begin_src org
  ,* table with multiple column spanning
  |                | @@latex:\multicolumn{2}{c}{@@\in (5300,5800)@@latex:}@@ | @@latex:\multicolumn{2}{c}{@@ \in (5320,5420) @@latex:} \\%@@ |        |        |
  |                |       <10> |       <10> |        |        |
  | classifier     |     signal |     combi. | signal | combi. |
  |----------------+------------+------------+--------+--------|
  | old BDT > 0.3  |      70347 |      10885 |  68502 |   4021 |
  | BDT v1 > -0.08 |      68458 |      20310 |  66683 |   5853 |
  | BDT v1 > -0.09 |      69418 |      22329 |  67617 |   6431 |
  | BDT v1 > -0.12 |      71336 |      28674 |  69479 |   8160 |

#+end_src

Note the \\% in the end of the last multi-column directive.

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-176-g45abec

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Tables with multicolumn in LaTeX export
  2015-08-25 15:13 ` Eric S Fraga
@ 2015-08-25 16:14   ` Suvayu Ali
  2015-08-25 22:40     ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: Suvayu Ali @ 2015-08-25 16:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi Eric,

On Tue, Aug 25, 2015 at 04:13:40PM +0100, Eric S Fraga wrote:
> On Tuesday, 25 Aug 2015 at 16:38, Suvayu Ali wrote:
> >
> > I was wondering if it is possible to have multicolumn when exporting
> > tables to LaTeX.  Something like the following:
> >
> > | | | ∈ (5300,5800) | | ∈ (5320,5420) | <- row with multicolumn

 [...]

> A kludge but you can use @@latex:...@@ in the table headings to achieve
> what you want.  Not pretty, mind you, and to avoid multiple \cr being
> created for the extra rows on the first line, this will only work if the
> last column is part of a multicolumn.
> 
> #+begin_src org
>   ,* table with multiple column spanning
>   |                | @@latex:\multicolumn{2}{c}{@@\in (5300,5800)@@latex:}@@ | @@latex:\multicolumn{2}{c}{@@ \in (5320,5420) @@latex:} \\%@@ |        |        |

This is very clever and works nicely :).  Thank you!

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Tables with multicolumn in LaTeX export
  2015-08-25 16:14   ` Suvayu Ali
@ 2015-08-25 22:40     ` Rasmus
  0 siblings, 0 replies; 4+ messages in thread
From: Rasmus @ 2015-08-25 22:40 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi Eric,
>
> On Tue, Aug 25, 2015 at 04:13:40PM +0100, Eric S Fraga wrote:
>> On Tuesday, 25 Aug 2015 at 16:38, Suvayu Ali wrote:
>> >
>> > I was wondering if it is possible to have multicolumn when exporting
>> > tables to LaTeX.  Something like the following:
>> >
>> > | | | ∈ (5300,5800) | | ∈ (5320,5420) | <- row with multicolumn
>
>  [...]
>
>> A kludge but you can use @@latex:...@@ in the table headings to achieve
>> what you want.  Not pretty, mind you, and to avoid multiple \cr being
>> created for the extra rows on the first line, this will only work if the
>> last column is part of a multicolumn.
>> 
>> #+begin_src org
>>   ,* table with multiple column spanning
>>   | | @@latex:\multicolumn{2}{c}{@@\in (5300,5800)@@latex:}@@ |
>> @@latex:\multicolumn{2}{c}{@@ \in (5320,5420) @@latex:} \\%@@ | | |
>
> This is very clever and works nicely :).  Thank you!

There's no good way, unfortunately, but you can find a filter solution
here (as far as I recall):

    http://thread.gmane.org/gmane.emacs.orgmode/66243/

I'd not use tabel.el.  In fact, I'd be keen to obsolete tabel.el in org.

Rasmus

-- 
El Rey ha muerto. ¡Larga vida al Rey!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-25 22:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-25 14:38 Tables with multicolumn in LaTeX export Suvayu Ali
2015-08-25 15:13 ` Eric S Fraga
2015-08-25 16:14   ` Suvayu Ali
2015-08-25 22:40     ` Rasmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).