From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: How to use :prologue with latex Date: Mon, 24 Apr 2017 09:43:24 -0700 Message-ID: References: <87k26a84um.fsf@u-cergy.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2h5J-0003dl-JG for emacs-orgmode@gnu.org; Mon, 24 Apr 2017 12:43:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2h5E-0005hW-Nc for emacs-orgmode@gnu.org; Mon, 24 Apr 2017 12:43:33 -0400 Received: from iport-acv4-out.ucsd.edu ([132.239.0.7]:6953) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2h5E-0005h7-AV for emacs-orgmode@gnu.org; Mon, 24 Apr 2017 12:43:28 -0400 In-Reply-To: <87k26a84um.fsf@u-cergy.fr> 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: Jeremie Juste Cc: emacs-orgmode@gnu.org 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