emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX table formatting
@ 2012-08-28 18:10 Neuwirth Erich
  2012-08-28 19:03 ` John Hendy
  0 siblings, 1 reply; 2+ messages in thread
From: Neuwirth Erich @ 2012-08-28 18:10 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org emacs-orgmode@gnu.org

I would like to add some twists to tables.
Using the ATTR_LaTeX attribute I can control
alignment and vertical gridlines in the table.
I also would like to have horizontal gridlines,
and I would like to have multicol top headers.
tgroupt and n.tgroup in theory should me give these multicol headers,
but it does not work.

Is there a way of accomplishing what I want?




#+title: Testing R table output
#+author: Erich Neuwirth
#+date: 28. August 2012

#+ATTR_LaTeX: align=|l|c|r|r|r|r|
#+ATTR_HTML: border="2" rules="all" frame="border"
#+begin_src R :session *RPisa* :results output org :exports results
require(ascii)
mydf <- data.frame(
            year   = rep(as.character(rep(seq(2000,2009,3)),each=2)),
            gender = rep(c("f","m"),times=2),
            m1     = (11:18)/11,
            m2     = (102:109)/22,
            s1     = seq(1,2,length.out=8),
            s2     = seq(1.5,2.5,length.out=8)
   )

res <- ascii(mydf,
             digits=c(0,0,1,1,2,2),
             align=c("l","c","r","r","r","r"),
             format=c("d","s","f","f","f","f"),
             include.rownames=FALSE,
             tgroup=c("","mean","se"),
             n.tgroup=c(2,2,2))

print(res,type="org")
#+end_src

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

* Re: LaTeX table formatting
  2012-08-28 18:10 LaTeX table formatting Neuwirth Erich
@ 2012-08-28 19:03 ` John Hendy
  0 siblings, 0 replies; 2+ messages in thread
From: John Hendy @ 2012-08-28 19:03 UTC (permalink / raw)
  To: Neuwirth Erich; +Cc: emacs-orgmode@gnu.org emacs-orgmode@gnu.org

On Tue, Aug 28, 2012 at 1:10 PM, Neuwirth Erich
<erich.neuwirth@univie.ac.at> wrote:
> I would like to add some twists to tables.
> Using the ATTR_LaTeX attribute I can control
> alignment and vertical gridlines in the table.
> I also would like to have horizontal gridlines,
> and I would like to have multicol top headers.
> tgroupt and n.tgroup in theory should me give these multicol headers,
> but it does not work.

I didn't think Org tables supported multicol/multirow. After searching
a bit... does this help?
- http://www.gnu.org/software/emacs/manual/html_node/org/A-LaTeX-example.html

For \hlines, you need dashed sep between all rows.

Like so:

|      |        | *mean* |     | *se* |      |
| year | gender |     m1 |  m2 |   s1 |   s2 |
|------+--------+--------+-----+------+------|
| 2000 | f      |    1.0 | 4.6 | 1.00 | 1.50 |
|------+--------+--------+-----+------+------|
| 2003 | m      |    1.1 | 4.7 | 1.14 | 1.64 |
|------+--------+--------+-----+------+------|
| 2006 | f      |    1.2 | 4.7 | 1.29 | 1.79 |
|------+--------+--------+-----+------+------|


John

>
> Is there a way of accomplishing what I want?
>
>
>
>
> #+title: Testing R table output
> #+author: Erich Neuwirth
> #+date: 28. August 2012
>
> #+ATTR_LaTeX: align=|l|c|r|r|r|r|
> #+ATTR_HTML: border="2" rules="all" frame="border"
> #+begin_src R :session *RPisa* :results output org :exports results
> require(ascii)
> mydf <- data.frame(
>             year   = rep(as.character(rep(seq(2000,2009,3)),each=2)),
>             gender = rep(c("f","m"),times=2),
>             m1     = (11:18)/11,
>             m2     = (102:109)/22,
>             s1     = seq(1,2,length.out=8),
>             s2     = seq(1.5,2.5,length.out=8)
>    )
>
> res <- ascii(mydf,
>              digits=c(0,0,1,1,2,2),
>              align=c("l","c","r","r","r","r"),
>              format=c("d","s","f","f","f","f"),
>              include.rownames=FALSE,
>              tgroup=c("","mean","se"),
>              n.tgroup=c(2,2,2))
>
> print(res,type="org")
> #+end_src
>
>

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

end of thread, other threads:[~2012-08-28 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 18:10 LaTeX table formatting Neuwirth Erich
2012-08-28 19:03 ` John Hendy

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).