|
From: Jay B. <bel...@tr...> - 2005-04-29 04:07:15
|
> When I try to use the image environment etc to turn a latex structure
> into a png image, I find that I am losing the bottom third (or so) of
> the image. (This does not appear to happen when converting an inserted
> .eps file.) I have attached the stripped down tex file, the resulting
> .makeimage file and .ps file. The conversion from the .ps file to the
> .png file is perfect. I am also attaching the "correct" .png file that I
> have created by editing the .makeimage file on the fly by increasing the
> y-coordinate of the -T option to dvips.
>
> Can anyone help, please?
I think the part of the image you lose is the part below the baseline.
I think (someone feel free to correct me) the problem is that when
hyperlatex computes the image dimensions, it doesn't include the
depth. The relevant part of hyperlatex.sty is
\if@makeimages
\typeout{******************************************}
\typeout{* Making bitmaps from Hyperlatex source! *}
\typeout{******************************************}
\newwrite\@makeimagecmds
\immediate\openout\@makeimagecmds=\jobname.makeimage
\newbox\@imagebox
\newcount\@imagecount\@imagecount=10000
\def\@@@@image{\setbox\@imagebox=\vbox\bgroup\tex}
\def\endimage{\egroup
{\global\advance\@imagecount by 1\count0=\@imagecount
\immediate\write\@makeimagecmds{dvips\space -f\space -p\space
\the\@imagecount\space -n\space 1\space -D\space \image@dpi\space
-T\the\wd\@imagebox,\the\ht\@imagebox\space-O-72bp,-72bp\space
\jobname.dvi\space>\space\im...@na...^^J%
ps2image\space -res\space \image@resolution\space \im...@na...%
\space \Hlx@directory/\image@name.\@imagetype^^J}
\shipout\copy\@imagebox}\unvbox\@imagebox}
\else
\def\@@@@image{\tex}
\def\endimage{}
\fi
One quick way to fix this is to add a blank line at the bottom of the
image enviroment when \makeimage is defined:
Change the
\def\endimage{\egroup
to
\def\endimage{\par~\egroup
Another (more proper?) way would be to put in the correct total height
to begin with. I don't know if there's a total height function
corresponding to the \ht height function, but the height and depth
could be added in a new register. Add the line
\newdimen\@imageheight
right after the
\newcount\@imagecount\@imagecount=10000
line. Then replace the definition of \endimage with
\def\endimage{\egroup
{\global\advance\@imagecount by 1\count0=\@imagecount
\@imageheight=\ht\@imagebox
\advance\@imageheight by \dp\@imagebox
\immediate\write\@makeimagecmds{dvips\space -f\space -p\space
\the\@imagecount\space -n\space 1\space -D\space \image@dpi\space
-T\the\wd\@imagebox,\the\@imageheight\space-O-72bp,-72bp\space
\jobname.dvi\space>\space\im...@na...^^J%
ps2image\space -res\space \image@resolution\space \im...@na...%
\space \Hlx@directory/\image@name.\@imagetype^^J}
\shipout\copy\@imagebox}\unvbox\@imagebox}
Jay
|