XeTeX – Using the Helvet Package with UTF-8 Source

helveticaunicodexetex

I'm trying to use a Helvetica clone in a document I'm creating using XeLaTeX, and I need to be able to use a variety of fairly basic Unicode characters in my document (particularly the 'vulgar' fraction glyphs, like ¼, ½ and ¾). Here's a MWE:

\documentclass{article}
\usepackage{fontspec}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault}
\begin{document}
\textsf{Touché 3¼}
\end{document}

The selected font is Nimbus Sans L, which is close enough to Helvetica for my needs. However, when I process this the PDF output reads 'Touché 3ij' – the 'é' works fine, but not the '¼'. I've tried removing the fontspec and/or inputenc lines with no effect; removing the fontenc line causes the document to revert to Computer Modern.

I'm not wedded to using the helvet package, and if I load the font manually, I get all the glyphs I want, so the problem seems not be with my Nimbus Sans L font. However, the font is no longer scaled by 95% as the helvet package does. This means it is perceptibly larger than the other text in the document. Here's a MWE:

\documentclass{article}
\usepackage{fontspec}
\setsansfont{Nimbus Sans L}
\renewcommand\familydefault{\sfdefault}
\begin{document}
\textsf{Touché 3¼}
\end{document}

I don't really mind whether I fix the first MWE to have all the glyphs I want, or fix the second MWE to scale the font. I've tried adding this to the second MWE, with absolutely no effect:

\usepackage{relsize}
\relscale{0.95}

Can anyone help?

Best Answer

enter image description here

You can scale the font using the fontspec declarations, eg this ensures the lower case letters match:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}
\setsansfont[Scale=MatchLowercase]{Nimbus Sans L}
%\renewcommand\familydefault{\sfdefault}
\begin{document}
Abc \textsf{Touché 3¼}
\end{document}

Never use T1 encoding with xelatex, it will break hyphenation completely as xelatex only loads hyphenation patterns for TU encoding.

(I commented out the resetting the default family to make it easier to compare lowercase letter sizes)