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