emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Hendy <jw.hendy@gmail.com>
To: Vikas Rawal <vikaslists@agrarianresearch.org>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: orgmod: R and threeparttable
Date: Wed, 11 Dec 2013 14:43:37 -0600	[thread overview]
Message-ID: <CA+M2ft84QnnnpzDFnErEvYct7NprNo45=8O5=-3dQt70YJwxig@mail.gmail.com> (raw)
In-Reply-To: <CAFVt51Kqc-+xMveuv6Qw+KMyEu5VBSeaSpxXrMhwdvdMNotaKA@mail.gmail.com>

On Wed, Dec 11, 2013 at 5:12 AM, Vikas Rawal
<vikaslists@agrarianresearch.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.  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
>
>
>

  reply	other threads:[~2013-12-11 20:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 11:12 orgmod: R and threeparttable Vikas Rawal
2013-12-11 20:43 ` John Hendy [this message]
2013-12-13  7:07   ` Vikas Rawal
2013-12-14  8:08   ` Vikas Rawal
2013-12-14  8:46     ` Nicolas Goaziou
2013-12-14  9:40       ` Vikas Rawal
2013-12-14 11:04         ` Nicolas Goaziou
2013-12-14 12:06           ` Vikas Rawal
2013-12-14 13:48             ` Vikas Rawal
2013-12-15  9:50               ` Vikas Rawal
2013-12-15  9:55                 ` Vikas Rawal
2013-12-15  9:58                 ` Nicolas Goaziou
2013-12-15 10:21                   ` Vikas Rawal
2013-12-15 10:46                     ` Nicolas Goaziou
2013-12-15 10:50                       ` Vikas Rawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+M2ft84QnnnpzDFnErEvYct7NprNo45=8O5=-3dQt70YJwxig@mail.gmail.com' \
    --to=jw.hendy@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=vikaslists@agrarianresearch.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).