emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: Block level specification for tex code html export method
Date: Wed, 12 Aug 2015 09:50:13 +0100	[thread overview]
Message-ID: <oluzj1wlwl6.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: CAD3Qf6sR4PiYD09kjtJV40jSe3Cpu=6eW_cJ7Zb6ATY97=y4FA@mail.gmail.com

Hi Haochen,

You can render svg from latex through org directly.  Here is a complete
example including a tikz diagram that that works on my system (once I
tackle a bug in PGF [1]).
It renders
- png by default (and for inlining the image into the org document)
- nothing for latex (directly include the tikz code into the tex document)
- svg for html


--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 :iminoptions -density 600 :imoutoptions -geometry 800
#+header: :results file raw
#+header: :fit yes
#+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 (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body))
#+end_src
--8<---------------cut here---------------end--------------->8---


Regards,
Andreas

[1] http://tex.stackexchange.com/a/232739


Haochen Xie <haochenx@acm.org> writes:
> Hi Fabrice,
>
> Thank you for mentioning dvisvgm. I did some researches on it, and it seems that as for now, the only way to invoke dvisvgm is to first export the latex part to dvi, and call dvisvgm
> manually to convert it to svg, then include it in the org file, which, is too troublesome for me. Is there any plan to add dvisvgm as an alternative to dvipng and imagemagick? IMO svg
> images will look much better than png (well, in browsers supporting it), so that's a nice option to have.
>
> Regards,
>
> Haochen
>
> --
>
> Mail from Haochen Xie
>
> On Tue, Aug 11, 2015 at 5:53 PM, Fabrice Popineau <fabrice.popineau@supelec.fr> wrote:
>
>
>  2015-08-11 10:47 GMT+02:00 Haochen Xie <haochenx@acm.org>:
>
>
>  Hi Andreas,
>
>  Thank you for your reply. I've read the whole thread, and found your
>  example (the second link) very useful. Although for some reason, SVG
>  image is not working well on my machine (not being displayed in
>  chrome, nor on IE. I don't have firefox installed), but since the SVG
>  image generated by imagemagick is indeed a raster image, I don't see
>  any benefit using SVG over PNG, and exporting to PNG works perfectly.
>
>  Use dvisvgm instead of imagemagick to generate the svg file.
>
>  Fabrice

  reply	other threads:[~2015-08-12  8:50 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 [this message]
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
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=oluzj1wlwl6.fsf@med.uni-goettingen.de \
    --to=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.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).