From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: tikz for multiple targets Date: Tue, 16 Jul 2013 14:26:09 +0200 Message-ID: <87mwpm3d3y.fsf@med.uni-goettingen.de> References: <87k3kztlam.fsf@ucl.ac.uk> <87wqoyagmh.fsf@gmx.us> <87obaa65uu.fsf@ucl.ac.uk> <87ehb62lhe.fsf@med.uni-goettingen.de> <878v1d7his.fsf@gmail.com> <878v1ds73o.fsf@med.uni-goettingen.de> <87ehb55bcn.fsf@gmail.com> <87zjtspvzr.fsf@ucl.ac.uk> <87y59c39yc.fsf@gmail.com> <87vc4ahhbz.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz4Kp-0007w9-Cu for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 08:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz4Kk-0003wV-KY for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 08:26:27 -0400 Received: from plane.gmane.org ([80.91.229.3]:59046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz4Kk-0003wM-Dv for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 08:26:22 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uz4Kj-0000s9-5B for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 14:26:21 +0200 Received: from genepi110.genepi.med.uni-goettingen.de ([134.76.140.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 16 Jul 2013 14:26:21 +0200 Received: from andreas.leha by genepi110.genepi.med.uni-goettingen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 16 Jul 2013 14:26:21 +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: > Hi Eric et al., > > I now have a system I am happy with mostly for using LaTeX code blocks > heading to multiple export targets. The solution I am using is a > combination of what has been discussed in this thread (by-backend > customisation of headers for babel) and using noweb substitution for the > main content. I have two LaTeX babel source blocks, one for PDF export > and the other for HTML export. Each of these has a tikzpicture > environment which then includes the actual instructions for drawing > brought in using noweb. > > The problem I have remaining is how to get the version used to export to > PDF via LaTeX to use a figure environment with captioning. I had > thought that something along these lines would work: > > #+begin_src org > ,#+name: picturecontents > ,#+begin_src latex :noweb yes :exports none > \node[red!50!black] (a) {A}; > \node (b) [right of=a] {B}; > \draw[->] (a) -- (b); > ,#+end_src > > ,#+name: flowdiagram > ,#+header: :exports (if (and (boundp 'backend) (eq (org-export-backend-name backend) (intern "latex"))) "results" "none") > ,#+header: :results latex > ,#+header: :noweb yes > ,#+begin_src latex > \begin{tikzpicture} > <> > \end{tikzpicture} > ,#+end_src > > ,#+caption: Testing figure caption for figure going to multiple destinations > ,#+results: flowdiagram > #+end_src > > as I expected the export to put the results of the flowdiagram code > block after the results line. This doesn't work: the exported LaTeX > has no figure environment etc. The diagram does come out but it is > placed directly into the document. > > I hope this all makes sense? Any suggestions? > > thanks, > eric I actually think, that it would be cool, if latex supported the tikz output as R does. But since you have a dedicated latex export-only block, the simplest solution would be to put the caption inside: --8<---------------cut here---------------start------------->8--- #+latex_header: \usepackage{tikz} #+latex_header: \usepackage{hyperref} * Test #+name: picturecontents #+begin_src latex :noweb yes :exports none \node[red!50!black] (a) {A}; \node (b) [right of=a] {B}; \draw[->] (a) -- (b); #+end_src #+name: flowdiagram #+header: :exports (if (and (boundp 'backend) (eq (org-export-backend-name backend) (intern "latex"))) "results" "none") #+header: :results latex #+header: :noweb yes #+begin_src latex \begin{figure} \begin{tikzpicture} <> \end{tikzpicture} \caption{Testing figure caption for figure going to multiple destinations} \end{figure} #+end_src --8<---------------cut here---------------end--------------->8--- Regards, Andreas