From: Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com>
To: Nick Dokos <ndokos@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Mathjax vs. problems with imagemagick
Date: Tue, 08 Jul 2014 15:01:36 +0200 [thread overview]
Message-ID: <87oax0ngwf.fsf@gmail.com> (raw)
In-Reply-To: <87mwcm6uyd.fsf@gmail.com> (Nick Dokos's message of "Sun, 06 Jul 2014 17:25:30 -0400")
[-- Attachment #1: Type: text/plain, Size: 4129 bytes --]
#+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.
At the beginning of my org file:
#+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.
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 <ndokos@gmail.com> 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 "\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)))
>
>
> 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.
[-- Attachment #2.1: Type: text/html, Size: 4896 bytes --]
[-- Attachment #2.2: latex2370749y_e0d3b5403491143b62376f682dfe5dbed1070fa6.png --]
[-- Type: image/png, Size: 636 bytes --]
next prev parent reply other threads:[~2014-07-08 13:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-06 8:03 Mathjax vs. problems with imagemagick Joseph Vidal-Rosset
2014-07-06 8:39 ` briangpowell .
2014-07-06 8:59 ` Joseph Vidal-Rosset
2014-07-06 21:25 ` Nick Dokos
2014-07-08 13:01 ` Joseph Vidal-Rosset [this message]
2014-07-08 13:04 ` Joseph Vidal-Rosset
2014-07-08 13:44 ` Joseph Vidal-Rosset
2014-07-11 0:59 ` Nick Dokos
2014-07-11 7:38 ` Joseph Vidal-Rosset
2014-07-11 15:59 ` Nick Dokos
2014-07-11 16:06 ` Joseph Vidal-Rosset
2014-07-11 18:05 ` Nick Dokos
2014-07-11 18:24 ` Joseph Vidal-Rosset
2014-07-28 14:36 ` Sebastien Vauban
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oax0ngwf.fsf@gmail.com \
--to=joseph.vidal.rosset@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=ndokos@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.