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