[XeTeX] Monospace font, not being set in monospace

Barry MacKichan barry.mackichan at mackichan.com
Thu Sep 30 19:51:06 CEST 2010


  Try (I used Courier instead of Pro Typewriter Underwood, but it should 
be about the same):

\documentclass{article}

\usepackage{fontspec}

\setmonofont[WordSpace={1.0,0.0,0.0}]{Courier}

\begin{document}

\noindent

\frenchspacing

\texttt{123456789012345678901234567890\\

x. xx. xx. xx. xx. xx xx xx xx\\

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\

}

\end{document}



On 9/28/10 9:39 PM, mskala at ansuz.sooke.bc.ca wrote:
> I'd like to use the commercial font "Pro Typewriter Underwood," from
> http://www.vintagetype.com/, with XeLaTeX, to produce a close
> approximation of old-style typewriter output.  But I can't get it to
> correctly recognize that the font is a monospace font for the purposes of
> inter-sentence spacing.  "Word" spaces come out to the same width as
> non-space characters, as they should.  But each "sentence" space comes out
> to about 1.35 times the width of a "word" space or non-space character,
> when it should be exactly 2.  As a result, the text no longer fits the
> grid, and the purpose of using a monospace font is defeated.
>
> Although there's a specific commercial font I want to use, I think the
> problem is actually internal to the fontspec package, because it happens
> with every monospace font I've tried including whatever the default is.
> This file demonstrates it:
>
>     \documentclass{article}
>     \usepackage{fontspec}
>     \begin{document}
>     \noindent
>     \texttt{x. xx\\
>     xxxxxx}
>     \end{document}
>
> The two lines should be the same length, but they aren't.  The
> space after the period, which should be as wide as two xes, is
> actually about as wide as one and a third of them.  Comment
> out \usepackage{fontspec} and the lines become the same length.
>
> I'm using XeTeX 3.1415926-2.2-0.9997.4 and 2010/09/19 v2.1, both from
> TeXLive 2010.
>
> I took a look in fontspec.sty hoping that I might find a place where it
> says how much space to insert between sentences, which I might adjust, but
> it seems not to be that simple.  I tried playing with the \sfcode settings
> as might be appropriate in regular TeX, but I couldn't get them to have
> any effect; I suspect that whatever fontspec does is overriding that.
>
> It occurs to me that since I only want to use one font in the entire
> document (basic typewriters don't have selectable fonts...), maybe I don't
> need fontspec, but could just manually simulate its effect by defining
> some macros of my own, Plain-TeX style, to serve the function of loading
> the one font.  Is that route likely to be viable?


More information about the XeTeX mailing list