How can I prevent LaTeX from inserting linebreaks in my \texttt{...}
or \url{...}
text regions? There's no spaces inside I can replace with ~
, it's just breaking on symbols.
Update: I don't want to cause line overflows, I'd just rather LaTeX insert linebreaks before these regions rather than inside them.
\mbox
is the simplest answer. Regarding the update:
TeX prefers overlong lines to adding too much space between words on a line; I think the idea is that you will notice the lines that extend into the margin (and the black boxes it inserts after such lines), and will have a chance to revise the contents, whereas if there was too much space, you might not notice it.
Use \sloppy
or \begin{sloppypar}...\end{sloppypar}
to adjust this behavior, at least a little. Another possibility is \raggedright
(or \begin{raggedright}...\end{raggedright}
).