\NeedsTeXFormat{LaTeX2e} %Package to simplify loading of newpxmath with a text font family such as newpxtext for all latex engines, or for newpxtext and an otf math package. \def\fileversion{1.51} \def\filedate{2023/08/04} \ProvidesPackage{newpx}[% \filedate\space v\fileversion (Michael Sharpe) latex and unicode latex support for newpxmath and newpxtext, or for newpxtext and an otf math package] \message{`newpx'v\fileversion,\space\filedate\space Integrated\space loading\space of\space newpxmath\space and\space a\space text\space font \space for\space all\space latex\space engines\space (msharpe)} \RequirePackage{fontenc,fontaxes} \RequirePackage{ifthen,iftex,etoolbox,scalefnt,trimspaces} \forcsvlist{\listadd\zpl@mathlst}{vecsep,amsthm,nosubscriptcorrection,subscriptcorrection,varbb,vvarbb,nosymbolsc,noamssymbols,amssymbols,uprightscript,uprightGreek,slantedGreek,frenchmath,upint,smallerops,useBImacros,varg,varvw,noOT1,fracspacing,subscriptcorrectionfile} %\show\zpl@mathlst \RequirePackage{kvoptions} \DeclareDefaultOption{ \xifinlist{\CurrentOptionKey}{\zpl@mathlst} {% true branch for xifinlist \expandafter\PassOptionsToPackage\expandafter{\CurrentOption}{newpxmath}} {% false branch for xifinlist %\xdef\zpl@Topt{\zpl@Topt \CurrentOption,} \expandafter\PassOptionsToPackage\expandafter% {\CurrentOption}{newpxtext}} \ifthenelse{\equal{scale}{\CurrentOptionKey} \OR \equal{scaled}{\CurrentOptionKey}} {% true branch for ifthenelse %\expandafter\PassOptionsToPackage\expandafter{\CurrentOption}{newpxmath} \edef\zpl@scale{\CurrentOptionValue} \edef\npxmath@scaled{\CurrentOptionValue} }{ % false branch for ifthenelse }} \newif\ifzpl@otfmath %\zpl@otfmathfalse % default is type1 math \DeclareBoolOption{otfmath}% defines \ifnewpx@otfmath \ifnewpx@otfmath\iftutex\zpl@otfmathtrue\fi\fi %\@nameuse{if#1}\iftutex\zpl@otfmathtrue\fi\fi} \DeclareBoolOption{type1}%[true]{}% no effect now %{%\@nameuse{if#1}\zpl@otftextfalse\fi} \DeclareBoolOption{type1text}%[true]{} %no effect now %{% same as type1--use type1 for text %\@nameuse{if#1}\zpl@otftextfalse\fi} \DeclareBoolOption{nofontspec}%[true]{} % no effect %{\@nameuse{if#1}\zpl@nofontspectrue\fi} \ProcessKeyvalOptions{newpx} \RequirePackage{xstring}% must load this after \@for % Needed for \StrLeft and \StrRight %Enginecheck %iftex's \iftutex is true for LuaTeX and XeTeX \newif\ifzpl@otftext \iftutex\zpl@otftexttrue\fi %\def\zpl@Mopt{} % math options to pass %\def\zpl@Topt{} % text options to pass %\def\tx@divide#1#2{\strip@pt\dimexpr 1pt * (\dimexpr #1pt) / \dimexpr #2pt\relax\relax} %\newcommand*{\zpltext@rm}{} % not understood by libertinus-otf %\newcommand*{\zpltext@sf}{}% not understood by libertinus-otf \def\zpl@dfltTF{newpxtext} % the default text font package name \def\zpl@text{\let\zpl@TF=\zpl@dfltTF % the text font package name \def\zpl@MF{newpxmath} %\def\zpl@id{0} % identifier for font properties %\def\zpl@sc{zpl@scale} % macro name for scale factor in font package \def\zpl@minfam{zplTLF} %roman font, tabular lining fd, used in math } \zpl@text % set the defaults% %\newcommand{\PassMathScale}{\ifzpl@iszero\gdef\zpltext@scale{\zplmath@scale}\gdef\zpltext@scaled{s*[\zpltext@scale]}\fi %\PassOptionsToPackage{scaled=\zpltext@scale}{\zpl@TF} %} \ifzpl@otftext \ifzpl@otfmath %I \typeout{I} \usepackage[]{newpxtext} %may not load fontspec \RequirePackage{fontspec} % just in case \usepackage{unicode-math} %loads amsmath \else %II: type1 math, otftext \typeout{II} \renewcommand*{\rmdefault}{zplTLF} % Roman and Bold text for math \usepackage[]{newpxmath} % options will be as passed from newpx \usepackage[no-math]{fontspec} \usepackage{newpxtext} \fi %ifzpl@otfmath %\show\zpl@otftexttrue \else % not otftext \typeout{IV} % IV, type1 tex and math \renewcommand*{\rmdefault}{\zpl@minfam}% Roman and Bold for math \usepackage{newpxmath} % options will be as passed from newpx \usepackage{\zpl@TF} % should load tt and sans math before newpx \fi \endinput