dvipng
[Top][All Lists]
Advanced

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

[Dvipng] Re: [AUCTeX-devel] preview-latex, dvipng, and LyX


From: David Kastrup
Subject: [Dvipng] Re: [AUCTeX-devel] preview-latex, dvipng, and LyX
Date: Fri, 06 Jan 2006 11:41:55 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Enrico Forestieri <address@hidden> writes:

> sorry if this is not the right list. In this case, please, redirect me
> to the right one.

The list is quite correct, though there might be a dvipng-specific
list, too.

> As you know, LyX (http://www.lyx.org) uses both the preview-latex
> package and dvipng to display snippet previews of LaTeX math
> formulas. In order to do so it also relies on the output (stdout) of
> dvipng to capture the snippet number and its height and depth.
>
> However, in recent versions of preview-latex and dvipng the output
> devised for LyX's sake gets corrupted in the following way:
>
> $ dvipng ...
> This is dvipng 1.7 Copyright 2002-2005 Jan-Ake Larsson
> [1 (preview-latex version 11.81) depth=6 height=16]
>
> this output confuses the script LyX uses for generating preview
> snippets, which, instead, is expecting an output like this:

A lesson is learnt, but the damage is irreversible.

I mean, dvipng and preview.sty have been released in this manner, so
there is no sane around letting LyX detect this string and deal with
it.  That's the only way to minimize the impact, even if dvipng get
changed again in the next version to give this information in a
different way.  So I am copying the LyX developer list with this mail:
they will have to be a part of damage control.

> $ dvipng ...
> This is dvipng 1.7 Copyright 2002-2005 Jan-Ake Larsson
> [1 depth=6 height=16]
>
> I found that the problem is due to both recent versions of preview-latex
> and dvipng. For example, this problem doesn't show up in debian testing
> but manifests itself on Windows with MikTeX (where a more recent version
> of preview.sty is installed).
>
> Here is the relevant part of the diff between the versions of preview.sty
> in debian tetex and in MikTeX:
>
> $ diff -u preview.sty.tetex preview.sty.miktex
> ...
> @@ -83,6 +85,7 @@
>  \DeclareOption{dvips}{%
>    address@hidden@ne
>    address@hidden
> +      \special{!/address@hidden(address@hidden)def}
>        \special{!userdict begin/preview-bop-level 0 def%
>        /bop-hook{/preview-bop-level dup load dup 0 le{/isls false def%
>            /vsize 792 def/hsize 612 def}if 1 add store}bind def%
> ...
>
>
> and here is the relevant code in the dvipng (version 1.7) special.c source
> file causing the problem:
>
>
>   if (strncmp(buffer,"!/address@hidden(",18)==0) {
>     buffer+=18;
>     length-=18;
>     while (length>0 && buffer[length]!=')')
>       length--;
>     if (page_imagep==NULL)
>       Message(BE_NONQUIET," (preview-latex version %.*s)",length,buffer);
>     return;
>   }
>
>   /* preview-latex' tightpage option */
>   if (strncmp(buffer,"!/address@hidden",19)==0) {
>     buffer+=19;
>     SKIPSPACES(buffer);
>     if (strncmp(buffer,"true",4)==0) {
>       if (page_imagep==NULL)
>         Message(BE_NONQUIET," (preview-latex tightpage option detected,\
>  will use its bounding box)");
>       flags |= PREVIEW_LATEX_TIGHTPAGE;
>       return;
>     }
>   }
>   if (strncmp(buffer,"!userdict",9)==0
>       && strstr(buffer+10,"7{currentfile token not{stop}if 65781.76 
> div")!=NULL)
>  {
>     if (page_imagep==NULL && ~flags & PREVIEW_LATEX_TIGHTPAGE)
>       Message(BE_NONQUIET," (preview-latex <= 0.9.1 tightpage option 
> detected,\
>  will use its bounding box)");
>     flags |= PREVIEW_LATEX_TIGHTPAGE;
>     return;
>   }
>
>
> As a solution, it would suffice to replace BE_NONQUIET with
> BE_VERBOSE in the code snippet above, such as to not clutter stdout
> between "[1 " and "depth=...]".
>
> I would like to ask if this acceptable for you, or, in case it is not,
> if you can suggest an alternative. In this regard, what it is important
> is that nothing goes inside "[" ... "]" except snippet number and depth
> and height information.
>
> A second problem that I noticed is that when a font is missing and
> mktexpk (or alike) gets called to generate it, its stdout gets intermixed
> with that of dvipng, causing a similar (but worse) confusion.
>
> Is it possible to have the stdout of those helper programs redirected to
> stderr?

The latter would actually be useful for preview-latex as well, only
that it would be nice to direct the output completely elsewhere (Emacs
does not capture stderr separately): I often have to run preview-latex
several times when new fonts get generated, because the font
generating output confuses it.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


_______________________________________________
auctex-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/auctex-devel




reply via email to

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