%\filename{mfiguremacros.tex}
%\edited{last on Wed Dec 14 21:23:51 1988 by stolfi}

% Floating figures at margin (for use with paperstyle/parms/mfig)

\catcode`@=11\endlinechar=-1

  \message{figures ...}

    %  Use \fig 5cm{\flower}{Figure 1: A Boojum}
    %    for a figure 5 cm high containing {\flower}, followed by a
    %    centered caption with the given text.

    \newif\ifcaptionsonly % if true, omits in-line figures (keeps captions)
    \newif\ifomitfigures  % if true, omits figures AND captions
    \newdimen\figcapwidth % width of figure captions

    \newif\ifshowfigbox   % if true, show vertical extent of figures 

    \long\def\fig#1#{\vf@g{#1}}

    \long\def\vf@g#1#2#3{
      \ifomitfigures\else
        \setbox2\hbox to \figcapwidth{
          \vbox{\hsize=\figcapwidth
            \centered
            \parindent=0pt
            \smallsize #3
          }
        }
        \setbox0\vbox{
          \ifshowfigbox\hrule\fi
          \hbox to \mfigwidth{
            \ifcaptionsonly\else
              \hss\vbox to #1{#2}
            \fi
            \hss
          }
          \ifshowfigbox\hrule\fi
          \ifdim 1\ht2>0pt
            \vskip2ex plus0.5ex
            \hbox to \mfigwidth{\hss\box2\hss}
            \vskip 0.5ex 
          \fi
        }
        \sideinsert{\box0}
      \fi
    }

\catcode`@=12\endlinechar=`\^^M

% END

