The available monospace fonts are mostly too wide for convenient use in documenting code (Courier is an extreme example). Although narrower fonts exist (Prestige Elite, and zcoN, a narrowed Courier), they are mostly based on 10cpi designs, or they may not go well with the body font, or may lack variants such as bold and italic.

I can scale a monospace font in both height and width with fontspec’s Scale parameter, but it only accepts a single decimal value (or the Match instructions). What I want to do is to narrow the font, so that it keeps its height but is slightly squeezed horizontally. I have tested what I want, using the \scalebox command, so I am satisfied that it won't appear too distorted.

Is there any way to achieve this in XeLaTeX, or will I have to created some modified font files?


See 6.7 Font transformations in the documentation:

\setmonofont{Courier New}
Courier \addfontfeature{FakeStretch=0.5} Courier

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.