> On Aug 2, 2017, at 4:22 PM, Jeremie Juste <jeremieju...@gmail.com> wrote: > > > > Hello > >> >> Putting together a macro seems like the best option. Recall that you >> can use elisp in macros by placing it between `(eval’ and `)', so the >> following emits “def’ in all but latex exports and “abc” for latex. >> > > > Yes I found this nice piece of code > > It switches to svg if backend is html and to raw latex if backend is > latex. You only have to tweak it your needs. >
I think this is obsolete. It fails on org-9.0.9. What version of org are you using? In any case replacing the ~(if ...)~ by ~org-export-current-backend~ will fix it. > #+header: :file (by-backend (html "tree.svg") (t 'nil)) > #+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 > > * 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 > > The reference > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html > Another case were adding dates to Worg entries might help. Chuck