summaryrefslogtreecommitdiff
path: root/fonts/newpx/tex/newpx.sty
blob: 6cb08a9a825fef4e8890e226aa95c8dc78188bc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
\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.533}
\def\filedate{2023/11/08}
\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,curlybraces}
%\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}% creates and inits \ifnewpx@otfmath 
%{\@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
  \ifnewpx@otfmath %
  \typeout{I}
    \usepackage[]{newpxtext} %may not load fontspec
    \usepackage{unicode-math} %loads amsmath
  \else %II: type1 math, otftext
  \typeout{II}
    \renewcommand*{\rmdefault}{\zpl@minfam} % 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