Skip to content

faked small caps may fail with microtype #10

@schlcht

Description

@schlcht

Due to a quirk in pdftex (see https://mailman.ntg.nl/pipermail/ntg-pdftex/2022-February/004340.html), the test for font equality in \es@xlsc can under some circumstances yield a wrong result. As this issue probably won't be fixed in pdftex, I suggest to change the test from comparing the fonts' \csname to their \fontname:

\documentclass{book}
\usepackage[spanish]{babel}
\usepackage{microtype}
\makeatletter
  \def\es@xlsc#1#2#3{%
    \leavevmode
    \hbox{%
      \scshape\selectfont
      \expandafter\ifx\csname\f@encoding/\f@family/\f@series
            /n/\f@size\expandafter\endcsname
        \csname\curr@fontshape/\f@size\endcsname
% --- instead of the above three lines:
%      \edef\@tempa{\expandafter\fontname\csname\f@encoding/\f@family/\f@series/n/\f@size\endcsname}%
%      \edef\@tempb{\expandafter\fontname\csname\curr@fontshape/\f@size\endcsname}%
%      \ifx\@tempa\@tempb
        \csname S@\f@size\endcsname
        \fontsize\sf@size\z@\selectfont
        \PackageWarning{spanish}{Replacing `\curr@fontshape' by
          \MessageBreak faked small caps}%
        #1{#3}%
      \else
        #2{#3}%
      \fi}}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\chapter{A}
\mainmatter
\chapter{B}
\end{document}

(I haven't really checked whether \@tempa and \@tempb are safe to use here.)

The above is a more minimised version of the example from here: https://tex.stackexchange.com/questions/633441

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions