emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Mathjax vs. problems with imagemagick


From: Joseph Vidal-Rosset
Subject: Re: [O] Mathjax vs. problems with imagemagick
Date: Tue, 08 Jul 2014 15:01:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hello Nick, hello everybody

Before using your suggestion of debugging, I have made another test to
convert formulas made with different latex packages into png images for
a html file.

At the beginning of my org file:

All formulas used with the equation environment have a nice png image,
and the Fitch proofs also.
But that is not the case with proofs in Gentzen tree style created via
bussproofs.sty : the png images are corrupted.

That's strange because it works well with LaTeX export and even with
latex-preview-image and org-htmlize. This image of implication
elimination rule in my gnus-message should be nice:

\begin{prooftree}
\AxiomC{$A \to B$}
\AxiomC{$A$}
\RightLabel{\scriptsize{$\to E$}}
\BinaryInfC{$B$}
\end{prooftree}

I am afraid to be not competent enough to use correctly the debugger
that you suggest, but it is probably again a problem my setup or
something missing in my headers and not a bug somewhere.

Best wishes,

Jo.

Le dim. 06 juil. 2014 à 11:25:30 , Nick Dokos <address@hidden> a
envoyé ce message:
> The process by which images are produced (for imagemagick: dvipng
> follows a slightly different path) is to wrap the latex fragment
> into a complete latex file, run pdflatex (or whatever your
> org-latex-pdf-process says) to produce a pdf file and then run
> the imagemagick `convert' program to produce the png.
>
> I'd suggest that you duplicate this process by hand and see where
> it goes wrong.
>
> I usually do that by adding a (debug) call into
> org-create-formula-image-with-imagemagick like this:
>
> (let ((latex-header (org-create-formula–latex-header)))
> (with-temp-file texfile
> (insert latex-header)
> (insert "\"
> "\"
> "\"
> "\"
> "{\"
> string
> "}"
> "\")))
> (org-latex-compile texfile t)
> (debug) <<<<<<<<<<<<<<ADDED THIS
> (if (not (file-exists-p pdffile))
> (progn (message "Failed to create pdf file from %s" texfile) nil)
> (ignore-errors
> (if (featurep 'xemacs)
> (call-process "convert" nil nil nil
> "-density" "96"
> "-trim"
> "-antialias"
> pdffile
> "-quality" "100"
> ;; "-sharpen" "0x1.0"
> pngfile)
> (call-process "convert" nil nil nil
> "-density" dpi
> "-trim"
> "-antialias"
> pdffile
> "-quality" "100"
> ;; "-sharpen" "0x1.0"
> pngfile)))
>
>
> I then reload the file (M-x load-file RET /path/to/org.el RET) to pick
> up the modified function and proceed normally to export the file. When
> the (debug) is executed, I get a debug buffer and I can examine things
> like `texfile' and `dpi', using the debugger's `e' command. I then copy
> the latex file named by `texfile' to some private directory and run
> pdflatex on it and then (using the dpi value the debugger showed me - in
> my case, it was "120.0"), I convert to png using the same command as the
> function does:
>
> cp /tmp/orgtex3771B9p.tex foo.tex
> pdflatex foo.tex
> convert -density 120.0 -trim -antialias foo.pdf -quality 100 foo.png
>
> The whole thing is a bit fiddly but not really difficult: it takes more
> time to explain than to do.
>
> BTW, if you go this way, don't forget to delete the (debug) afterwards.
>
> HTH.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]