[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] tikz for multiple targets
From: |
Eric Schulte |
Subject: |
Re: [O] tikz for multiple targets |
Date: |
Thu, 11 Jul 2013 10:07:15 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
>
> This is very nice and works well for me. I would very much like to see
> that in orgmode. Thanks a lot!
>
Great, I've just committed this patch. Thanks for your original example
which this simply extends.
>
> How do I extend your example to output latex for latex, svg for html and
> png in all other cases?
>
The attached does this. The catch is that the :imagemagick header
argument is required for png (and other) image types to be used.
#+LATEX_HEADER: \usepackage{tikz}
First execute the second code block, to define the convenience macro
and to set the required new variables in ob-latex.el. Then export to
HTML and to pdf to see the tree exported as an SVG image and as
embedded tikz respectively.
* Tikz test
Here's a tree, exported to both html and pdf.
#+header: :file (by-backend (html "tree.svg") (pdf 'nil) (t "tree.png"))
#+header: :imagemagick
#+header: :results (by-backend (pdf "latex") (t "raw"))
#+begin_src latex
\usetikzlibrary{trees}
\begin{tikzpicture}
\node [circle, draw, fill=red!20] at (0,0) {1}
child { node [circle, draw, fill=blue!30] {2}
child { node [circle, draw, fill=green!30] {3} }
child { node [circle, draw, fill=yellow!30] {4} }};
\end{tikzpicture}
#+end_src
#+RESULTS:
[[file:tree.png]]
* COMMENT setup
#+begin_src emacs-lisp :results silent
(setq org-babel-latex-htlatex "htlatex")
(defmacro by-backend (&rest body)
`(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body))
#+end_src
Cheers,
--
Eric Schulte
http://cs.unm.edu/~eschulte
- [O] tikz for multiple targets, Eric S Fraga, 2013/07/09
- Re: [O] tikz for multiple targets, Rasmus, 2013/07/10
- Re: [O] tikz for multiple targets, Rasmus, 2013/07/10
- Re: [O] tikz for multiple targets, Eric S Fraga, 2013/07/10
- Re: [O] tikz for multiple targets, Andreas Leha, 2013/07/11
- Re: [O] tikz for multiple targets,
Eric Schulte <=
- Re: [O] tikz for multiple targets, Andreas Leha, 2013/07/11
- Re: [O] tikz for multiple targets, Eric Schulte, 2013/07/11
- Re: [O] tikz for multiple targets, Andreas Leha, 2013/07/11
- Re: [O] tikz for multiple targets, Eric S Fraga, 2013/07/11
- Re: [O] tikz for multiple targets, Eric Schulte, 2013/07/11
- Re: [O] tikz for multiple targets, Eric S Fraga, 2013/07/15
- Re: [O] tikz for multiple targets, Eric S Fraga, 2013/07/16
- Re: [O] tikz for multiple targets, Andreas Leha, 2013/07/16
- Re: [O] tikz for multiple targets, Eric S Fraga, 2013/07/16
- Re: [O] tikz for multiple targets, Eric S Fraga, 2013/07/11