emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] tikz for multiple targets


From: Andreas Leha
Subject: Re: [O] tikz for multiple targets
Date: Wed, 10 Jul 2013 22:44:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi Eric,

Eric S Fraga <address@hidden> writes:

> Rasmus <address@hidden> writes:
>
> [...]
>
>> Tikz/pgf works for the latex exporter.  Just insert it as a file link
>> (with extension tikz or pgf) or as latex verbatim code.
>
> Yes, thanks.  However, I guess I didn't explain very well what I was
> looking for.  
>
> I use tikz all the time and typically enclose it in a #+begin_LaTeX
> ... #+end_LaTeX block.  That is fine for most of my documents where I
> only wish to export to PDF via LaTeX.
>
> However, what I would like is to be able to use the same code, inline
> within the org file and not as a separate .tikz file, in some cases to
> export to both LaTeX and HTML (or ODT for that matter).  The code in the
> link I posted used to do this by dynamically setting the :exports and/or
> :results options using org babel headers with emacs lisp code.  A
> variation of this worked with the old exporter but doesn't with the new
> one.
>
> Thanks again,
> eric

I updated the example again.  Try this:

--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \usepackage{tikz}

* Tikz test
#+name: contents
#+header: :exports (if (and (boundp 'backend) (eq (org-export-backend-name 
backend) (intern "latex"))) "results" "none")
#+header: :results latex
#+begin_src latex
  \begin{tikzpicture}
    \node[red!50!black] (a) {A};
    \node (b) [right of=a] {B};
    \draw[->] (a) -- (b);
  \end{tikzpicture}
#+end_src

#+header: :exports (if (and (boundp 'backend) (eq (org-export-backend-name 
backend) (intern "latex"))) "none" "results")
#+header: :results raw :file test.png
#+header: :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 400
#+header: :fit yes :noweb yes :headers '("\\usepackage{tikz}")
#+begin_src latex
  <<contents>>
#+end_src
--8<---------------cut here---------------end--------------->8---

Regards,
Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]