Debian Codegraph @

texmf-dist/tex/latex-dev/tools/bm.sty

raw
1 %%
2 %% This is file `bm.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% bm.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% The source is maintained by the LaTeX Project team and bug
12 %% reports for it can be opened at https://latex-project.org/bugs/
13 %% (but please observe conditions on bug reports sent to that address!)
14 %%
15 %% Copyright (C) 1993-2026
16 %% The LaTeX Project and any individual authors listed elsewhere
17 %% in this file.
18 %%
19 %% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
20 %% --------------------------------------------------------------------------
21 %%
22 %% It may be distributed and/or modified under the
23 %% conditions of the LaTeX Project Public License, either version 1.3c
24 %% of this license or (at your option) any later version.
25 %% The latest version of this license is in
26 %% https://www.latex-project.org/lppl.txt
27 %% and version 1.3c or later is part of all distributions of LaTeX
28 %% version 2005/12/01 or later.
29 %%
30 %% This file may only be distributed together with a copy of the LaTeX
31 %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
32 %% without such generated files.
33 %%
34 %% The list of all files belonging to the LaTeX `Tools Bundle' is
35 %% given in the file `manifest.txt'.
36 %%
37 %% Copyright 1996 1997 1998 1999 2002 2003 2004 2016 2017 2019 2021 2022 2023 2025
38 %% David Carlisle Frank Mittelbach
39 %%
40 %% Development of this package was commissioned by Y&Y Inc.
41 \NeedsTeXFormat{LaTeX2e}
42 \ProvidesPackage{bm}
43 [2025/10/21 v1.2g Bold Symbol Support (DPC/FMi)]
44 \DeclareOption{nopmb}{\let\bm@pmb@\@firstofone}
45 \DeclareOption{warn}{\def\bm@info{\PackageWarningNoLine{bm}}}
46 \DeclareOption{info}{\def\bm@info#1{\PackageInfo{bm}{#1\@gobble}}}
47 \DeclareOption{silent}{\let\bm@info\@gobble}
48 \ExecuteOptions{info}
49 \ProcessOptions\relax
50 \def\bm@setup#1#2{%
51 \let\bm@install@mathalphabet\install@mathalphabet
52 \let\bm@getanddefine@fonts\getanddefine@fonts
53 \let\bm@or\or
54 \edef\bm@general{\f@encoding/\f@family/\f@series/\f@shape/\f@size}%
55 \@tempcnta#2%
56 \count@-\count18%
57 \advance\count@-\@tempcnta
58 \advance\count@15\relax
59 \ifnum\count@<\z@
60 \advance\@tempcnta\count@
61 \fi
62 \let\or\relax
63 \expandafter\let\csname bm@#1table\endcsname\@gobble
64 \def\bm@define##1{%
65 \expandafter\xdef\csname bm@#1table\endcsname{%
66 \csname bm@#1table\endcsname\or##1}}%
67 \def\getanddefine@fonts##1##2{%
68 \def\@tempa{##2}%
69 \def\@tempb####1##1####2####3\@nil{\def\@tempb{####2}}%
70 \expandafter\expandafter\expandafter
71 \@tempb\csname mv@#1\endcsname\@nil
72 \ifx\@tempa\@tempb
73 \bm@define\m@ne
74 \bm@info{No #1 for \string##2%
75 \ifx\bm@pmb@\@firstofone\else, using \string\pmb\fi}%
76 \else
77 \edef\@tempa{sym#1\expandafter\@gobblefour\string##1}%
78 \ifnum\@tempcnta<%
79 \expandafter\ifx\csname\@tempa\endcsname\relax
80 \@ne
81 \else
82 \m@ne
83 \fi
84 \bm@define\z@
85 \else
86 \expandafter\ifx\csname\@tempa\endcsname\relax
87 \begingroup
88 \escapechar\m@ne
89 \edef\@tempb{\endgroup
90 \noexpand\split@name
91 \expandafter\string\@tempb}%
92 \@tempb/\@nil
93 \expandafter\ifx
94 \csname symbold\expandafter\@gobblefour\string##1\endcsname
95 \relax
96 \expandafter\new@mathgroup\csname\@tempa\endcsname
97 \expandafter\new@symbolfont\csname\@tempa\endcsname
98 \f@encoding\f@family\f@series\f@shape
99 \advance\@tempcnta\m@ne
100 \else
101 \def\bm@expand####1##1####2####3\@nil{\def\bm@expand{####2}}%
102 \expandafter\expandafter\expandafter
103 \bm@expand\csname mv@bold\endcsname\@nil
104 \ifx\bm@expand\@tempb
105 \expandafter\let\csname\@tempa\expandafter\endcsname
106 \csname symbold\expandafter
107 \@gobblefour\string##1\endcsname
108 \else
109 \expandafter\new@mathgroup\csname\@tempa\endcsname
110 \expandafter\new@symbolfont\csname\@tempa\endcsname
111 \f@encoding\f@family\f@series\f@shape
112 \advance\@tempcnta\m@ne
113 \fi
114 \fi
115 \else
116 \bm@info
117 {Symbol font \@tempa\space already defined.\MessageBreak
118 Not overwriting it}%
119 \fi
120 \count@\csname\@tempa\endcsname
121 \advance\count@-##1%
122 \bm@define{\the\count@\relax}%
123 \fi
124 \fi}%
125 \let\install@mathalphabet\@gobbletwo
126 \mv@normal
127 \expandafter\xdef\csname bm@#1table\endcsname{%
128 \noexpand\ifcase\@tempcnta
129 \csname bm@#1table\endcsname
130 \noexpand\else
131 \z@
132 \noexpand\fi}%
133 \expandafter\split@name\bm@general\@nil
134 \let\install@mathalphabet\bm@install@mathalphabet
135 \let\getanddefine@fonts\bm@getanddefine@fonts
136 \let\or\bm@or}
137 \ifx\bmmax\@undefined
138 \chardef\bmmax=4
139 \fi
140 \ifx\mv@bold\@undefined
141 \def\bm@boldtable{\m@ne}
142 \AtEndOfPackage{%
143 \def\bm@gr@up#1#2{%
144 \bm@install@mathalphabet{#2}}}
145 \else
146 \bm@setup{bold}\bmmax
147 \@ifundefined{symboldoperators}
148 {}
149 {\DeclareSymbolFontAlphabet\mathbf{boldoperators}}
150 \fi
151 \ifx\hmmax\@undefined
152 \chardef\hmmax=3
153 \fi
154 \ifx\mv@heavy\@undefined
155 \else
156 \bm@setup{heavy}\hmmax
157 \fi
158 \begingroup
159 \catcode`\'=\active
160 \catcode`\_=\active
161 \@firstofone{\endgroup
162 \def\bm@general#1#2#3#4#5{%
163 \begingroup
164 \let\bm\@firstofone
165 \let\hm\@firstofone
166 \global\let\bm@command\@empty
167 \let\@let@token\@empty
168 \let\protect\@empty
169 \let\@typeset@protect\@empty
170 \def\bm@mathchoice{\bm@m@thchoice#1}%
171 \def\bm@group{\bm@gr@up#1}%
172 \let\bm@table#2%
173 \let\left\holdinginserts
174 \let\right\left
175 \let\mskip\mkern
176 \let\hskip\kern
177 \let\bm@prime\copy
178 \let_\relax
179 \def'{\bm@prime\prime\relax}%
180 \def\@ifnextchar##1##2##3##4{%
181 \if##1##4%
182 \expandafter\@firstoftwo
183 \else
184 \expandafter\@secondoftwo
185 \fi
186 {##2##4}{##3{##4}}}%
187 \let\kernel@ifnextchar\@ifnextchar
188 \def\GenericWarning##1##2{%
189 \unvcopy{\GenericWarning{##1}{##2}}}%
190 \def\GenericError##1##2##3##4{%
191 \unvcopy{\GenericError{##1}{##2}{##3}{##4}}}%
192 \let\DN@\copy
193 \let\FN@\copy
194 \let\nolimits@\copy
195 \let\next@\copy
196 \global\let\bm@first\@empty
197 \ifx\uproot@\undefined\else
198 \def\root##1\of##2{{\root##1\of{##2}}}%
199 \fi
200 \def\mathaccentV##1{\mathaccent"\accentclass@}%
201 \let\@ifnext\@ifnextchar
202 \let\measure@lhs\copy
203 \let \rel@break\copy
204 \let \bin@break\copy
205 \let \after@open\copy
206 \let \after@close\copy
207 \let\ifmmode\iftrue
208 \let\install@mathalphabet\def
209 \let\getanddefine@fonts\@gobbletwo
210 #3%
211 \def\select@group##1##2##3##4{{%
212 \protect##1{##4}}}%
213 \def\use@mathgroup##1##2##3{{%
214 \protect\use@mathgroup##1{##2}{##3}}}%
215 \bm@expand#5\bm@end
216 \endgroup
217 #4}
218 }
219 \DeclareRobustCommand\bm{%
220 \bm@general\boldmath\bm@boldtable\mv@bold\bm@command}
221 \protected@edef\bm#1{\bm{#1}}
222 \def\DeclareBoldMathCommand{\@testopt\bm@declare{bold}}
223 \def\bm@declare[#1]#2{%
224 \expandafter\bm@general
225 \csname #1math\expandafter\endcsname
226 \csname bm@#1table\expandafter\endcsname
227 \csname mv@#1\endcsname
228 {\bm@define#2}}
229 \def\bmdefine{\DeclareBoldMathCommand[bold]}
230 \ifx\mv@heavy\@undefined
231 \let\hm\bm
232 \let\heavymath\boldmath
233 \let\bm@heavytable\bm@boldtable
234 \else
235 \DeclareRobustCommand\hm{%
236 \bm@general\heavymath\bm@heavytable\mv@heavy\bm@command}
237 \protected@edef\hm#1{\hm{#1}}
238 \def\hmdefine{\DeclareBoldMathCommand[heavy]}
239 \fi
240 \outer\def\bm@end{\@@end}
241 \def\bm@expand{\afterassignment\bm@exp@nd\count@`\a}
242 \def\bm@exp@nd{\afterassignment\bm@test\count@`\a}
243 \def\bm@test{%
244 \let\bm@previous\@let@token
245 \futurelet\@let@token\bm@test@}
246 \def\bm@test@{%
247 \ifx\@let@token\bgroup
248 \expandafter\bm@group
249 \else
250 \expandafter\bm@test@token
251 \fi}
252 \def\bm@gr@up#1#2{%
253 \bm@add{{\bm@gr@@p#1{{#2}}}}}
254 \def\bm@gr@@p#1#2{%
255 \ifmmode
256 \bm@mchoice#1{#2}{#2}{#2}{#2}%
257 \else
258 \bfseries#1#2%
259 \fi}
260 \def\bm@test@token#1{%
261 \let\bm@next\@empty
262 \ifx#1\@@end
263 \else\ifx#1\mathchoice
264 \let\bm@next\bm@mathchoice
265 \else\ifx#1\mathchar
266 \afterassignment\bm@mathchar\count@
267 \else\ifx#1\mathaccent
268 \afterassignment\bm@mathaccent\count@
269 \else\ifx#1\delimiter
270 \afterassignment\bm@delimiter\count@
271 \else\ifx#1\radical
272 \afterassignment\bm@radical\count@
273 \else\ifx#1\mkern
274 \bm@register#1{\muskip\z@}%
275 \else\ifx#1\kern
276 \bm@register#1\skip@
277 \else\ifx#1\penalty
278 \bm@register#1\count@
279 \else\ifx#1\unvcopy
280 \let\bm@next\bm@add
281 \else\ifcat\noexpand#1\relax
282 \xdef\meaning@{\meaning#1}%
283 \expandafter\bm@mchar@test\meaning@""""\@nil#1%
284 \else\ifcat.\ifcat a#1.\else#1\fi
285 \count@\mathcode`#1\relax
286 \ifnum\count@=\mathcode`\'%
287 \begingroup\uccode`\~`#1\uppercase{\endgroup
288 \def\bm@next{\bm@expand~}}%
289 \else
290 \ifx\bm@previous\left
291 \count@\delcode`#1\relax
292 \bm@delimiter
293 \else
294 \ifnum\count@>"8000
295 \Umathcharnumdef\@tempa\count@
296 \xdef\meaning@{\meaning\@tempa}%
297 \expandafter\bm@mchar@test\meaning@""""\@nil\@tempa
298 \else
299 \bm@mathchar
300 \fi
301 \fi
302 \fi
303 \else
304 \bm@add{#1}%
305 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
306 \bm@next}
307 \def\bm@define#1{%
308 \begingroup
309 \ifx\bm@command\@gtempa
310 \def\mathchar{\global\mathchardef#1}%
311 \bm@command
312 \else
313 \toks@\expandafter{\bm@command}%
314 \xdef#1{\bm@first\noexpand\bm@protect\noexpand#1{\the\toks@}}%
315 \fi
316 \endgroup}
317 \def\bm@protect#1{%
318 \ifx\protect\@typeset@protect
319 \expandafter\@firstofone
320 \else
321 \protect#1\expandafter\@gobble
322 \fi}
323 \def\bm@mchoice#1#2#3#4#5{%
324 \mathchoice{\hbox{#1$\displaystyle\m@th#2$}}%
325 {\hbox{#1$\textstyle\m@th#3$}}%
326 {\hbox{#1$\scriptstyle\m@th#4$}}%
327 {\hbox{#1$\scriptscriptstyle\m@th#5$}}}
328 \def\bm@m@thchoice#1#2#3#4#5{%
329 \bm@add{\bm@mchoice#1{#2}{#3}{#4}{#5}}}
330 \def\bm@register#1#2{%
331 \def\@tempa{#1\the#2}%
332 \afterassignment\bm@r@gister#2}
333 \def\bm@r@gister{%
334 \bm@xadd{\@tempa\space}}
335 \def\bm@mathchar{%
336 \@tempcntb\count@
337 \let\@tempa\bm@group
338 \bm@changefam{}%
339 \ifnum\count@>\@tempcntb
340 \ifx\bm@command\@empty
341 \xdef\@gtempa{\mathchar\the\count@\space}%
342 \fi
343 \bm@xadd{\mathchar\the\count@\space}%
344 \else
345 \begingroup
346 \divide\count@"1000
347 \let\bm@expand\relax
348 \bm@xadd\bm@class
349 \endgroup
350 \edef\@tempb{%
351 \noexpand\@tempa{\mathchar\the\count@\space}}%
352 \@tempb
353 \fi}
354 \def\bm@umathchar#1#2#3{%
355 \@tempcnta#2\relax
356 \count@\bm@table
357 \ifnum\count@=\z@
358 \bm@gr@up\boldmath{\Umathchar#1 #2 #3 }%
359 \else
360 \ifnum\count@=\m@ne
361 \else
362 \advance\@tempcnta\count@
363 \fi
364 \bm@xadd{\Umathchar#1\space
365 \the\@tempcnta\space\space
366 #3\space}%
367 \fi}
368 \def\bm@pmb#1{%
369 \bm@add{\bm@pmb@{#1}}}
370 \ifx\bm@pmb@\@firstofone\else
371 \def\bm@pmb@#1{{%
372 \setbox\tw@\hbox{$\m@th\mkern.4mu$}%
373 \mathchoice
374 \bm@pmb@@\displaystyle\@empty{#1}%
375 \bm@pmb@@\textstyle\@empty{#1}%
376 \bm@pmb@@\scriptstyle\defaultscriptratio{#1}%
377 \bm@pmb@@\scriptscriptstyle\defaultscriptscriptratio{#1}}}
378 \def\bm@pmb@@#1#2#3{{%
379 \setbox\z@\hbox{$\m@th#1#3$}%
380 \dimen@#2\wd\tw@
381 \rlap{\copy\z@}%
382 \kern\dimen@
383 \raise1.5\dimen@\rlap{\copy\z@}%
384 \kern\dimen@
385 \box\z@}}%
386 \fi
387 \def\bm@class{%
388 \ifcase\count@
389 \or
390 \mathop\or
391 \mathbin\or
392 \mathrel\or
393 \mathopen\or
394 \mathclose\or
395 \mathpunct\or
396 \fi}
397 \def\bm@add#1{%
398 \begingroup
399 \toks@\expandafter{\bm@command#1}%
400 \xdef\bm@command{\the\toks@}%
401 \endgroup
402 \bm@expand}
403 \def\bm@xadd#1{%
404 \begingroup
405 \toks@\expandafter{\bm@command}%
406 \xdef\bm@command{\the\toks@#1}%
407 \endgroup
408 \bm@expand}
409 \def\bm@mathaccent{%
410 \bm@changefam{}%
411 \begingroup
412 \def\bm@group##1{\endgroup\bm@xadd{\bgroup}##1\egroup}%
413 \def\bm@test@token{\endgroup\bm@test@token}%
414 \let\relax\@empty
415 \bm@xadd{\mathaccent\the\count@\space}}
416 \def\bm@delimiter{%
417 \ifnum\count@>\z@
418 \bm@changefam{}%
419 \bm@changefam{000}%
420 \fi
421 \bm@xadd{\delimiter\the\count@\space}}%
422 \def\bm@radical{%
423 \bm@changefam{}%
424 \bm@changefam{000}%
425 \bm@xadd{\radical\the\count@\space}}%
426 \edef\bm@mchar@{\meaning\mathchar}
427 \edef\bm@char@{\meaning\char}
428 \edef\bm@umchar@{\string\U\expandafter\@gobble\meaning\mathchar}
429 \def\bm@mchar@test#1"#2"#3"#4"#5\@nil#6{%
430 \xdef\meaning@{#1}%
431 \ifx\meaning@\bm@mchar@
432 \count@"#2\relax
433 \bm@mathchar
434 \else
435 \ifx\meaning@\bm@umchar@
436 \bm@umathchar{"#2}{"#3}{"#4}%
437 \else
438 \ifx\meaning@\bm@char@
439 \count@\mathcode"#2\relax
440 \bm@mathchar
441 \else
442 \ifx\bm@previous\@empty
443 \ifx\relax#6%
444 \gdef\bm@first{#6}%
445 \fi
446 \fi
447 \bm@add{#6}%
448 \fi
449 \fi
450 \fi}
451 \def\bm@changefam#1{%
452 \@tempcnta\count@
453 \divide\@tempcnta"1000#1 %
454 \multiply\@tempcnta"1000#1 %
455 \advance\@tempcnta-\count@
456 \divide\@tempcnta-"100#1 %
457 \@tempcnta\bm@table
458 \ifnum\@tempcnta=\m@ne
459 \let\@tempa\bm@pmb
460 \else
461 \multiply\@tempcnta"100#1 %
462 \advance\count@\@tempcnta
463 \fi}
464 \def\bm@prime{^\bgroup
465 \let\bm@prime'%
466 \def\prim@s##1\relax{##1\futurelet\@let@token\pr@m@s}%
467 \prim@s}
468 \let\boldsymbol\bm
469 \let\heavysymbol\hm
470 \endinput
471 %%
472 %% End of file `bm.sty'.