From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joseph Vidal-Rosset Subject: Re: Mathjax vs. problems with imagemagick Date: Tue, 08 Jul 2014 15:01:36 +0200 Message-ID: <87oax0ngwf.fsf@gmail.com> References: <87mwcm6uyd.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4V1n-0002WB-6G for emacs-orgmode@gnu.org; Tue, 08 Jul 2014 09:01:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4V1i-0007XK-Sf for emacs-orgmode@gnu.org; Tue, 08 Jul 2014 09:01:46 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:55673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4V1i-0007X8-Il for emacs-orgmode@gnu.org; Tue, 08 Jul 2014 09:01:42 -0400 Received: by mail-wi0-f173.google.com with SMTP id cc10so945011wib.6 for ; Tue, 08 Jul 2014 06:01:41 -0700 (PDT) In-Reply-To: <87mwcm6uyd.fsf@gmail.com> (Nick Dokos's message of "Sun, 06 Jul 2014 17:25:30 -0400") 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: Nick Dokos Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable #+OPTIONS: latex:t #+LATEX_HEADER: \usepackage{bussproofs} 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.=20 At the beginning of my org file:=20 #+LATEX_HEADER: \usepackage{fitch} #+LATEX_HEADER: \usepackage{bussproofs} #+OPTIONS: tex:imagemagick All formulas used with the equation environment have a nice png image, and the Fitch proofs also.=20 But that is not the case with proofs in Gentzen tree style created via bussproofs.sty : the png images are corrupted.=20 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:=20 \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.=20 Best wishes, Jo.=20 Le dim. 06 juil. 2014 =C3=A0 11:25:30 , Nick Dokos = a envoy=C3=A9 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 "\n\\begin{document}\n" > "\\definecolor{fg}{rgb}{" fg "}\n" > "\\definecolor{bg}{rgb}{" bg "}\n" > "\n\\pagecolor{bg}\n" > "\n{\\color{fg}\n" > string > "\n}\n" > "\n\\end{document}\n"))) > (org-latex-compile texfile t) > (debug) <<<<<<<<<<<<< (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. --=-=-= Content-Type: multipart/related; boundary="==-=-=" --==-=-= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

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:

3D"\begin{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 =C3=A0 11:25:30 , Nick Dokos <ndokos@gmail.co= m> a
envoy=C3=A9 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) n= il)
> (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 cop= y
> 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 t= he
> function does:
>
> cp /tmp/orgtex3771B9p.tex foo.tex
> pdflatex foo.tex
> convert -density 120.0 -trim -antialias foo.pdf -quality 100 foo.p= ng
>
> The whole thing is a bit fiddly but not really difficult: it takes mor= e
> time to explain than to do.
>
> BTW, if you go this way, don't forget to delete the (debug) afterwards= .
>
> HTH.

--==-=-= Content-Type: image/png Content-ID: <_tmp_ltxpng_latex2370749y_e0d3b5403491143b62376f682dfe5dbed1070fa6.png> Content-Disposition: inline; filename=latex2370749y_e0d3b5403491143b62376f682dfe5dbed1070fa6.png Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAJMAAAAeBAAAAADIUJ7OAAAABGdBTUEAALGPC/xhBQAAAAFzUkdC AK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dE AA86Mj6jAAAACW9GRnMAAAG6AAAAhACY49AmAAAACXBIWXMAAAB4AAAAeACd9VpgAAAACXZwQWcA AAP8AAAFKAAd/BK3AAABK0lEQVRIx62UO27DMBBE5crp5E4lE19Ax3Cpq9hdOiVpAqThFXQDXU0U DJBgM04iWT9wxyDMLQSChB5Hs6vJMJRVWJcGPIS6hDa7bFxctyffOXqJVVGU257YHD4XUJqhXDHv tfeFhPqsqapZtFGTzB9B1ZWjZgXDnQ38sRVQHUWZGdX/P8+wUgNxYKh6oWpytVFBkKWq9FKV8yMv +MafiQfu1W7aM/fudUrySokoUy9s99NYfQU5BbX99R14WXXQuQplUFS/1+i2M+regI8s5EV8FUuv nqsS9flp1DB9lW1TqPr9J5xK8oGlHlrVpPHK4oEqFqSr8qbEiaJYkGI90Y9UsSBl/6BwZyIUC9JI FAvSSBQL0nivGpUGJQZpNIoGaRxKDtJYlBykAuoGP91iRq6AQssAAAAldEVYdGRhdGU6Y3JlYXRl ADIwMTQtMDctMDhUMTU6MDE6MjgrMDI6MDCr1GABAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE0LTA3 LTA4VDE1OjAxOjI4KzAyOjAw2onYvQAAABR0RVh0cGRmOlZlcnNpb24AUERGLTEuNSAFXAs5AAAA AElFTkSuQmCC --==-=-=-- --=-=-=--