Joseph Vidal-Rosset <joseph.vidal.ros...@gmail.com> writes:
> To convert equations from *.orgĀ into *.html, Mathjax is certainly the > best solution but unfortunately, this solution does not work as soons > as one need to use some texlive package convenient to produce easily > proofs in specific format (for example if one uses bussproofs.sty of > fitch.sty ). > > That is why imagemagick is useful. Unfortunately, the produced png > images in my ltxpng/ have a very bad quality and if the browser load > them, the result is terrible. I met already this problem and I do not > remind what was the solution... > > I you have suggestions... > 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: --8<---------------cut here---------------start------------->8--- (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) <<<<<<<<<<<<<<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))) --8<---------------cut here---------------end--------------->8--- 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. -- Nick