From mboxrd@z Thu Jan 1 00:00:00 1970 From: Haochen Xie Subject: Re: Block level specification for tex code html export method Date: Thu, 3 Sep 2015 22:03:46 +0900 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11374472bb30b6051ed76a0d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXUBV-0003Wp-2d for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 09:04:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXUBQ-0007Ig-03 for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 09:04:08 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:36615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXUBP-0007IO-Rk for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 09:04:03 -0400 Received: by qgx61 with SMTP id 61so27382933qgx.3 for ; Thu, 03 Sep 2015 06:04:03 -0700 (PDT) Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com. [209.85.220.178]) by smtp.gmail.com with ESMTPSA id r16sm14843331qkl.3.2015.09.03.06.04.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 06:04:02 -0700 (PDT) Received: by qkcf65 with SMTP id f65so20571211qkc.3 for ; Thu, 03 Sep 2015 06:04:01 -0700 (PDT) In-Reply-To: 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: Alan Schmitt Cc: Andreas Leha , emacs-orgmode@gnu.org --001a11374472bb30b6051ed76a0d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =E2=80=8BHello Alan, I'm not 100% sure, but I think the distorted PNG file is generated by dvipng. It seems that dvipng cannot handle tikz blocks very well, and one must use imagemagick for those blocks. I think this line: #+header: :imagemagick :iminoptions -density 600 :imoutoptions -geometry 80= 0 should be #+header: :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 800 so that imagemagick would be used instead of dvipng, which is the global default. As said by Andreas, =E2=80=8Bit's probably that =E2=80=8B your =E2=80=8B=E2=80=8B by =E2=80=8B=E2=80=8B -backend =E2=80=8B=E2=80=8B macro =E2=80=8B=E2=80=8B =E2=80=8Bis not working=E2=80=8B properly, or, maybe you are not using a recent enough version of org-mod =E2=80=8B=E2=80=8B e =E2=80=8B=E2=80=8B . This =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B magic =E2=80=8B, if I remember correctly,=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B is =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B act =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B uall =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8B=E2=80=8B =E2=80=8By=E2=80=8B =E2=80=8B=E2=80=8B done =E2=80=8B=E2=80=8B by =E2=80=8B=E2=80=8B a =E2=80=8B=E2=80=8B special =E2=80=8B=E2=80=8B case =E2=80=8B=E2=80=8B added =E2=80=8B=E2=80=8B to =E2=80=8B=E2=80=8B some =E2=80=8B=E2=80=8B latex =E2=80=8B=E2=80=8B babel =E2=80=8B=E2=80=8B export =E2=80=8B=E2=80=8B function =E2=80=8B=E2=80=8B , wh =E2=80=8B=E2=80=8B ich is contributed by Andreas somehow recently. You may want to try upgrade your org-mode and try again. Also please follow this link [1] to fix a =E2=80=8Bbug in htlatex as mentioned in Andreas's mail, or your html export will fail silently (showing success on emacs, but no images generated). [1] http://tex.stackexchange.com/a/232739 -- Mail from Haochen Xie On Thu, Sep 3, 2015 at 9:30 PM, Andreas Leha < andreas.leha@med.uni-goettingen.de> wrote: > Hi Alan, > > Glad you like the example. > > Three things: > 1. It still works for me ;-) > 2. The distorted png might come from the bug in htlatex I mentioned in > this thread [1]. > 3. It seems that the by-backend does not work properly for you. I am > not sure about the reason for that. What org-mode version do you run? > > HTH, > Andreas > > > [1] http://tex.stackexchange.com/a/232739 > > > > Alan Schmitt writes: > > Hello Andreas, > > > > I=E2=80=99m slowly catching up on the org mailing list, and I found you= r example > > very interesting. I tried to run it and it does not seem to work here. > > Here is what I did: > > - I copied the code below to a file > > - I evaluated the last block > > - I made sure that latex was one of the org-babel-load-languages > > language > > - I tried executing the first block, which generated this strange png > > > > > > > > - I exported both to html and pdf, and in both cases I would have > > a reference to the png instead of the svg/tikz code. > > > > I=E2=80=99m afraid I=E2=80=99m missing a step. Do you see what I=E2=80= =99m doing wrong? > > > > Thanks, > > > > Alan > > > > On 2015-08-12 10:50, Andreas Leha > writes: > > > >> #+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=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 > >> > >> #+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 > > > > > --001a11374472bb30b6051ed76a0d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
=E2=80=8BHe= llo
=C2=A0Alan,

I'm not 100% sure, but I think the distorte= d PNG file is generated by dvipng. It seems that dvipng cannot handle tikz = blocks very well, and one must use imagemagick for those blocks. I think th= is line:

#+header: :imagemagick :iminoptions -density 600 :imoutopti= ons -geometry 800

should be

#+header: :imagemagick yes :imino= ptions -density 600 :imoutoptions -geometry 800

so that imagemagick = would be used instead of dvipng, which is the global default.

As sai= d by Andreas,
=E2=80=8Bit's probably that =E2=80=8B
you= r
=E2=80=8B=E2=80=8B
by
=E2=80=8B=E2=80=8B-backend
=E2=80=8B=E2=80=8B
macro
=E2=80=8B=E2= =80=8B
=E2=80=8Bis not working=E2=80=8B
=C2=A0properl= y, or, maybe you are not using a recent enough version of org-mod
=E2=80=8B=E2=80=8B
e
=E2=80=8B=E2=80=8B
. This
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
magic
=E2=80=8B, if I remember correctly,=E2=80=8B
=E2=80=8B= =E2=80=8B
=E2=80=8B=E2=80=8B
is
=E2=80=8B= =E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2= =80=8B
act
=E2=80=8B=E2=80=8B
=E2=80=8B=E2= =80=8B
uall
=E2=80=8B=E2=80=8B
=E2=80=8B=E2= =80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80= =8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2=80=8B=E2=80=8B
=E2= =80=8By=E2=80=8B
=E2=80=8B=E2=80=8B
done
= =E2=80=8B=E2=80=8B
by
=E2=80=8B=E2=80=8B
a
=E2=80=8B=E2=80=8B
special
=E2=80=8B=E2=80=8B
case=E2=80=8B=E2=80=8B
added
=E2=80=8B=E2=80=8B to
=E2=80=8B=E2=80=8B
some
=E2=80=8B=E2=80=8B latex
=E2=80=8B=E2=80=8B
babel
=E2=80=8B=E2= =80=8B
export
=E2=80=8B=E2=80=8B
function
=E2=80=8B=E2=80=8B
, wh
=E2=80=8B=E2=80=8B
ich is cont= ributed by Andreas somehow recently. You may want to try upgrade your org-m= ode and try again.

Also please follow this link [1] to fix a
=E2=80=8Bbug
=C2=A0in htlatex as mentioned in Andreas's mail, = or your html export will fail silently (showing success on emacs, but no im= ages generated).

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




--

=
Mail from Haochen Xie

On Thu, Sep 3, 2015 at 9:30 PM, Andreas Leha= <andreas.leha@med.uni-goettingen.de> wrote= :
Hi Alan,

Glad you like the example.

Three things:
1. It still works for me ;-)
2. The distorted png might come from the bug in htlatex I mentioned in
this thread [1].
3. It seems that the by-backend does not work properly for you.=C2=A0 I am<= br> not sure about the reason for that.=C2=A0 What org-mode version do you run?=

HTH,
Andreas


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



Alan Schmitt <alan.sch= mitt@polytechnique.org> writes:
> Hello Andreas,
>
> I=E2=80=99m slowly catching up on the org mailing list, and I found yo= ur example
> very interesting. I tried to run it and it does not seem to work here.=
> Here is what I did:
> - I copied the code below to a file
> - I evaluated the last block
> - I made sure that latex was one of the org-babel-load-languages
>=C2=A0 =C2=A0language
> - I tried executing the first block, which generated this strange png<= br> >
>
>
> - I exported both to html and pdf, and in both cases I wou= ld have
>=C2=A0 =C2=A0a reference to the png instead of the svg/tikz code.
>
> I=E2=80=99m afraid I=E2=80=99m missing a step. Do you see what I=E2=80= =99m doing wrong?
>
> Thanks,
>
> Alan
>
> On 2015-08-12 10:50, Andreas Leha <andreas.leha@med.uni-goettingen.de> writes: >
>> #+LATEX_HEADER: \usepackage{tikz}
>>
>> First execute the second code block, to define the convenience mac= ro
>> and to set the required new variables in ob-latex.el.=C2=A0 Then e= xport 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 &qu= ot;tree.tikz") (t "tree.png"))
>> #+header: :imagemagick :iminoptions -density 600 :imoutoptions -ge= ometry 800
>> #+header: :results file raw
>> #+header: :fit yes
>> #+begin_src latex
>>=C2=A0 =C2=A0\usetikzlibrary{trees}
>>=C2=A0 =C2=A0\begin{tikzpicture}
>>=C2=A0 =C2=A0 =C2=A0\node [circle, draw, fill=3Dred!20] at (0,0) {1= }
>>=C2=A0 =C2=A0 =C2=A0child { node [circle, draw, fill=3Dblue!30] {2}=
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0child { node [circle, draw, fill=3Dgreen= !30] {3} }
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0child { node [circle, draw, fill=3Dyello= w!30] {4} }};
>>=C2=A0 =C2=A0\end{tikzpicture}
>> #+end_src
>>
>> #+results:
>> [[file:tree.png]]
>>
>> * COMMENT setup
>> #+begin_src emacs-lisp :results silent
>>=C2=A0 =C2=A0(setq org-babel-latex-htlatex "htlatex")
>>=C2=A0 =C2=A0(defmacro by-backend (&rest body)
>>=C2=A0 =C2=A0 =C2=A0`(case (if (boundp 'backend) (org-export-ba= ckend-name backend) nil) ,@body))
>> #+end_src





--001a11374472bb30b6051ed76a0d--