[comp.text.tex] comments welcome

vavasis@afi.cs.cornell.edu (Stephen Vavasis) (02/06/91)

These are some macros that I wrote, and I am planning to give
them to SIAM for inclusion in "siam.sty", macros for typesetting
SIAM journal papers.  These macros generate the "end-of-proof"
marker, which is supposed to be a square box.  The current version
of siam.sty can generate the box (\@endproofo below), but cannot
position it correctly.  The rules for positioning the box are:
  (1) 2 ems from the last character, if end-of-proof occurs in
text.
  (2) Flush-right, if end-of-proof occurs in a displayed equation
(note: SIAM uses left equation numbers).

Since I am not an expert LaTeX hacker, I am hoping that some net
person will see mistakes that I made so that I can give reasonably
robust macros to SIAM.

Thanks,
Steve Vavasis (vavasis@cs.cornell.edu)

%
% \endproof macros.
%  macro \@endproofo generates the box to mark proof ends.
%  macro \@endprooft generates and end-of-proof box occurring
%   in text, preceded by the 2 ems of blank space.
%  macro @endproofnd generates the end-of-proof marker for
%   displayed equations for which LaTeX was planning to generate
%   a number.  It works by setting a flag read by \@@eqncr and
%   \endequation
% macro @endproofd generates the box for unnumbered displayed equations
%   using the plainTeX \eqno command.

\def\@endproofo{{\vbox{\hrule\hbox{%
   \vrule height1.3ex\hskip0.8ex\vrule}\hrule
  }}}
\def\@endprooft{\hspace{2em}\@endproofo}
\def\@endproofnd{\global\@proofendtrue}
\def\@endproofd{\eqno{\@endproofo}}
%
% Define a new flag ``numbering mode'' that tells us when
% LaTeX will generate its own numbers.
%
%
\newif\if@numberingmode
\newif\if@proofend
\@numberingmodefalse
%
% Change the equation environment to set the numbering
% mode.
%
\def\equation{$$ % $$ BRACE MATCHING HACK
\refstepcounter{equation}\@numberingmodetrue}
%
\def\endequation{\eqno{\if@proofend\@endproofo\global\@proofendfalse\fi
\@eqnnum} % $$ BRACE MATCHING HACK
$$\global\@ignoretrue\@numberingmodefalse}

\def\@@eqncr{\let\@tempa\relax 
    \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &} 
      \else \def\@tempa{&}\fi 
     \@tempa \if@proofend\@endproofo\global\@proofendfalse\fi
     \if@eqnsw\@eqnnum\stepcounter{equation}\fi
     \global\@eqnswtrue\global\@eqcnt\z@\cr}
%
% The \endproof macro to generate end-of-proof markers.
% Usage:
% In text:
%    . . . and this concludes our proof.\endproof
% In displayed equations:
%    $$ x \ge 0 \endproof $$
% In latex environments:
%  \begin{eqnarray}
%    .
%    .
%   x & \ge & 0 \endproof
%  \end{eqnarray}
% Also works in the equation environment.
%
\def\endproof{%
\ifmmode
   \if@numberingmode
     \@endproofnd
    \else
     \@endproofd
    \fi
\else
   \@endprooft
\fi}