From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: Block level specification for tex code html export method Date: Fri, 04 Sep 2015 09:10:12 +0200 Message-ID: References: <87egifp7jb.fsf@ucl.ac.uk> <87h9nbmbe1.fsf@nicolasgoaziou.fr> <87a8t2pv5v.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXl8d-00023k-Ra for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 03:10:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXl8a-00048k-LT for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 03:10:19 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:59097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXl8a-00048J-Ez for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 03:10:16 -0400 In-Reply-To: (Haochen Xie's message of "Fri, 4 Sep 2015 15:23:22 +0900") 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: Haochen Xie Cc: Fabrice Popineau , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks to everyone, I now have this working. Here is the final version. =2D-8<---------------cut here---------------start------------->8--- #+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 yes :iminoptions -density 600 :imoutoptions -geometr= y 800 #+header: :results file raw #+header: :fit yes #+header: :headers '("\\usepackage{tikz}") #+begin_src latex \usetikzlibrary{trees} \begin{tikzpicture} \node [circle, draw, fill=3Dred!20] at (0,0) {1} child { node [circle, draw, fill=3Dblue!30] {2} child { node [circle, draw, fill=3Dgreen!30] {3} } child { node [circle, draw, fill=3Dyellow!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 org-export-current-backend ,@body)) #+end_src =2D-8<---------------cut here---------------end--------------->8--- The header line that says to use the package tikz right before the source block is only necessary to generate the png when evaluating the block (=E2=80=9CC-c C-c=E2=80=9D on it), but as it does not prevent the exp= ort to work, I leave it there. I had to change my systems pgfsys-tex4ht.def as described in http://tex.stackexchange.com/questions/185349/error-using-pgfsysdriver-with= -tex4ht-only-shows-up-with-texlive-2014-ok-with-t/232739#232739 (having a local copy and modifying it as suggested on the site did not work). Thanks again, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Last week athmospheric CO=E2=82=82 average (Updated August 31, 2015, Mauna = Loa Obs.): 377.82 ppm --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJV6UPUAAoJEAQNCjtO0uXHMNcIAMIRsu6WVgS8ykhTbZgrSiSL i7ROzbOxjUjCZNwuViYlz8HprUhZYVh95kMoey5ZJkBh3rM20udNhqPOI9xf/wZW N387+zmWPqyGopay5O0zXxf+SbP4hzw0LADYWjM1X8IskcUc+oNG9Tw2bGk6Jsgr oE/KAhTF6HCivD2lk3qCR3eFkuTYwYwfKH367ExnyOMG5UO6aNtuiWGVYOhxT7JL EvYJkZ7z+NLBoiOJhsAwVSP5XQ8W14Hpu7vi2PXWP1s3LkG9bDlXMLwI6zTS1b3h JBRLcs13zFXZ5ta1tS4GIpvw0UhtDRQ/r68A9ACZ0zwn6aHVkZqUlRhBmj6LCzY= =8ViQ -----END PGP SIGNATURE----- --=-=-=--