%\filename{figuremacros.tex}
%\edited{last by stolfi on Sat Mar  7 02:00:55 1987}

% FIGURES

\catcode`@=11 \endlinechar=-1

  \message{figures ...}

  %  figures with caption at bottom

    %  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

    \long\def\fig#1#{\vf@g{#1}} % figure with caption at bottom

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

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

% END
