From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ezequiel Birman Subject: Re: conditional export based on target Date: Tue, 02 Nov 2010 16:41:05 -0300 Message-ID: References: <20101023234608.GD14385@soloJazz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=46875 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDPaO-0002cI-S2 for emacs-orgmode@gnu.org; Tue, 02 Nov 2010 18:44:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDPaJ-0006Aa-VD for emacs-orgmode@gnu.org; Tue, 02 Nov 2010 18:44:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:53894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDPaJ-0006AM-KT for emacs-orgmode@gnu.org; Tue, 02 Nov 2010 18:44:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PDPaH-0001d5-Li for emacs-orgmode@gnu.org; Tue, 02 Nov 2010 23:44:05 +0100 Received: from 190.55.113.235 ([190.55.113.235]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Nov 2010 23:44:05 +0100 Received: from stormwatch by 190.55.113.235 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Nov 2010 23:44:05 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org >>>>> "JP" == Juan Pechiar writes: > On Thu, Oct 07, 2010 at 01:24:28AM -0300, Ezequiel Birman wrote: >> Is there something like conditional export? I'd like to use tikz >> when exporting to latex but my own hand-made ascii drawing when >> exporting to ascii/latin1/utf8. > Hi, > I've been thinking on your request, and today this appeared on the > list which is quite similar: > http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg01106.html > It seems as if block settings can be lisp function calls rather > than a fixed string. > So, for example: > //------------------------------------------------------------ ** > Test conditional export > #+source: test_output #+begin_src octave :results value vector > :exports (if (and (boundp 'htmlp) htmlp) "none" "results" ) > rand(2) #+end_src > #+results: test_output | 0.3982018019389448 | 0.3879818701032038 | > | 0.8053847746148466 | 0.3333630867175288 > | ------------------------------------------------------------ > Will export nothing to HTML, and the resulting output to other > formats. > Values for 'exports' can be 'both', 'none', 'code' or 'results'; > and there are export flags latexp, htmlp, asciip, docbookp. > I tested the above example, and it "mostly" works. Sometimes not, > and I don't yet know why. Thank you Juan. This seems to work *always*. I had to remove the 'results: ...' portion but I don't understand why... #+source: tree1_latex #+BEGIN_SRC latex :exports (if (and (boundp 'latexp) latexp) "results" "none") \begin{tikzpicture} [every node/.style={draw,fill=white,circle,inner sep=0pt,minimum size=1em}, level distance=3em, level 1/.style={sibling distance=8em}, level 2/.style={sibling distance=4em}, level 3/.style={sibling distance=2em}] \node [level distance=0pt,style={draw=none,minimum size=0pt}] {} child {node {} edge from parent [draw=none] child {node {} child {node {} } child {node [style={fill=black}] {}}} child {node [style={fill=black}] {} child {node {} } child {node [style={fill=black}] {} }}} child {node [style={fill=black}] {} edge from parent [draw=none] child {node {} child {node {} } child {node [style={fill=black}] {} }} child {node [style={fill=black}] {} child {node {}} child {node [draw=none,style={shade}] {} edge from parent [dashed]}}}; \end{tikzpicture} #+end_src #+source: tree1_ascii #+BEGIN_SRC emacs-lisp :exports (if (and (boundp 'asciip) asciip) "results" "none") " B N\\\\ / \\ / \\\\\\ B N B N\\\\ / \\ / \\ / \\ / \\\\\\ B N B N B N B (N)" #+END_SRC I still don't know how to export the TikZ code to latex but a png or svg (generated by TikZ) to html. Also, if anyone can think of a better or different approach I'll be thankful. -- Ezequiel Birman