From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] bugfix: fix previewing latex fragments with imagemagick Date: Sun, 14 Jul 2013 10:29:22 +0200 Message-ID: <87ehb1lf31.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyHg7-00030E-Kt for emacs-orgmode@gnu.org; Sun, 14 Jul 2013 04:29:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyHg6-0004MT-81 for emacs-orgmode@gnu.org; Sun, 14 Jul 2013 04:29:11 -0400 Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]:48221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyHg5-0004MP-VY for emacs-orgmode@gnu.org; Sun, 14 Jul 2013 04:29:10 -0400 Received: by mail-we0-f182.google.com with SMTP id p60so9125538wes.41 for ; Sun, 14 Jul 2013 01:29:09 -0700 (PDT) In-Reply-To: (feng shu's message of "Sun, 14 Jul 2013 15:06:23 +0800") 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: feng shu Cc: "emacs-orgmode@gnu.org" Hello, feng shu writes: > Previewing and exporting latex fragments with imagemagick has been broken > when new export system merged. This is the fix patch. Thanks for the patch. Here are a few comments. > Subject: [PATCH] bugfix: fix generating formula image with imagemagick when > previewing and exporting Prefer "Fix generating LaTeX formula images" as subject. > -@file{dvipng} is used to create images, any @LaTeX{} environment will be > -handled.}. The only requirement is that the @code{\begin} and @code{\end} > -statements appear on a new line, at the beginning of the line or after > -whitespaces only. > +@file{dvipng} program or @file{imagemagick} suite is used to create images, > +any @LaTeX{} environment will be handled.}. The only requirement is that the > +@code{\begin} and @code{\end} statements appear on a new line, at the > +beginning of the line or after whitespaces only. > @item > Text within the usual @LaTeX{} math delimiters. To avoid conflicts with > currency specifications, single @samp{$} characters are only recognized as > @@ -10196,10 +10196,11 @@ You can also set this variable on a per-file basis using one of these > lines: > > @example > -#+OPTIONS: tex:t @r{Do the right thing automatically (MathJax)} > -#+OPTIONS: tex:dvipng @r{Force using dvipng images} > -#+OPTIONS: tex:nil @r{Do not process @LaTeX{} fragments at all} > -#+OPTIONS: tex:verbatim @r{Verbatim export, for jsMath or so} > +#+OPTIONS: tex:t @r{Do the right thing automatically (MathJax)} > +#+OPTIONS: tex:dvipng @r{Force using dvipng images} > +#+OPTIONS: tex:imagemagick @r{Force using images converted by imagemagick} > +#+OPTIONS: tex:nil @r{Do not process @LaTeX{} fragments at all} > +#+OPTIONS: tex:verbatim @r{Verbatim export, for jsMath or so} > @end example It should be: @example #+OPTIONS: tex:t @r{Do the right thing automatically (MathJax)} #+OPTIONS: tex:nil @r{Do not process @LaTeX{} fragments at all} #+OPTIONS: tex:verbatim @r{Verbatim export, for jsMath or so} @end example because `org-export-with-latex' provides neither `dvipng' nor `imagemagick' options. Those are added by some back-ends (e.g., `org-html-with-latex'). > @node Previewing @LaTeX{} fragments, CDLaTeX mode, @LaTeX{} fragments, Embedded @LaTeX{} > @@ -10207,8 +10208,8 @@ lines: > @cindex @LaTeX{} fragments, preview > > @vindex org-latex-create-formula-image-program > -If you have @file{dvipng} or @file{imagemagick} installed@footnote{Choose the > -converter by setting the variable > +If you have @file{dvipng} program or @file{imagemagick} suite > +installed@footnote{Choose the converter by setting the variable Does this change really matter? > -@cindex dvipng > +@cindex dvipng or imagemagick Use @cindex dvipng @cindex imagemagick instead. > @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two > different ways on HTML pages. The default is to use the > @@ -11282,13 +11283,21 @@ this line. > If you prefer, you can also request that @LaTeX{} fragments are processed > into small images that will be inserted into the browser page. Before the > availability of MathJax, this was the default method for Org files. This > -method requires that the @file{dvipng} program is available on your system. > -You can still get this processing with > +method requires that the @file{dvipng} program or @file{imagemagick} suite is > +available on your system.You can still get this processing with Mind the spaces: too many before "or", not enough before "You". > +or: > + > +@example > +#+OPTIONS: tex:imagemagick > +@end example > + > + > + Nitpick: No need for so many blank lines. > -@cindex dvipng > +@cindex dvipng or imagemagick See above. > @item PNG images > > This option is activated on a per-file basis with > @@ -12273,9 +12282,16 @@ This option is activated on a per-file basis with > #+OPTIONS: LaTeX:dvipng > @end example > > +or: > + > +@example > +#+OPTIONS: LaTeX:imagemagick > +@end example > + OK. But documentation is still wrong here. It should be "tex:dvipng" and "tex:imagemagick". > -that the @file{dvipng} program be available on your system. > +that the @file{dvipng} program or @file{imagemagick} suite be available on > +your system. Check white spaces. > - (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.)))))) > + (dpi (number-to-string (* scale (floor (if buffer fnh 120.))))) Note sure about this change. Why do you think it is needed? > - (dvipng > + ((or dvipng imagemagick) It should be: ((dvipng imagemagick) See `case' documentation. > - (dvipng > + ((or dvipng imagemagick) Ditto. > - (dvipng > + ((or dvipng imagemagick) Ditto. > (unless (and (org-check-external-command "latex" "" t) > - (org-check-external-command "dvipng" "" t)) > + (org-check-external-command "dvipng" "" t) > + (org-check-external-command "convert" "" t)) There's a missing `or': (or (org-check-external-command "dvipng" "" t) (org-check-external-command "convert" "" t)) > (case processing-type > - (dvipng "ltxpng/") > + ((or dvipng imagemagick) "ltxpng/") See above. > (case processing-type > - (dvipng (format "Creating LaTeX Image %d..." count)) > + ((or dvipng imagemagick) (format "Creating LaTeX Image %d..." count)) See above. Regards, -- Nicolas Goaziou