summaryrefslogtreecommitdiff
path: root/fonts/newpx/doc/newpxdoc.tex
blob: e30c210123c9e73be746f4acbef317ed64ea4bac (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
% !TEX TS-program = pdflatexmk
\documentclass[11pt]{article} 
\usepackage[margin=1in]{geometry} 
\usepackage[parfill]{parskip}% Begin paragraphs with an empty line rather than an indent
\pdfmapfile{=newtx.map}
\pdfmapfile{=newpx.map}
\pdfcompresslevel=0
\pdfgentounicode=1
\input glyphtounicode.tex
%\usepackage{pdfx} % v 1.6.4 or higher
\InputIfFileExists{glyphtounicode-cmr.tex}{}{}
\InputIfFileExists{glyphtounicode-ntx.tex}{}{}
\usepackage{fonttable}
\usepackage{amsmath} % must be  loaded before amsthm
\usepackage{amsthm} 
\newtheoremstyle{oldplain}
  {\topsep}   % ABOVESPACE
  {\topsep}   % BELOWSPACE
  {\itshape}  % BODYFONT
  {}       % INDENT (empty value is the same as 0pt)
  {\bfseries} % HEADFONT
  {.}         % HEADPUNCT
  {5pt plus 1pt minus 1pt} % HEADSPACE
  {}          % CUSTOM-HEAD-SPEC
\theoremstyle{oldplain}
\newtheorem{oldthm}{Theorem}[section]
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]  
\usepackage{graphicx}
\usepackage{url}
%SetFonts
% newpx text and math
\linespread{1.05}
%\usepackage[largesc,theoremfont]{newpxtext}
\usepackage[theoremfont,trueslanted]{newpxtext}
\usepackage[scaled=1.05]{nimbusmononarrow}
%\usepackage[scaled=1.05,zerostyle=a]{newtxtt}
\usepackage{textcomp}
\usepackage{newpxmath}
\usepackage{bm}
\useosf
%SetFonts
\usepackage{upquote}
\font\pcf=zpl-Regular-osf-sc-t1 at 10.95pt
\makeatletter
\DeclareMathSymbol{\Sumop}{\mathop}{largesymbols}{"50}
\makeatother
\usepackage{booktabs}\title{New PX font package}
\author{Michael Sharpe}
\date{\today}  % Activate to display a given date or no date

\begin{document}
\maketitle
\section{Introduction}
This package is meant to be  a replacement for Young Ryu's {\tt pxfonts}---a complete text and math package with roman text font provided by a Palatino clone, sans serif based on a \textsf{Helvetica} clone, typewriter faces, plus math symbol fonts whose math italic letters are from a Palatino Italic clone. As with the related {\tt txfonts} (though not as severe) the math metrics in {\tt pxfonts} are overly tight.

The goal of this new project is use his glyphs along with a few additions and with completely reworked metrics which are generally looser, but not as loose as Computer Modern math. The following small examples (double normal size) provide some idea of the  extent of the changes.


\begin{minipage}{3.1in}
\begin{center}
\includegraphics[scale=2]{pxfontseg-crop}\\
Math rendered with pxfonts
\end{center}
\end{minipage}
\begin{minipage}{3.1in}
\begin{center}
\includegraphics[scale=2]{newpxeg-crop}\\
Math rendered with newpxmath
\end{center}

\end{minipage}


This new package differs from {\tt pxfonts} in the following ways:
\begin{itemize}
\item
the new package is split into separate text and math packages that do not need to be used in conjunction;
\item both text and math packages offer options not present in the original package, described below;\item wide accent glyphs have been corrected (they should have zero depth) so that they no longer collide with the underlying glyph;
\item the summation and product symbols in {\tt pxfonts} seemed overly heavy at display size, and have been replaced by others of more suitable weights;
\item for those who do not like the integral in \textsf{pxfonts}, an emboldened version of the Computer Modern integral is made available, matching the weight of the \textsf{pxfonts} symbols;
\item an upright partial derivative symbol has been added, named \verb|\uppartial|---$\uppartial$;
\item there is now an option to get braces more pleasing to older eyes;
\item macros have been added to bring the calls to Greek symbols more into conformity with \textsc{psnfss} and Mathtime Pro~2;
\item an upright Greek \verb|\upvarkappa|, $\upvarkappa$, has been added as well as a matching italic version $\varkappa$;
\item problems using \textsc{ams} macro packages before \textsf{pxfonts} are settled;
\item \verb|\coloneq| and \verb|\eqcolon| now point to the correct glyphs;
\item The problem with the {\tt ogonek} accent  and tabular environments (bad definition of \verb|\k|) is fixed;
\item The default encoding for \textsf{newpxtext} is now T$1$, but support is offered also for OT$1$ and LY$1$. As some add-on packages are available only in T$1$, that seems the best current choice.
\item The font collection used for rendering text is based on TeXGyrePagella with a number of additions, denoted by TeXGyrePagellaX. The superior figures in this addition are set by default to render footnote markers. (It is also possible customize footnote markers by redefining \verb|\thefootnote| after loading {\tt newpxtext.sty}.) Small caps are available in all weights and styles, and are offered in two sizes. The default small caps supplied by TeXGyrePagella are really \textsc{Petite Caps}, having xheights approximately the same x-heights (sometimes smaller) as lowercase letters. Option \texttt{largesc} increases the size of small caps by about 8\%, approximating the size of Adobe Palatino Small Caps. IMO, this is a better match in terms of weight and size. For a side by side comparison: {\pcf Petite Caps}, \textsc{Small Caps}.
\item Sans serif is by default taken from TeXGyreHeros, a Helvetica clone, and by default at 94\% of the scale factor (set by {\tt scaled}, default value {\tt1}). The option {\tt helvratio=.98} will change that to 98\%. As of newpx version 1.415, there is an option {\tt nohelv} that prevents this loading.
\item New math accents such as \verb|\widearc| have been introduced in tandem with the {\tt newtx} package, where they are documented.
\end{itemize}


\section{Text mode options and macros}
\textsc{Important changes as of version 1.42}\\
Option  {\tt theoremfont} was reimplemented using a new font family, {\tt npxth} instead of abusing \verb|\textsl|. By default,  users of {\tt theoremfont} will see no change in its functionality, including the use of the macro \verb|\textsl| to output italics with upright punctuation. A new option, {\tt trueslanted}, to {\tt newpxtext} has the following effects:
\begin{itemize}
\item
\verb|\textsl| now outputs slanted text rather than italics with upright punctuation text, but not affecting the usage of the {\tt theoremfont} option to {\tt newpxtext}.
\item the former behavior of \verb|\textsl| is now available through the new macro \verb|\textth|, \textsc{aka} \verb|\textthit|.
\item \verb|\pagestyle{headings}| now functions as intended with slanted rather than upright figures in the headers.
\end{itemize}

The text mode environment invoked by
\begin{verbatim}
\usepackage{newpxtext}
\end{verbatim}
has several options: you may write
\begin{verbatim}
\usepackage[scaled=.95]{newpxtext}
\end{verbatim}
to load the roman and typewriter text fonts at 95\% of normal size, and the sans serif (\textsf{Helvetica} clone) at scale $0.95*0.94$. This is not of much utility if the package is used with the math package {\tt newpxmath} to which it is already matched, but may be with other math packages. The options
\begin{verbatim}
\usepackage[scaled=.95,helvratio=.96]{newpxtext}
\end{verbatim}
load roman and typewriter text fonts at 95\% of normal size, and the sans serif (\textsf{Helvetica} clone) at scale $0.95*0.96$.

The option \texttt{osf} instructs the text fonts to use old-style figures \oldstylenums{1234567890} rather than the default lining figures $1234567890$. As of version $1.23$, {\tt newpxtext} loads initially with lining figures so the math package uses lining figures in math mode. The option {\tt osf} switches to old-style figures in text at the very end of the preamble, forcing the use of oldstyle figures in text, but not math. In previous versions, it was necessary to run 
\verb|\useosf| after loading math. This is no longer required, but does no harm. See the discussion in section 4 for further details.

As of version 1.415, the new option {\tt nohelv} prevents the loading of the default Helvetica clone as the sans serif text font. If you use this option, you should load your preferred sans serif font, otherwise you will be left with the Computer Modern default, most likely in a metafont version if not using OT1 encoding.

As described above, option {\tt largesc} increases the size of small caps by about 8\%.

Option {\tt defaultsups} (same effect as {\tt defaultsups=true}) forces the package to use the \LaTeX\ default footnote markers (or, at least, those in force when the package is loaded) instead of those preferred by the package---Palatino (clone) superior figures instead of spindly ordinary Palatino lining figures reduced to about 70\%. (Footnote markers in minipages use the default lowercase alphabetic characters, unless otherwise specified by redefining \verb|\thempfootnote|.) For better control over position and size of footnote markers, use the {\tt superiors} package after loading {\tt newpxtext}. 

The {\tt theoremfont} option changes the default font used for the {\tt plain} theorem style of {\tt amsthm}, keeping italic text but substituting upright figures and punctuation. For example, with this option, you get theorem statements like this:

\begin{thm}
This is Theorem Italic: text numbers are upright---12345; punctuation is in many cases upright (also, parens, braces \{\} and brackets []). What about question marks and exclamations? Also upright! [These fit better with math mode punctuation and figures, like: for all $x\in[0,1]$, let $f(x)\coloneq \exp(\alpha x)$].
\end{thm}
Compare this to traditional {\tt plain} theorem style of the same text:
\begin{oldthm}
This is Theorem Italic: text numbers are upright---12345; punctuation is in many cases upright (also, parens, braces \{\} and brackets []). What about question marks and exclamations? Also upright! [These fit better with math mode punctuation and figures, like: for all $x\in[0,1]$, let $f(x)\coloneq \exp(\alpha x)$].
\end{oldthm}

If you are using another theorem package (e.g., ntheorem, theorem) you will have to add your own descriptors as specified in the its documentation and set the body font to \verb|\thfamily|.

Superior letters and figures may be called with either \verb|{\sustyle ...}| or \verb|\textsu{...}|, so you can emulate $18$\textsu{th} century orthography such as J\textsu{os} W\textsu{m} Smith, or print French style with , e.g., $1$\textsu{i\`ere}, M\textsu{me} Dubois or M\textsu{lle} D'Orl\'eans.

The next two sections describe options to {\tt newpxtext} of more specialized nature.

\section{Spacing issues}
This new version of {\tt newpxtext} has spacing that is a little different, in its default state, from that of the old {\tt newpxtext}. In small part this is due to the finer kerning of TeXGyre Pagella, but mostly because the three parameters that govern inter-word spacing are not the same.
\begin{verbatim}
                               pxfonts     Pagella
fontdimen2 (interword space)   .25em       .25em
fontdimen3 (interword stretch) .125em      .2em
fontdimen4 (interword shrink)  .08333em    .1em
\end{verbatim}
That is, {\tt Pagella} has the same normal spacing as {\tt pxfonts} but its spacing is more flexible in terms of both stretch and shrink. More frequently than not, a paragraph built with {\tt Pagella} will occupy more space than the same built with {\tt pxfonts}. For this reason, the package offers some ways to change the spacing parameters. This may be important if you are trying to imitate the pagination of a document built using~{\tt pxfonts}.

Option {\tt tighter} sets the three fontdimen values to those of {\tt pxfonts}, except with a little more shrink. This should make it unlikely that text will occupy more space than it would have using~{\tt pxfonts}. 

Option {\tt looser} sets the three fontdimen values to \verb|{.3em,.2em,.1em}| respectively. 

If you want full control, the options {\tt spacing, stretch, shrink} allow you to modify one or more of the above fontdimens. For example,
\begin{verbatim}
\usepackage[stretch=.15em,shrink=.095em]{newpxtext}
\end{verbatim}



\section{Usage with {\tt babel}}
You should normally load {\tt babel} before loading {\tt newpxtext} in order for {\tt babel} to function as expected.  A similar macro \verb|\useproportional| makes proportional figures the default outside math mode. For example:
\begin{verbatim}
\usepackage[greek.polutonico,english]{babel}
% the next line makes text figures proportional, oldstyle, while math uses lining figures
\usepackage[theoremfont,trueslanted,largesc,tighter,p,osf]{newpxtext}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[varqu,varl]{inconsolata}
\usepackage{amsmath} % must be loaded before amsthm
\usepackage{amsthm} % must be loaded before newpxmath
\usepackage[vvarbb]{newpxmath}
% option vvarbb gives you stix blackboard bold
\linespread{1.05}
\end{verbatim}

\section{Usage with Lua\LaTeX\ and Xe\LaTeX}
As far as I can tell, \textsf{newpxmath} works with both, but requires a very specific loading order and choice of options. Briefly,  the math options must all be loaded prior to loading and using {\tt fontspec}. Be aware that some text packages (e.g., {\tt cabin}) may contain a line like
\begin{verbatim}
\RequirePackage{fontspec}
\end{verbatim}
which would prevent (``option clash'' error) a subsequent 
\begin{verbatim}
\usepackage[no-math]{fontspec}
\end{verbatim}
unless suppressed by an appropriate option. E.g., 
\begin{verbatim}
\usepackage[type1]{cabin}
\end{verbatim}
prevents the problem with the {\tt cabin} package.

While the math font options must be specified before {\tt fontspec}, be aware of a potential trap. Using \verb|\usepackage{newpxtext}| before \verb|\usepackage{newpxmath}| results in {\tt newpxtext}'s font-loading options being run after all other packages in the preamble, so instead of \verb|\usepackage{newpxtext}|, use the following:

\textsc{Example:}
\begin{verbatim}
%load LaTeX text components before math math
\usepackage[T1]{fontenc}
\renewcommand{\rmdefault}{zpltlf}% Roman font for use in math mode
\usepackage[scaled=.85]{beramono}% used only by \mathtt
\usepackage[type1]{cabin}% used only by \mathsf
\usepackage{amsmath} % must be loaded before amsthm
\usepackage{amsthm}% load before newpxmath
\usepackage[bigdelims,vvarbb]{newpxmath}
\usepackage[scr=rsfso]{mathalfa}
\usepackage{bm}% load after all math to give access to bold math
%Now load the otf text fonts using fontspec---won't affect math
\usepackage[no-math]{fontspec} % process with XeLaTeX or LuaLaTeX
\setmainfont{TeXGyrePagellaX} % this reads in TeXGyrePagellaX.fontspec
\end{verbatim}


\section{Math mode options}
The package invoked by
\begin{verbatim}
\usepackage{newpxmath}
\end{verbatim}
loads the math part of the {\tt pxfonts} (with revised metrics and additional glyphs) and should be loaded \emph{after} the text font and its encoding have been specified, as it uses the text font settings to define how operators, numbers, math accents, \verb|\mathrm|, \verb|\mathbf| etc.\ are rendered. You should also load a Typewriter font so as not to generate mysterious error messages about \textsf{metafont} trying to generate \texttt{ectt10}. The package offers a number of options.
\begin{itemize}
\item {\tt upint} (new as of version 1.3.) selects upright integrals---the default shape is slanted. Each shape/size of integral takes one of twelve form, illustrated below in the case of display size slanted integrals.
\[\int\quad\oint\quad\iint\quad\iiint\quad\iiiint\quad\oiint\quad\oiiint\quad\varointclockwise\quad\ointctrclockwise\quad\fint\quad\sumint\quad\sqint\]
named respectively
\begin{verbatim}
\int \oint \iint \iiint \iiiint \oiint 
\oiiint \varointclockwise \ointctrclockwise \fint \sumint \sqint
\end{verbatim}
The three sizes of the upright integrals look like:
\begin{center}
  \begin{tabular}{@{} cl @{}}
    \hline
    Glyph & Command\\ 
    \hline
    $\smallintup$ & \verb|\smallint[up]|\\ 
    $\intup$ & \verb|\int[up]|  \\ 
    $\displaystyle{\intup}$ & \verb|\displaystyle{\int[up]}|\\ 
    \hline
  \end{tabular}
\end{center}
Note that the suffix {\tt up} is not required unless the document's integral style is slanted. You may find the \verb|\smallint| is useful for inline math mode when it is important not to change the line spacing.
\item {\tt smallerops} (new as of version 1.3.) causes big operators other than integrals to render up to 20\% less tall, so that displayed formulas may occupy less vertical space. For example, in the following display, the first operator is the usual \verb|\sum|, the second is what you would get with {\tt smallerops}, the third is \verb|\textstyle{\sum}| and the fourth is \verb|\smallsum|, the latter being used mainly with inline math. 
\[\sum \Sumop \textstyle{\sum} \smallsum\]
Similarly, there are \verb|\smallprod| and \verb|\smallcoprod| which, along with \verb|\smallsum|, are of class {\tt mathop}, unlike their Greek letter equivalents.
\item (New as of version 1.3.) Two macros allow you to change {\tt fontdimen} values in math mode: \verb|\setSYdimens| and \verb|\setEXdimens|, which allow you to change the {\tt fontdimen} parameters for the {\tt symbol} and {\tt extension} fonts respectively. They may be used only in your preamble. Their arguments can be any valid \TeX\ commands to change {\tt fontdimen} values. For example:
\begin{verbatim}
\def\setSYdimens{\fontdimen16\font=2pt\fontdimen17\font=1.15\fontdimen17\font }
\end{verbatim}
Don't use these unless you know what you're doing.
\item 
\begin{itemize}
\item{\tt varg} causes the math italic letter $g$ to be replaced by $\varg$;
\item Option {\tt cmintegrals} is now useless---the original ugly integral sign have been replaced.%instructs \textsf{newpxmath} to load a thicker version of the Computer Modern integral in place of the \textsf{newpxmath} default---the pxfonts integral (identical to the integral in the Wolfram fonts), which is not to everyone's taste---a consequence is that none of the special forms of \textsf{pxfonts} integrals are available; \textbf{As of version 1.3, this option does nothing, as the new default is slanted integrals.}
%\item The option {\tt cmbraces} instructs {\tt newpxmath} to ignore the brace collections from {\tt pxfonts}, substituting a collection based on thickened versions of the Computer Modern braces, which I find much easier to distinguish from other delimiters. This works quite well in regular weight but looks a bit clunky in bold.
\item The options {\tt cmbraces} and  {\tt bigdelims} now have no effect but do no harm---it is now the default behavior to use a larger size of delimiters than in the original package.
\end{itemize}
\item the combination
\begin{verbatim}
\usepackage{amsmath}% loads amstext, amsbsy, amsopn but not amssymb
\usepackage{newpxmath}
\end{verbatim}
causes no error, unlike the same combination with {\tt pxfonts}, but does nothing significant. The package {\tt newpxmath} loads the package {\tt amsmath} if it was not previously loaded. Options to {\tt amsmath} such as {\tt leqno,intlimits} may be passed to {\tt amsmath} via options to the documentclass. It is useful if you want to load {\tt amsthm} because the required order of loading is
\begin{verbatim}
\usepackage{amsmath}
\usepackage{amsthm} % amsmath must be loaded before amsthm
\usepackage{newpxmath} % amsthm must be loaded before newpxmath
\end{verbatim}

%The integrals are as defined in {\tt pxfonts}. %With
%\begin{verbatim}
%\usepackage[cmintegrals]{newpxmath}
%\end{verbatim}
%you may use the forms \verb|\iint|, \verb|\iiint|, \verb|\iiiint| and \verb|\idotsint| defined in {\tt amsmath}, but using the pumped-up Computer Modern integral loaded by {\tt newpxmath}. 
\item {\tt uprightGreek} and {\tt slantedGreek} determine the form of Greek alphabet loaded---the default is {\tt uprightGreek}, which loads upright uppercase and slanted lowercase Greek symbols, as is customary in Anglo-American mathematical typesetting. With the option {\tt slantedGreek}, which you might want to use if you cared about ISO standards, all Greek symbols are slanted. No matter which is set, \verb|\Gammaup| (or \verb|\upGamma|) gives you upright \verb|\Gamma|, etc, and \verb|\Deltait|, \verb|zetait| give you italic (i.e., slanted) versions of those letters, and \verb|\mathnormal{\Omega}| etc will always produce the slanted version of uppercase Greek letters. (The macro \verb|\mathnormal| means essentially ``use the version of the symbol in {\tt letters}''---i.e., the math italic form. This did not always work as expected in versions prior to 1.27.)
\item The \textsf{newpxmath} package contains three different Blackboard Bold alphabets, where original \textsf{pxfonts} contained one. The default, triggered by \verb|\mathbb{}|, takes its glyphs from the font which replaces {\tt msbm} and has the same overall appearance of a hollowed-out text font, which I find neither bold nor blackboard-like. The second option, taken from \textsf{pxfonts}, is triggered by \verb|\varmathbb{}|, is more geometric and, in my opinion, preferable but not optimal. The option {\tt varbb} makes \verb|\mathbb{}| synonymous with \verb|\varmathbb{}|. The third option is the double-struck glyphs from the STIX collection. See the expanded discussion below.
\item {\tt nosymbolsc} causes the package to not load the {\tt symbolsC} fonts, saving  a math family. (This font contains mostly exotic symbols, along with some very useful, commonly used symbols like \verb|\coloneq| $\coloneq$, \verb|\eqcolon| $\eqcolon$, \verb|\notin| $\notin$, \verb|\notni| $\notni$, \verb|\neq| $\neq$, \verb|\nsubset| $\nsubset$ and \verb|\nsupset| $\nsupset$, but these have been moved (virtually) to {\tt lettersA} so they may continue to be used even if you use the option {\tt nosymbolsc}.)
\item {\tt amssymbols} (the default) and {\tt noamssymbols} determine whether the {\tt pxfonts} versions of the \textsc{ams} symbols ({\tt msam}, {\tt msbm}) are loaded---if so, they override previous settings in {\tt amsmath}. If you use the option {\tt noamssymbols}, then \verb|\mathbb{}| is set to mean the same as \verb|\varmathbb{}|. (One advantage of {\tt noamssymbols} is that you save one of your precious math families for other purposes, such as setting a couple of external math alphabets by means of the \textsf{mathalpha} package.)
\end{itemize}

\textsc{Example:}
\begin{verbatim}
\documentclass[leqno]{article}
\usepackage[osf,theoremfont]{newpxtext} % T1, lining figures in math, osf in text
\usepackage{textcomp} % required for special glyphs
\usepackage[varg]{newpxmath}
\usepackage[scr=rsfso]{mathalfa}% \mathscr is fancier than \mathcal
\usepackage{bm} % load after all math to give access to bold math
%\useosf %no longer needed unless using babel
\linespread{1.05}% Give Palatino more leading (space between lines)
\end{verbatim}

\section{Some recent additions to \texttt{newpxmath}}
Because a number of the standard math accents appeared to be too close to the symbols they accented, a number of the problem accents have been reworked as additions to the {\tt symbols} font, along with a number of vertically doubled symbols. (The doubled symbols are described in the documentation to newtx.) The new accents are flatter and stand higher above their accentees than the old versions.

Another addition to {\tt symbols} may be used to signify matrix \emph{transpose}. In fact, the glyph is just the {\tt intercal} glyph (from the txfonts rendition of the AMS symbols) raised and narrowed considerable. Here is an example comparing its use to a number of other common constructions:
\[\mathbf{M}^{\transp}, \mathbf{M}^{\mathsf{T}}, \mathbf{M}^{\mathrm{T}}, \mathbf{M}^{\intercal},\]
are produced respectively by
\begin{verbatim}
\mathbf{M}^{\transp}, \mathbf{M}^{\mathsf{T}}, \mathbf{M}^{\mathrm{T}},
 \mathbf{M}^{\intercal}.
\end{verbatim}
Clearly, the last needs to have the exponent raised and moved to the left. This is not hard to do, but it may use up on of your math families unless you are already using the AMS symbols. A similar objection could be made to the use of \verb|\mathsf|.
\section{The \TeX\ math font problem}
Math font packages in \LaTeX\ are susceptible to the ``Too many math alphabets'' error, due to exceeding the limit of just sixteen math font families, or mathgroups, as they are called in \LaTeX. Put in oversimplified terms that do however correctly represent how this all works in \textsf{newpxmath}, the following math fonts are always loaded and permanently (if you didn't prevent loading of some features) occupying slots immediately following \verb|\begin{document}|, and others that may be called for in typesetting a mathematical expression can add to the list as the document grows.

\textsc{Always loaded:}
\begin{verbatim}
0: operators
1: letters
2: symbols
3: largesymbols
4: AMSm (replaces former AMSa and AMSb)
5: lettersA
6: symbolsC
7: largesymbolsTXA
8: boldoperators
9: boldletters
10: boldsymbols
11: boldlargesymbols
\end{verbatim}
\textsc{Notes:}
\begin{itemize}
\item
The {\tt operators} font is essentially the Roman text font, used for names of operators and as the target for \verb|\mathrm|---its bold version is used as the target for \verb|\mathbf|;
\item if you typeset an expression that, say, calls for a single bold glyph from  {\tt symbolsC}, that costs you an entire new slot, leaving only two remaining;
\item same with, e.g., \verb|\mathit|;
\item same with an external Fraktur, Blackboard Bold or Script glyphs;
\item if you run out of math alphabets, look first to dropping {\tt AMSm} and  {\tt symbolsC}, which can save you at least two slots;
\item if space is tight, do not call bold versions of the fonts listed above where the bold version is not already loaded, to avoid loading a new mathgroup; 
\item if you absolutely need a letter (not a math symbol) from some math font that would normally cost you another mathgroup, you might consider using as if it were text, with something like
\begin{verbatim}
\mbox{{\usefont{U}{zplmia}{b}{n} X}}
\end{verbatim}
which allows you to use letter X from {\tt boldlettersA} but without any math features;
\item there is a macro \verb|\ShowMathFonts| in {\tt newpxmath} which may be called at any point in your document, which will provide you a list of the mathgroups currently in use. This can be helpful in figuring out where problems occur. The output lines take the form
\begin{verbatim}
(<fam number>: <internal font id> = <tfm name> [newpx name])
\end{verbatim}

\end{itemize}
\section{Bold math fonts}\label{sec:boldmath}
Every math font in the {\tt pxfonts} package, and in the {\tt newpx} package, is accompanied by a bold version. Some usage examples are given below. Generally, one may use either \verb|\boldmath| to change an entire formula to bold, or \verb|\boldsymbol| to change one symbol, but the spacing generally works better after loading the {\tt bm} package and using the \verb|\bm| macro.

The text glyphs dotlessi (\verb|\i|) and dotlessj (\verb|\j|) are rarely needed in actual text---in many fonts, roman dotlessi is very similar to the numeral 1. They are however sometimes needed to build special math glyphs. The following table shows how to generate the mathematical forms of dotlessi and dotlessj. I illustrate with only dotlessi---dotlessj is entirely analogous.

\begin{center}
  \begin{tabular}{@{} llll @{}}
    \hline
    Type & Weight & Command & Result \\ 
    \hline
    Math Italic & Regular & \verb|$\hat{\imath}$| & $\hat{\imath}$ \\ 
    Math Italic & Bold & \verb|$\bm{\hat{\imath}}$| & $\bm{\hat{\imath}}$ \\ 
    Roman & Regular & \verb|$\hat{\textrm{\i}}$| & $\hat{\textrm{\i}}$\\ 
    Roman & Bold & \verb|$\bm{\hat{\textbf{\i}}}$| & $\bm{\hat{\textbf{\i}}}$\\ 
    \hline
  \end{tabular}
\end{center}
\newcommand{\xyvec}[2]{\ensuremath{#1\bm{\textbf{\i}}#2\bm{\textbf{\j}}}}

In math, bold roman characters are often used to indicate vector quantities, and for this one uses constructions like 
\begin{itemize}
\item
\verb|$\mathbf{x}$| produces $\mathbf{x}$;
\item
\verb|$\bm{\mathrm{x}}$| produces $\bm{\mathrm{x}}$ (same as previous but may offer improved spacing);
\item
\verb|$\bm{x}$| produces $\bm{x}$ (not roman);
\item
\verb|$\bm{\hat{\mathbf{x}}}$| produces $\bm{\hat{\mathbf{x}}}$ (with a bold accent);
\item \verb|$\bm{\dot{x}}$| produces $\bm{\dot{x}}$ (bold but not roman);
\item the macro definition
\begin{verbatim}
\newcommand{\xyvec}[2]{\ensuremath{#1\bm{\textbf{\i}}#2\bm{\textbf{\j}}}}
\end{verbatim}
allows you to write \verb|\xyvec{x}{+y}| to output $\xyvec{x}{+y}$;
\item \verb|$\bm{\Gamma}$| produces $\bm{\Gamma}$ (bold Gamma);
\item \verb|$\bm{\hat{\Gamma}}$| produces $\bm{\hat{\Gamma}}$ (bold Gamma with bold accent).
\end{itemize}
(The last two assume that you have effectively set the option {\tt uprightGreek}---the default.)

\section{Blackboard bold}
As mentioned briefly above, the package now has a new blackboard bold alphabet built-in, and some new macros to call the non-default versions. To summarize, the problems are:
\begin{itemize}
\item
the default, called by \verb|\mathbb| is quite ugly and indistinct, but does cooperate with the bolding macros \verb|\bm| and \verb|\boldsymbol|;
\item the original variant form called with the macro \verb|\varmathbb| is better, but the macro conflicts with \verb|\bm|. (In fact, the bold version is identical to the regular version, but it is still not right that it conflicts with them.) The problem stems from the part of the definition of \verb|\varmathbb| which allows you to insert an argument with more than one character, like \verb|\varmathbb{ABC}|. The solution is to make a new macro that takes a single argument, like \verb|\vmathbb{A}|, which cooperates with \verb|\bm|.
\item the third, new, alphabet is borrowed from the STIX fonts---it is sharp and quite clear, geometric in design. The only slight problem is that it lacks a full bold version, with only the letters C, D, H, N, P, Q, R, Z, d, e, i and j available. The macro \verb|\vvmathbb| provided to access this alphabet allows only a single character for its argument. The new option {\tt vvarbb} effectively makes \verb|\mathbb| mean the same as \verb|\vvmathbb|.
(The reason for including these in the \textsf{newpx} package rather than calling them from the \textsf{mathalfa} package is that \textsf{newpx} leaves very little space for new math symbol fonts and math alphabets, and this way requires no additional such resources.
\end{itemize}
One interesting feature of the new alphabet is that it contains blackboard bold numbers, of which $0$ and $1$ will likely be the most useful, perhaps as operator names. I find $\vvmathbb{1}$=\verb|$\vvmathbb{1}$| useful in specifying an indicator, AKA characteristic function. Here are some examples:

\begin{center}
  \begin{tabular}{@{} llll @{}}
    \toprule
     & Regular & Bold & Remarks \\ 
    \midrule
Default  & \verb|$\mathbb{R}$| $\mathbb{R}$& \verb|$\bm{\mathbb{R}}$| $\bm{\mathbb{R}}$\\ 
Variant 1     & \verb|$\varmathbb{R}$| $\varmathbb{R}$ &  & Bold is same as regular \\ 
$\dots$or     & \verb|$\vmathbb{R}$| $\vmathbb{R}$ &  & Single char.\ argument\\ 
Variant 2 & \verb|$\vvmathbb{R}}$| $\vvmathbb{R}$& \verb|{\boldmath $\vvmathbb{R}$}| {\boldmath $\vvmathbb{R}$} & Make a macro for this! \\ 
%     & $\bm{\mathbb{AB}}$  & $\bm{\vmathbb{A}\vmathbb{B}}$ & $\bm{\vvmathbb{A}\vvmathbb{B}}$ \\ 
    \bottomrule
  \end{tabular}
\end{center}

For further information on the changes made to \texttt{newpxmath} 1.3, see the appendix to the documentation for \texttt{newtxmath} 1.5.

\def\jj{\mkern-3mu j}

\section{Appendix 1: Changes made in version 1.40}
Versions of {\tt newpx}  dated from September, 2019 (1.40 for {\tt newpxmath} make some quite substantial changes, mostly to math mode. 

\section{Goals}
Spurred by work of Ross Moore to provide means of generating archivable pdf using {\tt pdflatex}, the main goal was to change {\tt newpx} and {\tt newtx} to meet the requirements for satisfying the {\tt PDF/A-1b} standards by using an appropriate preamble involving the {\tt pdfx} package and other unicode mapping files. Making these  changes  gave me the opportunity to organize the source files to make them more manageable in  future revisions. 

A further goal whose time seemed ripe was to rework the  spacing of math letters, both Roman and Greek, so they behaved better in superscripts and subscripts. This did not turn out to be so easy. The problem is illustrated by math italic j. If you don't give it enough extra space on the left, it will likely collide with the D in rendering \verb|$D^j$|. On the other hand, if you do give it enough space on the left, it will look bad as a  subscript, appearing too far right. 

A final goal was to make better use of the remaining space in some of the math fonts by placing some math alphabets in them, avoiding perhaps a waste of those precious sixteen math families.

\section{The important changes}
The following changes were made to both {\tt newtx} and {\tt newpx}.

\subsection{Archivability}
Some of the individual font files from which the math fonts are built turned out to have some fairly minor structural issues. These have all been corrected. The more major issue was the lack of unicode mapping for all characters in the fonts. For the symbol and math extension fonts, this issue was largely solved by Ross Moore's {\tt glyphtounicode} files that are now accessible as part of TeXLive and MiKTeX. The main problem was the math alphabets like math italic, bold math italic, upright Greek and slanted Greek, all of which have now been assigned their own unicode points. For all of these, I constructed new fonts using unicode names for the glyphs, then made \textsf{fontinst} scripts that renamed those unicode values to the original simple names as used in the encoding files so that I could use my old encoding and adjustment files. This exercise has now been carried out for {\tt newtxmath}, {\tt newpxmath}, {\tt newtxmath/libertine} and {\tt newtxmath/xcharter.} Each of these can now be considered to have an ``enhanced'' status that allows them to share all the new assets described below. The other packages which may be specified as an option to {\tt newtxmath} (e.g., {\tt cochineal, baskervillef}) must be considered for the moment to be ``unenhanced'' and able to share only some of the new assets. In particular, only the enhanced items can generate archivable pdf. 

Also modified were the {\tt sups} fonts in {newpxtext}, where the main issue was unicode mapping. Superior number and some superior letters do have assigned unicode values, but in may cases a more creative approach was needed, and provided once again by Ross Moore. I rebuilt the superior font files using those unicode names, solving that particular problem.

Here is a sample  preamble showing the elements you will need to specify to generate a pdf satisfying the PDF/A-1b standards, as verified by Adobe Acrobat Pro. (Other verification processes may yield different outcomes.)
\begin{verbatim}
\documentclass[noamsfonts]{amsart} % save 2 math families 
\pdfcompresslevel=0 
\pdfgentounicode=1 
\input glyphtounicode.tex 
\usepackage{pdfx} % v 1.6.4 or higher
\InputIfFileExists{glyphtounicode-cmr.tex}{}{} 
\InputIfFileExists{glyphtounicode-ntx.tex}{}{}
\usepackage{newpxtext} %T1 is default encoding
\usepackage[scaled=0.95]{inconsolata}  % typewriter
%\usepackage[leqno]{amsmath} 
\usepackage{amsthm}
\usepackage[vvarbb]{newpxmath} % vvarbb gives STIX Bbb
\end{verbatim}

Version 1.6.3 of {\tt pdfx} from February 2019  mishandles math accents. A fix is now available and will become part of the upcoming {\tt pdfx} v1.6.4.

\subsection{Glyph spacing changes} I reworked the math italics to improve the rendering of some  superscripts. This affects (a)  parentheses, brackets and braces to inhibit clashes; (b) glyphs like j, f, p, y, \verb|\rho|,  \verb|\beta| and  \verb|\mu| where a long tail could pose problems intersecting with other glyphs; (c) glyphs like such as D, Q and \verb|\Phi| that are round on the right, where interference is most likely to occur with a superscript. Increasing the left side-bearing of j, etc., helps with superscripts but creates an ugly gap when used as subscripts.  


 The {\tt subscriptcorrection} option to {\tt newpxmath} has been corrected and enhanced  so that it now offers a partial solution the subscript spacing problem. I regret that this option is incompatible with xy-pic, both depending on redefining \verb|_| as an active character. {\tt Newpxmath}  will detect if the {\tt xy} package is loaded and disable {\tt subscriptcorrection} if so. You would have to correct such issues by manually inserting a negative \verb|\mkern|. For example, you might put in your preamble something like
 \begin{verbatim}
\def\jj{\mkern-3mu j}
\end{verbatim}
and then use \verb|$x_{\jj}$| instead of \verb|$x_j$|, turning $x_j$ into $x_{\jj}$.

If you do enable {\tt subscriptcorrection}, there is a default correction table in the {\tt sty} file, but the sty file also looks for a file named,  {\tt newpx-subs.tex}. There is already such a file located in the {\tt newpx} distribution in the \verb|tex/latex/newpx| folder. 

(New as of version $1.426$:) If you wish to make changes to {\tt newpx-subs.tex}, it is possible though not wise to copy the file to your home TeX folder where it will be found by TeX before the one in the distribution. The problem is that it is easy to forget where the file is located when you want to make changes. For the moment, my advice is to place the file contents with your changes inside a {\tt filecontents} environment at the top of your source file, as shown below. The effect will be to write that file in the same folder as your source, overwriting any existing copy. Version $1.426$ also offers you a new option {\tt subscriptcorrectionfile} that lets you specify a file name other than the default {\tt newpx-subs.tex} that can be used to specify a subscript correction file for some special use.

\textbf{A sample newpx-subs.tex:}\\
Copy the entire block below, starting with the line \verb|\begin{...| and ending after the line beginning \verb|\end{|
and pasting it into the top of your document before the \verb|\documentclass...| line, which will allow for easy editing and will write the file to the same folder as your document.
\begin{verbatim}
\begin{filecontents*}[force,nosearch]{newpx-subs.tex}
{f}{-2.5}
{j}{-1.5}
{p}{-1}
{y}{-1}
{A}{-1.5}
{B}{-1}
{D}{-1}
{H}{-1}
{I}{-1}
{K}{-1}
{L}{-1}
{M}{-1}
{N}{-0.5}
{P}{-1}
{X}{-1}
{\rho}{-1.5}
{\mu}{-1}
\end{filecontents*}
\end{verbatim}
The entries in the file are lines like
\begin{verbatim}
{j}{-3}
\end{verbatim}
each of which will have the same effect as the above macro \verb|\jj| if the first item in the subscript is {\tt j}. You can also specify Greek letters with lines like
\begin{verbatim}
{\beta}{-1.5}
\end{verbatim}

\subsection{New glyphs added}  Math family 1 {\tt (letters)} has been extended from 128 slots to 256, retaining the {\tt OML} encoding of the first 128. Most of additional slots have been allocated to a script font from the old STIX collection and an upright modification of that font.
By default, \verb|$\mathscr{F}$| will produce $\mathscr{F}$.\\
$\bullet$ option {\tt uprightscript} changes the output to {\usefont{OML}{ntxmi}{m}{it}\char201}.\\
In both cases, there are full upper-case and lower-case and {\tt dotlessi}, {\tt dotlessj}. To insert the latter, you can write either \verb|$\mathscr{\imath}$| or \verb|$\imathscr$|, rendered as $\mathscr{\imath}$ in the slanted script case.

The secondary letters font {\tt (lettersA)} and math family 2 {\tt(symbols)} have been rearranged. The first of these continues to have a Fraktur alphabet, but it a modification of its original one, having wider vertical stems and a blacker appearance more in keeping with the weight Times. {\tt Dotlessi} and {\tt dotlessj} have been added and can be specified in math mode by \verb|$\imathfrak$| and \verb|$\jmathfrak$|---\verb|$\mathfrak{\imath}$| also works. There are in addition two subsidiary Bbb alphabets in {\tt lettersA}, specified by the respective options {\tt vmathbb}, {\tt vvmathbb}, and there are corresponding {\tt dotlessi}, {\tt dotlessj} activated by \verb|$\imathbb$|, \verb|$\jmathbb$|, which always render as $\imathbb$, $\jmathbb$ no matter the choice of which Blackboard Bold Alphabet. If you select one of the options {\tt vmathbb}, {\tt vvmathbb}, you will have Bbb digits 0..9 using, e.g., \verb|$\mathbb{1}$| to get~$\varmathbb{1}$. (Without one of these options in force, \verb|$\mathbb{1}$| will render as~$\mathbb{1}$ because the default Bbb has no figure glyphs in the default slots.)

Among the new symbols added are:\\
$\bullet$ \verb|\hslash|, \verb|\hbar|, \verb|\lambdaslash|, \verb|\lambdabar|, \verb|\Zbar|, \verb|\Angstrom| are now constructed from the native glyphs.\\
$\bullet$ Euler's constant \verb|$\Euler$| ($\Euler$).\\
$\bullet$ Hermitian transpose \verb|\hermtransp| or \verb|\htransp| is used like \verb|$\mathbf{A}^{\htransp}$| ($\mathbf{A}^{\htransp}$). This usage is similar to simple transpose \verb|$\mathbf{A}^{\transp}$| ($\mathbf{A}^{\transp}$).\\
$\bullet$ Independence can use \verb|\Perp|, $\Perp$, and there is a new \verb|\nPerp|, $\nPerp$, for its negation.

\subsection{Adaptive vector accent} The \LaTeX\ macro \verb|\overrightarrow| provides a right arrow with adaptive width, but not matching the vector head of {\tt newpxmath}. Likewise, the {\tt esvect} provides a similar service with a choice of vector heads, none of which match {\tt newpxmath}. I've added code to provide a matching adaptive vector accent and which uses the same macro name, \verb|\vv|, as {\tt esvect}.
For a comparison of these vector accents, \verb|$\vec{XY} \vv{XY} \overrightarrow{XY}$| renders as\\ 
$\vec{XY} \vv{XY} \overrightarrow{XY}$.\\ 
$\bullet$ \verb|$\vv{AB}$|  renders as $\vv{AB}$.\\ 
$\bullet$ \verb|$\vv*{AB}{x}$| renders as $\vv*{AB}{x}$. This provides better horizontal spacing of subscripts than \verb|$\vv{AB}_{x}$|, $\vv{AB}_{x}$.\\
$\bullet$  You can also do \verb|$\vv*{AB}{\vv{CD}}$|, which  renders as $\vv*{AB}{\vv{CD}}$.\\
$\bullet$ You can change the vertical space between the arrow and the accentee by means of the package option {\tt vecsep}, whose default value is {\tt .25ex}.

\subsection{Miscellaneous Changes}
\begin{itemize}
\item
The superior letters fonts in {\tt newpx} 
have been extended and all glyphs now have appropriate unicode mappings.
\item
The AMS fonts replacement, {\tt zplsym} corrects the former misplacement of \verb|\kbbb|, \verb|\daleth|, \verb|\circledR| and \verb|\circledS|.)
\end{itemize}
\newpage
\section{Changed Font Tables}
\subsection{letters}
\fonttable{zplmi}
\newpage  
\subsection{lettersA}
\fonttable{zplmia}
\newpage  
\subsection{symbols}
\fonttable{zplsy}
\end{document}