emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Hendy <jw.hendy@gmail.com>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Centering R babel plots in LaTeX/Beamer export?
Date: Mon, 9 Jul 2012 16:56:56 -0500	[thread overview]
Message-ID: <CA+M2ft9qdTTy0t3QHpsHJvcOE4AjB6=ehWF7xUST6PYt_QPVGw@mail.gmail.com> (raw)
In-Reply-To: <6351.1341869204@alphaville>

On Mon, Jul 9, 2012 at 4:26 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> John Hendy <jw.hendy@gmail.com> wrote:
>
>> I'm exporting a Beamer presentation with R babel blocks and my plots
>> are not centered. This should be a reproducible example:
>>
>> -----
>> #+startup: beamer
>> #+latex_class: beamer
>> #+options: toc:nil latex:t tex:t
>> #+latex_class_options: [presentation,bigger]
>> #+beamer_frame_level: 1
>>
>> * plot
>>
>> #+header: :width 8 :height 6
>> #+begin_src R :exports results :results output graphics :file file.pdf
>> x <- c(1:10)
>> y <- x^2
>> plot(x,y)
>> #+end_src
>> -----
>>
>> I tried putting #+begin_center and #+end_center around the block, but
>> it changes the LaTeX export to wrapping my R block in
>> \begin/\end{verbatim}.
>>
>> Worg ob-R-doc has a :pagecentre option, but says it defaults to true,
>> so I'm not sure that's my fix.
>>
>
> This is pretty much brute-force, but seems to work:
>
> --8<---------------cut here---------------start------------->8---
> #+startup: beamer
> #+latex_class: beamer
> #+options: toc:nil latex:t tex:t
> #+latex_class_options: [presentation,bigger]
> #+beamer_frame_level: 1
>
> * plot
>
> #+header: :width 8 :height 6
> #+name: foo
> #+begin_src R :exports results :results output graphics :file file.pdf :pagecentre true
> x <- c(1:10)
> y <- x^2
> plot(x,y)
> #+end_src
>
> #+LATEX: \begin{center}
> #+RESULTS: foo
> [[file:file.pdf]]
> #+LATEX: \end{center}
> --8<---------------cut here---------------end--------------->8---
>

I only get a #+results line if I do C-c C-c on the block. I'm
primarily tweaking other stuff and just using C-c C-e p to export to
LaTeX, which produces no #+results section and thus does not allow me
to use a center environment around that bit. I suppose I can manually
add them, but if I re-evaluate babel doesn't recognize it as the
#+results section anymore and I wind up with this after the second
eval:

-----
#+RESULTS: foo
[[file:file.pdf]]

#+LATEX: \begin{center}
#+RESULTS: foo
[[file:file.pdf]]
#+LATEX: \end{center}
-----

I still may consider it as an interim solution. I'm surprised there's
no option to center resultant plots!


John


> Nick
>

  reply	other threads:[~2012-07-09 21:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09 17:18 Centering R babel plots in LaTeX/Beamer export? John Hendy
2012-07-09 21:26 ` Nick Dokos
2012-07-09 21:56   ` John Hendy [this message]
2012-07-09 23:24     ` Nick Dokos
2012-07-12 21:22       ` John Hendy
2012-07-19 15:29         ` John Hendy

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='CA+M2ft9qdTTy0t3QHpsHJvcOE4AjB6=ehWF7xUST6PYt_QPVGw@mail.gmail.com' \
    --to=jw.hendy@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.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).