From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?SsOpcsOpbWllIEp1c3Rl?= Subject: Re: How to use :prologue with latex Date: Tue, 25 Apr 2017 12:25:19 +0200 Message-ID: References: <87k26a84um.fsf@u-cergy.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114d71ba2cad1e054dfb253a Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2xfB-0004ko-9Q for emacs-orgmode@gnu.org; Tue, 25 Apr 2017 06:25:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2xfA-0003Qr-6W for emacs-orgmode@gnu.org; Tue, 25 Apr 2017 06:25:41 -0400 Received: from mail-yw0-x22f.google.com ([2607:f8b0:4002:c05::22f]:36512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2xfA-0003QQ-12 for emacs-orgmode@gnu.org; Tue, 25 Apr 2017 06:25:40 -0400 Received: by mail-yw0-x22f.google.com with SMTP id l18so34211548ywh.3 for ; Tue, 25 Apr 2017 03:25:39 -0700 (PDT) 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" To: "Charles C. Berry" Cc: emacs-org list --001a114d71ba2cad1e054dfb253a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, Many thanks to you, Best wishes, Jeremie On Mon, Apr 24, 2017 at 6:43 PM, Charles C. Berry 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=3Drnorm(10),b=3Dletters[1:10])),floati > ng.environment=3DFALSE) > #+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=3Drnorm(10),b=3Dletters[1:10])),floati > ng.environment=3D"table") > #+end_src > > > HTH, > > Chuck > > > > --=20 J=C3=A9r=C3=A9mie Juste --001a114d71ba2cad1e054dfb253a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,

Many thanks to you,
=
Best wishes,
Jeremie



On Mon, Apr 2= 4, 2017 at 6:43 PM, Charles C. Berry <ccberry@ucsd.edu> wrote= :
On Mon, 24 Apr 2017, Jeremie Juste wrot= e:



Hello,

I would like to use :prologue=C2=A0 and epilogue with latex output when usi= ng
R. Would it be possible to do something like the following?


[...]
#+BEGIN_SRC R :results output latex :prologue \\begin{table} :epilogue \\en= d{table} [...]

[...]


Sure. But you do not need to; see my comment at bottom.=C2=A0 Try this:

#+NAME: test1123
#+HEADER: :prologue cat("\\begin{table}\n")
#+HEADER: :epilogue cat("\\end{table}\n")
#+BEGIN_SRC R :results output latex=C2=A0 :session *R* :dir tmp :cache no require(xtable)
print(xtable(data.frame(a=3Drnorm(10),b=3Dletters[1:10])),floatin= g.environment=3DFALSE)
#+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.=C2=A0 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=3Drnorm(10),b=3Dletters[1:10])),floatin= g.environment=3D"table")
#+end_src


HTH,

Chuck






--
J=C3=A9r=C3=A9mie Juste
--001a114d71ba2cad1e054dfb253a--