From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Block level specification for tex code html export method Date: Wed, 12 Aug 2015 09:50:13 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPRjZ-0000EF-U8 for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 04:50:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPRjV-0006vH-2o for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 04:50:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:55524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPRjU-0006up-Rx for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 04:50:01 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZPRjT-0008Ur-B1 for emacs-orgmode@gnu.org; Wed, 12 Aug 2015 10:49:59 +0200 Received: from 193.63.222.18 ([193.63.222.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Aug 2015 10:49:59 +0200 Received: from andreas.leha by 193.63.222.18 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Aug 2015 10:49:59 +0200 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: emacs-orgmode@gnu.org 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 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 wrote: > > > 2015-08-11 10:47 GMT+02:00 Haochen Xie : > > > 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