TransWikia.com

How to get a shorter hyphen in text mode?

TeX - LaTeX Asked on January 9, 2021

I’m creating a title page with large fonts, in French, and I really hate the usual hyphen for such a big title. So I’m looking for a shorter hyphen, something elegant and simple. Here’s a MWE showing the issue (I’m using manual kerning to adjust the spacements, since it’s a big title on a title page. Not the main text!):

documentclass[11pt,letterpaper,twoside]{book}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[french]{babel}
usepackage{lmodern}
usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
usepackage{microtype}
usepackage{libertine}
renewcommand*familydefault{sfdefault}

begin{document}

raggedleft
        {fontsize{58}{0}selectfont{lkern-0.03em 'kern-0.10em ekern-0.02em skern-0.03em pkern-0.03em akern-0.02em ckern-0.02em etextperiodcentered tkern-0.03em ekern-0.03em mkern-0.04em pkern-0.03em s}}

        {fontsize{58}{0}selectfont{lkern-0.03em 'kern-0.10em ekern-0.02em skern-0.03em pkern-0.03em akern-0.02em ckern-0.02em e-tkern-0.03em ekern-0.03em mkern-0.04em pkern-0.03em s}}

        {fontsize{58}{0}selectfont{l'espace-temps}}

end{document}

Preview:

enter image description here

So is there a way to define or get a shorter hyphen, just for this title? I’m really jealous of the English word spacetime, which I can’t use in my French book!

One Answer

With fontspec, you have several options. One is to add the font feature FakeStretch= with a value less than 1.0.

documentclass[11pt]{book}
tracinglostchars=2
usepackage[french]{babel}
usepackage{fontspec}
usepackage{microtype}
usepackage{libertinus}
renewcommand*familydefault{sfdefault}

newcommandshorthyphen{{addfontfeature{FakeStretch=0.5}^^^^2010}}

begin{document}

raggedleft
        {huge l'espace-temps}
        
        {huge l'espace{shorthyphen}temps}
end{document}

Libertinus sample

If your font has it, you could substitute a shorter hyphen-like character, such as ﹣ (U+FE63 small hyphen-minus).

newcommandshorthyphen{^^^^fe63}

If you have a condensed or extra-condensed version of the font, you could load the hyphen character from that. If you’d previously declared newfontfamilycondensedfont{...}, that might be

newcommandshorthyphen{{condensedfont -}}

or if using the NFSS scheme where medium condensed is the series mc, something like

{fontseries{mc}selectfont -}

Answered by Davislor on January 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP