emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] bugfix: fix previewing latex fragments with imagemagick


From: Feng Shu
Subject: Re: [O] [PATCH] bugfix: fix previewing latex fragments with imagemagick
Date: Sun, 14 Jul 2013 21:03:04 +0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.2 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Hello,
>
> feng shu <address@hidden> 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.
>
>> address@hidden 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.
>> address@hidden program or @file{imagemagick} suite is used to create images, 
>> +any @LaTeX{} environment will be handled.}.  The only requirement is that 
>> the
>> address@hidden 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} address@hidden the
>> -converter by setting the variable
>> +If you have @file{dvipng} program  or @file{imagemagick} suite
>> address@hidden the converter by setting the variable
>
> Does this change really matter?
>
>> address@hidden dvipng
>> address@hidden dvipng or imagemagick
>
> Use
>
>   @cindex dvipng
>   @cindex imagemagick
>
> instead.
>
>>  @LaTeX{} math snippets (@address@hidden 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:
>> +
>> address@hidden
>> +#+OPTIONS: tex:imagemagick
>> address@hidden example
>> +
>> +
>> +
>
> Nitpick: No need for so many blank lines.
>
>> address@hidden dvipng
>> address@hidden 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:
>> +
>> address@hidden
>> +#+OPTIONS: LaTeX:imagemagick
>> address@hidden 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,

-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]