From 138d0a6cfd5f2187973fb6b83ad2fb0dcf5a8348 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 2 Jun 2021 03:04:23 +0000
Subject: CTAN sync 202106020304

---
 macros/latex/required/tools/bm.dtx | 71 ++++++++++++++++++++++++++++++--------
 1 file changed, 57 insertions(+), 14 deletions(-)

(limited to 'macros/latex/required/tools/bm.dtx')

diff --git a/macros/latex/required/tools/bm.dtx b/macros/latex/required/tools/bm.dtx
index 096f6c4bc2..2b56b92b54 100644
--- a/macros/latex/required/tools/bm.dtx
+++ b/macros/latex/required/tools/bm.dtx
@@ -1,8 +1,8 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2020
+% Copyright (C) 1993-2021
 %
-% The LaTeX3 Project and any individual authors listed elsewhere
+% The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
 % This file is part of the Standard LaTeX `Tools Bundle'.
@@ -36,7 +36,7 @@
 %<driver>\ProvidesFile{bm.drv}
 % \fi
 %         \ProvidesFile{bm.dtx}
-          [2019/07/24 v1.2d Bold Symbol Support (DPC/FMi)]
+          [2021/04/25 v1.2e Bold Symbol Support (DPC/FMi)]
 %
 % \iffalse
 %<*driver>
@@ -295,6 +295,23 @@
 % between these two packages, this package defines |\boldsymbol| and
 % |\heavysymbol| as alternative names for |\bm| and |\hm|.
 %
+% \section{Package Options}
+%
+% \subsection{Logging level}
+% As described above, the \textsf{bm} package has to interrogate the font
+% setup to try to find matching bold fonts for each font used in the |normal|
+% math version. This can fail in various ways as there may be no bold font
+% or a bold font may be found but no room is available to allocate it.
+% The options |warn|, |info| and |silent| control whether messages that \textsf{bm}
+% produces are sent to the terminal, or just to the log file (the default) or suppressed.
+%
+% \subsection{Poor Man's Bold}
+% As discussed above, by default, if no real bold font is available, \textsf{bm} will use
+% ``poor man's bold''. That is, over-printing the character with slight offsets.
+% Since version 1.2e, the package now warns if a font is set up to use this over-printing and
+% the package option |nopbm|  is available which prevents its use in which case |\bm| will
+% use the non-bold for characters from the affected font,
+%
 % \StopEventually{}
 %
 % \section{Implementation}
@@ -320,6 +337,20 @@
 %      {minor doc changes latex/3058}
 %
 %
+% \changes{v1.2e}{2021/04/25}
+%      {Package options gh/71}
+% Options to use or not use poor mans bold (over-printing)
+% and level of warning messages.
+%    \begin{macrocode}
+%<*package>
+\DeclareOption{nopmb}{\let\bm@pmb@\@firstofone}
+\DeclareOption{warn}{\def\bm@info{\PackageWarningNoLine{bm}}}
+\DeclareOption{info}{\def\bm@info#1{\PackageInfo{bm}{#1\@gobble}}}
+\DeclareOption{silent}{\let\bm@info\@gobble}
+\ExecuteOptions{info}
+\ProcessOptions\relax
+%</package>
+%    \end{macrocode}
 %
 % The commands |\bm| and |\hm| work by defining a number of additional
 % symbol fonts corresponding to the standard ones
@@ -368,6 +399,7 @@
 % code, which is temporarily defined to |\bm|, to save wasting a csname.
 % Similarly |\bm@pmb|\ldots\ (which will be defined later) are used
 % as scratch macros.
+% (This csname saving no longer used, setup command is |\bm@setup| not |\bm|).
 %
 % The general plan. Run through the fonts allocated to the normal math
 % version. Ignore \meta{math alphabet} allocations\footnote{For now?}
@@ -393,15 +425,15 @@
 % using |\boldmath| or poor man's bold.)
 %
 %    \begin{macrocode}
-\def\bm#1#2{%
+\def\bm@setup#1#2{%
 %    \end{macrocode}
 % This code can not work inside a group, as that would affect any symbol
 % font allocations, so instead use some scratch macros to save and
 % restore the definitions of commands we need to change locally.
 %    \begin{macrocode}
-  \let\bm@pmb\install@mathalphabet
-  \let\bm@pmb@\getanddefine@fonts
-  \let\bm@pmb@@\or
+  \let\bm@install@mathalphabet\install@mathalphabet
+  \let\bm@getanddefine@fonts\getanddefine@fonts
+  \let\bm@or\or
   \edef\bm@general{\f@encoding/\f@family/\f@series/\f@shape/\f@size}%
 %    \end{macrocode}
 %
@@ -465,8 +497,12 @@
 %    \end{macrocode}
 % If they are the same, set this offset to $-1$, as a flag to use
 % poor man's bold.
+% \changes{v1.2e}{2021/04/25}
+%      {make use of pmb optional and warn about it gh/71}
 %    \begin{macrocode}
       \bm@define\m@ne
+      \bm@info{No #1 for \string##2%
+               \ifx\bm@pmb@\@firstofone\else, using \string\pmb\fi}%
     \else
 %    \end{macrocode}
 % Else make a new name by adjoining |#1| to the name of the symbol font
@@ -569,7 +605,7 @@
 %    \end{macrocode}
 % If the font has been allocated already, use the existing allocation.
 %    \begin{macrocode}
-          \PackageInfo{bm}%
+          \bm@info
             {Symbol font \@tempa\space already defined.\MessageBreak
              Not overwriting it}%
         \fi
@@ -613,9 +649,9 @@
 % Put things back as they were.
 %    \begin{macrocode}
   \expandafter\split@name\bm@general\@nil
-  \let\install@mathalphabet\bm@pmb
-  \let\getanddefine@fonts\bm@pmb@
-  \let\or\bm@pmb@@}
+  \let\install@mathalphabet\bm@install@mathalphabet
+  \let\getanddefine@fonts\bm@getanddefine@fonts
+  \let\or\bm@or}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -647,13 +683,13 @@
   \def\bm@boldtable{\m@ne}
   \AtEndOfPackage{%
     \def\bm@gr@up#1#2{%
-      \bm@pmb{#2}}}
+      \bm@install@mathalphabet{#2}}}
 \else
 %    \end{macrocode}
 % Otherwise use the definition of |\bm| above to set up |\bm@boldtable|
 % by comparing the fonts available in the normal and bold math versions.
 %    \begin{macrocode}
-  \bm{bold}\bmmax
+  \bm@setup{bold}\bmmax
 %    \end{macrocode}
 %
 % \begin{macro}{\mathbf}
@@ -689,7 +725,7 @@
 %    \begin{macrocode}
 \ifx\mv@heavy\@undefined
 \else
-  \bm{heavy}\hmmax
+  \bm@setup{heavy}\hmmax
 \fi
 %    \end{macrocode}
 % \end{macro}
@@ -781,6 +817,8 @@
 % you put something really strange in the arguments.
 % \changes{v0.11}{1997/01/06}
 %      {\cs{@ifnextchar} made safe.}
+% \changes{v1.2e}{2021/04/25}
+%      {treat \cs{kernel@ifnextchar} like \cs{@ifnextchar}}
 %    \begin{macrocode}
     \def\@ifnextchar##1##2##3##4{%
       \if##1##4%
@@ -789,6 +827,7 @@
         \expandafter\@secondoftwo
       \fi
       {##2##4}{##3{##4}}}%
+    \let\kernel@ifnextchar\@ifnextchar
 %    \end{macrocode}
 % For Vladimir Volovich\ldots
 % \changes{v1.0f}{1998/12/10}
@@ -1397,6 +1436,8 @@
 % \begin{macro}{\bm@pmb}
 % \changes{v0.10}{1997/01/04}
 %      {Macro added}
+% \changes{v1.2e}{2021/04/25}
+%      {option to make pmb a no-op}
 % Add a poor man's bold construction to the list being built.
 %    \begin{macrocode}
 \def\bm@pmb#1{%
@@ -1410,6 +1451,7 @@
 % |\pmb| variant. (See \TeX{}Book, or AMS \textsf{amsbsy} package).
 % This one takes a bit more care to use smaller offsets in subscripts.
 %    \begin{macrocode}
+\ifx\bm@pmb@\@firstofone\else
 \def\bm@pmb@#1{{%
   \setbox\tw@\hbox{$\m@th\mkern.4mu$}%
   \mathchoice
@@ -1434,6 +1476,7 @@
   \raise1.5\dimen@\rlap{\copy\z@}%
   \kern\dimen@
   \box\z@}}%
+\fi
 %    \end{macrocode}
 % \end{macro}
 %
-- 
cgit v1.2.3

