0

I reconnect myself to this discussion: Matching punctuation size to small caps The interesting solution posted by James Ashton "to make the apostrophe an active character and define it to use \raisebox only when small caps are in effect" is no more working with the more recent versions of fontspec, for this options acts globally (as explains the following discussion: New version of fontspec gives WordSpace error). I post an (almost) MWE, that is not working; the aim is to create an "ad hoc" small caps font. I'm not able to change the code to adjust it. Has anyone a solution? Thanx

\documentclass[a4paper,12pt]{report}
\usepackage{fontspec}
\defaultfontfeatures{Contextuals=NoAlternate}
\setmainfont[Ligatures=TeX,Scale=1.1]{EB Garamond}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newfontfamily{\spacedcaps}{EB Garamond}[%
\makeatletter
\let\horn@scshape\scshape
\def\scshape{\addfontfeature{Letters=UppercaseSmallCaps,Letters=SmallCaps,LetterSpace=2,WordSpace=1.2}%
\let\horn@apos\horn@@apos}
\def\horn@apos{'}
\def\horn@@apos{\raisebox{-0.4ex}{\kern0.06em'}}
% make ' (apostophe) active for the argument to chapter so we can lower it for small caps
\let\horn@chapter\chapter
\def\chapter{
\begingroup
    \catcode`\'=\active\begingroup\lccode`\~=`\'\lowercase{\endgroup\def~{\protect\horn@apos}}
    \horn@@chapter
}
\def\horn@@chapter#1{%
\horn@chapter{#1}
\endgroup
}
\makeatother
]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\@ifdefinable\@chap@title@rule@gap{\newdimen\@chap@title@rule@gap}
\renewcommand{\@makechapterhead}[1]{%
    \vspace*{50\p@}%
    \begingroup
    \setlength\parindent{\z@}%
    \setlength\parskip{\z@skip}%
    \raggedright \normalfont \large \scshape
    \hrule
    \setlength\prevdepth{\z@}%
    \setlength\@chap@title@rule@gap{.1\baselineskip}
    \nobreak \vspace{\@chap@title@rule@gap}%
    \interlinepenalty\@M
    \noindent\MakeLowercase #1\par
    \addtolength\@chap@title@rule@gap{.5\baselineskip}
    \addtolength\@chap@title@rule@gap{-\prevdepth}%
    \nobreak \vspace{\@chap@title@rule@gap}%
    \hrule
    \nobreak \vskip 40\p@
    \endgroup
    \setlength\prevdepth{\z@}%
}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{hyperref}
\hypersetup{unicode=true,hidelinks}

\begin{document}
\tableofcontents

\chapter{quel ramo dell'ago di como}
QUEL RAMO DELL'AGO DI COMO

\textsc{quel ramo dell'ago di como}

\end{document}
2

This won't work with \scshape, but I don't think you need it.

\documentclass[a4paper,12pt]{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{xparse,l3regex}

\setmainfont{EB Garamond}[
  Scale=1.1,
  Contextuals=NoAlternate,
]
\newfontfamily{\spacedcaps}{EB Garamond}[
  Scale=1.1,
  Letters={UppercaseSmallCaps,SmallCaps},
  LetterSpace=2,
  WordSpace=1.2,
]

\setmainlanguage[babelshorthands=true]{italian}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\RenewDocumentCommand{\textsc}{m}
 {
  \tl_set:Nn \l_tmpa_tl { #1 }
  \regex_replace_all:nnN { ['’] } { \c{loweredapostrophe} } \l_tmpa_tl
  {\spacedcaps \tl_use:N \l_tmpa_tl}
 }
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter
\newcommand{\loweredapostrophe}{\raisebox{-0.4ex}{\kern0.06em’}}
\newdimen\@chap@title@rule@gap
\renewcommand{\@makechapterhead}[1]{%
    \vspace*{50\p@}%
    \begingroup
    \setlength\parindent{\z@}%
    \setlength\parskip{\z@skip}%
    \raggedright \normalfont \large \scshape
    \hrule
    \setlength\prevdepth{\z@}%
    \setlength\@chap@title@rule@gap{.1\baselineskip}
    \nobreak \vspace{\@chap@title@rule@gap}%
    \interlinepenalty\@M
    \noindent\textsc{#1}\par
    \addtolength\@chap@title@rule@gap{.5\baselineskip}
    \addtolength\@chap@title@rule@gap{-\prevdepth}%
    \nobreak \vspace{\@chap@title@rule@gap}%
    \hrule
    \nobreak \vskip 40\p@
    \endgroup
    \setlength\prevdepth{\z@}%
}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{hyperref}
\hypersetup{unicode=true,hidelinks}

\begin{document}
\tableofcontents

\chapter{quel ramo dell'ago di como}
QUEL RAMO DELL'AGO DI C’OMO

\textsc{quel ramo dell'ago di c’omo}

\end{document}

Note that both ' and can be used and will be lowered. It would be easy to also cope with other quotation marks as well.

enter image description here

  • It works in a parfetct way (obviously...). Thanx a lot! – user41063 Mar 5 '17 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.