summaryrefslogtreecommitdiff
path: root/info/examples/tex-in-practice/mathenv.tip
blob: 098d040c4065c1c04a83a7aeab92c32cdc73a841 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 13.1.4, p. II-158.
% Original source in file "math1.TEX", starting line 211.
\wlog{L: "mathenv.tip" ["math1.TEX," l. 211, p. II-158]}%
% This file DOES belong to format "texip."
\def\BeginMath{%
    \ifmath
        \ifinner
            \errmessage{\string\BeginMath: already in math
                mode, \string\BeginMath ignored.}%
        \else
            \errmessage{\string\BeginMath: in display math
                mode, terminated and math mode started.}%
            $$
            $
        \fi
    \else
        $\relax
    \fi
}
\def\EndMath{%
    \ifmath
        \ifinner
            $%
        \else
            \errmessage{\string\EndMath: you are in display math
                mode! Should have used \string\EndDisplayMath!}%
            $$
        \fi
    \else
        \errmessage{\string\EndMath: already in math
            mode, \string\EndMath ignored.}%
    \fi
}
\def\BeginDisplayMath{%
    \ifmath
        \ifinner
            \errmessage{\string\BeginDisplayMath: in inline
                math mode, terminate it, start display math.}%
            $
            $$
        \else
            \errmessage{\string\BeginDisplayMath: already in math
                mode, \string\BeginDisplayMath ignored.}%
        \fi
    \else
        $$
    \fi
}
\def\EndDisplayMath{%
    \ifmath
        \ifinner
            \errmessage{\string\EndDisplayMath: inline
                math mode in effect, did you intend to
                write \string\EndMath?}%
            $%
        \else
            $$
        \fi
    \else
        \errmessage{\string\EndDisplayMath: not in math
            mode, \string\EndDisplayMath ignored.}%
    \fi
}