* How to use :prologue with latex
@ 2017-04-24 10:41 Jeremie Juste
2017-04-24 16:43 ` Charles C. Berry
0 siblings, 1 reply; 3+ messages in thread
From: Jeremie Juste @ 2017-04-24 10:41 UTC (permalink / raw)
To: emacs-orgmode
Hello,
I would like to use :prologue and epilogue with latex output when using
R. Would it be possible to do something like the following?
#+NAME: test1123
#+BEGIN_SRC R :results output latex :prologue \\begin{table} :epilogue \\end{table} :session *R* :dir tmp :cache no
print(xtable(data.frame(a=rnorm(10),b=letters[1:10])),floating.environment=FALSE)
#+END_SRC
#+RESULTS: test1123
#+BEGIN_EXPORT latex
Error: unexpected input in "\"
% latex table generated in R 3.3.1 by xtable 1.8-2 package
% Mon Apr 24 12:40:21 2017
\begin{FALSE}[ht]
\centering
\begin{tabular}{rrl}
\hline
& a & b \\
\hline
1 & -0.79 & a \\
2 & 0.71 & b \\
3 & 0.82 & c \\
4 & 1.04 & d \\
5 & 0.46 & e \\
6 & 1.02 & f \\
7 & 0.89 & g \\
8 & -1.12 & h \\
9 & 0.77 & i \\
10 & 2.08 & j \\
\hline
\end{tabular}
\end{FALSE}
Error: unexpected input in "\"
#+END_EXPORT
Best wishes,
Jeremie
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to use :prologue with latex
2017-04-24 10:41 How to use :prologue with latex Jeremie Juste
@ 2017-04-24 16:43 ` Charles C. Berry
2017-04-25 10:25 ` Jérémie Juste
0 siblings, 1 reply; 3+ messages in thread
From: Charles C. Berry @ 2017-04-24 16:43 UTC (permalink / raw)
To: Jeremie Juste; +Cc: emacs-orgmode
On Mon, 24 Apr 2017, Jeremie Juste wrote:
>
>
> Hello,
>
> I would like to use :prologue and epilogue with latex output when using
> R. Would it be possible to do something like the following?
>
[...]
> #+BEGIN_SRC R :results output latex :prologue \\begin{table} :epilogue \\end{table} [...]
[...]
Sure. But you do not need to; see my comment at bottom. Try this:
#+NAME: test1123
#+HEADER: :prologue cat("\\begin{table}\n")
#+HEADER: :epilogue cat("\\end{table}\n")
#+BEGIN_SRC R :results output latex :session *R* :dir tmp :cache no
require(xtable)
print(xtable(data.frame(a=rnorm(10),b=letters[1:10])),floating.environment=FALSE)
#+END_SRC
You might be better off using the :post header arg.
Define a src block like this:
#+name: add-table-env
#+BEGIN_SRC emacs-lisp
(format "\\begin{table}\n%s\n\\end{table}\n" *this*)
#+END_SRC
Then use
#+HEADER: :post add-table-env()
in place of the two header lines above. The advantage is that you can if
you want do more complicated moidification of the result.
----
AFAIK, LaTeX has no FALSE environment.
I think what you actually wanted was *not* :prologue and :epilogue but
this R code:
#+begin_src R
print(xtable(data.frame(a=rnorm(10),b=letters[1:10])),floating.environment="table")
#+end_src
HTH,
Chuck
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to use :prologue with latex
2017-04-24 16:43 ` Charles C. Berry
@ 2017-04-25 10:25 ` Jérémie Juste
0 siblings, 0 replies; 3+ messages in thread
From: Jérémie Juste @ 2017-04-25 10:25 UTC (permalink / raw)
To: Charles C. Berry; +Cc: emacs-org list
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
Hello,
Many thanks to you,
Best wishes,
Jeremie
On Mon, Apr 24, 2017 at 6:43 PM, Charles C. Berry <ccberry@ucsd.edu> wrote:
> On Mon, 24 Apr 2017, Jeremie Juste wrote:
>
>
>>
>> Hello,
>>
>> I would like to use :prologue and epilogue with latex output when using
>> R. Would it be possible to do something like the following?
>>
>>
> [...]
>
>> #+BEGIN_SRC R :results output latex :prologue \\begin{table} :epilogue
>> \\end{table} [...]
>>
>
> [...]
>
>
> Sure. But you do not need to; see my comment at bottom. Try this:
>
> #+NAME: test1123
> #+HEADER: :prologue cat("\\begin{table}\n")
> #+HEADER: :epilogue cat("\\end{table}\n")
> #+BEGIN_SRC R :results output latex :session *R* :dir tmp :cache no
> require(xtable)
> print(xtable(data.frame(a=rnorm(10),b=letters[1:10])),floati
> ng.environment=FALSE)
> #+END_SRC
>
> You might be better off using the :post header arg.
>
> Define a src block like this:
>
> #+name: add-table-env
> #+BEGIN_SRC emacs-lisp
> (format "\\begin{table}\n%s\n\\end{table}\n" *this*)
> #+END_SRC
>
> Then use
>
> #+HEADER: :post add-table-env()
>
> in place of the two header lines above. The advantage is that you can if
> you want do more complicated moidification of the result.
>
> ----
>
> AFAIK, LaTeX has no FALSE environment.
>
> I think what you actually wanted was *not* :prologue and :epilogue but
> this R code:
>
> #+begin_src R
> print(xtable(data.frame(a=rnorm(10),b=letters[1:10])),floati
> ng.environment="table")
> #+end_src
>
>
> HTH,
>
> Chuck
>
>
>
>
--
Jérémie Juste
[-- Attachment #2: Type: text/html, Size: 2477 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-25 10:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24 10:41 How to use :prologue with latex Jeremie Juste
2017-04-24 16:43 ` Charles C. Berry
2017-04-25 10:25 ` Jérémie Juste
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).