Example: Faking slanted small caps using TikZ low level transforms

Published 2009-11-04 | Author: Berteun Damman

In italicized environments normal small caps often looks wrong because of its upright shape. A solution is to simply use all-uppercase in these environments, but this too is ugly. Using TikZ one can fake a slant. This is not that great, but better than nothing.

Note that kpfonts for example provides a font which has slanted small caps by default.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Faking slanted small caps using TikZ low level transforms

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Author: Berteun Damman
% Faking slanted small caps using TikZ low level transforms.
\documentclass{minimal}
\usepackage{tikz}
\usepackage{amsthm}
\newtheorem{lem}{Lemma}
% If you externalize figures this will give a new figure for
% each usage!
\makeatletter
\newcommand{\textscsl}[1]{%
   \tikz[baseline=(N.base)]%
   % The transform says:
   % x' = 1x + 0.22y + 0pt
   % y' = 0x + 1y    + 0pt
   % This gives a slant - adjust the value for each font!
   \pgfsys@transformcm{1}{0}{0.22}{1}{0pt}{0pt}%
   \node[inner sep=0pt] (N) {\textsc{#1}};%
}
\makeatother
\begin{document}
   % In italicized environments normal small caps often looks wrong because of
   % its upright shape. A solution is to simply use all-uppercase in these
   % environments, but this too is ugly. Using TikZ one can fake a slant. This
   % is not that great, but better than nothing.
   %
   % Note that http://www.ctan.org/tex-archive/fonts/kpfonts/ for example
   % provides a font which has slanted small caps by default.

   \begin{minipage}{4.5cm}
       \begin{lem}
           The \textsc{gcd} of two numbers can be used to find
           the \textsc{lcm} of these numbers.
       \end{lem}
       \begin{lem}
           The \textscsl{gcd} of two numbers can be used to find
           the \textscsl{lcm} of these numbers.
       \end{lem}
   \end{minipage}

\end{document}

Comments

Adding comments is currently not enabled.