0

The font I am using for titles in my document (Duvall) is missing the glyph for apostrophe.

I tried to work around this by defining a macro to use a superscript comma for the few occasions where I need an apostrophe in a title:

\newcommand{\apost}{\raisebox{1ex}{,}}

\section{Murphy\apost s Law}

This works fine for the display of the title, but in the ToC (which uses a different font) it displays as "Murphy,s Law".

Is there a way to redefine the apostrophe glyph for the Duvall font only?

9
  • 1
    which engine? with lualatex you could modify the font on loading Commented May 1 at 15:09
  • dafont.com/duvall.charmap?f=0 suggests the font does have a straight ' in the usual ascii slot ' U+0027 Commented May 1 at 15:12
  • If you are happy with the raised comma you could use \section[Murphy's Law]{Murphy\apost s Law} Commented May 1 at 15:24
  • 1
    as you can see showing code doesn't work in comments, please always in the question include a complete small document that shows the problem (but I would probably use the ' that's in the font) Commented May 1 at 16:33
  • 2
    @rallg have a look at the typewriter package to see what "minor improvements" can be inflicted on a font. Commented May 1 at 17:36

1 Answer 1

0

Thanks for the hint to modify the font. I eventually managed to get what I wanted. It's a bit of a hack but good enough for the three headings in my document that contain apostrophes.

Here's what I did:

\RequirePackage{fontspec}

% Hack for missing apostrophe glyph in Duvall font

% Create a custom encoding based on TU which redefines single quote as comma
\DeclareUnicodeEncoding{apost}{
  \input{tuenc.def}
  \EncodingSymbol{\textquotesingle}{"002C}
}

% Apply the custom encoding to the Duvall font only
\newfontfamily\titlefont{DuvallSmallCaps}[NFSSEncoding=apost]

% Macro to raise comma so it becomes an apostrophe
\newcommand*{\apost}{\raisebox{1ex}{\textquotesingle}}

Now in the document:

\part{Murphy\apost s Law}

displays with a "smart" apostrophe (raised comma) in the body text and a normal single quote in the PDF table of contents.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.