LaTeX: Prevent line break in a span of text

后端 未结 5 1366
离开以前
离开以前 2021-01-30 06:07

How can I prevent LaTeX from inserting linebreaks in my \\texttt{...} or \\url{...} text regions? There\'s no spaces inside I can replace with ~

5条回答
  •  臣服心动
    2021-01-30 06:38

    \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}).

提交回复
热议问题