emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Happily exporting LaTeX, now want to export to text and HTML, ca


From: Jeremie Juste
Subject: Re: [O] 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)


Hello 

>
> Putting together a macro seems like the best option.  Recall that you
> can use elisp in macros by placing it between `(eval’ and `)', so the
> following emits “def’ in all but latex exports and “abc” for latex.
>


Yes I found this nice piece of code  

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=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 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

The reference 
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html


Best regards

Jeremie



reply via email to

[Prev in Thread] Current Thread [Next in Thread]