From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremie Juste Subject: Re: Happily exporting LaTeX, now want to export to text and HTML, can't figure how to handle latex markup Date: Thu, 03 Aug 2017 01:22:05 +0200 Message-ID: <87vam5tv1e.fsf@freegnu.noherd.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dd2xy-0006EN-16 for emacs-orgmode@gnu.org; Wed, 02 Aug 2017 19:22:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dd2xu-0004Z5-Mq for emacs-orgmode@gnu.org; Wed, 02 Aug 2017 19:22:14 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:36922) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dd2xu-0004YU-Fw for emacs-orgmode@gnu.org; Wed, 02 Aug 2017 19:22:10 -0400 Received: by mail-wr0-x229.google.com with SMTP id 33so2017535wrz.4 for ; Wed, 02 Aug 2017 16:22:08 -0700 (PDT) In-Reply-To: (Charles Berry's message of "Wed, 2 Aug 2017 16:15:48 +0000") 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" To: "Berry, Charles" Cc: "emacs-orgmode@gnu.org" , Grant Rettke Hello=20 > > Putting together a macro seems like the best option. Recall that you > can use elisp in macros by placing it between `(eval=E2=80=99 and `)', so= the > following emits =E2=80=9Cdef=E2=80=99 in all but latex exports and =E2=80= =9Cabc=E2=80=9D for latex. > Yes I found this nice piece of code=20=20 It switches to svg if backend is html and to raw latex if backend is latex. You only have to tweak it your needs. #+header: :file (by-backend (html "tree.svg") (t 'nil)) #+header: :imagemagick #+header: :results (by-backend (pdf "latex") (t "raw")) #+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 * 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) ,@b= ody)) #+end_src The reference http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-La= TeX.html Best regards Jeremie