I asked a question earlier about \verb
and overfull hbox :
In-line \verb — overfull hbox problem
And regarding the solution there, changed many of my \verb
s to \texttt{}
s. I have come up with a new problem now. An example:
\documentclass {article}
\begin{document}
\section {Introduction}
The entry point is in \texttt{TRCS.Main()} (\texttt{TRCS\char`\\TRCS.cs}).
The stateless (see \S 3.4.3) forms are started immediately, then another controller
is invoked, namely \texttt{Workflow}.
\end{document}
Compiling this example will show my problem. \texttt{Workflow}
causes an overflow, and a rather significant one. What should I do to alleviate the problem? Thanks in advance for your help!
Best Answer
Informally speaking, TeX break lines at spaces (and a few other positions in a word, called "discretionary break"). Discretionary break is not allowed in typewriter typesetting. If there is no space in
\texttt{}
, it cannot break.For your example, there is no help using
\texttt
instead of\verb
. There are several ways to solve such kind of problem:Enable microtype for pdfTeX (suggested):
Enable hythenation of TT text:
Use a sloppy paragraph:
or
This may cause bad spacing.
Enable break manually:
This is not useful here, but may be useful for
\texttt{TRCS.\allowbreak Main()}