From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: shorter syntax for both latex and html export of a figure Date: Tue, 08 Mar 2016 11:33:04 +0100 Message-ID: References: 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]:41751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adEwx-0000gC-BT for emacs-orgmode@gnu.org; Tue, 08 Mar 2016 05:33:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adEwr-0007BV-BA for emacs-orgmode@gnu.org; Tue, 08 Mar 2016 05:33:11 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:8994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adEwr-0007BP-4k for emacs-orgmode@gnu.org; Tue, 08 Mar 2016 05:33:05 -0500 In-Reply-To: (Charles C. Berry's message of "Mon, 7 Mar 2016 08:34:36 -0800") 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: "Charles C. Berry" Cc: emacs-orgmode --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-03-07 17:34, "Charles C. Berry" writes: > On Mon, 7 Mar 2016, Alan Schmitt wrote: > >> 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. >> > > Maybe this gets you a step closer > > #+begin_src emacs-lisp :results silent > (defmacro by-backend (&rest body) > `(case (org-bound-and-true-p 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) > (defalias 'org-babel-expand-body:tikz 'org-babel-expand-body:latex) > > (add-to-list 'org-src-lang-modes '("tikz" . latex)) > > (defvar org-babel-default-header-args:tikz > '((:imagemagick . "yes") > (:iminoptions . "-density 600") > (:imoutoptions . "-geometry 800") > (:results . "file raw") > (:fit . "yes") > (:headers . "(\\usepackage{tikz})") > (:exports . "results"))) > #+end_src > > > When I run your tikz src block interactively I get two files created. No= t=20 > sure why and I haven't time to edebug step thru the code. But maybe you=20 > can handle that bit. Thank you for the suggestion. At the moment I use a macro (because I need to put the resulting figure in a figure environment, as I want a label and caption), but I will give this a try. Thanks again, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO=E2=82=82 (2016-02, Mauna Loa Obs.): 404.02 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJW3qpgAAoJEAQNCjtO0uXH1nIIAMWLM/u+qIZ7q1fxegQ6QYV4 vxLjla0fcEbvi2rZ31QYDsaSugKpQyCF7RRYLiWOMCE+oNBW+VPFSUAGMAy3Te3h u2+asehCwBiDS5JndIXO6aJ6IqGOxHk042qobcJBEHsnfWrtb9Vp29OrFg0acOhJ 6DT8c2n4LG3McFjOz9bE558oXOZQhpHhcvZ/Y0KbfJtA3dJxruTi/V41/FQcG01I 8hVIsxnJ0rwyOE9C8JQY+tfOa4z6S+j2lLdPhHEWciBWGcw57S1ndAMYRZ3TnCQr +7eJIaXvwcXu6UlsbornuhTThZHyH4oK/NPwo1l+Hto3KC39dpIvYGs+2Psb+Zk= =BF8u -----END PGP SIGNATURE----- --=-=-=--