[latex3-commits] [git/LaTeX3-latex3-latex2e] nfssaxes: Testing for an empty arguments is dangerous ... (1d36e80c)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Oct 7 14:04:51 CEST 2019


Repository : https://github.com/latex3/latex2e
On branch  : nfssaxes
Link       : https://github.com/latex3/latex2e/commit/1d36e80c7fbf8c53a55a8e133114997a920eaa11

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

commit 1d36e80c7fbf8c53a55a8e133114997a920eaa11
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Oct 7 14:04:51 2019 +0200

    Testing for an empty arguments is dangerous ...


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

1d36e80c7fbf8c53a55a8e133114997a920eaa11
 base/nfssaxes.tex                          | 11 ++++++++---
 base/testfiles-search/tlb-nfssaxes-003.lvt | 26 ++++++++++++++++++++++++++
 base/testfiles-search/tlb-nfssaxes-003.tlg |  4 ++++
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/base/nfssaxes.tex b/base/nfssaxes.tex
index a747f6fd..380840e5 100644
--- a/base/nfssaxes.tex
+++ b/base/nfssaxes.tex
@@ -136,13 +136,18 @@
 %    This now defines the new \cs{f at series}:
 %    \begin{macrocode}
 \def\merge at font@series@#1#2#3\@nil{%
+  \def\@reserveda{#3}%
   \edef\f at series{%
 %    \end{macrocode}
 %    If the third argument is empty there is no database entry for the
 %    combination and the second argument holds the new series so we
 %    return that.
+%
+%    Originally the test was simply \verb=\ifx!#3!= but that actually
+%    dies if \texttt{\#3} starts with a conditional and in the
+%    definition of \cs{AmSfont} that is actually the case.
 %    \begin{macrocode}
-    \ifx!#3!%
+    \ifx\@reserveda\@empty
       #2%
     \else
 %    \end{macrocode}
@@ -182,7 +187,6 @@
 
 
 
-
 % \section{Changing the  shape}
 %
 %    Rules for managing shapes (i.e., essentially building in an ``sc''
@@ -328,8 +332,9 @@
 %    Same game now, except that we look at shapes not series values.
 %    \begin{macrocode}
 \def\merge at font@shape@#1#2#3\@nil{%
+  \def\@reserveda{#3}%
   \edef\f at shape{%
-    \ifx!#3!%
+    \ifx\@reserveda\@empty
       #2%
     \else
       \expandafter \ifx
diff --git a/base/testfiles-search/tlb-nfssaxes-003.lvt b/base/testfiles-search/tlb-nfssaxes-003.lvt
new file mode 100644
index 00000000..334f8e09
--- /dev/null
+++ b/base/testfiles-search/tlb-nfssaxes-003.lvt
@@ -0,0 +1,26 @@
+\documentclass{article}
+
+\input{test2e}
+
+
+\def\showresult#1#2{#2\typeout{\detokenize{#2} -> \csname f@#1\endcsname}}
+
+
+\begin{document}
+
+\START
+
+% as used in the definition of \AmSfont
+
+\makeatletter
+
+\showresult{series}{\usefont{OMS}{cmsy}{\if\expandafter\@car\f at series\@nil bb\else m\fi}{n}}
+
+\fontseries{bx}\selectfont
+
+\showresult{series}{\usefont{OMS}{cmsy}{\if\expandafter\@car\f at series\@nil bb\else m\fi}{n}}
+
+
+  
+
+\stop
diff --git a/base/testfiles-search/tlb-nfssaxes-003.tlg b/base/testfiles-search/tlb-nfssaxes-003.tlg
new file mode 100644
index 00000000..a448558c
--- /dev/null
+++ b/base/testfiles-search/tlb-nfssaxes-003.tlg
@@ -0,0 +1,4 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+\usefont {OMS}{cmsy}{\if \expandafter \@car \f at series \@nil bb\else m\fi }{n} -> m
+\usefont {OMS}{cmsy}{\if \expandafter \@car \f at series \@nil bb\else m\fi }{n} -> b





More information about the latex3-commits mailing list