From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vikas Rawal Subject: Re: orgmod: R and threeparttable Date: Fri, 13 Dec 2013 08:07:37 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013cba62f8e8cd04ed651d9f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrMqc-0005Ok-Q2 for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 02:07:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrMqY-00061d-7N for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 02:07:42 -0500 Received: from mail-oa0-f52.google.com ([209.85.219.52]:51095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrMqY-00061V-15 for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 02:07:38 -0500 Received: by mail-oa0-f52.google.com with SMTP id h16so1633776oag.25 for ; Thu, 12 Dec 2013 23:07:37 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Hendy Cc: "emacs-orgmode@gnu.org" --089e013cba62f8e8cd04ed651d9f Content-Type: text/plain; charset=ISO-8859-1 Thanks very much, John. I have been trying something of this kind without much success. Will try to take your code, and work with it. In the meanwhile, this is really calling for a neat implementation. Can we have it somewhere marked as TODO? Vikas On Wed, Dec 11, 2013 at 9:43 PM, John Hendy wrote: > On Wed, Dec 11, 2013 at 5:12 AM, Vikas Rawal > wrote: > > What is the best solution for the following scenario? > > > > In my org file, I use an R source code to generate a table. I would > like to > > additionally specify notes to this table, and use threeparttable in latex > > export to be able to specify notes below the table. > > > > Can somebody point me to an example on how could this be done best? > > I fiddled with this a little out of curiosity, and I'm not sure it's > going to work with the current #+attr_latex abilities. Someone more > familiar could correct me, though! I think the issue is that the > structure needs to be something like this:[1] > > ========== > > \begin{threeparttable} > \begin{tabular}{c c c c} > \toprule > \textbf{1st Column} & \textbf{2nd Colimn} & \textbf{3rd Colimn} & > \textbf{4th Colimn} \\ \midrule > QWERTY\tnote{1} & & & \\ > ASDFGH\tnote{2} & & & > \\ \bottomrule > \end{tabular} > \begin{tablenotes} > \item[1] qwerty; \item[2] asdfgh > \end{tablenotes} > \end{threeparttable} > ========== > > [1] Taken from: > http://tex.stackexchange.com/questions/118743/threeparttable-notes-layout > > But Org, I believe, can only wrap stuff in one \begin/end{} pair. So, > naively, I tried: > > #+begin_src R :session r :exports results :results output wrap :eval no > library(ascii) > > options(asciiType = "org") > > data <- data.frame(a = 1:5, b = 6:10, c = 11:15) > cat("#+attr_latex: :environment threeparttable \n") > ascii(data, include.rownames = F, rownames = F, colnames = names(data)) > > #+end_src > > #+RESULTS: > :RESULTS: > #+attr_latex: :environment threeparttable > | a | b | c | > |------+-------+-------| > | 1.00 | 6.00 | 11.00 | > | 2.00 | 7.00 | 12.00 | > | 3.00 | 8.00 | 13.00 | > | 4.00 | 9.00 | 14.00 | > | 5.00 | 10.00 | 15.00 | > :END: > > It *sort of* works in that I get LaTeX table syntax wrapped with > \begin/end{threeparttable}, but then I caught that threeparttable is > actually a wrapper around tabular. Not sure how you can currently use > Org to specify two layered wrappers like that? Or you might need > someone to write an equivalent of #+begin/end_center for > threeparttable? > > #+begin_threeparttable > table-generating-stuff > #+end_threeparttable > > Even more complicate is that tabular ends, then a tablenotes > environment begins/ends, and only *then* does threeparttable end. > > Sorry I couldn't be of more help. I wanted to post anyway so that > others might better understand how this is supposed to work. In the > future, I'd highly recommend posting some minimal code so others can > understand. At the very least, post some minimal LaTeX of the sort you > want as a result. Even better would be any Org-specific methods tried. > Otherwise, people scan the email, see threeparttable, have no > reference for it (like me) and probably just delete. > > I happen to be on vacation with plenty of time for digging, so I dug > for a bit on this. > > > Best regards, > John > > > > > Vikas > > > > > > > --089e013cba62f8e8cd04ed651d9f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks very much, John. I have been trying somet= hing of this kind without much success. Will try to take your code, and wor= k with it.

In the meanwhile, this is really calling for a neat= implementation.

Can we have it somewhere marked as TODO?

Vikas


On Wed, Dec 11, 2013 at 9:43 PM, John Hendy <jw.hendy@= gmail.com> wrote:
On W= ed, Dec 11, 2013 at 5:12 AM, Vikas Rawal
<vikaslists@agrarianr= esearch.org> wrote:
> What is the best solution for the following scenario?
>
> In my org file, I use an R source code to generate a table. =A0I would= like to
> additionally specify notes to this table, and use threeparttable in la= tex
> export to be able to specify notes below the table.
>
> Can somebody point me to an example on how could this be done best?
I fiddled with this a little out of curiosity, and I'm not = sure it's
going to work with the current #+attr_latex abilities. Someone more
familiar could correct me, though! I think the issue is that the
structure needs to be something like this:[1]

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

\begin{threeparttable}
\begin{tabular}{c c c c}
=A0 =A0 \toprule
=A0 =A0 \textbf{1st Column} & \textbf{2nd Colimn} & \textbf{3rd Col= imn} &
\textbf{4th Colimn} \\ \midrule
=A0 =A0 =A0 QWERTY\tnote{1} =A0 & =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 & =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 & =A0\\
=A0 =A0 =A0 ASDFGH\tnote{2} =A0 & =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 & =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &
\\ \bottomrule
\end{tabular}
\begin{tablenotes}
\item[1] qwerty; \item[2] asdfgh
\end{tablenotes}
\end{threeparttable}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

[1] Taken from:
http://tex.stackexchange.com/questions/118743/= threeparttable-notes-layout

But Org, I believe, can only wrap stuff in one \begin/end{} pair. So,
naively, I tried:

#+begin_src R :session r :exports results :results output wrap :eval no
library(ascii)

options(asciiType =3D "org")

data <- data.frame(a =3D 1:5, b =3D 6:10, c =3D 11:15)
cat("#+attr_latex: :environment threeparttable \n")
ascii(data, include.rownames =3D F, rownames =3D F, colnames =3D names(data= ))

#+end_src

#+RESULTS:
:RESULTS:
#+attr_latex: :environment threeparttable
| a =A0 =A0| b =A0 =A0 | c =A0 =A0 |
|------+-------+-------|
| 1.00 | 6.00 =A0| 11.00 |
| 2.00 | 7.00 =A0| 12.00 |
| 3.00 | 8.00 =A0| 13.00 |
| 4.00 | 9.00 =A0| 14.00 |
| 5.00 | 10.00 | 15.00 |
:END:

It *sort of* works in that I get LaTeX table syntax wrapped with
\begin/end{threeparttable}, but then I caught that threeparttable is
actually a wrapper around tabular. Not sure how you can currently use
Org to specify two layered wrappers like that? Or you might need
someone to write an equivalent of #+begin/end_center for
threeparttable?

#+begin_threeparttable
table-generating-stuff
#+end_threeparttable

Even more complicate is that tabular ends, then a tablenotes
environment begins/ends, and only *then* does threeparttable end.

Sorry I couldn't be of more help. I wanted to post anyway so that
others might better understand how this is supposed to work. In the
future, I'd highly recommend posting some minimal code so others can understand. At the very least, post some minimal LaTeX of the sort you
want as a result. Even better would be any Org-specific methods tried.
Otherwise, people scan the email, see threeparttable, have no
reference for it (like me) and probably just delete.

I happen to be on vacation with plenty of time for digging, so I dug
for a bit on this.


Best regards,
John

>
> Vikas
>
>
>

--089e013cba62f8e8cd04ed651d9f--