[texhax] overfull with \texttt{}

Uwe Lück uwe.lueck at web.de
Wed Jun 8 13:08:14 CEST 2005

At 16:53 06.06.05, Eduardo Pérez wrote:
>I'm having overfull when I use \texttt{}
>Is there a simple way to prevent this overfull problems when using
>\texttt{} ?

This is due to the fact that \texttt usually is installed with
\hyphenchar\font=-1, disabling hyphenation. So

     \texttt{\hyphenchar\font45\relax <text>}

enables hyphenation. Of course a shorthand may be useful.
And with long passages, one better defines an environment.

A passage in the LaTeX Companion shows how to change
the behaviour of ...tt... in general using \DeclareFontFamily.

Perhaps even \sloppy would at least avoid overfull.

For straight margins (entire \tt paragraphs, letters), I have used

     \fontdimen3\font=.167em \fontdimen4\font=.056em

but I admit that straight margins with \tt may exhibit bad taste.

Lucky typesetting,

More information about the texhax mailing list