Paper/document/proof.sty
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 26 May 2010 15:24:33 +0200
changeset 2183 e3ac78e13acc
parent 1739 468c3c1adcba
permissions -rwxr-xr-x
qpaper
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1739
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
%       proof.sty       (Proof Figure Macros)
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
%       version 3.0 (for both LaTeX 2.09 and LaTeX 2e)
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
%       Mar 6, 1997
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
%       Copyright (C) 1990 -- 1997, Makoto Tatsuta (tatsuta@kusm.kyoto-u.ac.jp)
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
% 
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
% This program is free software; you can redistribute it or modify
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
% it under the terms of the GNU General Public License as published by
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
% the Free Software Foundation; either versions 1, or (at your option)
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
% any later version.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
% 
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
% This program is distributed in the hope that it will be useful
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
% but WITHOUT ANY WARRANTY; without even the implied warranty of
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
% GNU General Public License for more details.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
%       Usage:
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
%               In \documentstyle, specify an optional style `proof', say,
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
%                       \documentstyle[proof]{article}.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
%       The following macros are available:
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
%       In all the following macros, all the arguments such as
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
%       <Lowers> and <Uppers> are processed in math mode.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
%       \infer<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
%               draws an inference.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
%               Use & in <Uppers> to delimit upper formulae.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
%               <Uppers> consists more than 0 formulae.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
%               \infer returns \hbox{ ... } or \vbox{ ... } and
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
%               sets \@LeftOffset and \@RightOffset globally.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
%       \infer[<Label>]<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
%               draws an inference labeled with <Label>.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
%       \infer*<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
%               draws a many step deduction.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
%       \infer*[<Label>]<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
%               draws a many step deduction labeled with <Label>.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
%       \infer=<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
%               draws a double-ruled deduction.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
%       \infer=[<Label>]<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
%               draws a double-ruled deduction labeled with <Label>.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
%       \deduce<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
%               draws an inference without a rule.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
%       \deduce[<Proof>]<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
%               draws a many step deduction with a proof name.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
%       Example:
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
%               If you want to write
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
%                           B C
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
%                          -----
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
%                      A     D
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
%                     ----------
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
%                         E
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
%       use
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
%               \infer{E}{
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
%                       A
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
%                       &
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
%                       \infer{D}{B & C}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
%               }
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
%       Style Parameters
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
\newdimen\inferLineSkip         \inferLineSkip=2pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
\newdimen\inferLabelSkip        \inferLabelSkip=5pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
\def\inferTabSkip{\quad}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
%       Variables
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
\newdimen\@LeftOffset   % global
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
\newdimen\@RightOffset  % global
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\newdimen\@SavedLeftOffset      % safe from users
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\newdimen\UpperWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
\newdimen\LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
\newdimen\LowerHeight
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
\newdimen\UpperLeftOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
\newdimen\UpperRightOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
\newdimen\UpperCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
\newdimen\LowerCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
\newdimen\UpperAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
\newdimen\RuleAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
\newdimen\LowerAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
\newdimen\RuleWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
\newdimen\HLabelAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
\newdimen\VLabelAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
\newdimen\WidthAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
\newbox\@UpperPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
\newbox\@LowerPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
\newbox\@LabelPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
\newbox\ResultBox
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
%       Flags
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
\newif\if@inferRule     % whether \@infer draws a rule.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
\newif\if@DoubleRule    % whether \@infer draws doulbe rules.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
\newif\if@ReturnLeftOffset      % whether \@infer returns \@LeftOffset.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
\newif\if@MathSaved     % whether inner math mode where \infer or
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
                       % \deduce appears.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
%       Special Fonts
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
\def\DeduceSym{\vtop{\baselineskip4\p@ \lineskiplimit\z@
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
    \vbox{\hbox{.}\hbox{.}\hbox{.}}\hbox{.}}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
%       Math Save Macros
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
%       \@SaveMath is called in the very begining of toplevel macros
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
%       which are \infer and \deduce.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
%       \@RestoreMath is called in the very last before toplevel macros end.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
%       Remark \infer and \deduce ends calling \@infer.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
\def\@SaveMath{\@MathSavedfalse \ifmmode \ifinner
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
       \relax $\relax \@MathSavedtrue \fi\fi }
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
\def\@RestoreMath{\if@MathSaved \relax $\relax\fi }
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
%       Macros
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
% Renaming @ifnextchar and @ifnch of LaTeX2e to @IFnextchar and @IFnch.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
\def\@IFnextchar#1#2#3{%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  \let\reserved@e=#1\def\reserved@a{#2}\def\reserved@b{#3}\futurelet
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
    \reserved@c\@IFnch}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
\def\@IFnch{\ifx \reserved@c \@sptoken \let\reserved@d\@xifnch
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
      \else \ifx \reserved@c \reserved@e\let\reserved@d\reserved@a\else
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
          \let\reserved@d\reserved@b\fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
      \fi \reserved@d}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
\def\@ifEmpty#1#2#3{\def\@tempa{\@empty}\def\@tempb{#1}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
       \ifx \@tempa \@tempb #2\else #3\fi }
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
\def\infer{\@SaveMath \@IFnextchar *{\@inferSteps}{\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
       \@IFnextchar ={\@inferDoubleRule}{\@inferOneStep}}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
\def\@inferOneStep{\@inferRuletrue \@DoubleRulefalse
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
       \@IFnextchar [{\@infer}{\@infer[\@empty]}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
\def\@inferDoubleRule={\@inferRuletrue \@DoubleRuletrue
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
       \@IFnextchar [{\@infer}{\@infer[\@empty]}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
\def\@inferSteps*{\@IFnextchar [{\@@inferSteps}{\@@inferSteps[\@empty]}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
\def\@@inferSteps[#1]{\@deduce{#1}[\DeduceSym]}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
\def\deduce{\@SaveMath \@IFnextchar [{\@deduce{\@empty}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
       {\@inferRulefalse \@infer[\@empty]}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
%       \@deduce<Proof Label>[<Proof>]<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
\def\@deduce#1[#2]#3#4{\@inferRulefalse
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
       \@infer[\@empty]{#3}{\@SaveMath \@infer[{#1}]{#2}{#4}}}
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
%       \@infer[<Label>]<Lower><Uppers>
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
%               If \@inferRuletrue, it draws a rule and <Label> is right to
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
%               a rule. In this case, if \@DoubleRuletrue, it draws
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
%               double rules.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
%               Otherwise, draws no rule and <Label> is right to <Lower>.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
\def\@infer[#1]#2#3{\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
% Get parameters
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
       \if@ReturnLeftOffset \else \@SavedLeftOffset=\@LeftOffset \fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
       \setbox\@LabelPart=\hbox{$#1$}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
       \setbox\@LowerPart=\hbox{$#2$}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
       \global\@LeftOffset=0pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
       \setbox\@UpperPart=\vbox{\tabskip=0pt \halign{\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
               \global\@RightOffset=0pt \@ReturnLeftOffsettrue $##$&&
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
               \inferTabSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
               \global\@RightOffset=0pt \@ReturnLeftOffsetfalse $##$\cr
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
               #3\cr}}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
%                       Here is a little trick.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
%                       \@ReturnLeftOffsettrue(false) influences on \infer or
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
%                       \deduce placed in ## locally
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
%                       because of \@SaveMath and \@RestoreMath.
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
       \UpperLeftOffset=\@LeftOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
       \UpperRightOffset=\@RightOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
% Calculate Adjustments
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
       \LowerWidth=\wd\@LowerPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
       \LowerHeight=\ht\@LowerPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
       \LowerCenter=0.5\LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
       \UpperWidth=\wd\@UpperPart \advance\UpperWidth by -\UpperLeftOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
       \advance\UpperWidth by -\UpperRightOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
       \UpperCenter=\UpperLeftOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
       \advance\UpperCenter by 0.5\UpperWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
       \ifdim \UpperWidth > \LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
               % \UpperCenter > \LowerCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
       \UpperAdjust=0pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
       \RuleAdjust=\UpperLeftOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
       \LowerAdjust=\UpperCenter \advance\LowerAdjust by -\LowerCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
       \RuleWidth=\UpperWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
       \global\@LeftOffset=\LowerAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
       \else   % \UpperWidth <= \LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
       \ifdim \UpperCenter > \LowerCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
       \UpperAdjust=0pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
       \RuleAdjust=\UpperCenter \advance\RuleAdjust by -\LowerCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
       \LowerAdjust=\RuleAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
       \RuleWidth=\LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
       \global\@LeftOffset=\LowerAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
       \else   % \UpperWidth <= \LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
               % \UpperCenter <= \LowerCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
       \UpperAdjust=\LowerCenter \advance\UpperAdjust by -\UpperCenter
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
       \RuleAdjust=0pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
       \LowerAdjust=0pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
       \RuleWidth=\LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
       \global\@LeftOffset=0pt
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
       \fi\fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
% Make a box
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
       \if@inferRule
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
       \setbox\ResultBox=\vbox{
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
               \moveright \UpperAdjust \box\@UpperPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
               \nointerlineskip \kern\inferLineSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
               \if@DoubleRule
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
               \moveright \RuleAdjust \vbox{\hrule width\RuleWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
                       \kern 1pt\hrule width\RuleWidth}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
               \else
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
               \moveright \RuleAdjust \vbox{\hrule width\RuleWidth}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
               \fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
               \nointerlineskip \kern\inferLineSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
               \moveright \LowerAdjust \box\@LowerPart }\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
       \@ifEmpty{#1}{}{\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
       \HLabelAdjust=\wd\ResultBox     \advance\HLabelAdjust by -\RuleAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
       \advance\HLabelAdjust by -\RuleWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
       \WidthAdjust=\HLabelAdjust
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
       \advance\WidthAdjust by -\inferLabelSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
       \advance\WidthAdjust by -\wd\@LabelPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
       \ifdim \WidthAdjust < 0pt \WidthAdjust=0pt \fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
       \VLabelAdjust=\dp\@LabelPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
       \advance\VLabelAdjust by -\ht\@LabelPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
       \VLabelAdjust=0.5\VLabelAdjust  \advance\VLabelAdjust by \LowerHeight
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
       \advance\VLabelAdjust by \inferLineSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
       \setbox\ResultBox=\hbox{\box\ResultBox
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
               \kern -\HLabelAdjust \kern\inferLabelSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
               \raise\VLabelAdjust \box\@LabelPart \kern\WidthAdjust}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
       }\relax % end @ifEmpty
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
       \else % \@inferRulefalse
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
       \setbox\ResultBox=\vbox{
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
               \moveright \UpperAdjust \box\@UpperPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
               \nointerlineskip \kern\inferLineSkip
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
               \moveright \LowerAdjust \hbox{\unhbox\@LowerPart
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
                       \@ifEmpty{#1}{}{\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
                       \kern\inferLabelSkip \unhbox\@LabelPart}}}\relax
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
       \fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
       \global\@RightOffset=\wd\ResultBox
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
       \global\advance\@RightOffset by -\@LeftOffset
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
       \global\advance\@RightOffset by -\LowerWidth
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
       \if@ReturnLeftOffset \else \global\@LeftOffset=\@SavedLeftOffset \fi
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
%
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
       \box\ResultBox
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
       \@RestoreMath
468c3c1adcba more on the paper
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
}