Re: poor man's incremental graphics

Hi,

[... request for the best way to include incremented graphics
produced by gnuplot and xfig ...]

Stephan> I see four different possible ways:

Stephan> a) export to metapost, embed the metapost code with emp
Stephan> and insert \step commands wherever you want

Stephan> b) use the xfig patch for generating different mpost
Stephan> figures (dunno how this works).

Since the date for my doctoral exam was delayed :-( , I had time to
look a little beyond the hack I proposed in my previous post :-).

So I compiled xfig and fig2dev with Klaus Guntermann's patches to
export multiple Metapost figures.

I tried to use the mpmulti.sty package from Klaus Guntermann as well,
but that didn't succeed. Instead of overlaying, each graphic
was put next to the other. I guess this has to do with the way
the \pause command is implemented in ppower and texpower.

I wrote a macro tpmultiinc that uses \step to include the
graphics step by step. I include it below. Does anyone have any

Stephan> c) export from xfig to eepic and insert steps in the
Stephan> eepic code (don't know whether this has enough expressive
Stephan> power for your pictures).  Unfortunately, xfig doesn't
Stephan> seem to support PSTricks export.

Stephan> d) export from gnuplot to PSTricks and add \steps and any
Stephan> decoration directly into the PSTricks code (xfig not used
Stephan> here).

The trouble with the route

{xfig,gnuplot} -> any text format ->
manually include \step commands to the text format -> latex the source

is, that xfig or gnuplot don't necessarily write the text format in the
right order in which you want to build your graphics. So you have to
look at the text quite hard to see what \step[\value=n] you put
where. I don't think it can be done when the graphics get more
complex.

With using the multiple metapost output from xfig and the tpmultiinc
macro in the latex source I avoided that. Besides I don't have to edit
the source every time I change the figure in xfig.

Holger
---------------cut--------------cut----------------------------------
%% tpmultiinc.sty
%%
%% This package provides the command \tpmultiinc{foo} to include
%% incremental graphics using Stephan Lehmke's texpower package.
%%
%% It requires that you have the graphic files in a certain order.
%%  foo.0 is the first file to be included. It appears at once.
%% The graphic files
%%  foo.n with n >=1 are included step by step using the step command
%%                   from texpower.
%% The files foo.* are eps-Files, as produced by metapost. They must
%% all have the same bounding box.
%%
%% The most convenient way to generate them is to use xfig with the
%% patches provided by Klaus Guntermann to generate multiple metapost
%% output. See:
%%
%%
%% Author: Holger Wenzel [EMAIL PROTECTED]
%% Version: 0.1  July 4, 2000
%%
\RequirePackage{texpower}
\RequirePackage{graphicx}
\RequirePackage{ifthen}
%%
\InputIfFileExists{repeat}{}{\message{Get repeat.tex from CTAN}}
%%
%% The width and the height of the included graphics
\newlength{\layerwidth}
\newlength{\layerheight}
%% Boolean value to decide wether we have to include another layer
%% file
\newboolean{morelayers}
%%
%%
%%
\newcommand*{\tpmultiinc}[1]{%
%%
%% Determine the dimensions of the picture
\settowidth{\layerwidth}{\includegraphics{#1.0}}
\settoheight{\layerheight}{\includegraphics{#1.0}}
%% initialise
\setboolean{morelayers}{true}
%%
%% use parstepwise instead of stepwise to avoid glitches in
%% the output
\parstepwise{%
%%
%% Make room for the picture
\parbox[t][\layerheight][b]{\layerwidth}{%
%%
%% Be sure that the files are nicely overlaid
%% by anchoring them at (0,0) in a picture environment
\begin{picture}(0,0)
%% Include at least one file (this is foo.0)
\put(0,0) {\includegraphics{#1.0}}
%%
%% for the following construct you need repeat.tex
%%
%% This is the loop to include all the foo.n files
%% like in the mpmulti.sty of ppower.
%%
\repeat
\for{layer} \from{1} \by{1} \while{\ifmorelayers}
\do {\IfFileExists{#1.\number\layer}%
{\setboolean{morelayers}{true}%
\put(0,0) {\step{\includegraphics{#1.\number\layer}}}}%
{\setboolean{morelayers}{false}}}
\end{picture}}}%
\\}%