3

How can I increase the letterspacing (tracking) of monospace fonts in Xetex?

This doesn't seem to work:

\documentclass{minimal}
\setlength{\parindent}{0cm}
\usepackage{fontspec}

\begin{document}

\addfontfeature{LetterSpace=0}
HLHHLLH\\
\addfontfeature{LetterSpace=50.0}
HLHHLLH\\

\addfontfeature{LetterSpace=0}
\texttt{HLHHLLH}\\
\addfontfeature{LetterSpace=50.0}
\texttt{HLHHLLH}\\

\end{document}

Results in:

screenshot of rendering of non-tracking in fontspec monospace font

4

You should put the \addfontfeature inside the \texttt, and you must load the fonts with the fontspec commands:

\documentclass{article}
\setlength{\parindent}{0cm}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\setmonofont{Latin Modern Mono}
\begin{document}

\texttt{\addfontfeature{LetterSpace=50}HLHHLLH}

\end{document}

enter image description here

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.