From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: tikz for multiple targets Date: Wed, 10 Jul 2013 22:44:45 +0200 Message-ID: <87ehb62lhe.fsf@med.uni-goettingen.de> References: <87k3kztlam.fsf@ucl.ac.uk> <87wqoyagmh.fsf@gmx.us> <87obaa65uu.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux1GU-0003W7-6d for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 16:45:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ux1GT-0006ij-0l for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 16:45:30 -0400 Received: from plane.gmane.org ([80.91.229.3]:40287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux1GS-0006ie-Qo for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 16:45:28 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ux1GQ-0005Cd-70 for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 22:45:26 +0200 Received: from 84.121.221.93.dyn.user.ono.com ([84.121.221.93]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Jul 2013 22:45:26 +0200 Received: from andreas.leha by 84.121.221.93.dyn.user.ono.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Jul 2013 22:45:26 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Eric, Eric S Fraga writes: > Rasmus 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 <> #+end_src --8<---------------cut here---------------end--------------->8--- Regards, Andreas