emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Haochen Xie <haochenx@acm.org>
Cc: Fabrice Popineau <fabrice.popineau@centralesupelec.fr>,
	emacs-orgmode@gnu.org
Subject: Re: Block level specification for tex code html export method
Date: Fri, 04 Sep 2015 09:10:12 +0200	[thread overview]
Message-ID: <m2lhcmacdn.fsf@charm-ecran.irisa.fr> (raw)
In-Reply-To: <CAD3Qf6t=42G-UhV4jv4Y2wSXW58vMn3YA_OaUNairwgY9O9J3A@mail.gmail.com> (Haochen Xie's message of "Fri, 4 Sep 2015 15:23:22 +0900")

[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]

Thanks to everyone, I now have this working. Here is the final version.

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

#+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
--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 (“C-c C-c” on it), but as it does not prevent the export 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

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Last week athmospheric CO₂ average (Updated August 31, 2015, Mauna Loa Obs.):
377.82 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

  parent reply	other threads:[~2015-09-04  7:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10  8:11 Block level specification for tex code html export method Haochen Xie
2015-08-10 22:56 ` Andreas Leha
2015-08-11  8:47   ` Haochen Xie
2015-08-11  8:53     ` Fabrice Popineau
2015-08-11 16:24       ` Haochen Xie
2015-08-12  8:50         ` Andreas Leha
2015-08-12 12:51           ` Haochen Xie
2015-08-12 13:40             ` Andreas Leha
2015-09-03 11:42           ` Alan Schmitt
2015-09-03 12:30             ` Andreas Leha
2015-09-03 13:03               ` Haochen Xie
2015-09-03 20:39                 ` Andreas Leha
2015-09-03 20:33               ` Eric S Fraga
2015-09-03 21:11                 ` Andreas Leha
2015-09-03 21:38                   ` Nicolas Goaziou
2015-09-04  6:15                     ` Eric S Fraga
2015-09-04  6:23                       ` Haochen Xie
2015-09-04  7:07                         ` Eric S Fraga
2015-09-04  7:10                         ` Alan Schmitt [this message]
2015-09-04 12:08                     ` Andreas Leha
2015-09-04 12:48                       ` Nicolas Goaziou
2015-09-04 13:42                         ` Andreas Leha
2015-09-05  8:58                           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2lhcmacdn.fsf@charm-ecran.irisa.fr \
    --to=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=fabrice.popineau@centralesupelec.fr \
    --cc=haochenx@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).