summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/breqn/mathstyle.sty
blob: 141ea46f3bf00b0e3217a19d75e8da4a4730c22e (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
78
79
80
81
82
83
84
85
86
87
88
89
%% Created by stripbwr [2001-09-11T03:39:44]
%% From /home/work/alnilam/mathstyle.bwr
\ProvidesPackage{mathstyle}[2001/09/10 v0.8]
\providecommand{\@saveprimitive}[2]{%
  \begingroup
  \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}%
  \ifx\@tempa\@tempb \global\let#2#1%
  \else
    \edef\@tempb{\meaning#2}%
    \ifx\@tempa\@tempb
    \else
      \keyed@msg\@latex@error\@saveprimitive{{#2}{#1}}
%      {Unable to properly define \string#2; primitive
%      \noexpand#1no longer primitive}\@eha
    \fi
  \fi
  \endgroup
}
\chardef\mathstyle=0
\@saveprimitive\displaystyle\@@displaystyle
\@saveprimitive\textstyle\@@textstyle
\@saveprimitive\scriptstyle\@@scriptstyle
\@saveprimitive\scriptscriptstyle\@@scriptscriptstyle
\DeclareRobustCommand{\displaystyle}{%
  \@@displaystyle \chardef\mathstyle\z@}
\DeclareRobustCommand{\textstyle}{%
  \@@textstyle \chardef\mathstyle\@ne}
\DeclareRobustCommand{\scriptstyle}{%
  \@@scriptstyle \chardef\mathstyle\tw@}
\DeclareRobustCommand{\scriptscriptstyle}{%
  \@@scriptscriptstyle \chardef\mathstyle\thr@@}
\begingroup \catcode`\^=7 \catcode`\_=8 % just in case
\lowercase{\endgroup
\let\@@superscript=^ \let\@@subscript=_
}%
\def\subsupstyle{%
  \ifnum\mathstyle<\tw@ \chardef\mathstyle\tw@
  \else \chardef\mathstyle\thr@@   
  \fi
}
\begingroup \catcode`\^=7 \catcode`\_=8
\global\let\mathsup=^\global\let\mathsub=_\relax 
\endgroup
\def\sb#1{\mathsub{\protect\subsupstyle#1}}%
\def\sp#1{\mathsup{\protect\subsupstyle#1}}%
\def\mathchoice#1#2#3#4{%
  \relax\ifcase\mathstyle#1\relax\or#2\relax\or#3\relax\else#4\relax\fi
}
\DeclareOption{activechars}{\catcode`\^=13 \catcode`\_=13 }
\ProcessOptions\relax
\ifnum\catcode`\^=13
  \let^=\sp \let_=\sb
\else
  \mathcode`\^="8000 \mathcode`\_="8000
  \begingroup \catcode`\^=\active \catcode`\_=\active
  \global\let^=\sp \global\let_=\sb
  \endgroup
\fi
\@saveprimitive\over\@@over
\@saveprimitive\atop\@@atop
\@saveprimitive\above\@@above
\@saveprimitive\overwithdelims\@@overwithdelims
\@saveprimitive\atopwithdelims\@@atopwithdelims
\@saveprimitive\abovewithdelims\@@abovewithdelims
\DeclareRobustCommand\genfrac[6]{%
  {\fracstyle #1%
    {\begingroup #5\endgroup
      \csname @@\ifx\maxdimen#4\maxdimen over\else above\fi
        \if @#2@\else withdelims\fi\endcsname #2#3#4\relax
     #6}%
  }%
}
\renewcommand{\frac}{\genfrac{}{}{}{}}
\providecommand{\dfrac}{}
\providecommand{\tfrac}{}
\renewcommand{\dfrac}{\genfrac\displaystyle{}{}{}}
\renewcommand{\tfrac}{\genfrac\textstyle{}{}{}}
\providecommand{\binom}{}
\providecommand{\tbinom}{}
\providecommand{\dbinom}{}
\renewcommand{\binom}{\genfrac{}(){0pt}}
\renewcommand{\dbinom}{\genfrac\displaystyle(){0pt}}
\renewcommand{\tbinom}{\genfrac\textstyle(){0pt}}
\def\fracstyle{\ifcase\mathstyle
    \chardef\mathstyle=\@ne
  \or \chardef\mathstyle=\tw@
  \else \chardef\mathstyle=\thr@@
  \fi
}