From: Erik Iverson <eriki@ccbr.umn.edu>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [babel] strategies for generating multiple graphics files from same code block
Date: Mon, 09 Aug 2010 16:04:12 -0500 [thread overview]
Message-ID: <4C606D4C.1030904@ccbr.umn.edu> (raw)
Hello,
I'm using org-mode to write R code and generate figures.
I have multiple files generated per code block, one png and one PDF.
This is so that I can display the graphic:
1) Inline in my org-mode buffer (png)
2) Upon export to HTML, viewable in the browser (png)
3) Included in a separate PDF, *not* from exporting my org-mode
file. For this, I would like a PDF version of the graphic to be
generated, and pdflatex can use it (pdf)
So, for points 1 and 2 above, no problem.
* Figure 1
Here is the first figure.
#+begin_src R :file figure1.png :width 960 :exports both :tangle fig1.R
plot(1,1)
#+end_src
For point 3, I use tangling to write the source code to a file. I
notice that the graphical code is wrapped by the export process by a
call to png() and dev.off().
My question, is there any facility to have the tangled code generate a
PDF, instead of PNG? I still need the png for goals 1 and 2, but the
pdf for goal 3. Anyone else have any other strategies for realizing all
3 of my goals?
I suppose one would be to define a named code block, and use the noweb
syntax:
Define the plot
#+srcname: fig-test
#+begin_src R
plot(1,1)
#+end_src
Tangle, but don't export
#+begin_src R :file figure1.pdf :exports none :tangle fig1.R :noweb yes
<<fig-test>>
#+end_src
Export, but don't tangle
#+begin_src R :file figure1.png :exports both :noweb yes
<<fig-test>>
#+end_src
This is not too bad, but maybe there's an alternative approach?
Thanks!
Erik Iverson
next reply other threads:[~2010-08-09 21:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-09 21:04 Erik Iverson [this message]
2010-08-09 23:00 ` [babel] strategies for generating multiple graphics files from same code block Eric Schulte
2010-08-09 23:37 ` Erik Iverson
2010-08-10 18:21 ` Eric Schulte
2010-08-10 21:51 ` Dan Davison
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C606D4C.1030904@ccbr.umn.edu \
--to=eriki@ccbr.umn.edu \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.