Larry's private LaTeX-2e version
authorpaulson
Wed May 07 16:26:02 1997 +0200 (1997-05-07)
changeset 3126feb7a5d01c1e
parent 3125 3f0ab2c306f7
child 3127 4cc2fe62f7c3
Larry's private LaTeX-2e version
doc-src/proof.sty
     1.1 --- a/doc-src/proof.sty	Wed May 07 13:51:22 1997 +0200
     1.2 +++ b/doc-src/proof.sty	Wed May 07 16:26:02 1997 +0200
     1.3 @@ -1,8 +1,11 @@
     1.4 -%	proof.sty	(Proof Figure Macros)
     1.5 +\ProvidesPackage{proof}[1995/05/22]
     1.6 +%       proof.sty       (Proof Figure Macros)
     1.7  %
     1.8 -% 	version 1.0
     1.9 -%	October 13, 1990
    1.10 -% 	Copyright (C) 1990 Makoto Tatsuta (tatsuta@riec.tohoku.ac.jp)
    1.11 +%       version 2.0
    1.12 +%       June 24, 1991
    1.13 +%       Copyright (C) 1990,1991 Makoto Tatsuta (tatsuta@riec.tohoku.ac.jp)
    1.14 +%
    1.15 +%Modified for LaTeX-2e by L. C. Paulson
    1.16  % 
    1.17  % This program is free software; you can redistribute it or modify
    1.18  % it under the terms of the GNU General Public License as published by
    1.19 @@ -14,65 +17,71 @@
    1.20  % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21  % GNU General Public License for more details.
    1.22  %
    1.23 -%	Usage:
    1.24 -%		In \documentstyle, specify an optional style `proof', say,
    1.25 -%			\documentstyle[proof]{article}.
    1.26 +%       Usage:
    1.27 +%               In \documentstyle, specify an optional style `proof', say,
    1.28 +%                       \documentstyle[proof]{article}.
    1.29 +%
    1.30 +%       The following macros are available:
    1.31  %
    1.32 -%	The following macros are available:
    1.33 +%       In all the following macros, all the arguments such as
    1.34 +%       <Lowers> and <Uppers> are processed in math mode.
    1.35  %
    1.36 -%	In all the following macros, all the arguments such as
    1.37 -%	<Lowers> and <Uppers> are processed in math mode.
    1.38 +%       \infer<Lower><Uppers>
    1.39 +%               draws an inference.
    1.40  %
    1.41 -%	\infer<Lower><Uppers>
    1.42 -%		draws an inference.
    1.43 +%               Use & in <Uppers> to delimit upper formulae.
    1.44 +%               <Uppers> consists more than 0 formulae.
    1.45  %
    1.46 -%		Use & in <Uppers> to delimit upper formulae.
    1.47 -%		<Uppers> consists more than 0 formulae.
    1.48 +%               \infer returns \hbox{ ... } or \vbox{ ... } and
    1.49 +%               sets \@LeftOffset and \@RightOffset globally.
    1.50  %
    1.51 -%		\infer returns \hbox{ ... } or \vbox{ ... } and
    1.52 -%		sets \@LeftOffset and \@RightOffset globally.
    1.53 +%       \infer[<Label>]<Lower><Uppers>
    1.54 +%               draws an inference labeled with <Label>.
    1.55  %
    1.56 -%	\infer[<Label>]<Lower><Uppers>
    1.57 -%		draws an inference labeled with <Label>.
    1.58 +%       \infer*<Lower><Uppers>
    1.59 +%               draws a many step deduction.
    1.60  %
    1.61 -%	\infer*<Lower><Uppers>
    1.62 -%		draws a many step deduction.
    1.63 +%       \infer*[<Label>]<Lower><Uppers>
    1.64 +%               draws a many step deduction labeled with <Label>.
    1.65  %
    1.66 -%	\infer*[<Label>]<Lower><Uppers>
    1.67 -%		draws a many step deduction labeled with <Label>.
    1.68 +%       \infer=<Lower><Uppers>
    1.69 +%               draws a double-ruled deduction.
    1.70  %
    1.71 -%	\deduce<Lower><Uppers>
    1.72 -%		draws an inference without a rule.
    1.73 +%       \infer=[<Label>]<Lower><Uppers>
    1.74 +%               draws a double-ruled deduction labeled with <Label>.
    1.75  %
    1.76 -%	\deduce[<Proof>]<Lower><Uppers>
    1.77 -%		draws a many step deduction with a proof name.
    1.78 +%       \deduce<Lower><Uppers>
    1.79 +%               draws an inference without a rule.
    1.80  %
    1.81 -%	Example:
    1.82 -%		If you want to write
    1.83 -%       	       	    B C
    1.84 -%		 	   -----
    1.85 -%		       A     D
    1.86 -%		      ----------
    1.87 -%			  E
    1.88 -%	use
    1.89 -%		\infer{E}{
    1.90 -%			A
    1.91 -%			&
    1.92 -%			\infer{D}{B & C}
    1.93 -%		}
    1.94 +%       \deduce[<Proof>]<Lower><Uppers>
    1.95 +%               draws a many step deduction with a proof name.
    1.96 +%
    1.97 +%       Example:
    1.98 +%               If you want to write
    1.99 +%                           B C
   1.100 +%                          -----
   1.101 +%                      A     D
   1.102 +%                     ----------
   1.103 +%                         E
   1.104 +%       use
   1.105 +%               \infer{E}{
   1.106 +%                       A
   1.107 +%                       &
   1.108 +%                       \infer{D}{B & C}
   1.109 +%               }
   1.110  %
   1.111  
   1.112 -%	Style Parameters
   1.113 +%       Style Parameters
   1.114  
   1.115 -\newdimen\inferLineSkip		\inferLineSkip=2pt
   1.116 -\newdimen\inferLabelSkip	\inferLabelSkip=5pt
   1.117 +\newdimen\inferLineSkip         \inferLineSkip=2pt
   1.118 +\newdimen\inferLabelSkip        \inferLabelSkip=5pt
   1.119  \def\inferTabSkip{\quad}
   1.120  
   1.121 -%	Variables
   1.122 +%       Variables
   1.123  
   1.124 -\newdimen\@LeftOffset	% global
   1.125 -\newdimen\@RightOffset	% global
   1.126 -\newdimen\@SavedLeftOffset	% safe from users
   1.127 +\newdimen\@LeftOffset   % global
   1.128 +\newdimen\@RightOffset  % global
   1.129 +\newdimen\@SavedLeftOffset      % safe from users
   1.130  
   1.131  \newdimen\UpperWidth
   1.132  \newdimen\LowerWidth
   1.133 @@ -94,157 +103,170 @@
   1.134  \newbox\@LabelPart
   1.135  \newbox\ResultBox
   1.136  
   1.137 -%	Flags
   1.138 +%       Flags
   1.139  
   1.140 -\newif\if@inferRule	% whether \@infer draws a rule.
   1.141 -\newif\if@ReturnLeftOffset	% whether \@infer returns \@LeftOffset.
   1.142 -\newif\if@MathSaved	% whether inner math mode where \infer or
   1.143 -			% \deduce appears.
   1.144 +\newif\if@inferRule     % whether \@infer draws a rule.
   1.145 +\newif\if@DoubleRule    % whether \@infer draws doulbe rules.
   1.146 +\newif\if@ReturnLeftOffset      % whether \@infer returns \@LeftOffset.
   1.147 +\newif\if@MathSaved     % whether inner math mode where \infer or
   1.148 +                        % \deduce appears.
   1.149  
   1.150 -%	Special Fonts
   1.151 +%       Special Fonts
   1.152  
   1.153  \def\DeduceSym{\vtop{\baselineskip4\p@ \lineskiplimit\z@
   1.154      \vbox{\hbox{.}\hbox{.}\hbox{.}}\hbox{.}}}
   1.155  
   1.156 -%	Math Save Macros
   1.157 +%       Math Save Macros
   1.158  %
   1.159 -%	\@SaveMath is called in the very begining of toplevel macros
   1.160 -%	which are \infer and \deduce.
   1.161 -%	\@RestoreMath is called in the very last before toplevel macros end.
   1.162 -%	Remark \infer and \deduce ends calling \@infer.
   1.163 +%       \@SaveMath is called in the very begining of toplevel macros
   1.164 +%       which are \infer and \deduce.
   1.165 +%       \@RestoreMath is called in the very last before toplevel macros end.
   1.166 +%       Remark \infer and \deduce ends calling \@infer.
   1.167 +%TEMPORARILY DELETED BY LCP DUE TO CONFLICT WITH CLASS "amsmath.sty"
   1.168  
   1.169 -\def\@SaveMath{\@MathSavedfalse \ifmmode \ifinner
   1.170 -	\relax $\relax \@MathSavedtrue \fi\fi }
   1.171 +\def\@SaveMath{}
   1.172  
   1.173 -\def\@RestoreMath{\if@MathSaved \relax $\relax\fi }
   1.174 +\def\@RestoreMath{}
   1.175  
   1.176 -%	Macros
   1.177 +%       Macros
   1.178  
   1.179  \def\@ifEmpty#1#2#3{\def\@tempa{\@empty}\def\@tempb{#1}\relax
   1.180 -	\ifx \@tempa \@tempb #2\else #3\fi }
   1.181 +        \ifx \@tempa \@tempb #2\else #3\fi }
   1.182 +
   1.183 +\def\infer{\@SaveMath \@ifnextchar *{\@inferSteps}{\relax
   1.184 +        \@ifnextchar ={\@inferDoubleRule}{\@inferOneStep}}}
   1.185  
   1.186 -\def\infer{\@SaveMath \@ifnextchar *{\@inferSteps}{\@inferOneStep}}
   1.187 +\def\@inferOneStep{\@inferRuletrue \@DoubleRulefalse
   1.188 +        \@ifnextchar [{\@infer}{\@infer[\@empty]}}
   1.189  
   1.190 -\def\@inferOneStep{\@inferRuletrue
   1.191 -	\@ifnextchar [{\@infer}{\@infer[\@empty]}}
   1.192 +\def\@inferDoubleRule={\@inferRuletrue \@DoubleRuletrue
   1.193 +        \@ifnextchar [{\@infer}{\@infer[\@empty]}}
   1.194  
   1.195  \def\@inferSteps*{\@ifnextchar [{\@@inferSteps}{\@@inferSteps[\@empty]}}
   1.196  
   1.197  \def\@@inferSteps[#1]{\@deduce{#1}[\DeduceSym]}
   1.198  
   1.199  \def\deduce{\@SaveMath \@ifnextchar [{\@deduce{\@empty}}
   1.200 -	{\@inferRulefalse \@infer[\@empty]}}
   1.201 +        {\@inferRulefalse \@infer[\@empty]}}
   1.202  
   1.203 -%	\@deduce<Proof Label>[<Proof>]<Lower><Uppers>
   1.204 +%       \@deduce<Proof Label>[<Proof>]<Lower><Uppers>
   1.205  
   1.206  \def\@deduce#1[#2]#3#4{\@inferRulefalse
   1.207 -	\@infer[\@empty]{#3}{\@SaveMath \@infer[{#1}]{#2}{#4}}}
   1.208 +        \@infer[\@empty]{#3}{\@SaveMath \@infer[{#1}]{#2}{#4}}}
   1.209  
   1.210 -%	\@infer[<Label>]<Lower><Uppers>
   1.211 -%		If \@inferRuletrue, draws a rule and <Label> is right to
   1.212 -%		a rule.
   1.213 -%		Otherwise, draws no rule and <Label> is right to <Lower>.
   1.214 +%       \@infer[<Label>]<Lower><Uppers>
   1.215 +%               If \@inferRuletrue, it draws a rule and <Label> is right to
   1.216 +%               a rule. In this case, if \@DoubleRuletrue, it draws
   1.217 +%               double rules.
   1.218 +%
   1.219 +%               Otherwise, draws no rule and <Label> is right to <Lower>.
   1.220  
   1.221  \def\@infer[#1]#2#3{\relax
   1.222  % Get parameters
   1.223 -	\if@ReturnLeftOffset \else \@SavedLeftOffset=\@LeftOffset \fi
   1.224 -	\setbox\@LabelPart=\hbox{$#1$}\relax
   1.225 -	\setbox\@LowerPart=\hbox{$#2$}\relax
   1.226 +        \if@ReturnLeftOffset \else \@SavedLeftOffset=\@LeftOffset \fi
   1.227 +        \setbox\@LabelPart=\hbox{$#1$}\relax
   1.228 +        \setbox\@LowerPart=\hbox{$#2$}\relax
   1.229  %
   1.230 -	\global\@LeftOffset=0pt
   1.231 -	\setbox\@UpperPart=\vbox{\tabskip=0pt \halign{\relax
   1.232 -		\global\@RightOffset=0pt \@ReturnLeftOffsettrue $##$&&
   1.233 -		\inferTabSkip
   1.234 -		\global\@RightOffset=0pt \@ReturnLeftOffsetfalse $##$\cr
   1.235 -		#3\cr}}\relax
   1.236 -%			Here is a little trick.
   1.237 -%			\@ReturnLeftOffsettrue(false) influences on \infer or
   1.238 -%			\deduce placed in ## locally
   1.239 -%			because of \@SaveMath and \@RestoreMath.
   1.240 -	\UpperLeftOffset=\@LeftOffset
   1.241 -	\UpperRightOffset=\@RightOffset
   1.242 +        \global\@LeftOffset=0pt
   1.243 +        \setbox\@UpperPart=\vbox{\tabskip=0pt \halign{\relax
   1.244 +                \global\@RightOffset=0pt \@ReturnLeftOffsettrue $##$&&
   1.245 +                \inferTabSkip
   1.246 +                \global\@RightOffset=0pt \@ReturnLeftOffsetfalse $##$\cr
   1.247 +                #3\cr}}\relax
   1.248 +%                       Here is a little trick.
   1.249 +%                       \@ReturnLeftOffsettrue(false) influences on \infer or
   1.250 +%                       \deduce placed in ## locally
   1.251 +%                       because of \@SaveMath and \@RestoreMath.
   1.252 +        \UpperLeftOffset=\@LeftOffset
   1.253 +        \UpperRightOffset=\@RightOffset
   1.254  % Calculate Adjustments
   1.255 -	\LowerWidth=\wd\@LowerPart
   1.256 -	\LowerHeight=\ht\@LowerPart
   1.257 -	\LowerCenter=0.5\LowerWidth
   1.258 +        \LowerWidth=\wd\@LowerPart
   1.259 +        \LowerHeight=\ht\@LowerPart
   1.260 +        \LowerCenter=0.5\LowerWidth
   1.261 +%
   1.262 +        \UpperWidth=\wd\@UpperPart \advance\UpperWidth by -\UpperLeftOffset
   1.263 +        \advance\UpperWidth by -\UpperRightOffset
   1.264 +        \UpperCenter=\UpperLeftOffset
   1.265 +        \advance\UpperCenter by 0.5\UpperWidth
   1.266  %
   1.267 -	\UpperWidth=\wd\@UpperPart \advance\UpperWidth by -\UpperLeftOffset
   1.268 -	\advance\UpperWidth by -\UpperRightOffset
   1.269 -	\UpperCenter=\UpperLeftOffset
   1.270 -	\advance\UpperCenter by 0.5\UpperWidth
   1.271 +        \ifdim \UpperWidth > \LowerWidth
   1.272 +                % \UpperCenter > \LowerCenter
   1.273 +        \UpperAdjust=0pt
   1.274 +        \RuleAdjust=\UpperLeftOffset
   1.275 +        \LowerAdjust=\UpperCenter \advance\LowerAdjust by -\LowerCenter
   1.276 +        \RuleWidth=\UpperWidth
   1.277 +        \global\@LeftOffset=\LowerAdjust
   1.278 +%
   1.279 +        \else   % \UpperWidth <= \LowerWidth
   1.280 +        \ifdim \UpperCenter > \LowerCenter
   1.281  %
   1.282 -	\ifdim \UpperWidth > \LowerWidth
   1.283 -		% \UpperCenter > \LowerCenter
   1.284 -	\UpperAdjust=0pt
   1.285 -	\RuleAdjust=\UpperLeftOffset
   1.286 -	\LowerAdjust=\UpperCenter \advance\LowerAdjust by -\LowerCenter
   1.287 -	\RuleWidth=\UpperWidth
   1.288 -	\global\@LeftOffset=\LowerAdjust
   1.289 +        \UpperAdjust=0pt
   1.290 +        \RuleAdjust=\UpperCenter \advance\RuleAdjust by -\LowerCenter
   1.291 +        \LowerAdjust=\RuleAdjust
   1.292 +        \RuleWidth=\LowerWidth
   1.293 +        \global\@LeftOffset=\LowerAdjust
   1.294  %
   1.295 -	\else	% \UpperWidth <= \LowerWidth
   1.296 -	\ifdim \UpperCenter > \LowerCenter
   1.297 +        \else   % \UpperWidth <= \LowerWidth
   1.298 +                % \UpperCenter <= \LowerCenter
   1.299  %
   1.300 -	\UpperAdjust=0pt
   1.301 -	\RuleAdjust=\UpperCenter \advance\RuleAdjust by -\LowerCenter
   1.302 -	\LowerAdjust=\RuleAdjust
   1.303 -	\RuleWidth=\LowerWidth
   1.304 -	\global\@LeftOffset=\LowerAdjust
   1.305 -%
   1.306 -	\else	% \UpperWidth <= \LowerWidth
   1.307 -		% \UpperCenter <= \LowerCenter
   1.308 +        \UpperAdjust=\LowerCenter \advance\UpperAdjust by -\UpperCenter
   1.309 +        \RuleAdjust=0pt
   1.310 +        \LowerAdjust=0pt
   1.311 +        \RuleWidth=\LowerWidth
   1.312 +        \global\@LeftOffset=0pt
   1.313  %
   1.314 -	\UpperAdjust=\LowerCenter \advance\UpperAdjust by -\UpperCenter
   1.315 -	\RuleAdjust=0pt
   1.316 -	\LowerAdjust=0pt
   1.317 -	\RuleWidth=\LowerWidth
   1.318 -	\global\@LeftOffset=0pt
   1.319 -%
   1.320 -	\fi\fi
   1.321 +        \fi\fi
   1.322  % Make a box
   1.323 -	\if@inferRule
   1.324 +        \if@inferRule
   1.325  %
   1.326 -	\setbox\ResultBox=\vbox{
   1.327 -		\moveright \UpperAdjust \box\@UpperPart
   1.328 -		\nointerlineskip \kern\inferLineSkip
   1.329 -		\moveright \RuleAdjust \vbox{\hrule width\RuleWidth}\relax
   1.330 -		\nointerlineskip \kern\inferLineSkip
   1.331 -		\moveright \LowerAdjust \box\@LowerPart }\relax
   1.332 +        \setbox\ResultBox=\vbox{
   1.333 +                \moveright \UpperAdjust \box\@UpperPart
   1.334 +                \nointerlineskip \kern\inferLineSkip
   1.335 +                \if@DoubleRule
   1.336 +                \moveright \RuleAdjust \vbox{\hrule width\RuleWidth
   1.337 +                        \kern 1pt\hrule width\RuleWidth}\relax
   1.338 +                \else
   1.339 +                \moveright \RuleAdjust \vbox{\hrule width\RuleWidth}\relax
   1.340 +                \fi
   1.341 +                \nointerlineskip \kern\inferLineSkip
   1.342 +                \moveright \LowerAdjust \box\@LowerPart }\relax
   1.343  %
   1.344 -	\@ifEmpty{#1}{}{\relax
   1.345 +        \@ifEmpty{#1}{}{\relax
   1.346  %
   1.347 -	\HLabelAdjust=\wd\ResultBox	\advance\HLabelAdjust by -\RuleAdjust
   1.348 -	\advance\HLabelAdjust by -\RuleWidth
   1.349 -	\WidthAdjust=\HLabelAdjust
   1.350 -	\advance\WidthAdjust by -\inferLabelSkip
   1.351 -	\advance\WidthAdjust by -\wd\@LabelPart
   1.352 -	\ifdim \WidthAdjust < 0pt \WidthAdjust=0pt \fi
   1.353 +        \HLabelAdjust=\wd\ResultBox     \advance\HLabelAdjust by -\RuleAdjust
   1.354 +        \advance\HLabelAdjust by -\RuleWidth
   1.355 +        \WidthAdjust=\HLabelAdjust
   1.356 +        \advance\WidthAdjust by -\inferLabelSkip
   1.357 +        \advance\WidthAdjust by -\wd\@LabelPart
   1.358 +        \ifdim \WidthAdjust < 0pt \WidthAdjust=0pt \fi
   1.359  %
   1.360 -	\VLabelAdjust=\dp\@LabelPart
   1.361 -	\advance\VLabelAdjust by -\ht\@LabelPart
   1.362 -	\VLabelAdjust=0.5\VLabelAdjust	\advance\VLabelAdjust by \LowerHeight
   1.363 -	\advance\VLabelAdjust by \inferLineSkip
   1.364 +        \VLabelAdjust=\dp\@LabelPart
   1.365 +        \advance\VLabelAdjust by -\ht\@LabelPart
   1.366 +        \VLabelAdjust=0.5\VLabelAdjust  \advance\VLabelAdjust by \LowerHeight
   1.367 +        \advance\VLabelAdjust by \inferLineSkip
   1.368  %
   1.369 -	\setbox\ResultBox=\hbox{\box\ResultBox
   1.370 -		\kern -\HLabelAdjust \kern\inferLabelSkip
   1.371 -		\raise\VLabelAdjust \box\@LabelPart \kern\WidthAdjust}\relax
   1.372 +        \setbox\ResultBox=\hbox{\box\ResultBox
   1.373 +                \kern -\HLabelAdjust \kern\inferLabelSkip
   1.374 +                \raise\VLabelAdjust \box\@LabelPart \kern\WidthAdjust}\relax
   1.375  %
   1.376 -	}\relax % end @ifEmpty
   1.377 +        }\relax % end @ifEmpty
   1.378  %
   1.379 -	\else % \@inferRulefalse
   1.380 +        \else % \@inferRulefalse
   1.381  %
   1.382 -	\setbox\ResultBox=\vbox{
   1.383 -		\moveright \UpperAdjust \box\@UpperPart
   1.384 -		\nointerlineskip \kern\inferLineSkip
   1.385 -		\moveright \LowerAdjust \hbox{\unhbox\@LowerPart
   1.386 -			\@ifEmpty{#1}{}{\relax
   1.387 -			\kern\inferLabelSkip \unhbox\@LabelPart}}}\relax
   1.388 -	\fi
   1.389 +        \setbox\ResultBox=\vbox{
   1.390 +                \moveright \UpperAdjust \box\@UpperPart
   1.391 +                \nointerlineskip \kern\inferLineSkip
   1.392 +                \moveright \LowerAdjust \hbox{\unhbox\@LowerPart
   1.393 +                        \@ifEmpty{#1}{}{\relax
   1.394 +                        \kern\inferLabelSkip \unhbox\@LabelPart}}}\relax
   1.395 +        \fi
   1.396  %
   1.397 -	\global\@RightOffset=\wd\ResultBox
   1.398 -	\global\advance\@RightOffset by -\@LeftOffset
   1.399 -	\global\advance\@RightOffset by -\LowerWidth
   1.400 -	\if@ReturnLeftOffset \else \global\@LeftOffset=\@SavedLeftOffset \fi
   1.401 +        \global\@RightOffset=\wd\ResultBox
   1.402 +        \global\advance\@RightOffset by -\@LeftOffset
   1.403 +        \global\advance\@RightOffset by -\LowerWidth
   1.404 +        \if@ReturnLeftOffset \else \global\@LeftOffset=\@SavedLeftOffset \fi
   1.405  %
   1.406 -	\box\ResultBox
   1.407 -	\@RestoreMath
   1.408 +        \box\ResultBox
   1.409 +        \@RestoreMath
   1.410  }
   1.411 +\endinput