Jan-Åke Larsson wrote:
> Angus Leeming wrote:
> > I use it within LyX to calculate the 'ascent fraction' of the 
> > snippet. (A snippet whose base line was in the middle of the image 
> > would have an ascent fraction of 0.5.) The code that does this inside 
> > LyX is (stripped down):
> > 
> <snip>
> > 
> > This information is used to position the image on the LyX screen.
> > 
> > Since both dvipng and dvips,gs,pnmcrop use the same dvi file, it 
> > seems to make sense to use the same mechanism. However, if you have 
> > another mechanism to obtain this info within dvipng, then please do 
> > tell me.
> 
> I see. There are two possibilities:
> 
> 1) Make dvipng detect usage of the 'tightpage' option and use the
>    image metrics within the DVI.
> 
> 2) Output the position of the baseline of the first character output
>    in each image, in pixels or possibly as a fraction

Actually, it is better than that. I had a look at this last night (and
just checked it in).

  <technical mumbo-jumbo> 
  I understand that when using \usepackage[active,...]{preview}, the
  baseline is at the origin of the DVI coordinate system. The
  boundingbox calculations inside dvipng offsets the image so that the
  output ends up within the image.

  This also means that the y-offset is the position of the baseline.
  Simply reporting the y-offset will tell us what the baseline of the
  image is. Without using preview's "tightpage" option. 
  </technical mumbo-jumbo>

Try
      dvipng -baseline dvifile

The dvifile should be generated with \usepackage[active,...]{preview},
otherwise the output will be real boring (baseline=0), generally.
preview-latex's "tightpage" option is not needed.

/JÅ


PS: I do not feel strongly about the output format of this, so if
Angus or someone has opinions, let me know.


-- 
"We just typed make"
   Stephen Lambrigh, Director of Server Product Marketing at Informix
   about porting their Database to Linux

Reply via email to