From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Block level specification for tex code html export method Date: Thu, 03 Sep 2015 13:30:06 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXTep-0002G9-CH for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 08:30:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXTel-0006lT-Bl for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 08:30:23 -0400 Received: from plane.gmane.org ([80.91.229.3]:52218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXTel-0006lJ-5g for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 08:30:19 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZXTeg-00077f-U8 for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 14:30:15 +0200 Received: from 193.63.221.248 ([193.63.221.248]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Sep 2015 14:30:14 +0200 Received: from andreas.leha by 193.63.221.248 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Sep 2015 14:30:14 +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 Alan, Glad you like the example. Three things: 1. It still works for me ;-) 2. The distorted png might come from the bug in htlatex I mentioned in this thread [1]. 3. It seems that the by-backend does not work properly for you. I am not sure about the reason for that. What org-mode version do you run? HTH, Andreas [1] http://tex.stackexchange.com/a/232739 Alan Schmitt writes: > Hello Andreas, > > I’m slowly catching up on the org mailing list, and I found your example > very interesting. I tried to run it and it does not seem to work here. > Here is what I did: > - I copied the code below to a file > - I evaluated the last block > - I made sure that latex was one of the org-babel-load-languages > language > - I tried executing the first block, which generated this strange png > > > > - I exported both to html and pdf, and in both cases I would have > a reference to the png instead of the svg/tikz code. > > I’m afraid I’m missing a step. Do you see what I’m doing wrong? > > Thanks, > > Alan > > On 2015-08-12 10:50, Andreas Leha writes: > >> #+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") (latex "tree.tikz") (t "tree.png")) >> #+header: :imagemagick :iminoptions -density 600 :imoutoptions -geometry 800 >> #+header: :results file raw >> #+header: :fit yes >> #+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