[latex3-commits] [git/LaTeX3-latex3-latex2e] bm-ifnextchar: options for pmb (no user documentation yet) #71 (93511e68)

David Carlisle d.p.carlisle at gmail.com
Mon Apr 26 00:34:46 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : bm-ifnextchar
Link       : https://github.com/latex3/latex2e/commit/93511e68b3e1a6bc3bed06984428c9b0a04e8aab

>---------------------------------------------------------------

commit 93511e68b3e1a6bc3bed06984428c9b0a04e8aab
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Apr 25 23:34:46 2021 +0100

    options for pmb (no user documentation yet) #71


>---------------------------------------------------------------

93511e68b3e1a6bc3bed06984428c9b0a04e8aab
 required/tools/bm.dtx                            | 49 +++++++++++++++++-------
 required/tools/testfiles/github-0071a.luatex.tlg | 47 +++++++++++++++++++++++
 required/tools/testfiles/github-0071a.lvt        | 27 +++++++++++++
 required/tools/testfiles/github-0071a.tlg        | 47 +++++++++++++++++++++++
 required/tools/testfiles/github-0071b.luatex.tlg | 27 +++++++++++++
 required/tools/testfiles/github-0071b.lvt        | 27 +++++++++++++
 required/tools/testfiles/github-0071b.tlg        | 27 +++++++++++++
 7 files changed, 238 insertions(+), 13 deletions(-)

diff --git a/required/tools/bm.dtx b/required/tools/bm.dtx
index 1c92b68a..fb62cf1b 100644
--- a/required/tools/bm.dtx
+++ b/required/tools/bm.dtx
@@ -320,6 +320,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 at pmb@\@firstofone}
+\DeclareOption{warn}{\def\bm at info{\PackageWarningNoLine{bm}}}
+\DeclareOption{info}{\def\bm at info#1{\PackageInfo{bm}{#1\@gobble}}}
+\DeclareOption{silent}{\let\bm at 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 +382,7 @@
 % code, which is temporarily defined to |\bm|, to save wasting a csname.
 % Similarly |\bm at pmb|\ldots\ (which will be defined later) are used
 % as scratch macros.
+% (This csname saving no longer used, setup command is |\bm at 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 +408,15 @@
 % using |\boldmath| or poor man's bold.)
 %
 %    \begin{macrocode}
-\def\bm#1#2{%
+\def\bm at 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 at pmb\install at mathalphabet
-  \let\bm at pmb@\getanddefine at fonts
-  \let\bm at pmb@@\or
+  \let\bm at install@mathalphabet\install at mathalphabet
+  \let\bm at getanddefine@fonts\getanddefine at fonts
+  \let\bm at or\or
   \edef\bm at general{\f at encoding/\f at family/\f at series/\f at shape/\f at size}%
 %    \end{macrocode}
 %
@@ -465,8 +480,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 at define\m at ne
+      \bm at info{No #1 for \string##2%
+               \ifx\bm at 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 +588,7 @@
 %    \end{macrocode}
 % If the font has been allocated already, use the existing allocation.
 %    \begin{macrocode}
-          \PackageInfo{bm}%
+          \bm at info
             {Symbol font \@tempa\space already defined.\MessageBreak
              Not overwriting it}%
         \fi
@@ -613,9 +632,9 @@
 % Put things back as they were.
 %    \begin{macrocode}
   \expandafter\split at name\bm at general\@nil
-  \let\install at mathalphabet\bm at pmb
-  \let\getanddefine at fonts\bm at pmb@
-  \let\or\bm at pmb@@}
+  \let\install at mathalphabet\bm at install@mathalphabet
+  \let\getanddefine at fonts\bm at getanddefine@fonts
+  \let\or\bm at or}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -647,13 +666,13 @@
   \def\bm at boldtable{\m at ne}
   \AtEndOfPackage{%
     \def\bm at gr@up#1#2{%
-      \bm at pmb{#2}}}
+      \bm at install@mathalphabet{#2}}}
 \else
 %    \end{macrocode}
 % Otherwise use the definition of |\bm| above to set up |\bm at boldtable|
 % by comparing the fonts available in the normal and bold math versions.
 %    \begin{macrocode}
-  \bm{bold}\bmmax
+  \bm at setup{bold}\bmmax
 %    \end{macrocode}
 %
 % \begin{macro}{\mathbf}
@@ -689,7 +708,7 @@
 %    \begin{macrocode}
 \ifx\mv at heavy\@undefined
 \else
-  \bm{heavy}\hmmax
+  \bm at setup{heavy}\hmmax
 \fi
 %    \end{macrocode}
 % \end{macro}
@@ -782,7 +801,7 @@
 % \changes{v0.11}{1997/01/06}
 %      {\cs{@ifnextchar} made safe.}
 % \changes{v1.2e}{2021/04/25}
-%      {tread \cs{kernel at ifnextchar} like \cs{@ifnextchar}}
+%      {treat \cs{kernel at ifnextchar} like \cs{@ifnextchar}}
 %    \begin{macrocode}
     \def\@ifnextchar##1##2##3##4{%
       \if##1##4%
@@ -791,7 +810,7 @@
         \expandafter\@secondoftwo
       \fi
       {##2##4}{##3{##4}}}%
-     \let\kernel at ifnextchar\@ifnextchar
+    \let\kernel at ifnextchar\@ifnextchar
 %    \end{macrocode}
 % For Vladimir Volovich\ldots
 % \changes{v1.0f}{1998/12/10}
@@ -1400,6 +1419,8 @@
 % \begin{macro}{\bm at 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 at pmb#1{%
@@ -1413,6 +1434,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 at pmb@\@firstofone\else
 \def\bm at pmb@#1{{%
   \setbox\tw@\hbox{$\m at th\mkern.4mu$}%
   \mathchoice
@@ -1437,6 +1459,7 @@
   \raise1.5\dimen@\rlap{\copy\z@}%
   \kern\dimen@
   \box\z@}}%
+\fi
 %    \end{macrocode}
 % \end{macro}
 %
diff --git a/required/tools/testfiles/github-0071a.luatex.tlg b/required/tools/testfiles/github-0071a.luatex.tlg
new file mode 100644
index 00000000..f512e4c0
--- /dev/null
+++ b/required/tools/testfiles/github-0071a.luatex.tlg
@@ -0,0 +1,47 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(bm.sty
+Package: bm ....-..-.. v... Bold Symbol Support (DPC/FMi)
+\symboldoperators=\mathgroup4
+\symboldletters=\mathgroup5
+\symboldsymbols=\mathgroup6
+Package bm Info: No bold for \OMX/cmex/m/n, using \pmb.
+LaTeX Font Info:    Redeclaring math alphabet \mathbf on input line ....
+)
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+> \box...=
+\hbox(7.83336+2.50006)x28.4027, direction TLT
+.\glue(\spaceskip) 3.33333 plus 1.66666 minus 1.11111
+.\mathon
+.\hbox(7.83336+2.50006)x10.99998, direction TLT
+..\hbox(7.50006+2.50006)x0.0, glue set - 10.55559fil, direction TLT
+...\hbox(7.50006+2.50006)x10.55559, direction TLT
+....\mathon
+....\hbox(0.0+10.00012)x10.55559, shifted -7.50006, direction TLT
+.....\OMX/cmex/m/n/5 P
+....\mathoff
+...\glue 0.0 plus 1.0fil minus 1.0fil
+..\kern0.2222
+..\hbox(7.50006+2.50006)x0.0, glue set - 10.55559fil, shifted -0.3333, direction TLT
+...\hbox(7.50006+2.50006)x10.55559, direction TLT
+....\mathon
+....\hbox(0.0+10.00012)x10.55559, shifted -7.50006, direction TLT
+.....\OMX/cmex/m/n/5 P
+....\mathoff
+...\glue 0.0 plus 1.0fil minus 1.0fil
+..\kern0.2222
+..\hbox(7.50006+2.50006)x10.55559, direction TLT
+...\mathon
+...\hbox(0.0+10.00012)x10.55559, shifted -7.50006, direction TLT
+....\OMX/cmex/m/n/5 P
+...\mathoff
+.\glue(\thinmuskip) 1.66663
+.\OML/cmm/m/it/10 X
+.\kern0.7847 (italic)
+.\mathoff
+.\glue(\spaceskip) 3.33333 plus 1.66666 minus 1.11111
+! OK.
+l. ...\showbox0
diff --git a/required/tools/testfiles/github-0071a.lvt b/required/tools/testfiles/github-0071a.lvt
new file mode 100644
index 00000000..b507bd9b
--- /dev/null
+++ b/required/tools/testfiles/github-0071a.lvt
@@ -0,0 +1,27 @@
+\documentclass{article}
+\makeatletter
+\let\test at end\@@end % end games in test2e and bm.sty conflict
+\input{test2e}
+
+\START
+
+% should log pmb may be used.
+\usepackage[
+%nopmb
+%,warn
+]
+{bm}
+
+\OMIT
+\begin{document}
+\TIMO
+
+\sbox0{
+\let\@@end\test at end
+$\bm{\sum}X$
+}
+
+% \sum set three times
+\showbox0
+
+\END
\ No newline at end of file
diff --git a/required/tools/testfiles/github-0071a.tlg b/required/tools/testfiles/github-0071a.tlg
new file mode 100644
index 00000000..4db406a6
--- /dev/null
+++ b/required/tools/testfiles/github-0071a.tlg
@@ -0,0 +1,47 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(bm.sty
+Package: bm ....-..-.. v... Bold Symbol Support (DPC/FMi)
+\symboldoperators=\mathgroup4
+\symboldletters=\mathgroup5
+\symboldsymbols=\mathgroup6
+Package bm Info: No bold for \OMX/cmex/m/n, using \pmb.
+LaTeX Font Info:    Redeclaring math alphabet \mathbf on input line ....
+)
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+> \box...=
+\hbox(7.83336+2.50006)x28.4027
+.\glue 3.33333 plus 1.66666 minus 1.11111
+.\mathon
+.\hbox(7.83336+2.50006)x10.99998
+..\hbox(7.50006+2.50006)x0.0, glue set - 10.55559fil
+...\hbox(7.50006+2.50006)x10.55559
+....\mathon
+....\hbox(0.0+10.00012)x10.55559, shifted -7.50006
+.....\OMX/cmex/m/n/5 P
+....\mathoff
+...\glue 0.0 plus 1.0fil minus 1.0fil
+..\kern 0.2222
+..\hbox(7.50006+2.50006)x0.0, glue set - 10.55559fil, shifted -0.3333
+...\hbox(7.50006+2.50006)x10.55559
+....\mathon
+....\hbox(0.0+10.00012)x10.55559, shifted -7.50006
+.....\OMX/cmex/m/n/5 P
+....\mathoff
+...\glue 0.0 plus 1.0fil minus 1.0fil
+..\kern 0.2222
+..\hbox(7.50006+2.50006)x10.55559
+...\mathon
+...\hbox(0.0+10.00012)x10.55559, shifted -7.50006
+....\OMX/cmex/m/n/5 P
+...\mathoff
+.\glue(\thinmuskip) 1.66663
+.\OML/cmm/m/it/10 X
+.\kern0.7847
+.\mathoff
+.\glue 3.33333 plus 1.66666 minus 1.11111
+! OK.
+l. ...\showbox0
diff --git a/required/tools/testfiles/github-0071b.luatex.tlg b/required/tools/testfiles/github-0071b.luatex.tlg
new file mode 100644
index 00000000..e3854627
--- /dev/null
+++ b/required/tools/testfiles/github-0071b.luatex.tlg
@@ -0,0 +1,27 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(bm.sty
+Package: bm ....-..-.. v... Bold Symbol Support (DPC/FMi)
+\symboldoperators=\mathgroup4
+\symboldletters=\mathgroup5
+\symboldsymbols=\mathgroup6
+Package bm Warning: No bold for \OMX/cmex/m/n.
+LaTeX Font Info:    Redeclaring math alphabet \mathbf on input line ....
+)
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+> \box...=
+\hbox(7.50006+2.50006)x27.9583, direction TLT
+.\glue(\spaceskip) 3.33333 plus 1.66666 minus 1.11111
+.\mathon
+.\hbox(0.0+10.00012)x10.55559, shifted -7.50006, direction TLT
+..\OMX/cmex/m/n/5 P
+.\glue(\thinmuskip) 1.66663
+.\OML/cmm/m/it/10 X
+.\kern0.7847 (italic)
+.\mathoff
+.\glue(\spaceskip) 3.33333 plus 1.66666 minus 1.11111
+! OK.
+l. ...\showbox0
diff --git a/required/tools/testfiles/github-0071b.lvt b/required/tools/testfiles/github-0071b.lvt
new file mode 100644
index 00000000..d3336975
--- /dev/null
+++ b/required/tools/testfiles/github-0071b.lvt
@@ -0,0 +1,27 @@
+\documentclass{article}
+\makeatletter
+\let\test at end\@@end % end games in test2e and bm.sty conflict
+\input{test2e}
+
+\START
+
+% should warn no bold for cmex.
+\usepackage[
+nopmb,
+warn
+]
+{bm}
+
+\OMIT
+\begin{document}
+\TIMO
+
+\sbox0{
+\let\@@end\test at end
+$\bm{\sum}X$
+}
+
+% \sum set once
+\showbox0
+
+\END
\ No newline at end of file
diff --git a/required/tools/testfiles/github-0071b.tlg b/required/tools/testfiles/github-0071b.tlg
new file mode 100644
index 00000000..4e0ee6be
--- /dev/null
+++ b/required/tools/testfiles/github-0071b.tlg
@@ -0,0 +1,27 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(bm.sty
+Package: bm ....-..-.. v... Bold Symbol Support (DPC/FMi)
+\symboldoperators=\mathgroup4
+\symboldletters=\mathgroup5
+\symboldsymbols=\mathgroup6
+Package bm Warning: No bold for \OMX/cmex/m/n.
+LaTeX Font Info:    Redeclaring math alphabet \mathbf on input line ....
+)
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+> \box...=
+\hbox(7.50006+2.50006)x27.9583
+.\glue 3.33333 plus 1.66666 minus 1.11111
+.\mathon
+.\hbox(0.0+10.00012)x10.55559, shifted -7.50006
+..\OMX/cmex/m/n/5 P
+.\glue(\thinmuskip) 1.66663
+.\OML/cmm/m/it/10 X
+.\kern0.7847
+.\mathoff
+.\glue 3.33333 plus 1.66666 minus 1.11111
+! OK.
+l. ...\showbox0





More information about the latex3-commits mailing list.