2

When I use the mathpazo package (Palatino font), the font shapes generated by using the \textit and \textsl commands (or alternatively the \itshape and \slshape commands) look different as intended: The first one produces italic text, the second one produces slanted text.

However, when I use the newpxtext or the tgpagella package (also Palatino font), both \textit and \textsl produce italic text only. You may try this out with the following MWE:

\documentclass{article}

\usepackage{mathpazo}
%\usepackage{newpxtext}
%\usepackage{tgpagella}

\begin{document}
\texttt{itshape}: \textit{The quick brown fox jumps over the sleazy dog.}

\texttt{slshape}: \textsl{The quick brown fox jumps over the sleazy dog.}
\end{document}

By the way: I use MikTeX and pdflatex.

When running this example with tgpagella, a warning shows up, saying that sl is not available and it is used instead:

LaTeX Font Warning: Font shape 'OT1/qpl/m/sl' in size <10> not available (Font) Font shape 'OT1/qpl/m/it' tried instead on input line 10. (taken from the .log file)

However, no warning appears when I use newpxtext. Apparently, sl is just defined to be the same font shape as it for this package.

My question: Is there a way to use the newpxtext package and be able to use actually slanted text? I am particularly interested in using newpxtext instead of the other two packages since I want to use it jointly with the newpxmath package as recommended in many forums.

1
  • Welcome to tex.sx. Slanted text fonts are fairly rare, especially for serif fonts. I am not sure, but seriously doubt that either Palatino (or pagella) provides such a shape. Italic is the usual substitution. Commented Apr 10, 2019 at 16:47

2 Answers 2

2

Here, I redefine \textsl and \slshape to invoke the mathpazo font.

\documentclass{article}

%\usepackage{mathpazo}
%\usepackage{newpxtext}
\usepackage{tgpagella}

\let\svtextsl\textsl
\renewcommand\textsl[1]{\bgroup\fontfamily{ppl}\selectfont\svtextsl{#1}\egroup}
\let\svslshape\slshape
\renewcommand\slshape{\fontfamily{ppl}\selectfont\svslshape}

\begin{document}
\texttt{itshape}: \textit{The quick brown fox jumps over the sleazy dog.}

\texttt{slshape}: \textsl{The quick brown fox jumps over the sleazy dog.}

Normal text and \slshape now in slshape. \upshape Back ``up'' again.
\end{document}

enter image description here

The only pitfall, if you want to call it that, is that if you are operating in this revised \slshape and change the font family, as in \rmfamily, you will return to the italic shape, because (as the OP knows) the slshape is unknown to the default font family, be it nepxtext or tgpagella.

2
  • To clarify the last sentence for a future reader: If you change the font family at some point in your document (e.g. by calling \sffamily), you will not be able to use this secondary font's \slshape. Reason: You will jump back to using Palatino since it is now "hard-coded" within the re-definition of the \slshape/\textsl command. As a solution, you can define different \slshape commands for different font families (but this might not be the most elegant way to do it).
    – TopQuark
    Commented Apr 10, 2019 at 17:41
  • @TopQuark Correct, though I would think for most situations, this would not naturally occur at the user level (invoking a different font family in the midst of \slshape). However, some macros are known to invoke a font family which could, in these situations, lead to unanticipated results. Commented Apr 10, 2019 at 19:42
2

You can substitute the font call for \slshape:

\documentclass{article}

\usepackage{newpxtext}

\makeatletter
\AtBeginDocument{%
  \DeclareFontShape{T1}{zpl\zpl@figurealign\zpl@figurestyle}{m}{sl}{<-> pplro8t}{}%
  \DeclareFontShape{T1}{zpl\zpl@figurealign\zpl@figurestyle}{b}{sl}{<-> pplbo8t}{}%
}
\makeatother

\begin{document}

\texttt{upshape}: \textup{The quick brown fox jumps over the sleazy dog.}

\texttt{itshape}: \textit{The quick brown fox jumps over the sleazy dog.}

\texttt{slshape}: \textsl{The quick brown fox jumps over the sleazy dog.}

\end{document}

enter image description here

Be aware that this will not follow possible choices about oldstyle figures you make when loading newpxtext.

I'd avoid it. I generally agree with Knuth's typographical choices, but definitely not about slanted type that I find essentially indistinguishable from upright type and ugly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .