diff options
Diffstat (limited to 'fonts/newpx/tex/newpxtext.sty')
-rw-r--r-- | fonts/newpx/tex/newpxtext.sty | 230 |
1 files changed, 134 insertions, 96 deletions
diff --git a/fonts/newpx/tex/newpxtext.sty b/fonts/newpx/tex/newpxtext.sty index 696a5c9732..1b25ea155a 100644 --- a/fonts/newpx/tex/newpxtext.sty +++ b/fonts/newpx/tex/newpxtext.sty @@ -8,16 +8,18 @@ % Text is now directed to an extension of TeXGyrePagella rather than ppl. % 1.5 is first version of newpxtext to support both [pdf]latex and unicode latex. -\def\fileversion{1.521} -\def\filedate{2023/09/27} +\def\fileversion{1.53} +\def\filedate{2023/10/23} \ProvidesPackage{newpxtext}[% \filedate\space v\fileversion (Michael Sharpe) latex and unicode latex support for TeXGyrePagellaX] \message{`newpxtext' v\fileversion, \filedate\space Text macros taking advantage of TeXGyre Pagella and its extensions (msharpe)} \RequirePackage[T1]{fontenc} -\renewcommand*{\rmdefault}{zplTLF} % the default until end of preamble +\RequirePackage{xcolor} +\renewcommand*{\rmdefault}{zpltlf} % the default until end of preamble \renewcommand*{\familydefault}{\rmdefault} +\RequirePackage{xpatch} % need to patch \scshape \RequirePackage{iftex,xkeyval,etoolbox,textcomp} \RequirePackage{xstring,ifthen,scalefnt} % for \textfrac \IfFileExists{mweights.sty}{\RequirePackage{mweights}}{} @@ -127,13 +129,17 @@ \newdimen\zplsups@scale \newdimen\zplsups@raise \def\zplsups@raised{\z@} -\def\zplsups@spaced{.04em} +\def\zplsups@Lspaced{.04em} +\def\zplsups@Rspaced{.04em} \def\zplsups@scaledval{1.0} -\def\zplsups@supscale{1.0} +\def\zplsups@scalefactor{1} +\newcommand*{\zplsups@color}{black} \DeclareOptionX{supscaled}{\renewcommand*{\zplsups@scaledval}{#1}} \DeclareOptionX{supscale}{\renewcommand*{\zplsups@scaledval}{#1}} \DeclareOptionX{supsraised}{\renewcommand*{\zplsups@raised}{#1}} -\DeclareOptionX{supspaced}{\renewcommand*{\zplsups@supspaced}{#1}} +\DeclareOptionX{supLspaced}{\renewcommand*{\zplsups@Lspaced}{#1}} +\DeclareOptionX{supRspaced}{\renewcommand*{\zplsups@Rspaced}{#1}} +\DeclareOptionX{supscolor}{\renewcommand*{\zplsups@color}{#1}} % Other options \DeclareOptionX{defaultsups}[true]{% @@ -203,8 +209,8 @@ \setlength{\zplsups@raise}{\zplsups@raised} \setlength{\zplsups@scale}{\zplsups@scaledval\p@} \zplsups@scale=\zpl@scale\zplsups@scale % +\def\zplsups@scalefactor{\strip@pt\zplsups@scale} \def\zplsups@scaled{s*[\strip@pt\zplsups@scale]} - % for stacked fractions \@ifundefined{zpl@xht}{\def\zpl@xht{460}}{} % lowercase letters \@ifundefined{zpl@deht}{\def\zpl@deht{412}}{} % denominator figures ht @@ -218,6 +224,7 @@ \def\re@DeclareTextSymbol#1#2#3{% \let#1=\undefined \DeclareTextSymbol{#1}{#2}{#3}} + \ifzpl@otf \ifzpl@nomath \RequirePackage[no-math]{fontspec} @@ -232,7 +239,14 @@ "local", "texmf", "system" }} \fi \def\zpl@base{TeXGyrePagellaX} - + \ifzpl@scosf + \AtBeginDocument{% + \xpretocmd{\scshape} + {\addfontfeatures{Numbers=OldStyle}} + {}{}% + }% + \fi + \newcommand{\textfrac}[3][]{{%\normalfont% \mbox{% \ifthenelse{\not\equal{#1}{}}%Test for integer portion [optional #1] @@ -242,23 +256,18 @@ }}} \else % type1 -% for possible use in footnote markers -% \DeclareFontFamily{OT1}{zplsups}{}% -% \DeclareFontShape{OT1}{zplsups}{m}{n}{% -% <-> \zplsups@scaled zplsups-Regular-ot1 -%}{} -% \DeclareFontFamily{T1}{zplsups}{}% -% \DeclareFontShape{T1}{zsups}{m}{n}{% -% <-> \zplsups@scaled zplsups-Regular-t1 -%}{} -% \DeclareFontFamily{TS1}{zsups}{}% -% \DeclareFontShape{TS1}{zsups}{m}{n}{% -% <-> \zplsups@scaled zplsups-Regular-ts1 -%}{} -\DeclareRobustCommand{\supstyle}{% - \not@math@alphabet\supstyle\relax - \usefont{\f@encoding}{zplsups}{m}{n}} - + \ifzpl@scosf + \AtBeginDocument{% + \xpretocmd{\scshape} + {\fontfamily{zpl\zpl@figurealign osf}} + {}{}% + }% + \fi% + \DeclareRobustCommand{\sustyle}{% + \not@math@alphabet\sustyle\relax + \fontfamily{zplsups}\selectfont} + \let\supstyle\sustyle + \ifdim\zplsups@raise=\z@ \DeclareRobustCommand{\textsups}[1]{{\supstyle#1}} \else @@ -273,13 +282,7 @@ % \fontfigurestyle{superior}\selectfont} % \let\sustyle=\sufigures % \DeclareTextFontCommand{\textsu}{\sufigures} -% \let\textsuperior\textsu - \DeclareRobustCommand{\sustyle}{% - \not@math@alphabet\sustyle\relax - \fontfamily{zplsups}\selectfont} \let\sufigures=\sustyle - \let\nustyle=\sustyle - \let\nufigures=\sustyle \fa@naming@exception{figures}{{inferior}{proportional}}{inf} \fa@naming@exception{figures}{{inferior}{tabular}}{inf} @@ -288,11 +291,12 @@ % \let\instyle=\infigures % \DeclareTextFontCommand{\textinf}{\infigures} % \let\textinferior\textinf - \DeclareRobustCommand{\instyle}{% + \DeclareRobustCommand{\infstyle}{% \not@math@alphabet\instyle\relax \fontfamily{zplsubs}\selectfont} - \let\infigures=\instyle - + \let\infigures=\infstyle + \let\instyle\infstyle + \fa@naming@exception{figures}{{denominators}{proportional}}{dnom} \fa@naming@exception{figures}{{denominators}{tabular}}{dnom} % \def\defigures{\@nomath\defigures @@ -354,8 +358,8 @@ } % textfrac \fi -\let\orig@footnote=\thefootnote -\let\orig@makefnmark=\@makefnmark +%\let\orig@footnote=\thefootnote +%\let\orig@makefnmark=\@makefnmark \def\bfseries@rm{b} \def\mdseries@rm{m} \def\useosf{\zpl@liningfalse} @@ -392,13 +396,13 @@ {\edef\zpl@dflt{\zpl@dflt StylisticSet={\zpl@lst} , }}{} - \defaultfontfeatures{ + \defaultfontfeatures[\zpl@base]{ Ligatures = TeX , Scale = \zpl@scale , Extension = .otf , SmallCapsFeatures={\ifzpl@scosf Numbers = OldStyle , - \fi RawFeature = +\zpl@scraw , - \ifluatex Renderer=Basic\fi} , + \fi RawFeature = +\zpl@scraw } , + \ifluatex Renderer=Basic , \fi \zpl@dflt , RawFeature=-ss05 , \zpl@defaultfeatures @@ -413,29 +417,26 @@ \edef\qhv@scale{\strip@pt\@tempdima} \def\zpl@scaled{s*[\zpl@scale]}% used in fd files - %\def\oldstylenums#1{{\fontencoding{TS1}\selectfont #1}} - - %\expandafter\patchcmd\expandafter{\csname scshape \endcsname}{\fontshape}{\fontfamily{zpl\zpl@figurealign osf}\fontshape}{\message{Replaced figure style by osf in sc.}}{\message{Unable to replace figure style by osf in sc.}} \DeclareRobustCommand{\lfstyle}{% \not@math@alphabet\lfstyle\relax - \fontfamily{zplLF}\selectfont % + \fontfamily{zpllf}\selectfont % } \DeclareRobustCommand{\tlfstyle}{% \not@math@alphabet\tlfstyle\relax - \fontfamily{zplTLF}\selectfont % + \fontfamily{zpltlf}\selectfont % } \DeclareRobustCommand{\osfstyle}{% \not@math@alphabet\osfstyle\relax - \fontfamily{zplOsF}\selectfont % + \fontfamily{zplosf}\selectfont % } \DeclareRobustCommand{\tosfstyle}{% \not@math@alphabet\tosfstyle\relax - \fontfamily{zplTOsF}\selectfont % + \fontfamily{zpltosf}\selectfont % } \ifzpl@defaultsups % \else - \ExplSyntaxOn + \ExplSyntaxOn \DeclareDocumentCommand \fakesuperscript {m} { \@textsuperscript{\selectfont#1} } @@ -443,23 +444,31 @@ \IfBooleanTF #1 \fakesuperscript \realsuperscript } \DeclareDocumentCommand \realsuperscript {m} { - \ifzpl@defaultsups\fakesuperscript{#1} - \else\hspace*{\zplsups@spaced}\textsups{#1}\fi - } - - \cs_set:Npn \@makefnmark { - \mbox{% + \hbox_set:Nn \l_tmpa_box {{\sustyle#1}} + \box_scale:Nnn \l_tmpa_box { \zplsups@scalefactor } { \zplsups@scalefactor } + \hbox_set:Nn \l_tmpa_box + { \box_move_up:nn \zplsups@raised {\box_use:N \l_tmpa_box} } + \hspace*{\zplsups@Lspaced}{\color{\zplsups@color}% + \box_use:N \l_tmpa_box} \hspace*{\zplsups@Rspaced}}% + + + \cs_set:Npn \@makefnmark { + \mbox{% \footnotemarkfont\textsuperscript{\@thefnmark}} } - \cs_if_exist:NTF \ftntm@font + \cs_if_exist:NTF \ftntm@font % will exist only for KOMA { - \cs_new:Npn \footnotemarkfont {\normalfont \ftntm@font} + \cs_new:Npn \footnotemarkfont {\normalfont \ftntm@font} } { - \cs_new:Npn \footnotemarkfont {\normalfont} + \cs_new:Npn \footnotemarkfont {\normalfont} } \ExplSyntaxOff \fi + \ifzpl@KOMA + \setkomafont{footnotereference}{\normalfont\supstyle} + \setkomafont{footnotelabel}{\normalfont\supstyle} + \fi % \ifzpl@KOMA % \let\textsuperscript\sustyle % \setkomafont{footnotelabel}{\textsuperscript} @@ -510,7 +519,7 @@ \ifzpl@otf % \def\zpl@nft{\if t\zpl@thmtab Monospaced% % \else Proportional\fi} - \DeclareTextFontCommand{\textsl}{\slshape} +%\DeclareTextFontCommand{\textsl}{\slshape} \DeclareTextFontCommand{% \osfstyle}{\addfontfeatures{Numbers={Proportional,OldStyle}}} \DeclareTextFontCommand{% @@ -520,32 +529,69 @@ \DeclareTextFontCommand{% \lfstyle}{\addfontfeatures{Numbers={Proportional,Lining}}} - \providecommand\sufigures{% - \addfontfeatures{VerticalPosition=Superior}} - \providecommand\infigures{% - \addfontfeatures{VerticalPosition=Inferior}} - \providecommand\nufigures{% - \addfontfeatures{VerticalPosition=Numerator}} - \providecommand\defigures{% - \addfontfeatures{VerticalPosition=Denominator}} - \let\sustyle=\sufigures - \let\nustyle=\nufigures - \let\instyle=\infigures - \let\destyle=\defigures + \DeclareRobustCommand{\destyle}{% + \not@math@alphabet\destyle\relax + \addfontfeatures{VerticalPosition=Denominator}% + } + \DeclareRobustCommand{\nustyle}{% + \not@math@alphabet\nustyle\relax + \addfontfeatures{VerticalPosition=Numerator}% + } + \DeclareRobustCommand{\sustyle}{% + \not@math@alphabet\sustyle\relax + \addfontfeatures{VerticalPosition=Superior}% + } + \DeclareRobustCommand{\infstyle}{% + \not@math@alphabet\infstyle\relax + \addfontfeatures{VerticalPosition=Inferior}% + } + \let\instyle\infstyle + \let\sufigures\sustyle + \let\nufigures\nustyle + \let\infigures\infstyle + \let\defigures\destyle + \ifzpl@defaultsups % \else + \patchcmd{\maketitle}{\@textsuperscript{\normalfont\@thefnmark}}{\normalfont\textsuperscript{\@thefnmark}}{}{} + \patchcmd{\maketitle}{\@textsuperscript{\normalfont\@thefnmark}}{\normalfont\textsuperscript{\@thefnmark}}{}{} + %\show\maketitle \RequirePackage{realscripts} - \renewcommand\footnotemarkfont{\normalfont\sufigures} + \renewcommand\footnotemarkfont{\normalfont}%\sufigures} + \ExplSyntaxOn + \DeclareDocumentCommand \fakesuperscript {m} { + \@textsuperscript{\selectfont#1} + } + \RenewDocumentCommand \textsuperscript {s} { + \IfBooleanTF #1 \fakesuperscript \realsuperscript + } + \DeclareDocumentCommand \realsuperscript {m} { + \hbox_set:Nn \l_tmpa_box {\textsups{#1}} + \box_scale:Nnn \l_tmpa_box { \zplsups@scalefactor } { \zplsups@scalefactor } + \hbox_set:Nn \l_tmpa_box + { \box_move_up:nn \zplsups@raised {\box_use:N \l_tmpa_box} } + \hspace*{\zplsups@Lspaced}{\color{\zplsups@color}% + \box_use:N \l_tmpa_box }% + \hspace*{\zplsups@Rspaced}} + + \cs_set:Npn \@makefnmark {% + \mbox{% + \footnotemarkfont\textsuperscript{\@thefnmark}} + } + \cs_if_exist:NTF \ftntm@font + { + \cs_set:Npn \footnotemarkfont {\normalfont \ftntm@font} + } + { + \cs_set:Npn \footnotemarkfont {\normalfont} + } + \ExplSyntaxOff \fi \ifzpl@KOMA \setkomafont{footnotereference}{\normalfont\sustyle} \setkomafont{footnotelabel}{\normalfont\sustyle} \fi -% \ifzpl@scosf -% \edef\zpl@fnt{\expandafter\csname zpl\ifzpl@tabular T\fi OsF\endcsname} -% \DeclareRobustCommand{\textsc}[1]{% -% {\zpl@fnt \addfontfeatures{RawFeature=+smcp}#1}}% -% \fi + \renewcommand*{\textcircled}[1]{\hmode@bgroup\ooalign{% \hfil \raise -.255ex\hbox{{% \normalfont\addfontfeatures{Numbers={Monospaced, Lining}}% @@ -574,18 +620,17 @@ \DeclareRobustCommand{\texttosf}[1]{% {\tosfstyle #1}% } -\DeclareRobustCommand{\textsu}[1]{% - {\sustyle #1}% -} \DeclareTextFontCommand{\textsu}{\sustyle} - \let\textsuperior\textsu + \let\textsup\textsu + \let\textsups\textsu \DeclareTextFontCommand{\textnumerator}{\nustyle} \ifzpl@notextnu\else\let\textnu=\textnumerator\fi \let\textnum\textnumerator \DeclareTextFontCommand{\textde}{\destyle} \let\textdenominator\textde -\DeclareTextFontCommand{\textinf}{\instyle} +\DeclareTextFontCommand{\textinf}{\infstyle} \let\textinferior\textinf + \let\textsub\textinf \newdimen\zpl@sixem\zpl@sixem6pt % for checking if a number refers to ex \newdimen\zpl@y \newdimen\zpl@x @@ -650,12 +695,6 @@ \fi \setmainfont [ Numbers = {\zpl@figurealign,\zpl@figurestyle}, - UprightFont = *-Regular , - ItalicFont = *-Italic , - SlantedFont = *-Slanted , - BoldFont = *-Bold , - BoldItalicFont = *-BoldItalic , - BoldSlantedFont= *-BoldSlanted , ] {\zpl@base} \let\zpl@sty\zpl@figurestyle \if l\zpl@thmlin\def\zpl@sty{Lining}\fi @@ -669,22 +708,22 @@ \else % type1 \ifzpl@lining - \def\zpl@figurestyle{LF} + \def\zpl@figurestyle{lf} \else - \def\zpl@figurestyle{OsF} + \def\zpl@figurestyle{osf} \fi \ifzpl@tabular - \def\zpl@figurealign{T} + \def\zpl@figurealign{t} \else \def\zpl@figurealign{} \fi \renewcommand*{\rmdefault}{zpl\zpl@figurealign% \zpl@figurestyle} - \ifzpl@scosf % - \DeclareRobustCommand{\textsc}[1]{% - {\fontfamily{zpl\zpl@figurealign OsF}\scshape\selectfont #1}% - }\fi% use OsF in small caps + %\ifzpl@scosf % + %\DeclareRobustCommand{\textsc}[1]{% + %{\fontfamily{zpl\zpl@figurealign osf}\scshape\selectfont #1}% + %}\fi% use osf in small caps \def\zpl@thfigurestyle{\zpl@figurestyle} \ifx\zpl@figurestyle\zpl@dfltfigurestyle @@ -697,7 +736,6 @@ \fi % type1 % both \ifzpl@KOMA - %\let\textsuperscript\textsu \@ifpackageloaded{AB@authnote}{% \renewcommand\AB@authnote[1]{\textsu{#1}} \renewcommand\AB@affilnote[1]{\textsu{#1}} @@ -726,9 +764,9 @@ \DeclareTextFontCommand{% \oldstylenums}{\fontfamily{zpl\zpl@figurealign OsF}\selectfont } \DeclareTextFontCommand{% - \liningnums}{\fontfamily{zpl\zpl@figurealign LF}\selectfont } + \liningnums}{\fontfamily{zpl\zpl@figurealign lf}\selectfont } \DeclareTextFontCommand{% - \tabularnums}{\fontfamily{zplT\zpl@figurestyle}\selectfont } + \tabularnums}{\fontfamily{zplt\zpl@figurestyle}\selectfont } \DeclareTextFontCommand{% \proportionalnums}{\fontfamily{zpl\zpl@figurestyle}\selectfont } \re@DeclareTextSymbol{\textdollar}{OT1}{36} |