LaTeX:防止文本跨度中的换行符 [英] LaTeX: Prevent line break in a span of text
问题描述
如何防止 LaTeX 在我的 exttt{...}
或 url{...}
文本区域中插入换行符?里面没有空格我可以用 ~
代替,它只是打破符号.
How can I prevent LaTeX from inserting linebreaks in my exttt{...}
or url{...}
text regions? There's no spaces inside I can replace with ~
, it's just breaking on symbols.
更新:我不想导致行溢出,我宁愿 LaTeX 在这些区域之前而不是在它们内部插入换行符.
Update: I don't want to cause line overflows, I'd just rather LaTeX insert linebreaks before these regions rather than inside them.
推荐答案
mbox
是最简单的答案.关于更新:
mbox
is the simplest answer. Regarding the update:
TeX 更喜欢过长的行而不是在一行的单词之间添加太多的空格;我认为这个想法是你会注意到延伸到边缘的线条(以及它在这些线条之后插入的黑框),并且有机会修改内容,而如果空间太大,你可能不会注意到它.
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.
使用 sloppy
或 egin{sloppypar}...end{sloppypar}
来调整这种行为,至少稍微调整一下.另一种可能性是
aggedright
(或 egin{raggedright}...end{raggedright}
).
Use sloppy
or egin{sloppypar}...end{sloppypar}
to adjust this behavior, at least a little. Another possibility is
aggedright
(or egin{raggedright}...end{raggedright}
).
这篇关于LaTeX:防止文本跨度中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!