I am in great need of keeping long words set in teletype fonts on the same line of output in both TeX and LaTeX documents. Neither TeX nor LaTeX breaks the line ahead of teletype text when horizontal boxes overflow. The command \allowbreak exists in Plain TeX, and maybe it even existed in Basic TeX back in the late ’70s. Sadly that command doesn’t do what I want. Maybe I’m missing something vital.

A long time ago I began using a macro called \goodlinebreak. Here are both the TeX and LaTeX versions of that macro.

\def\goodlinebreak{\hfil\penalty200\hfilneg }
\newcommand{\goodlinebreak}{\hfil\penalty200\hfilneg }

Type something like:

Use multicast addresses like \goodlinebreak
{\tt FF38:30:2001:DB8:1234::ABA:CAB}.

If the multicast address would overflow the typeset line, then (La)TeX will simply break the line at the point indicated.