emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Jeremie Juste <jeremiejuste@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to use :prologue with latex
Date: Mon, 24 Apr 2017 09:43:24 -0700	[thread overview]
Message-ID: <alpine.OSX.2.20.1704240925080.726@charles-berrys-macbook.local> (raw)
In-Reply-To: <87k26a84um.fsf@u-cergy.fr>

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

  reply	other threads:[~2017-04-24 16:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 10:41 How to use :prologue with latex Jeremie Juste
2017-04-24 16:43 ` Charles C. Berry [this message]
2017-04-25 10:25   ` Jérémie Juste

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.20.1704240925080.726@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jeremiejuste@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).