emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Erik Iverson <eriki@ccbr.umn.edu>
To: John Hendy <jw.hendy@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: TikZ to separate file (babel?) possible?
Date: Fri, 22 Oct 2010 15:35:53 -0500	[thread overview]
Message-ID: <4CC1F5A9.6060501@ccbr.umn.edu> (raw)
In-Reply-To: <AANLkTikDXGma21rfevq18ni0fjJwt2S5oQsG56kvYf_2@mail.gmail.com>

John,

Does
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.php#sec-4_2
help?  There is a tikz example there.  The :file argument may be all
you're missing, and putting your code in a latex source block.

Here is what I do when I have an R code block that generates
LaTeX code.  Hopefully this can be adapted to your case.

#+srcname: R-latex
#+begin_src R :results silent :exports code
   lf <- function() {
       "\\LaTeX"
   }

   lf()
#+end_src

#+begin_src latex :noweb yes :file (if (and (boundp 'htmlp) htmlp) 
"latex-logo-html.png" "latex-logo.png") :buffer (if (and (boundp 'htmlp) 
htmlp) "no" t)
<<R-latex()>>~is a high-quality typesetting system; it includes
features designed for the production of technical and scientific
documentation. <<R-latex()>>~is the de facto standard for the
communication and publication of scientific
documents. <<R-latex()>>~is available as free software.
#+end_src

That messy :file and :buffer arguments needs some explanation.

They are there so that when I eval the code block *in* an org-mode
buffer, with C-c C-c, that an image will be generated to be
inserted into the buffer.  However, this uses my background color
in emacs, which I don't actually want when exported to HTML, that's
what the :buffer argument controls.  Essentially, it's just
what arguments get passed to dvipng (if I recall correctly).

On Latex export, the actual latex code should be included in the
document, so I think all of my use cases are covered.

The only issue is that org-mode doesn't display PDFs generated
from a :file argument in buffer, but you might not care about
that.

If you're an R user, you might also check out the tikzDevice package:
http://r-forge.r-project.org/projects/tikzdevice/

HTH,
--Erik


John Hendy wrote:
> Hi,
> 
> 
> I've recently gotten into TikZ and love it. It is simply fantastic for 
> creating neat diagrams and other thingies.
> 
> One question... I created an org file with a flow chart in it and simply 
> put my TikZ code in between #+begin_latex and #+end_latex. This is fine 
> when the picture is in a document, but what if I want just a 
> .png/jpg/eps/pdf output? Is it possible to use babel or something else 
> so that I can simply generate a picture vs. needing it to be "in" the 
> PDF output?
> 
> I can ask the PGF list as well, but this one is far more active and I 
> know some use TikZ here. I ask because sometimes in my notes I'd like to 
> have the code present but also be able to reuse my work elsewhere, like 
> when I have to present using powerpoint. It'd be nice to just grab the 
> picture (like what I do with gnuplot output) rather than generating a 
> pdf just for the TikZ pic, screenshot or gimp it down to size, and then 
> be able to use it.
> 
> Does that make sense? It seems like babel would be perfect for this. It 
> already allows all the typical handles -- file output, what to export, etc.
> 
> Or does this already exist and I'm ignorant?
> 
> 
> Thoughts?
> John
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-10-22 20:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 20:13 TikZ to separate file (babel?) possible? John Hendy
2010-10-22 20:35 ` Erik Iverson [this message]
2010-10-22 21:25 ` Eric Schulte
2010-10-22 21:36   ` John Hendy
2010-10-22 23:11     ` Eric S Fraga
2010-10-23 17:58       ` John Hendy
2010-10-25 18:21         ` John Hendy
2010-10-25 18:53           ` Eric Schulte
2010-10-25 18:58             ` John Hendy
2010-10-26  8:17               ` Eric S Fraga
2010-10-26 14:34                 ` John Hendy
2010-10-26 21:34                   ` John Hendy
2010-10-26 23:01                     ` Eric Schulte
2010-10-28 21:43                       ` John Hendy
2010-10-28 21:52                         ` 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=4CC1F5A9.6060501@ccbr.umn.edu \
    --to=eriki@ccbr.umn.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jw.hendy@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).