From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: orgmod: R and threeparttable Date: Wed, 11 Dec 2013 14:43:37 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqqdA-0006tV-CW for emacs-orgmode@gnu.org; Wed, 11 Dec 2013 15:43:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vqqd8-00027j-Sr for emacs-orgmode@gnu.org; Wed, 11 Dec 2013 15:43:40 -0500 Received: from mail-oa0-x22e.google.com ([2607:f8b0:4003:c02::22e]:50060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vqqd8-00027d-NA for emacs-orgmode@gnu.org; Wed, 11 Dec 2013 15:43:38 -0500 Received: by mail-oa0-f46.google.com with SMTP id o6so7861062oag.5 for ; Wed, 11 Dec 2013 12:43: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: Vikas Rawal Cc: "emacs-orgmode@gnu.org" 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 > > >