Debian Codegraph @

texmf-dist/tex/latex/breqn/mathstyle.sty

raw
1 %%
2 %% This is file `mathstyle.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% mathstyle.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 1997-2003 by Michael J. Downes
12 %% Copyright (C) 2007-2008 by Morten Hoegholm
13 %% Copyright (C) 2007-2014 by Lars Madsen
14 %% Copyright (C) 2007-2020 by Will Robertson
15 %% Copyright (C) 2010-2017 by Joseph Wright
16 %% Copyright (C) 2020-2020 by Ulrike Fischer
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3 of this license or (at your option) any later
21 %% version. The latest version of this license is in
22 %% http://www.latex-project.org/lppl.txt
23 %% and version 1.3 or later is part of all distributions of
24 %% LaTeX version 2005/12/01 or later.
25 %%
26 %% This work has the LPPL maintenance status "maintained".
27 %%
28 %% The Current Maintainer of this work is Will Robertson.
29 %%
30 %% This work consists of the main source file breqn.dtx,
31 %% flexisym.dtx, and mathstyle.dtx.
32 %%
33 \NeedsTeXFormat{LaTeX2e}
34 \RequirePackage{expl3}
35 \ProvidesExplPackage{mathstyle}{2021/10/28}{0.98l}{Tracking mathstyle implicitly}
36 \ExplSyntaxOff
37 \providecommand\@saveprimitive[2]{%
38 \begingroup
39 \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}%
40 \ifx\@tempa\@tempb \global\let#2#1%
41 \else
42 \edef\@tempb{\meaning#2}%
43 \ifx\@tempa\@tempb
44 \else \@saveprimitive@a#1#2%
45 \fi
46 \fi
47 \endgroup
48 }
49 \providecommand\@saveprimitive@a[2]{%
50 \begingroup
51 \def\@tempb##1#1##2{\edef\@tempb{##2}\@car{}}%
52 \@tempb\nullfont{select font nullfont}%
53 \topmark{\string\topmark:}%
54 \firstmark{\string\firstmark:}%
55 \botmark{\string\botmark:}%
56 \splitfirstmark{\string\splitfirstmark:}%
57 \splitbotmark{\string\splitbotmark:}%
58 #1{\string#1}%
59 \@nil % for the \@car
60 \edef\@tempa{\expandafter\strip@prefix\meaning\@tempb}%
61 \edef\@tempb{\meaning#1}%
62 \ifx\@tempa\@tempb \global\let#2#1%
63 \else
64 \PackageError{mathstyle}%
65 {Unable to properly define \string#2; primitive
66 \noexpand#1no longer primitive}\@eha
67 \fi
68 \fi
69 \endgroup
70 }
71 \begingroup\expandafter\expandafter\expandafter\endgroup
72 \expandafter\ifx\csname directlua\endcsname\relax
73 \everydisplay=\expandafter{\the\everydisplay\chardef\mathstyle\z@}
74 \fi
75 \begingroup\expandafter\expandafter\expandafter\endgroup
76 \expandafter\ifx\csname directlua\endcsname\relax
77 \chardef\mathstyle=2\relax
78 \chardef\mathstyledenom=0\relax
79 \else
80 \directlua{tex.enableprimitives("", {"mathstyle"})}
81 \fi
82 \@saveprimitive\displaystyle\@@displaystyle
83 \@saveprimitive\textstyle\@@textstyle
84 \@saveprimitive\scriptstyle\@@scriptstyle
85 \@saveprimitive\scriptscriptstyle\@@scriptscriptstyle
86 \@saveprimitive\mathchoice\@@mathchoice
87 \@saveprimitive\over\@@over
88 \@saveprimitive\atop\@@atop
89 \@saveprimitive\above\@@above
90 \@saveprimitive\overwithdelims\@@overwithdelims
91 \@saveprimitive\atopwithdelims\@@atopwithdelims
92 \@saveprimitive\abovewithdelims\@@abovewithdelims
93 \begingroup\expandafter\expandafter\expandafter\endgroup
94 \expandafter\ifx\csname directlua\endcsname\relax
95 \DeclareRobustCommand{\displaystyle}{%
96 \@@displaystyle \chardef\mathstyle0\relax}
97 \DeclareRobustCommand{\textstyle}{%
98 \@@textstyle \chardef\mathstyle2\relax}
99 \DeclareRobustCommand{\scriptstyle}{%
100 \@@scriptstyle \chardef\mathstyle4\relax}
101 \DeclareRobustCommand{\scriptscriptstyle}{%
102 \@@scriptscriptstyle \chardef\mathstyle6\relax}
103 \fi
104 \begingroup \catcode`\^=7\relax \catcode`\_=8\relax % just in case
105 \lowercase{\endgroup
106 \let\@@superscript=^ \let\@@subscript=_
107 }%
108 \begingroup \catcode`\^=12\relax \catcode`\_=12\relax % just in case
109 \lowercase{\endgroup
110 \let\@@superscript@other=^ \let\@@subscript@other=_
111 }%
112 \begingroup\expandafter\expandafter\expandafter\endgroup
113 \expandafter\ifx\csname directlua\endcsname\relax
114 \def\subsupstyle{%
115 \ifnum\mathstyle<4\relax
116 \chardef\mathstyle\numexpr4+\mathstyledenom\relax
117 \else
118 \chardef\mathstyle\numexpr6+\mathstyledenom\relax
119 \fi
120 }
121 \else
122 \def\subsupstyle{}
123 \fi
124 \let\mathsup=\@@superscript
125 \let\mathsub=\@@subscript
126 \def\sb#1{\mathsub{\protect\subsupstyle#1}}%
127 \def\sp#1{\mathsup{\protect\subsupstyle#1}}%
128 \def\mathchoice{%
129 \relax\ifcase\numexpr\mathstyle\relax
130 \expandafter\@firstoffour % Display
131 \or
132 \expandafter\@firstoffour % Cramped display
133 \or
134 \expandafter\@secondoffour % Text
135 \or
136 \expandafter\@secondoffour % Cramped text
137 \or
138 \expandafter\@thirdoffour % Script
139 \or
140 \expandafter\@thirdoffour % Cramped script
141 \else
142 \expandafter\@fourthoffour % (Cramped) Scriptscript
143 \fi
144 }
145 \providecommand\@firstoffour[4]{#1}
146 \providecommand\@secondoffour[4]{#2}
147 \providecommand\@thirdoffour[4]{#3}
148 \providecommand\@fourthoffour[4]{#4}
149 \DeclareRobustCommand\genfrac[6]{%
150 {%
151 % emulate old amsmath syntax:
152 \if 0#4\relax\displaystyle\else
153 \if 1#4\relax\textstyle\else
154 \if 2#4\relax\scriptstyle\else
155 \if 3#4\relax\scriptscriptstyle\else
156 #4%
157 \fi\fi\fi\fi
158 \fracstyle
159 {\begingroup #5\endgroup
160 \csname @@\ifx\maxdimen#3\maxdimen over\else above\fi
161 \if @#1@\else withdelims\fi\endcsname #1 #2 #3\relax
162 \ifnum\mathstyledenom=0\relax
163 \chardef\mathstyledenom=1\relax
164 \edef\mathstyle@tempa{\number\mathstyle}%
165 \chardef\mathstyle=\numexpr\mathstyle@tempa+1\relax
166 \fi
167 #6%
168 \chardef\mathstyledenom=0\relax}%
169 }%
170 }
171 \begingroup\expandafter\expandafter\expandafter\endgroup
172 \expandafter\ifx\csname directlua\endcsname\relax\else
173 \DeclareRobustCommand\genfrac[6]{%
174 {%
175 % emulate old amsmath syntax:
176 \if 0#4\relax\displaystyle\else
177 \if 1#4\relax\textstyle\else
178 \if 2#4\relax\scriptstyle\else
179 \if 3#4\relax\scriptscriptstyle\else
180 #4%
181 \fi\fi\fi\fi
182 \fracstyle
183 {\begingroup #5\endgroup
184 \csname @@\ifx\maxdimen#3\maxdimen over\else above\fi
185 \if @#1@\else withdelims\fi\endcsname #1 #2 #3\relax
186 #6%
187 }%
188 }%
189 }
190 \fi
191 \renewcommand{\frac}{\genfrac{}{}{}{}}
192 \providecommand{\dfrac}{}
193 \providecommand{\tfrac}{}
194 \renewcommand{\dfrac}{\genfrac{}{}{}\displaystyle}
195 \renewcommand{\tfrac}{\genfrac{}{}{}\displaystyle}
196 \providecommand{\binom}{}
197 \providecommand{\tbinom}{}
198 \providecommand{\dbinom}{}
199 \renewcommand{\binom}{\genfrac(){0pt}{}}
200 \renewcommand{\dbinom}{\genfrac(){0pt}\displaystyle}
201 \renewcommand{\tbinom}{\genfrac(){0pt}\textstyle}
202
203 \begingroup\expandafter\expandafter\expandafter\endgroup
204 \expandafter\ifx\csname directlua\endcsname\relax
205 \def\fracstyle{%
206 \ifcase\numexpr\mathstyle\relax
207 \chardef\mathstyle=0\relax % 0
208 \or \chardef\mathstyle=1\relax % 1
209 \or \chardef\mathstyle=2\relax % 2
210 \or \chardef\mathstyle=3\relax % 3
211 \else \chardef\mathstyle=3\relax % 4 or more
212 \fi
213 }
214 \else
215 \def\fracstyle{}
216 \fi
217 \def\currentmathstyle{%
218 \ifcase\numexpr\mathstyle\relax
219 \@@displaystyle
220 \or
221 \@@displaystyle
222 \or
223 \@@textstyle
224 \or
225 \@@textstyle
226 \or
227 \@@scriptstyle
228 \or
229 \@@scriptstyle
230 \else
231 \@@scriptscriptstyle
232 \fi}
233 \DeclareOption{mathactivechars}{%
234 % \catcode`\^=12\relax
235 % \catcode`\_=12\relax
236 \AtBeginDocument{\catcode`\^=12\relax \catcode`\_=12\relax}%
237 }
238 \DeclareOption{activechars}{%
239 % \catcode`\^=13\relax
240 % \catcode`\_=13\relax
241 \AtBeginDocument{\catcode`\^=13\relax \catcode`\_=13\relax}%
242 }
243 \DeclareOption{noactivechars}{%
244 % \catcode`\^=7\relax
245 % \catcode`\_=8\relax
246 \AtBeginDocument{\catcode`\^=7\relax \catcode`\_=8\relax}%
247 }
248 \ExecuteOptions{mathactivechars}
249 \ProcessOptions\relax
250 \ifnum\catcode`\^=13\relax
251 \let^=\sp \let_=\sb
252 \else
253 \mathcode`\^="8000\relax
254 \mathcode`\_="8000\relax
255 \begingroup
256 \catcode`\^=\active
257 \catcode`\_=\active
258 \global\let^=\sp
259 \global\let_=\sb
260 \endgroup
261 \fi
262 \endinput
263 %%
264 %% End of file `mathstyle.sty'.