[Top][All Lists]

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

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

From: Angus Leeming
Subject: Re: [AUCTeX-devel] preview-latex, dvipng, and LyX
Date: Mon, 9 Jan 2006 16:07:17 +0000
User-agent: KMail/1.9.1

On Monday 09 January 2006 15:26, Jan-Åke Larsson wrote:
> Angus Leeming wrote:
> >>>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.
> Well, dvipng has always been chattering about things it does on each
> page, even though this particular message will always appear on page 1
> from now on. For instance, if the dvi page numbers differ from the
> physical page numbers, there will be a heads-up in the form of
> "(physical page number)". And if an eps is included you'll see
> "<foo.eps>".

Hi, Jan-Åke.

Currently we look for the regex:
    metrics_re = re.compile("\[([0-9]+) depth=(-?[0-9]+) height=(-?[0-9]+)")

So keep the chatter, but give it a line of its own.

> I suppose that
>      "\[([0-9]+) .*?depth=(-?[0-9]+) height=(-?[0-9]+)"
> would do the trick. Or is there some deep reason for not using ".*?" ?

It's ugly and fragile. The .* can currently contain mutliple lines from 
ghostscript which means that we'd have to load the entire metrics file into 
the data to be regex-ed rather than proceed line by line, as now.

> Anyhow, the font-generating call is internal to kpathsea, it is not as
> if I get to choose where to send output. With glibc redirection should
> be easy, but without glibc I think I'll need to fork for every call to
> kpse_find_pk, and redirect or gobble output and _then_ call kpse_find_pk
> _again_ in the parent. Hmmmmmmmmm. Some overhead, but possible.

Don't do this. I/we aren't looking to make your life/code more complex. Just 
store the metrics info as a string and output it as a chunk.

> Opinions?
> /JÅ

Just the question: is it not possible to output "\[([0-9]+) depth=(-?[0-9]+) 
height=(-?[0-9]+)" without any intervening noise?


reply via email to

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