From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: shorter syntax for both latex and html export of a figure Date: Mon, 07 Mar 2016 11:35:48 +0100 Message-ID: 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]:42436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acsVv-0004f4-KS for emacs-orgmode@gnu.org; Mon, 07 Mar 2016 05:35:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acsVq-0000U0-L9 for emacs-orgmode@gnu.org; Mon, 07 Mar 2016 05:35:47 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acsVq-0000Tr-9U for emacs-orgmode@gnu.org; Mon, 07 Mar 2016 05:35:42 -0500 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 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hello, I'm trying to adapt the example that allows to export a figure both to tikz and to png so that I don't have to manually add all the header lines. Here is what I tried: --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=orgtikz.org #+LATEX_HEADER: \usepackage{tikz} * Tikz test Here's a tree, exported to both html and pdf. #+header: :file (by-backend (latex "tree.tikz") (t "tree.png")) #+header: :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 800 #+header: :results file raw #+header: :fit yes #+header: :headers '("\\usepackage{tikz}") #+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 The same, with shorter syntax #+header: :file (by-backend (latex "tree2.tikz") (t "tree2.png")) #+begin_src tikz \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 * COMMENT evaluate this first #+begin_src emacs-lisp :results silent (defmacro by-backend (&rest body) `(case org-export-current-backend ,@body)) (org-babel-do-load-languages 'org-babel-load-languages '((latex . t))) (defalias 'org-babel-execute:tikz 'org-babel-execute:latex) (add-to-list 'org-src-lang-modes '("tikz" . latex)) (defvar org-babel-default-header-args:tikz '((:imagemagick . "yes") (:iminoptions . "-density 600") (:imoutoptions . "-geometry 300") (:results . "file raw") (:fit . "yes") (:headers . "'(\"\\\\usepackage{tikz}\")"))) #+end_src --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable The first part, where all the headers line are there, works great, but the second source block for a newly defined language tikz (an alias to latex with some default headers) does not work unfortunately. In the exported version, I get a minted source block and not a link. Am I doing something wrong? Is it possible to have a shorter syntax for these blocks, or do I have to put all the header lines all the time? Thanks, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO=E2=82=82 (2016-01, Mauna Loa Obs.): 402.52 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJW3VmEAAoJEAQNCjtO0uXHSjcIAI/ZFauLkrKZmxX/ufMBvcg7 JElo+/k0rHFnyf/OLA3aDyO7ZfTS6JW+41H+s2AD9+DJ1cd27ahYJRtOTve9ORIt bdCxkFAy5PKlE7+TfISoPbEzSslPahVuqodhBrS0IislRSIyQCbYawGkEBxKW/Br uv2IbAK0Osh033ml0puWAWcjGSw6Q5JCnH0rym8En7x1PLuqvql3cI+9qxcVoNLx SPPAhXhDbNW2uNGw3Zv7J9f+8EHjKOHjSuUk2toRCqJbHUnEhycXj9vRqXEH3EJS rIZ74oPvacjtb/ka6vGKMfaaRD1/91SmlwQjtf3bvbAs1aefk/HJcGBbEv4Sae8= =Vadq -----END PGP SIGNATURE----- --==-=-=--