LaTeX:防止文本范围内的换行 [英] LaTeX: Prevent line break in a span of text

查看:169
本文介绍了LaTeX:防止文本范围内的换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止LaTeX在我的 \ texttt {...} \ url {...} 文本区域中插入换行符?我里面没有空格可以替换为,只是在符号上打断了.

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.

更新:我不想引起行溢出,我宁愿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 \ begin {sloppypar} ... \ end {sloppypar} 至少可以调整一下此行为.另一种可能性是 \ raggedright (或 \ begin {raggedright} ... \ end {raggedright} ).

Use \sloppy or \begin{sloppypar}...\end{sloppypar} to adjust this behavior, at least a little. Another possibility is \raggedright (or \begin{raggedright}...\end{raggedright}).

这篇关于LaTeX:防止文本范围内的换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆