I have to include small overlapping pictures into a LaTeX file.
However, their bounding box is larger than really needed, so
if I code:
\includegraphics{1.eps}
\hskip-1.5em\relax
\includegraphics{2.eps}
the image 1.eps is partly erased by the opaque white background
of 2.eps . Since these small pictures are some 300, hand-editing
is not really an issue... Is there any kind of LaTeX/graphicx/PostScript
trick I can do to have transparent backgrounds?
Thank you,
Riccardo
Riccardo> Hello,
Riccardo> I have to include small overlapping pictures into a LaTeX file.
Riccardo> However, their bounding box is larger than really needed, so
Riccardo> if I code:
Riccardo> \includegraphics{1.eps}
Riccardo> \hskip-1.5em\relax
Riccardo> \includegraphics{2.eps}
Riccardo> the image 1.eps is partly erased by the opaque white
Riccardo> background of 2.eps
Which would imply that 2.eps draws an opaque white background. This
is bad EPS practice. Finding and deleting the code with a script
would be one idea. Making proper bounding boxes another.
Riccardo> Since these small pictures are some 300, hand-editing is
Riccardo> not really an issue...
Then edit with a script, or run epsffit on it, or (depending on the
tool in fault) run one of the many available fix*ps tools from the
psutils package on it, or ps2epsi...
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: David....@t-online.de
: Which would imply that 2.eps draws an opaque white background. This
: is bad EPS practice. Finding and deleting the code with a script
: would be one idea. Making proper bounding boxes another.
The EPS images are generated by dvips (dvips(k) 5.86) via
dvips -Pamz -Pcmz -E -i -j pictures ...
The pictures.tex file contains, for each picture, the sequence of commands
\fbox{ <some Xy-Pic code> }%
\clearpage
with \fboxrule=1bp and \fboxsep=1bp. The resulting pictures are included
in the main LaTeX file with \includegraphics[clip,trim=3 3 3 3]{...}.
I resorted to put a frame around each picture because dvips would compute
some bounding boxes wrong, and pictures would very badly overlap.
How can I stop LaTeX/dvips from putting a white background in EPS?
I could also make a script to replace PS code in the generated files, but
I do not know PostScript and the generated EPS is very unreadable.
Would dvips's -h option do? Where can I find a suitable PS header file?
TIA,
Riccardo
> The EPS images are generated by dvips (dvips(k) 5.86) via
>
> dvips -Pamz -Pcmz -E -i -j pictures ...
Oh dear. I wouldn't have thought that the eps from dvips would be
that bad.
> How can I stop LaTeX/dvips from putting a white background in EPS?
I'm surprised it does so at all, but you could of course simply fix
the bounding box and clip at the box. I'm not sure if eps2eps would
do so, but ps2epsi will. Unfortunately it will also add a
preview-image, which you need then remove by a second script. I use
this:
--- snip ---
#!/opt/bin/tcsh -f
awk 'BEGIN {toggle=0} \
{if ($1=="%%BeginPreview:")\
{toggle=1}\
if (toggle==1 && $1=="%%EndPreview") \
{toggle=0} \
if (toggle==0 && $1!="%%EndPreview") {print $0}}' $1 > $1:r.eps
--- snip ---
Sven
--
_ __ The Cognitive Systems Group
| |/ /___ __ _ ___ University of Hamburg
| ' </ _ \/ _` (_-< phone: +49 (0)40 42883-2576 Vogt-Koelln-Strasse 30
|_|\_\___/\__, /__/ fax : +49 (0)40 42883-2572 D-22527 Hamburg
|___/ http://kogs-www.informatik.uni-hamburg.de/~utcke/home.html
Sven> mu...@giove.mat.uniroma1.it (Riccardo Murri) writes:
>> The EPS images are generated by dvips (dvips(k) 5.86) via
>>
>> dvips -Pamz -Pcmz -E -i -j pictures ...
Sven> Oh dear. I wouldn't have thought that the eps from dvips
Sven> would be that bad.
Mine doesn't. I know this because my preview-latex package
<URL:http://preview-latex.sourceforge.net> uses dvips to generate
preview images, and I insert them into GhostScript after clearing the
canvas to Emacs' background colour and making the pen assume Emacs'
foreground color, and this works perfectly.
>> How can I stop LaTeX/dvips from putting a white background in
>> EPS?
They don't, so it would be necessary to find out who does. Probably
the tool/package that you create the graphics with that you then
include into your TeX document.
> I resorted to put a frame around each picture because dvips would
compute
> some bounding boxes wrong, and pictures would very badly overlap.
>
Wouldn't the non-transparent background be due to a 'coloured' frame (even
if it is white, some kind of full vs empty frame)?
Olivier.
--
Olivier Crouzet
Human and Machine Perception Research Centre
Keele University
Gotcha! I removed the \fbox and dvips produced transparent EPS.
The bounding boxes are usually wrong, but they could be fixed through
ps2epsi and Sven Utcke's awk script.
Thanks to everybody who answered my question, you really helped me a lot.
Riccardo