Nicolas Goaziou <n.goaz...@gmail.com> writes: > Hello, > > feng shu <tuma...@gmail.com> 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'). > I just find "dvipng" and add a similar "imagemagick" line below..... Good luck....
>> @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". Good luck +1 > >> -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? Compared with buffer font height, The font height in image generated seemd too small, This may be a bug I introduced when I coded imagemagick feature a year ago. > >> - (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)) > The imagemagick feature use (car org-latex-pdf-process) to generate pdf file , then convert it to image. check "latex" may be no effort, but it has no harm too. > 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, --