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: Thu, 03 Sep 2015 21:39:34 +0100	[thread overview]
Message-ID: <olur3mfme49.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: CAD3Qf6vuMyqQyQWJSew6b1fO=a7K3sKvVPTMd+D9L_NStiQHDA@mail.gmail.com

Hi Haochen,

Thanks for following that up!

Haochen Xie <haochenx@acm.org> writes:
> ​Hello
> 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 800
>
> 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.

Thanks for that!  I'll keep that in mind.

Regards,
Andreas




>
> As said by Andreas, 
> ​it's probably that ​
> your
> ​​ by
> ​​-backend
> ​​ macro
> ​​ 
> ​is not working​
> properly, or, maybe you are not using a recent enough version of org-mod
> ​​e
> ​​. This
> ​​ 
> ​​magic
> ​, if I remember correctly,​
> ​​ 
> ​​is
> ​​​​ 
> ​​act
> ​​​​uall
> ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​y​
> ​​ done
> ​​ by
> ​​ a
> ​​ special
> ​​ case
> ​​ added
> ​​ to
> ​​ some
> ​​ latex
> ​​ babel
> ​​ export
> ​​ function
> ​​, wh
> ​​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 
> ​bug
> 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 <alan.schmitt@polytechnique.org> writes:
>  > Hello Andreas,
>  >
>  > I’m slowly catching up on the org mailing list, and I found your 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’m afraid I’m missing a step. Do you see what I’m 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 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

  reply	other threads:[~2015-09-03 20:39 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 [this message]
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=olur3mfme49.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).