[latex3-commits] [git/LaTeX3-latex3-latex2e] textcomp: provide \legacyoldstylenums (d4b7e651)
Frank Mittelbach
frank.mittelbach at latex-project.org
Fri Nov 15 22:41:16 CET 2019
Repository : https://github.com/latex3/latex2e
On branch : textcomp
Link : https://github.com/latex3/latex2e/commit/d4b7e65191f0078ab99ab405428427abce40f6f8
>---------------------------------------------------------------
commit d4b7e65191f0078ab99ab405428427abce40f6f8
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Fri Nov 15 22:41:16 2019 +0100
provide \legacyoldstylenums
>---------------------------------------------------------------
d4b7e65191f0078ab99ab405428427abce40f6f8
base/testfiles-legacy/tlb-textcomp-006.lvt | 8 ++--
base/testfiles-legacy/tlb-textcomp-006.tlg | 71 ++++++++++++++++++++++++++----
base/textcomp-adds.tex | 28 ++++++------
3 files changed, 80 insertions(+), 27 deletions(-)
diff --git a/base/testfiles-legacy/tlb-textcomp-006.lvt b/base/testfiles-legacy/tlb-textcomp-006.lvt
index 5508ca32..ec24eca7 100644
--- a/base/testfiles-legacy/tlb-textcomp-006.lvt
+++ b/base/testfiles-legacy/tlb-textcomp-006.lvt
@@ -19,11 +19,13 @@
\typeout{oldstyle in cmr cmss or cmtt from TS1}
-CM \oldstylenums{123,4} % here cmr gets substituted
+ LMR + cmr \oldstylenums{123,4} % here cmr gets substituted
-\sffamily LM \oldstylenums{567.8} % this should give cmss
+\sffamily CMSS + cmss \oldstylenums{567.8} % this should give cmss
+\ttfamily LMTT + cmtt \oldstylenums{0.99} % this should give cmtt
+
+\ttfamily LMTT + oms \legacyoldstylenums{12.34} % this should now comes from OMS
-\ttfamily LM \oldstylenums{0.99} % this should give cmtt but needs nfssaxes for that ...
\end{document}
diff --git a/base/testfiles-legacy/tlb-textcomp-006.tlg b/base/testfiles-legacy/tlb-textcomp-006.tlg
index 51395adf..4f55ea53 100644
--- a/base/testfiles-legacy/tlb-textcomp-006.tlg
+++ b/base/testfiles-legacy/tlb-textcomp-006.tlg
@@ -11,6 +11,10 @@ LaTeX Font Warning: Font shape `OT1/lmtt/m/n' undefined
LaTeX Info: Oldstyle digits unavailable for family lmtt.
Default oldstyle digits used instead on input line ....
LaTeX Font Info: Trying to load font information for TS1+cmtt on input line ....
+LaTeX Font Info: Trying to load font information for OML+lmr on input line ....
+LaTeX Font Info: No file OMLlmr.fd. on input line ....
+LaTeX Font Warning: Font shape `OML/lmr/m/it' undefined
+(Font) using `OML/cmm/m/it' instead on input line ....
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0
.\glue 16.0
@@ -20,14 +24,21 @@ Completed box being shipped out [1]
...\hbox(0.0+0.0)x345.0
..\glue 25.0
..\glue(\lineskip) 0.0
-..\vbox(550.0+0.0)x345.0, glue set 515.94489fil
+..\vbox(550.0+0.0)x345.0, glue set 503.94617fil
...\write-{}
...\glue(\topskip) 3.11125
-...\hbox(6.88875+1.94397)x345.0, glue set 287.50546fil
+...\hbox(6.88875+1.94397)x345.0, glue set 249.97766fil
....\hbox(0.0+0.0)x15.0
-....\OT1/lmr/m/n/10 C
+....\OT1/lmr/m/n/10 L
....\OT1/lmr/m/n/10 M
+....\OT1/lmr/m/n/10 R
....\glue 3.33333 plus 1.66498 minus 1.11221
+....\OT1/lmr/m/n/10 +
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/lmr/m/n/10 c
+....\OT1/lmr/m/n/10 m
+....\OT1/lmr/m/n/10 r
+....\glue 3.33333 plus 1.66666 minus 1.11111
....\TS1/cmr/m/n/10 1
....\TS1/cmr/m/n/10 2
....\TS1/cmr/m/n/10 3
@@ -38,11 +49,20 @@ Completed box being shipped out [1]
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 3.11159
-...\hbox(6.94444+1.94397)x345.0, glue set 289.72772fil
+...\hbox(6.94444+1.94397)x345.0, glue set 243.14435fil
....\hbox(0.0+0.0)x15.0
-....\OT1/cmss/m/n/10 L
+....\OT1/cmss/m/n/10 C
....\OT1/cmss/m/n/10 M
+....\OT1/cmss/m/n/10 S
+....\OT1/cmss/m/n/10 S
....\glue 3.33333 plus 1.66498 minus 1.11221
+....\OT1/cmss/m/n/10 +
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/cmss/m/n/10 c
+....\OT1/cmss/m/n/10 m
+....\OT1/cmss/m/n/10 s
+....\OT1/cmss/m/n/10 s
+....\glue 3.33333 plus 1.66666 minus 1.11111
....\TS1/cmss/m/n/10 5
....\TS1/cmss/m/n/10 6
....\TS1/cmss/m/n/10 7
@@ -53,11 +73,21 @@ Completed box being shipped out [1]
....\glue(\rightskip) 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 3.22272
-...\hbox(6.83331+2.22168)x345.0, glue set 290.2551fil
+...\hbox(6.83331+2.22168)x345.0, glue set 241.08836fil
....\hbox(0.0+0.0)x15.0
-....\OT1/cmr/m/n/10 L
-....\OT1/cmr/m/n/10 M
+....\OT1/lmtt/m/n/10 L
+....\OT1/lmtt/m/n/10 M
+....\OT1/lmtt/m/n/10 T
+....\OT1/lmtt/m/n/10 T
....\glue 3.33333 plus 1.66498 minus 1.11221
+....\OT1/lmtt/m/n/10 +
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/lmtt/m/n/10 c
+....\OT1/lmtt/m/n/10 m
+....\kern-0.27779
+....\OT1/lmtt/m/n/10 t
+....\OT1/lmtt/m/n/10 t
+....\glue 3.33333 plus 1.66666 minus 1.11111
....\TS1/cmtt/m/n/10 0
....\TS1/cmtt/m/n/10 .
....\TS1/cmtt/m/n/10 9
@@ -65,7 +95,30 @@ Completed box being shipped out [1]
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
-...\glue -2.22168
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 2.945
+...\hbox(6.83331+1.94444)x345.0, glue set 240.08316fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/lmtt/m/n/10 L
+....\OT1/lmtt/m/n/10 M
+....\OT1/lmtt/m/n/10 T
+....\OT1/lmtt/m/n/10 T
+....\glue 3.33333 plus 1.66498 minus 1.11221
+....\OT1/lmtt/m/n/10 +
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/lmtt/m/n/10 o
+....\OT1/lmtt/m/n/10 m
+....\OT1/lmtt/m/n/10 s
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OML/cmm/m/it/10 1
+....\OML/cmm/m/it/10 2
+....\OML/cmm/m/it/10 .
+....\OML/cmm/m/it/10 3
+....\OML/cmm/m/it/10 4
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -1.94444
...\glue 0.0 plus 1.0fil
...\glue 0.0
...\glue 0.0 plus 0.0001fil
diff --git a/base/textcomp-adds.tex b/base/textcomp-adds.tex
index 373f398b..3cccc974 100644
--- a/base/textcomp-adds.tex
+++ b/base/textcomp-adds.tex
@@ -20,23 +20,19 @@
-% use textcomp \oldstylenums if in pdftex
-
-\DeclareRobustCommand\oldstylenums[1]{%
- \begingroup
- \ifmmode
- \mathgroup\symletters #1%
- \else
- \CheckEncodingSubset\@use at text@encoding{TS1}%
- {\PackageWarning{textcomp}%
- {Oldstyle digits unavailable for
- family \f at family.\MessageBreak
- Lining digits used instead}}%
- \tw@{#1}%
- \fi
- \endgroup
+% preserve the old definition of \cs{oldstylenums} under a different name
+
+\DeclareRobustCommand\legacyoldstylenums[1]{%
+ \begingroup
+ \spaceskip\fontdimen\tw@\font
+ \usefont{OML}{\rmdefault}{\f at series}{it}%
+ \mathgroup\symletters #1%
+ \endgroup
}
+
+% and here is the improved one that adjusts depending on surroundings.
+
\DeclareRobustCommand\oldstylenums[1]{%
\begingroup
\ifmmode
@@ -827,6 +823,8 @@
\DeclareTextSymbolDefault{\textperiodcentered}{OMS}%
\DeclareTextSymbolDefault{\textsection}{OMS}%
\UndeclareTextCommand{\textsection}{T1}%
+ \expandafter\let\csname oldstylenums \expandafter\endcsname
+ \csname legacyoldstylenums \endcsname
}
More information about the latex3-commits
mailing list