* orgmod: R and threeparttable
@ 2013-12-11 11:12 Vikas Rawal
2013-12-11 20:43 ` John Hendy
0 siblings, 1 reply; 15+ messages in thread
From: Vikas Rawal @ 2013-12-11 11:12 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
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?
Vikas
[-- Attachment #2: Type: text/html, Size: 425 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-11 11:12 orgmod: R and threeparttable Vikas Rawal
@ 2013-12-11 20:43 ` John Hendy
2013-12-13 7:07 ` Vikas Rawal
2013-12-14 8:08 ` Vikas Rawal
0 siblings, 2 replies; 15+ messages in thread
From: John Hendy @ 2013-12-11 20:43 UTC (permalink / raw)
To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org
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
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-11 20:43 ` John Hendy
@ 2013-12-13 7:07 ` Vikas Rawal
2013-12-14 8:08 ` Vikas Rawal
1 sibling, 0 replies; 15+ messages in thread
From: Vikas Rawal @ 2013-12-13 7:07 UTC (permalink / raw)
To: John Hendy; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 3480 bytes --]
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 <jw.hendy@gmail.com> wrote:
> 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
> >
> >
> >
>
[-- Attachment #2: Type: text/html, Size: 4480 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-11 20:43 ` John Hendy
2013-12-13 7:07 ` Vikas Rawal
@ 2013-12-14 8:08 ` Vikas Rawal
2013-12-14 8:46 ` Nicolas Goaziou
1 sibling, 1 reply; 15+ messages in thread
From: Vikas Rawal @ 2013-12-14 8:08 UTC (permalink / raw)
To: John Hendy; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
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.
>
>
This is precisely the problem. At the moment, there does not seem to be a
way of doing it.
I think it is a major limitation and we should try to overcome it. I do not
know lisp, and can't judge, but is it very difficult to overcome?
Wonder what Carsten/Bastien/Nicholas think.
Vikas
[-- Attachment #2: Type: text/html, Size: 1232 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-14 8:08 ` Vikas Rawal
@ 2013-12-14 8:46 ` Nicolas Goaziou
2013-12-14 9:40 ` Vikas Rawal
0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-12-14 8:46 UTC (permalink / raw)
To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org
Hello,
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
> 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.
>>
>>
> This is precisely the problem. At the moment, there does not seem to be a
> way of doing it.
Of doing what? You can always write raw LaTeX in an Org buffer.
#+begin_latex
...
the whole threeparttable stuff
...
#+end_latex
You can also build something with special blocks:
#+begin_threeparttable
...
tabular with Org syntax
...
#+begin_tablenotes
... probably some raw LaTeX...
#+end_tablenotes
#+end_threeparttable
Moreover, footnotes can give you almost the same result.
> I think it is a major limitation
Aren't you exaggerating a bit?
> and we should try to overcome it. I do not know lisp, and can't judge,
> but is it very difficult to overcome?
I don't know. AFAICT your problem is not clearly defined. But it seems
that you already have a couple solutions to experiment first.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-14 8:46 ` Nicolas Goaziou
@ 2013-12-14 9:40 ` Vikas Rawal
2013-12-14 11:04 ` Nicolas Goaziou
0 siblings, 1 reply; 15+ messages in thread
From: Vikas Rawal @ 2013-12-14 9:40 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]
>> \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.
> >>
> >>
> > This is precisely the problem. At the moment, there does not seem to be a
> > way of doing it.
>
> Of doing what?
You can always write raw LaTeX in an Org buffer.
>
Nicolas,
The objective is to be able to add notes to a table generated by an R
source code.
It is indeed possible to use raw latex to use threeparttable. I did that
when I prepared a book manuscript earlier this year, my biggest experiment
so far with use of org mode for writing.
This was not entirely satisfactory because it broke the link between my R
source code and the table. Doing this compromises easy reproducibility that
is such a big plus with working on org mode.
I do not know if I am expressing myself clearly. The table is being
generated by an R source code. We need a way of adding notes to such a
table.
> Moreover, footnotes can give you almost the same result.
>
>
Unfortunately, on such matters, one has to work with the conventions in
different disciplines. At least in social sciences, it is usually expected
that notes are placed below Tables and Figures, and not as part of
footnotes, which are reserved for notes to text. At least my collaborators
and readers frown when I put table sources and notes in the footnotes.
> > I think it is a major limitation
>
> Aren't you exaggerating a bit?
>
I meant to say that this is the major limitation in my use of org mode,
which is primarily for writing research papers. I would really like to know
if this is a limitation faced by others using org mode to write research
papers.
I do understand that there are innumerable requests for adding this feature
and that. In particular, it has been said many times before that we cannot
support every possible latex table environment. But I still think that, in
this area of application of org mode, capability to neatly add a footer to
tables and graphics, including when they are made by a source block, would
be very useful.
Vikas
[-- Attachment #2: Type: text/html, Size: 3577 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-14 9:40 ` Vikas Rawal
@ 2013-12-14 11:04 ` Nicolas Goaziou
2013-12-14 12:06 ` Vikas Rawal
0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-12-14 11:04 UTC (permalink / raw)
To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
> I do not know if I am expressing myself clearly. The table is being
> generated by an R source code. We need a way of adding notes to such a
> table.
There are two different problems:
1. How to generate "threeparttable" environment using Org syntax and
`latex' export back-end.
2. How to generate Org syntax specified above from a source block.
At the moment, my only concern is point 1.
> Unfortunately, on such matters, one has to work with the conventions in
> different disciplines. At least in social sciences, it is usually expected
> that notes are placed below Tables and Figures, and not as part of
> footnotes, which are reserved for notes to text. At least my collaborators
> and readers frown when I put table sources and notes in the footnotes.
Understood. You didn't answer to my suggestion to use special blocks,
though.
> I do understand that there are innumerable requests for adding this feature
> and that. In particular, it has been said many times before that we cannot
> support every possible latex table environment. But I still think that, in
> this area of application of org mode, capability to neatly add a footer to
> tables and graphics, including when they are made by a source block, would
> be very useful.
If my suggestion to use special blocks doesn't apply, you still need to
properly define your problem. In particular:
- How table notes are generated? Do you want to hijack footnotes in
table to produce them?
- Should note numbers be configurable?
- Should "threeparttable" be generated only when table contains at least
a note and some global option is set to a non-nil value? Or should
a user explicitly write that he requires such an environment for the
current table?
- Can another environment than "tabular" be used within
"threeparttable"?
- Is the "table" environment around mandatory?
- ...
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-14 11:04 ` Nicolas Goaziou
@ 2013-12-14 12:06 ` Vikas Rawal
2013-12-14 13:48 ` Vikas Rawal
0 siblings, 1 reply; 15+ messages in thread
From: Vikas Rawal @ 2013-12-14 12:06 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 3189 bytes --]
On Sat, Dec 14, 2013 at 12:04 PM, Nicolas Goaziou <n.goaziou@gmail.com>wrote:
> Vikas Rawal <vikaslists@agrarianresearch.org> writes:
>
> > I do not know if I am expressing myself clearly. The table is being
> > generated by an R source code. We need a way of adding notes to such a
> > table.
>
> There are two different problems:
>
> 1. How to generate "threeparttable" environment using Org syntax and
> `latex' export back-end.
> 2. How to generate Org syntax specified above from a source block.
>
> At the moment, my only concern is point 1.
>
>
Yes, this is right.
> Unfortunately, on such matters, one has to work with the conventions in
> > different disciplines. At least in social sciences, it is usually
> expected
> > that notes are placed below Tables and Figures, and not as part of
> > footnotes, which are reserved for notes to text. At least my
> collaborators
> > and readers frown when I put table sources and notes in the footnotes.
>
> Understood. You didn't answer to my suggestion to use special blocks,
> though.
>
>
I do not know how to use special blocks. I will read the manual and see
what can be done with those. I f special blocks cannot give a statisfactory
solution (I do not know), other questions you raise may be relevant in
exploring a better solution.
>
>
> If my suggestion to use special blocks doesn't apply, you still need to
> properly define your problem. In particular:
>
> - How table notes are generated? Do you want to hijack footnotes in
> table to produce them?
>
- Should note numbers be configurable?
>
We should be able to add something to #+RESULTS block. I would think that
the natural way would be to specify threeparttable in #+attr_latex. It
would be ideal to put contents of a footer under a separate headline
(tagged noexport) somewhere in the document with a custom_id property. This
custom_id could be specified along with threeparttable in the above
#+attr_latex. Something like the following:
#+attr_latex: threeparttable [[notes_custom_id_1]]
#+RESUlTS:
|x|y|z|
|1|2|2|
* Table notes :noexport:
:PROPERTIES:
:CUSTOM_ID: notes_custom_id_1
:END:
+ first note here
+ second note here
+ third note here
- Should "threeparttable" be generated only when table contains at least
> a note and some global option is set to a non-nil value? Or should
> a user explicitly write that he requires such an environment for the
> current table?
>
I would think threeparttable be generated when you have something like the
above specified in #+attr_latex.
> - Can another environment than "tabular" be used within
> "threeparttable"?
> - Is the "table" environment around mandatory?
> - ...
>
I use tabulary inside threeparttable (that is, when I give raw latex code).
The code I used has table environment around it. I am no expert on latex
and I must have put it together using whatever I could find on
threeparttable. I cannot say whether this is mandatory. I am sure other
people on this list would just know this. Otherwise, I can experiment.
I am really stretching my capabilities and knowledge of org. So, please
excuse me, if what I said is nonsensical.
Vikas
[-- Attachment #2: Type: text/html, Size: 4910 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-14 12:06 ` Vikas Rawal
@ 2013-12-14 13:48 ` Vikas Rawal
2013-12-15 9:50 ` Vikas Rawal
0 siblings, 1 reply; 15+ messages in thread
From: Vikas Rawal @ 2013-12-14 13:48 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 3975 bytes --]
Nicolas,
Special blocks seem to work very well, actually. Thank you.
This is what you had proposed:
#+begin_threeparttable
...
tabular with Org syntax
...
#+begin_tablenotes
... probably some raw LaTeX...
#+end_tablenotes
#+end_threeparttable
It seem to work beautifully even when the table is a result of a source
code block. My experiments suggest that when the result changes, on account
of evaluating the source code block again, the special block structure
around is respected.
Super. I am amazed.
Thank you.
I bow.
Vikas
On Sat, Dec 14, 2013 at 1:06 PM, Vikas Rawal <
vikaslists@agrarianresearch.org> wrote:
>
>
>
> On Sat, Dec 14, 2013 at 12:04 PM, Nicolas Goaziou <n.goaziou@gmail.com>wrote:
>
>> Vikas Rawal <vikaslists@agrarianresearch.org> writes:
>>
>> > I do not know if I am expressing myself clearly. The table is being
>> > generated by an R source code. We need a way of adding notes to such a
>> > table.
>>
>> There are two different problems:
>>
>> 1. How to generate "threeparttable" environment using Org syntax and
>> `latex' export back-end.
>> 2. How to generate Org syntax specified above from a source block.
>>
>> At the moment, my only concern is point 1.
>>
>>
> Yes, this is right.
>
> > Unfortunately, on such matters, one has to work with the conventions in
>
>> > different disciplines. At least in social sciences, it is usually
>> expected
>> > that notes are placed below Tables and Figures, and not as part of
>> > footnotes, which are reserved for notes to text. At least my
>> collaborators
>> > and readers frown when I put table sources and notes in the footnotes.
>>
>> Understood. You didn't answer to my suggestion to use special blocks,
>> though.
>>
>>
> I do not know how to use special blocks. I will read the manual and see
> what can be done with those. I f special blocks cannot give a statisfactory
> solution (I do not know), other questions you raise may be relevant in
> exploring a better solution.
>
>
>>
>>
>> If my suggestion to use special blocks doesn't apply, you still need to
>> properly define your problem. In particular:
>>
>> - How table notes are generated? Do you want to hijack footnotes in
>> table to produce them?
>>
> - Should note numbers be configurable?
>>
>
> We should be able to add something to #+RESULTS block. I would think that
> the natural way would be to specify threeparttable in #+attr_latex. It
> would be ideal to put contents of a footer under a separate headline
> (tagged noexport) somewhere in the document with a custom_id property. This
> custom_id could be specified along with threeparttable in the above
> #+attr_latex. Something like the following:
>
> #+attr_latex: threeparttable [[notes_custom_id_1]]
> #+RESUlTS:
> |x|y|z|
> |1|2|2|
>
> * Table notes :noexport:
> :PROPERTIES:
> :CUSTOM_ID: notes_custom_id_1
> :END:
> + first note here
> + second note here
> + third note here
>
> - Should "threeparttable" be generated only when table contains at least
>> a note and some global option is set to a non-nil value? Or should
>> a user explicitly write that he requires such an environment for the
>> current table?
>>
>
> I would think threeparttable be generated when you have something like the
> above specified in #+attr_latex.
>
>
>> - Can another environment than "tabular" be used within
>> "threeparttable"?
>> - Is the "table" environment around mandatory?
>> - ...
>>
>
> I use tabulary inside threeparttable (that is, when I give raw latex
> code).
>
> The code I used has table environment around it. I am no expert on latex
> and I must have put it together using whatever I could find on
> threeparttable. I cannot say whether this is mandatory. I am sure other
> people on this list would just know this. Otherwise, I can experiment.
>
> I am really stretching my capabilities and knowledge of org. So, please
> excuse me, if what I said is nonsensical.
>
> Vikas
>
>
>
[-- Attachment #2: Type: text/html, Size: 6387 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
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
0 siblings, 2 replies; 15+ messages in thread
From: Vikas Rawal @ 2013-12-15 9:50 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 2546 bytes --]
On Sat, Dec 14, 2013 at 2:48 PM, Vikas Rawal <
vikaslists@agrarianresearch.org> wrote:
>
> Nicolas,
>
> Special blocks seem to work very well, actually. Thank you.
>
>
On further exploration, there seems to be a problem.
As you can see in the example below, \end{table} is wrongly placed.
tablenotes and \end{threeparttable} should come before \end{table} and not
after. Since special blocks are wrapping around the table, this is creating
a problem.
My org syntax;
#+begin_threeparttable
#+NAME: gharsondi-yield
#+CAPTION: Average yields of selected crops in Gharsondi, Gwalior, Madhya
Pradesh and India, 2007-08 (kilograms per acre)
#+RESULTS: gharsondi-yield-in
| Crop | Gharsondi | Gwalior | Madhya Pradesh | India |
|-----------+-----------+---------+----------------+-------|
| Soybean | nil | 689 | 442 | 500 |
| Paddy | 1553 | 866 | 569 | 1337 |
| Urad | 53 | 142 | 142 | 192 |
| Sesame | 101 | 127 | 153 | 170 |
| Wheat | 824 | 664 | 652 | 1134 |
| Chick pea | 462 | 445 | 288 | 308 |
| Rapeseed | 501 | 280 | 375 | 405 |
#+begin_tablenotes
\item [] \footnotesize{Note: Yield of rice Gwalior, Madhya Pradesh and
India were converted to paddy equivalents.}
\item [] \footnotesize{Source: Data for Gwalior, Madhya Pradesh and
India taken from the website Directorate of Economics and Statistics,
Ministry of Agriculture, Government of India}
#+end_tablenotes
#+end_threeparttable
When exported, this creates the following in the .tex file.
\begin{threeparttable}
\begin{table}[htb]
\caption{\label{gharsondi-yield}Average yields of selected crops in
Gharsondi, Gwalior, Madhya Pradesh and India, 2007-08 (kilograms per acre)}
\centering
\begin{tabular}{lrrrr}
Crop & Gharsondi & Gwalior & Madhya Pradesh & India\\
\hline
Soybean & nil & 689 & 442 & 500\\
Paddy & 1553 & 866 & 569 & 1337\\
Urad & 53 & 142 & 142 & 192\\
Sesame & 101 & 127 & 153 & 170\\
Wheat & 824 & 664 & 652 & 1134\\
Chick pea & 462 & 445 & 288 & 308\\
Rapeseed & 501 & 280 & 375 & 405\\
\end{tabular}
\end{table}
\begin{tablenotes}
\item [] \footnotesize\{Note: Yield of rice Gwalior, Madhya Pradesh and
India were converted to paddy equivalents.\}
\item [] \footnotesize\{Source: Data for Gwalior, Madhya Pradesh and
India taken from the website Directorate of Economics and Statistics,
Ministry of Agriculture, Government of India\}
\end{tablenotes}
\end{threeparttable}
Vikas
[-- Attachment #2: Type: text/html, Size: 3401 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-15 9:50 ` Vikas Rawal
@ 2013-12-15 9:55 ` Vikas Rawal
2013-12-15 9:58 ` Nicolas Goaziou
1 sibling, 0 replies; 15+ messages in thread
From: Vikas Rawal @ 2013-12-15 9:55 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 4909 bytes --]
Sorry again. Found the solution.
#+begin_threeparttable must come after name and caption.
The following works:
Org syntax:
#+NAME: gharsondi-yield
#+CAPTION: Average yields of selected crops in Gharsondi, Gwalior, Madhya
Pradesh and India, 2007-08 (kilograms per acre)
#+begin_threeparttable
#+RESULTS: gharsondi-yield-in
| Crop | Gharsondi | Gwalior | Madhya Pradesh | India |
|-----------+-----------+---------+----------------+-------|
| Soybean | nil | 689 | 442 | 500 |
| Paddy | 1553 | 866 | 569 | 1337 |
| Urad | 53 | 142 | 142 | 192 |
| Sesame | 101 | 127 | 153 | 170 |
| Wheat | 824 | 664 | 652 | 1134 |
| Chick pea | 462 | 445 | 288 | 308 |
| Rapeseed | 501 | 280 | 375 | 405 |
#+begin_tablenotes
\item [] \footnotesize{Note: Yield of rice Gwalior, Madhya Pradesh and
India were converted to paddy equivalents.}
\item [] \footnotesize{Source: Data for Gwalior, Madhya Pradesh and
India taken from the website Directorate of Economics and Statistics,
Ministry of Agriculture, Government of India}
#+end_tablenotes
#+end_threeparttable
Gives this:
\begin{threeparttable}
\caption{\label{gharsondi-yield}Average yields of selected crops in
Gharsondi, Gwalior, Madhya Pradesh and India, 2007-08 (kilograms per acre)}
\begin{center}
\begin{tabular}{lrrrr}
Crop & Gharsondi & Gwalior & Madhya Pradesh & India\\
\hline
Soybean & nil & 689 & 442 & 500\\
Paddy & 1553 & 866 & 569 & 1337\\
Urad & 53 & 142 & 142 & 192\\
Sesame & 101 & 127 & 153 & 170\\
Wheat & 824 & 664 & 652 & 1134\\
Chick pea & 462 & 445 & 288 & 308\\
Rapeseed & 501 & 280 & 375 & 405\\
\end{tabular}
\end{center}
\begin{tablenotes}
\item [] \footnotesize\{Note: Yield of rice Gwalior, Madhya Pradesh and
India were converted to paddy equivalents.\}
\item [] \footnotesize\{Source: Data for Gwalior, Madhya Pradesh and
India taken from the website Directorate of Economics and Statistics,
Ministry of Agriculture, Government of India\}
\end{tablenotes}
\end{threeparttable}
On Sun, Dec 15, 2013 at 10:50 AM, Vikas Rawal <
vikaslists@agrarianresearch.org> wrote:
>
>
>
> On Sat, Dec 14, 2013 at 2:48 PM, Vikas Rawal <
> vikaslists@agrarianresearch.org> wrote:
>
>>
>> Nicolas,
>>
>> Special blocks seem to work very well, actually. Thank you.
>>
>>
> On further exploration, there seems to be a problem.
>
> As you can see in the example below, \end{table} is wrongly placed.
> tablenotes and \end{threeparttable} should come before \end{table} and not
> after. Since special blocks are wrapping around the table, this is creating
> a problem.
>
>
> My org syntax;
>
> #+begin_threeparttable
> #+NAME: gharsondi-yield
> #+CAPTION: Average yields of selected crops in Gharsondi, Gwalior, Madhya
> Pradesh and India, 2007-08 (kilograms per acre)
> #+RESULTS: gharsondi-yield-in
> | Crop | Gharsondi | Gwalior | Madhya Pradesh | India |
> |-----------+-----------+---------+----------------+-------|
> | Soybean | nil | 689 | 442 | 500 |
> | Paddy | 1553 | 866 | 569 | 1337 |
> | Urad | 53 | 142 | 142 | 192 |
> | Sesame | 101 | 127 | 153 | 170 |
> | Wheat | 824 | 664 | 652 | 1134 |
> | Chick pea | 462 | 445 | 288 | 308 |
> | Rapeseed | 501 | 280 | 375 | 405 |
> #+begin_tablenotes
> \item [] \footnotesize{Note: Yield of rice Gwalior, Madhya Pradesh and
> India were converted to paddy equivalents.}
> \item [] \footnotesize{Source: Data for Gwalior, Madhya Pradesh and
> India taken from the website Directorate of Economics and Statistics,
> Ministry of Agriculture, Government of India}
> #+end_tablenotes
> #+end_threeparttable
>
> When exported, this creates the following in the .tex file.
>
> \begin{threeparttable}
> \begin{table}[htb]
> \caption{\label{gharsondi-yield}Average yields of selected crops in
> Gharsondi, Gwalior, Madhya Pradesh and India, 2007-08 (kilograms per acre)}
> \centering
> \begin{tabular}{lrrrr}
> Crop & Gharsondi & Gwalior & Madhya Pradesh & India\\
> \hline
> Soybean & nil & 689 & 442 & 500\\
> Paddy & 1553 & 866 & 569 & 1337\\
> Urad & 53 & 142 & 142 & 192\\
> Sesame & 101 & 127 & 153 & 170\\
> Wheat & 824 & 664 & 652 & 1134\\
> Chick pea & 462 & 445 & 288 & 308\\
> Rapeseed & 501 & 280 & 375 & 405\\
> \end{tabular}
> \end{table}
> \begin{tablenotes}
> \item [] \footnotesize\{Note: Yield of rice Gwalior, Madhya Pradesh and
> India were converted to paddy equivalents.\}
> \item [] \footnotesize\{Source: Data for Gwalior, Madhya Pradesh and
> India taken from the website Directorate of Economics and Statistics,
> Ministry of Agriculture, Government of India\}
> \end{tablenotes}
> \end{threeparttable}
>
> Vikas
>
[-- Attachment #2: Type: text/html, Size: 6489 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
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
1 sibling, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-12-15 9:58 UTC (permalink / raw)
To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org
Hello,
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
> On Sat, Dec 14, 2013 at 2:48 PM, Vikas Rawal <
> vikaslists@agrarianresearch.org> wrote:
>
>>
>> Nicolas,
>>
>> Special blocks seem to work very well, actually. Thank you.
>>
>>
> On further exploration, there seems to be a problem.
>
> As you can see in the example below, \end{table} is wrongly placed.
> tablenotes and \end{threeparttable} should come before \end{table} and not
> after. Since special blocks are wrapping around the table, this is creating
> a problem.
Try this:
#+name: gharsondi-yield
#+caption: Average yields of selected crops in Gharsondi, Gwalior, Madhya Pradesh and India, 2007-08 (kilograms per acre)
#+attr_latex: :options [htb]
#+begin_table
#+begin_threeparttable
#+RESULTS: gharsondi-yield-in
| Crop | Gharsondi | Gwalior | Madhya Pradesh | India |
|-----------+-----------+---------+----------------+-------|
| Soybean | nil | 689 | 442 | 500 |
| Paddy | 1553 | 866 | 569 | 1337 |
| Urad | 53 | 142 | 142 | 192 |
| Sesame | 101 | 127 | 153 | 170 |
| Wheat | 824 | 664 | 652 | 1134 |
| Chick pea | 462 | 445 | 288 | 308 |
| Rapeseed | 501 | 280 | 375 | 405 |
#+begin_tablenotes
\item [] \footnotesize{Note: Yield of rice Gwalior, Madhya Pradesh and
India were converted to paddy equivalents.}
\item [] \footnotesize{Source: Data for Gwalior, Madhya Pradesh and
India taken from the website Directorate of Economics and Statistics,
Ministry of Agriculture, Government of India}
#+end_tablenotes
#+end_threeparttable
#+end_table
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-15 9:58 ` Nicolas Goaziou
@ 2013-12-15 10:21 ` Vikas Rawal
2013-12-15 10:46 ` Nicolas Goaziou
0 siblings, 1 reply; 15+ messages in thread
From: Vikas Rawal @ 2013-12-15 10:21 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]
>
> Try this:
>
> #+name: gharsondi-yield
> #+caption: Average yields of selected crops in Gharsondi, Gwalior,
> Madhya Pradesh and India, 2007-08 (kilograms per acre)
> #+attr_latex: :options [htb]
> #+begin_table
> #+begin_threeparttable
>
Thanks Nicolas.
I need #+attr_latex to come after #begin_threeparttable. Otherwise, it is
not used.
The following works:
#+NAME: gharsondi-yield
#+CAPTION: Average yields of selected crops in Gharsondi, Gwalior, Madhya
Pradesh and India, 2007-08 (kilograms per acre)
#+begin_table
#+begin_threeparttable
#+attr_latex: :environment tabularx :width \textwidth :align lrrrr
#+RESULTS: gharsondi-yield-in
| Crop | Gharsondi | Gwalior | Madhya Pradesh | India |
|-----------+-----------+---------+----------------+-------|
| Soybean | nil | 689 | 442 | 500 |
| Paddy | 1553 | 866 | 569 | 1337 |
| Urad | 53 | 142 | 142 | 192 |
| Sesame | 101 | 127 | 153 | 170 |
| Wheat | 824 | 664 | 652 | 1134 |
| Chick pea | 462 | 445 | 288 | 308 |
| Rapeseed | 501 | 280 | 375 | 405 |
#+begin_tablenotes
\footnotesize Source: Data for Gwalior, Madhya Pradesh and
India taken from the website Directorate of Economics and Statistics,
Ministry of Agriculture, Government of India. Yield of rice were
converted to paddy equivalents.
#+end_tablenotes
#+end_threeparttable
#+end_table
Vikas
[-- Attachment #2: Type: text/html, Size: 1950 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-15 10:21 ` Vikas Rawal
@ 2013-12-15 10:46 ` Nicolas Goaziou
2013-12-15 10:50 ` Vikas Rawal
0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-12-15 10:46 UTC (permalink / raw)
To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
>>
>> Try this:
>>
>> #+name: gharsondi-yield
>> #+caption: Average yields of selected crops in Gharsondi, Gwalior,
>> Madhya Pradesh and India, 2007-08 (kilograms per acre)
>> #+attr_latex: :options [htb]
>> #+begin_table
>> #+begin_threeparttable
>>
>
> I need #+attr_latex to come after #begin_threeparttable. Otherwise, it is
> not used.
You can have both. The "attr_latex" line I suggest applies to the
"table" environment below. It doesn't prevent you to add another one
applying to the "tabularx" environment.
Attributes apply to the element right after them.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: orgmod: R and threeparttable
2013-12-15 10:46 ` Nicolas Goaziou
@ 2013-12-15 10:50 ` Vikas Rawal
0 siblings, 0 replies; 15+ messages in thread
From: Vikas Rawal @ 2013-12-15 10:50 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
>
> > I need #+attr_latex to come after #begin_threeparttable. Otherwise, it is
> > not used.
>
> You can have both. The "attr_latex" line I suggest applies to the
> "table" environment below. It doesn't prevent you to add another one
> applying to the "tabularx" environment.
>
> Attributes apply to the element right after them.
>
>
>
Thanks very much for clarifying. Very useful to know.
Vikas
[-- Attachment #2: Type: text/html, Size: 753 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-12-15 10:50 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 11:12 orgmod: R and threeparttable Vikas Rawal
2013-12-11 20:43 ` John Hendy
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
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).