Browse Source

MRTsfacc: performance tweaks

master
Jonathan Spratte 1 year ago
parent
commit
ffe3c9fcba
2 changed files with 63 additions and 62 deletions
  1. BIN
      Doc/doc_MRTbundle.pdf
  2. 63
    62
      MRTsfacc/MRTsfacc.sty

BIN
Doc/doc_MRTbundle.pdf View File


+ 63
- 62
MRTsfacc/MRTsfacc.sty View File

@@ -12,10 +12,11 @@
12 12
 \RequirePackage{MRTif}
13 13
 \RequirePackage{amsmath}
14 14
 
15
-\providecommand\@firstofthree[3]{#1}
16
-\providecommand\@secondofthree[3]{#2}
17
-\providecommand\@thirdofthree[3]{#3}
15
+\long\def\MRTsfacc@fifiATa#1\fi\fi#2#3#4{\fi#2}
16
+\long\def\MRTsfacc@fifiBATb#1\fi\fi#2#3#4{\fi\fi#3}
17
+\long\def\MRTsfacc@fifiBBTc\fi\fi#1#2#3{\fi\fi#3}
18 18
 
19
+%% Package options >>>
19 20
 \def\MRTsfacc@share{0.25}
20 21
 \newcommand\MRTsfaccSet[1]%>>>
21 22
   {%
@@ -40,8 +41,9 @@
40 41
 \DeclareOption{notest}{\@MRTsfacc@notest@true}
41 42
 \DeclareOption*{\expandafter\MRTsfaccSet\expandafter{\CurrentOption}}
42 43
 \ProcessOptions\relax
44
+% <<<
43 45
 
44
-% Test whether \mathaccentV has the correct meaning >>>
46
+%% Test whether \mathaccentV has the correct meaning >>>
45 47
 \if@MRTsfacc@notest@
46 48
 \else
47 49
   % this is amsmath's definition of \mathaccentV (2018-06-11)
@@ -91,12 +93,13 @@
91 93
 \fi
92 94
 % <<<
93 95
 
94
-\newcommand\MRTsfacc@mathaccentV[5]% >>>
96
+\newcommand\MRTsfacc@mathaccentV[4]% >>>
95 97
   {%
96 98
     \global\let\macc@nucleus\@empty
97
-    \mathaccent"\accentclass@#2#3#4{#5}\macc@nucleus
99
+    \mathaccent"\accentclass@#1#2#3{#4}\macc@nucleus
98 100
   }% <<<
99 101
 
102
+%% Test for nested mathaccentV with known argument >>>
100 103
 \newif\if@MRTsfacc@found@known@
101 104
 \edef\MRTsfacc@mathaccentV@detokenized{\detokenize{\mathaccentV}}
102 105
 \long\def\MRTsfacc@mathaccentV@using@inner#1 #2 #3\endMRTsfacc@arg% >>>
@@ -122,9 +125,9 @@
122 125
             $#2$%
123 126
           }%
124 127
         \if@MRTsfacc@found@known@
125
-          \expandafter\@firstoftwo
128
+          \MRTif@fiAa
126 129
         \else
127
-          \expandafter\@secondoftwo
130
+          \MRTif@fiBb
128 131
         \fi
129 132
       }
130 133
       {\@secondoftwo}%
@@ -144,16 +147,13 @@
144 147
               {\@secondoftwo}%
145 148
           }
146 149
           {\@secondoftwo}%
147
-          {%
148
-            #5%
149
-          }
150
-          {%
151
-            \global\@MRTsfacc@found@known@false
152
-          }%
150
+          {#5}
151
+          {\global\@MRTsfacc@found@known@false}%
153 152
       }%
154 153
   }% <<<
154
+% <<<
155 155
 
156
-% stupid package for math font is stupid. Have to cure the sickness >>>
156
+%% stupid package for math font is stupid. Have to cure the sickness >>>
157 157
 \if@MRTsfacc@height@
158 158
 % true >>>
159 159
   \newcommand*\MRTsfacc@patch@mathaccentV% >>>
@@ -161,11 +161,11 @@
161 161
       \protected\long\def\mathaccentV##1##2##3##4% >>>
162 162
         {%
163 163
           \ifmmode
164
-            \def\mathaccentV@args{{##1}{##2}{##3}{##4}}%
165
-            \expandafter\@firstofone
164
+            \def\mathaccentV@args{{##2}{##3}{##4}}%
165
+            \MRTif@fiAy
166 166
           \else
167 167
             \@xp\nonmatherr@\csname ##1\endcsname
168
-            \expandafter\@gobble
168
+            \MRTif@fiBn
169 169
           \fi
170 170
           {\futurelet\next\mathaccentV@a}%
171 171
         }% <<<
@@ -178,42 +178,42 @@
178 178
   \newcommand*\mathaccentV@a[1]% >>>
179 179
     {%
180 180
       \expandafter\ifx\next!%
181
-        \expandafter\@firstofthree
181
+        \MRTsfacc@fifiATa
182 182
       \else
183 183
         \expandafter\ifx\next*%
184
-          \expandafter\expandafter\expandafter\@secondofthree
184
+          \MRTsfacc@fifiBATb
185 185
         \else
186
-          \expandafter\expandafter\expandafter\@thirdofthree
186
+          \MRTsfacc@fifiBBTc
187 187
         \fi
188 188
       \fi
189 189
       {\expandafter\MRTsfacc@mathaccentV\mathaccentV@args}
190 190
       {\expandafter\mathaccentV@shifted\mathaccentV@args}
191 191
       {\expandafter\mathaccentV@b\mathaccentV@args{#1}}%
192 192
     }% <<<
193
-  \newcommand*\mathaccentV@b[5]% >>>
193
+  \newcommand*\mathaccentV@b[4]% >>>
194 194
     {%
195
-      \MRTifLetterGTF{#5}
196
-        {\mathaccentV@shifted{#1}{#2}{#3}{#4}{#5}}
195
+      \MRTifLetterGTF{#4}
196
+        {\mathaccentV@shifted{#1}{#2}{#3}{#4}}
197 197
         {%
198
-          \MRTsfacc@testnest\MRTifLetterGTF{#5}
199
-            {\mathaccentV@shifted{#1}{#2}{#3}{#4}{#5}}
200
-            {\MRTsfacc@mathaccentV{#1}{#2}{#3}{#4}{#5}}%
198
+          \MRTsfacc@testnest\MRTifLetterGTF{#4}
199
+            {\mathaccentV@shifted{#1}{#2}{#3}{#4}}
200
+            {\MRTsfacc@mathaccentV{#1}{#2}{#3}{#4}}%
201 201
         }%
202 202
     }% <<<
203
-  \newcommand*\mathaccentV@shifted[5]% >>>
203
+  \newcommand*\mathaccentV@shifted[4]% >>>
204 204
     {%
205 205
       \mathchoice
206
-        {\mathaccentV@shifted@a{display}{#1}{#2}{#3}{#4}{#5}}
207
-        {\mathaccentV@shifted@a{text}{#1}{#2}{#3}{#4}{#5}}
208
-        {\mathaccentV@shifted@a{script}{#1}{#2}{#3}{#4}{#5}}
209
-        {\mathaccentV@shifted@a{scriptscript}{#1}{#2}{#3}{#4}{#5}}%
206
+        {\mathaccentV@shifted@a{display}{#1}{#2}{#3}{#4}}
207
+        {\mathaccentV@shifted@a{text}{#1}{#2}{#3}{#4}}
208
+        {\mathaccentV@shifted@a{script}{#1}{#2}{#3}{#4}}
209
+        {\mathaccentV@shifted@a{scriptscript}{#1}{#2}{#3}{#4}}%
210 210
     }% <<<
211
-  \newcommand*\mathaccentV@shifted@a[6]% >>>
211
+  \newcommand*\mathaccentV@shifted@a[5]% >>>
212 212
     {%
213
-      \setbox\MRTsfacc@box\hbox{$\csname #1style\endcsname#6$}%
214
-      \MRTsfacc@mathaccentV{#2}{#3}{#4}{#5}%
213
+      \setbox\MRTsfacc@box\hbox{$\csname #1style\endcsname#5$}%
214
+      \MRTsfacc@mathaccentV{#2}{#3}{#4}%
215 215
         {%
216
-          #6%
216
+          #5%
217 217
           \kern\MRTsfacc@kern
218 218
         }%
219 219
       \kern-\MRTsfacc@kern
@@ -225,15 +225,15 @@
225 225
       \protected\def\mathaccentV##1##2##3##4% >>>
226 226
         {%
227 227
           \ifmmode
228
-            \expandafter\@firstofone
228
+            \MRTif@fiAy
229 229
           \else
230 230
             \@xp\nonmatherr@\csname ##1\endcsname
231
-            \expandafter\@gobble
231
+            \MRTif@fiBn
232 232
           \fi
233 233
           {%
234 234
             \@ifnextchar[%]
235
-              {\mathaccentV@b{##1}{##2}{##3}{##4}}
236
-              {\mathaccentV@a{##1}{##2}{##3}{##4}}%
235
+              {\mathaccentV@b{##2}{##3}{##4}}
236
+              {\mathaccentV@a{##2}{##3}{##4}}%
237 237
           }%
238 238
         }% <<<
239 239
     }% <<<
@@ -242,50 +242,50 @@
242 242
       \begingroup
243 243
       \expandafter\ifx\csname\MRTsfacc@shift{#1}\endcsname\relax
244 244
         \endgroup
245
-        \expandafter\@secondoftwo
245
+        \MRTif@fiAb
246 246
       \else
247 247
         \endgroup
248
-        \expandafter\@firstoftwo
248
+        \MRTif@fiBa
249 249
       \fi
250 250
     }% <<<
251
-  \newcommand*\MRTsfacc@mathaccentV@shifted@expandhelper[6]% >>>
251
+  \newcommand*\MRTsfacc@mathaccentV@shifted@expandhelper[5]% >>>
252 252
     {%
253
-      \mathaccentV@shifted{#2}{#3}{#4}{#5}
254
-        {\csname\MRTsfacc@shift{#1}\endcsname}{#6}%
253
+      \mathaccentV@shifted{#2}{#3}{#4}
254
+        {\csname\MRTsfacc@shift{#1}\endcsname}{#5}%
255 255
     }% <<<
256
-  \newcommand\mathaccentV@a[5]% >>>
256
+  \newcommand\mathaccentV@a[4]% >>>
257 257
     {%
258
-      \MRTsfacc@ifknown{#5}
258
+      \MRTsfacc@ifknown{#4}
259 259
         {%
260
-          \mathaccentV@shifted{#1}{#2}{#3}{#4}
261
-            {\csname\MRTsfacc@shift{#5}\endcsname}{#5}%
260
+          \mathaccentV@shifted{#1}{#2}{#3}
261
+            {\csname\MRTsfacc@shift{#4}\endcsname}{#4}%
262 262
         }%
263 263
         {%
264
-          \MRTsfacc@testnest\MRTsfacc@ifknown{#5}
264
+          \MRTsfacc@testnest\MRTsfacc@ifknown{#4}
265 265
             {%
266 266
               \expandafter\MRTsfacc@mathaccentV@shifted@expandhelper\expandafter
267
-                {\MRTsfacc@known}{#1}{#2}{#3}{#4}{#5}%
267
+                {\MRTsfacc@known}{#1}{#2}{#3}{#4}%
268 268
             }
269
-            {\MRTsfacc@mathaccentV{#1}{#2}{#3}{#4}{#5}}%
269
+            {\MRTsfacc@mathaccentV{#1}{#2}{#3}{#4}}%
270 270
         }%
271 271
     }% <<<
272
-  \long\def\mathaccentV@b#1#2#3#4[#5]#6% >>>
272
+  \long\def\mathaccentV@b#1#2#3[#4]#5% >>>
273 273
     {%
274
-      \MRTsfacc@ifknown{#5}
274
+      \MRTsfacc@ifknown{#4}
275 275
         {%
276
-          \mathaccentV@shifted{#1}{#2}{#3}{#4}
277
-            {\csname\MRTsfacc@shift{#5}\endcsname}{#6}%
276
+          \mathaccentV@shifted{#1}{#2}{#3}
277
+            {\csname\MRTsfacc@shift{#4}\endcsname}{#5}%
278 278
         }
279
-        {\mathaccentV@shifted{#1}{#2}{#3}{#4}{#5}{#6}}%
279
+        {\mathaccentV@shifted{#1}{#2}{#3}{#4}{#5}}%
280 280
     }% <<<
281
-  \newcommand\mathaccentV@shifted[6]% >>>
281
+  \newcommand\mathaccentV@shifted[5]% >>>
282 282
     {%
283
-      \MRTsfacc@mathaccentV{#1}{#2}{#3}{#4}
283
+      \MRTsfacc@mathaccentV{#1}{#2}{#3}
284 284
         {%
285
-          #6%
286
-          \mkern#5\relax
285
+          #5%
286
+          \mkern#4\relax
287 287
         }
288
-      \mkern-#5\relax
288
+      \mkern-#4\relax
289 289
     }% <<<
290 290
   \newcommand*\MRTsfacc@shift[1]% >>>
291 291
     {%
@@ -317,6 +317,7 @@
317 317
 % <<<
318 318
 \fi
319 319
 % <<<
320
+
320 321
 \AtBeginDocument{\MRTsfacc@patch@mathaccentV}
321 322
 
322 323
 

Loading…
Cancel
Save