Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/tex/latex/tools/bm.sty

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


%%
%% This is file `bm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bm.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% This file is a generated file from the sources of the `tools' bundle
%% in the LaTeX2e distribution.
%% 
%% For the copyright notice see the source file(s).
%% 
%% You are not allowed to modify this file.
%% 
%% You are allowed to distribute this file if and only if
%% it is distributed with the corresponding source files in
%% the `tools' bundle.
%% 
%% For the copying and distribution conditions of the source files,
%% see the file readme.txt distributed with the tools bundle.
%% 
%% Copyright 1996 1997 David Carlisle Frank Mittelbach
%%
%% Development of this package was commissioned by Y&Y Inc.
%% http://www.yandy.com
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bm}
          [1997/11/22 v1.0e Bold Symbol Support (DPC/FMi)]
\def\bm#1#2{%
  \let\bm@pmb\install@mathalphabet
  \let\bm@pmb@\getanddefine@fonts
  \let\bm@pmb@@\or
  \edef\bm@general{\f@encoding/\f@family/\f@series/\f@shape/\f@size}%
  \@tempcnta#2%
  \count@-\count18%
  \advance\count@-\@tempcnta
  \advance\count@15\relax
  \ifnum\count@<\z@
    \advance\@tempcnta\count@
  \fi
  \let\or\relax
  \expandafter\let\csname bm@#1table\endcsname\@gobble
  \def\bm@define##1{%
    \expandafter\xdef\csname bm@#1table\endcsname{%
      \csname bm@#1table\endcsname\or##1}}%
  \def\getanddefine@fonts##1##2{%
    \def\@tempa{##2}%
    \def\@tempb####1##1####2####3\@nil{\def\@tempb{####2}}%
    \expandafter\expandafter\expandafter
      \@tempb\csname mv@#1\endcsname\@nil
    \ifx\@tempa\@tempb
      \bm@define\m@ne
    \else
      \edef\@tempa{sym#1\expandafter\@gobblefour\string##1}%
      \ifnum\@tempcnta<%
           \expandafter\ifx\csname\@tempa\endcsname\relax
             \@ne
           \else
             \m@ne
           \fi
        \bm@define\z@
      \else
        \expandafter\ifx\csname\@tempa\endcsname\relax
          \begingroup
          \escapechar\m@ne
          \edef\@tempb{\endgroup
            \noexpand\split@name
            \expandafter\string\@tempb}%
          \@tempb/\@nil
         \expandafter\ifx
           \csname symbold\expandafter\@gobblefour\string##1\endcsname
           \relax
            \expandafter\new@mathgroup\csname\@tempa\endcsname
            \expandafter\new@symbolfont\csname\@tempa\endcsname
                       \f@encoding\f@family\f@series\f@shape
            \advance\@tempcnta\m@ne
         \else
           \def\bm@expand####1##1####2####3\@nil{\def\bm@expand{####2}}%
    \expandafter\expandafter\expandafter
           \bm@expand\csname mv@bold\endcsname\@nil
           \ifx\bm@expand\@tempb
             \expandafter\let\csname\@tempa\expandafter\endcsname
                \csname symbold\expandafter
                        \@gobblefour\string##1\endcsname
           \else
             \expandafter\new@mathgroup\csname\@tempa\endcsname
             \expandafter\new@symbolfont\csname\@tempa\endcsname
                       \f@encoding\f@family\f@series\f@shape
             \advance\@tempcnta\m@ne
           \fi
         \fi
        \else
          \PackageInfo{bm}%
            {Symbol font \@tempa\space already defined.\MessageBreak
             Not overwriting it}%
        \fi
        \count@\csname\@tempa\endcsname
        \advance\count@-##1%
        \bm@define{\the\count@\relax}%
      \fi
    \fi}%
  \let\install@mathalphabet\@gobbletwo
  \mv@normal
  \expandafter\xdef\csname bm@#1table\endcsname{%
    \noexpand\ifcase\@tempcnta
      \csname bm@#1table\endcsname
    \noexpand\else
      \z@
    \noexpand\fi}%
  \expandafter\split@name\bm@general\@nil
  \let\install@mathalphabet\bm@pmb
  \let\getanddefine@fonts\bm@pmb@
  \let\or\bm@pmb@@}
\ifx\bmmax\@undefined
  \chardef\bmmax=4
\fi
\ifx\mv@bold\@undefined
  \def\bm@boldtable{\m@ne}
  \AtEndOfPackage{%
    \def\bm@gr@up#1#2{%
      \bm@pmb{#2}}}
\else
  \bm{bold}\bmmax
  \@ifundefined{symboldoperators}
    {}
    {\DeclareSymbolFontAlphabet\mathbf{boldoperators}}
\fi
\ifx\hmmax\@undefined
  \chardef\hmmax=3
\fi
\ifx\mv@heavy\@undefined
\else
  \bm{heavy}\hmmax
\fi
\begingroup
\catcode`\'=\active
\@firstofone{\endgroup
\def\bm@general#1#2#3#4{%
  \begingroup
    \let\bm\@firstofone
    \let\hm\@firstofone
    \global\let\bm@command\@empty
    \let\@let@token\@empty
    \let\protect\@empty
    \let\@typeset@protect\@empty
    \def\bm@mathchoice{\bm@m@thchoice#1}%
    \def\bm@group{\bm@gr@up#1}%
    \let\bm@table#2%
    \let\left\holdinginserts
    \let\right\left
    \let\mskip\mkern
    \let\bm@prime\copy
    \def'{\bm@prime\prime\relax}%
    \def\@ifnextchar##1##2##3##4{%
      \if##1##4%
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
      {##2##4}{##3{##4}}}%
    \let\DN@\copy
    \let\FN@\copy
    \let\next@\copy
    \global\let\bm@first\@empty
    \let\@ifnext\@ifnextchar
    \let\measure@lhs\copy
    \let \rel@break\copy
    \let \bin@break\copy
    \let \after@open\copy
    \let \after@close\copy
    \let\ifmmode\iftrue
    \def\select@group##1##2##3##4{{%
      \protect##1{##4}}}%
    \def\use@mathgroup##1##2##3{{%
      \protect\use@mathgroup##1{##2}{##3}}}%
    \bm@expand#4\bm@end
  \endgroup
  #3}
}
\DeclareRobustCommand\bm{%
  \bm@general\boldmath\bm@boldtable\bm@command}
\protected@edef\bm#1{\bm{#1}}
\def\DeclareBoldMathCommand{\@testopt\bm@declare{bold}}
\def\bm@declare[#1]#2{%
  \expandafter\bm@general
        \csname #1math\expandafter\endcsname
        \csname bm@#1table\endcsname
        {\bm@define#2}}
\def\bmdefine{\DeclareBoldMathCommand[bold]}
\ifx\mv@heavy\@undefined
  \let\hm\bm
  \let\heavymath\boldmath
  \let\bm@heavytable\bm@boldtable
\else
  \DeclareRobustCommand\hm{%
    \bm@general\heavymath\bm@heavytable\bm@command}
  \protected@edef\hm#1{\hm{#1}}
  \def\hmdefine{\DeclareBoldMathCommand[heavy]}
\fi
\outer\def\bm@end{\@@end}
\def\bm@expand{\afterassignment\bm@exp@nd\count@`\a}
\def\bm@exp@nd{\afterassignment\bm@test\count@`\a}
\def\bm@test{%
  \let\bm@previous\@let@token
  \futurelet\@let@token\bm@test@}
\def\bm@test@{%
  \ifx\@let@token\bgroup
    \expandafter\bm@group
  \else
    \expandafter\bm@test@token
  \fi}
\def\bm@gr@up#1#2{%
  \bm@add{{\bm@gr@@p#1{{#2}}}}}
\def\bm@gr@@p#1#2{%
  \ifmmode
    \bm@mchoice#1{#2}{#2}{#2}{#2}%
  \else
    \bfseries#1#2%
  \fi}
\def\bm@test@token#1{%
  \let\bm@next\@empty
  \ifx#1\@@end
  \else\ifx#1\mathchoice
    \let\bm@next\bm@mathchoice
  \else\ifx#1\mathchar
    \afterassignment\bm@mathchar\count@
  \else\ifx#1\mathaccent
    \afterassignment\bm@mathaccent\count@
  \else\ifx#1\delimiter
    \afterassignment\bm@delimiter\count@
  \else\ifx#1\radical
    \afterassignment\bm@radical\count@
  \else\ifx#1\mkern
    \bm@register#1{\muskip\z@}%
  \else\ifx#1\kern
    \bm@register#1\dimen@
  \else\ifx#1\penalty
    \bm@register#1\count@
  \else\ifcat\noexpand#1\relax
    \xdef\meaning@{\meaning#1}%
    \expandafter\bm@mchar@test\meaning@""\@nil#1%
  \else\ifcat.\ifcat a#1.\else#1\fi
    \count@\mathcode`#1\relax
    \ifnum\count@=\mathcode`\'%
      \begingroup\uccode`\~`#1\uppercase{\endgroup
        \def\bm@next{\bm@expand~}}%
    \else
      \ifx\bm@previous\left
        \count@\delcode`#1\relax
        \bm@delimiter
      \else
        \bm@mathchar
      \fi
    \fi
  \else
    \bm@add{#1}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \bm@next}
\def\bm@define#1{%
  \begingroup
    \ifx\bm@command\@gtempa
      \def\mathchar{\global\mathchardef#1}%
      \bm@command
    \else
      \toks@\expandafter{\bm@command}%
      \xdef#1{\bm@first\noexpand\bm@protect\noexpand#1{\the\toks@}}%
    \fi
  \endgroup}
\def\bm@protect#1{%
  \ifx\protect\@typeset@protect
    \expandafter\@firstofone
  \else
    \protect#1\expandafter\@gobble
  \fi}
\def\bm@mchoice#1#2#3#4#5{%
  \mathchoice{\hbox{#1$\displaystyle\m@th#2$}}%
             {\hbox{#1$\textstyle\m@th#3$}}%
             {\hbox{#1$\scriptstyle\m@th#4$}}%
             {\hbox{#1$\scriptscriptstyle\m@th#5$}}}
\def\bm@m@thchoice#1#2#3#4#5{%
  \bm@add{\bm@mchoice#1{#2}{#3}{#4}{#5}}}
\def\bm@register#1#2{%
  \def\@tempa{#1\the#2}%
  \afterassignment\bm@r@gister#2}
\def\bm@r@gister{%
  \bm@xadd{\@tempa\space}}
\def\bm@mathchar{%
  \@tempcntb\count@
  \let\@tempa\bm@group
  \bm@changefam{}%
  \ifnum\count@>\@tempcntb
    \ifx\bm@command\@empty
      \xdef\@gtempa{\mathchar\the\count@\space}%
    \fi
    \bm@xadd{\mathchar\the\count@\space}%
  \else
    \begingroup
      \divide\count@"1000
      \let\bm@expand\relax
      \bm@xadd\bm@class
    \endgroup
    \edef\@tempb{%
      \noexpand\@tempa{\mathchar\the\count@\space}}%
    \@tempb
  \fi}
\def\bm@pmb#1{%
  \bm@add{\bm@pmb@{#1}}}
\def\bm@pmb@#1{{%
  \setbox\tw@\hbox{$\m@th\mkern.4mu$}%
  \mathchoice
    \bm@pmb@@\displaystyle\@empty{#1}%
    \bm@pmb@@\textstyle\@empty{#1}%
    \bm@pmb@@\scriptstyle\defaultscriptratio{#1}%
    \bm@pmb@@\scriptscriptstyle\defaultscriptscriptratio{#1}}}
\def\bm@pmb@@#1#2#3{{%
  \setbox\z@\hbox{$\m@th#1#3$}%
  \dimen@#2\wd\tw@
  \rlap{\copy\z@}%
  \kern\dimen@
  \raise1.5\dimen@\rlap{\copy\z@}%
  \kern\dimen@
  \box\z@}}%
\def\bm@class{%
  \ifcase\count@
    \or
    \mathop\or
    \mathbin\or
    \mathrel\or
    \mathopen\or
    \mathclose\or
    \mathpunct\or
  \fi}
\def\bm@add#1{%
  \begingroup
    \toks@\expandafter{\bm@command#1}%
    \xdef\bm@command{\the\toks@}%
  \endgroup
  \bm@expand}
\def\bm@xadd#1{%
  \begingroup
    \toks@\expandafter{\bm@command}%
    \xdef\bm@command{\the\toks@#1}%
  \endgroup
  \bm@expand}
\def\bm@mathaccent{%
 \bm@changefam{}%
 \begingroup
 \def\bm@group##1{\endgroup\bm@xadd{\bgroup}##1\egroup}%
 \def\bm@test@token{\endgroup\bm@test@token}%
 \let\relax\@empty
 \bm@xadd{\mathaccent\the\count@\space}}
\def\bm@delimiter{%
  \ifnum\count@>\z@
    \bm@changefam{}%
    \bm@changefam{000}%
  \fi
  \bm@xadd{\delimiter\the\count@\space}}%
\def\bm@radical{%
 \bm@changefam{}%
 \bm@changefam{000}%
 \bm@xadd{\radical\the\count@\space}}%
\edef\bm@mchar@{\meaning\mathchar}
\def\bm@mchar@test#1"#2"#3\@nil#4{%
  \xdef\meaning@{#1}%
  \ifx\meaning@\bm@mchar@
    \count@"#2\relax
    \bm@mathchar
  \else
    \ifx\bm@previous\@empty
      \ifx\relax#4%
        \gdef\bm@first{#4}%
      \fi
    \fi
    \bm@add{#4}%
  \fi}
\def\bm@changefam#1{%
  \@tempcnta\count@
  \divide\@tempcnta"1000#1 %
  \multiply\@tempcnta"1000#1 %
  \advance\@tempcnta-\count@
  \divide\@tempcnta-"100#1 %
  \@tempcnta\bm@table
  \ifnum\@tempcnta=\m@ne
    \let\@tempa\bm@pmb
  \else
    \multiply\@tempcnta"100#1 %
    \advance\count@\@tempcnta
  \fi}
\def\bm@prime{^\bgroup
  \let\bm@prime'%
  \def\prim@s##1\relax{##1\futurelet\@let@token\pr@m@s}%
  \prim@s}
\let\boldsymbol\bm
\let\heavysymbol\hm
\endinput
%%
%% End of file `bm.sty'.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].