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 \verbs to \texttt{}s. I have come up with a new problem now. An example:

\documentclass {article}
\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}.

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!

2 Answers 2


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:

  1. Enable microtype for pdfTeX (suggested):

  2. Enable hythenation of TT text:

  3. Use a sloppy paragraph:



    The entry point is...

    This may cause bad spacing.

  4. Enable break manually:

    \texttt{Work\allowbreak flow}

    This is not useful here, but may be useful for \texttt{TRCS.\allowbreak Main()}

  • 1
    The tip of \allowbreak was helpful for me. When writing method names in code, I would suggest against using hyphenation and toward \allowbreak. I'm making a habit of inserting these at the case changes in in my camel-case method names.
    – greg
    Jan 6, 2012 at 18:44
  • But I still don't get a "-" in the end of the line, indicating that next lines word is part of previous line! Otherwise nice.
    – netigger
    May 2, 2013 at 13:20

You can have a look at the packages url and path. Both have pros and cons, depending on what you want. So far, I used path and am pleased with it.

Note that the command \path{} exists even without loading the path package. From what I saw, its behaviour is more or less the same, but you cannot specify the break characters.

Finally, in addition to \allowbreak already mentioned, you can also use \- to define conditional breaks. But in that case, LaTeX will put a dash at the end of the line.

  • To my surprise, \path does not support unicode characters.
    – kakyo
    May 12, 2016 at 19:43

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.