如何在数学中换行
我想表达以下句子(source_location也是斜体,它没有正确呈现):
每个条目都有一个元组列表:< 源位置、读/写、行程计数器、发生、死亡(在稍后)>
我目前的解决方法是:
$ \left\langle
\textit{source\_location}, \textit{R/W}, \textit{trip\_counter},
\textit{occurrence}, \textit{killed} \text{(explained in the later)}
\right\rangle $
我使用 2 列纸张。这< ..>太长了,但没有换行,因为它是数学题。在这种情况下如何自动(或手动)换行?看来 \left\langle
和 \right\rangle
应该在一个数学中。所以,很难闯入多项数学。
$<$
和 $>$
是一个替代方案,但我不喜欢它。
I'd like to express the following sentence (source_location is also italic, it's not correctly rendered):
Each entry has a list of tuple: < source_location, R/W, trip_counter, occurrence, killed (explained in the later) >
My current workaround for this is:
$ \left\langle
\textit{source\_location}, \textit{R/W}, \textit{trip\_counter},
\textit{occurrence}, \textit{killed} \text{(explained in the later)}
\right\rangle $
I'm using 2-column paper. This < .. > is too long, but no line break because it is a math. How do I automatically (or manually) put line break in such case? It seems that \left\langle
and \right\rangle
should be in a single math. So, hard to break into multiple maths.
$<$
and $>$
would be an alternative, but I don't like it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
默认情况下,LaTeX 确实允许内联数学突破行,但有许多限制。具体来说,在您的情况下,使用
\left...\right
将所有内容放入不可破坏的数学组中,因此第一步是将它们替换为普通的\langle.. .\rangle
或\bigl\langle...\bigr\rangle
。然而,这仍然不足以允许换行;通常仍然只允许在关系或运算符之后使用,而不是像逗号这样的标点符号。 (我认为这就是正在发生的事情;我还没有停下来查找这一点。)因此,您希望通过在每个逗号后写入
\linebreak[1]
来指示允许的换行符可能发生的位置。根据您执行此操作的频率,最好编写一个命令将您的“元组”包装成一个不错的命令。为了在源代码中编写此内容:
这里是
\mytuple
的定义,它考虑了上述所有内容:LaTeX does allow inline maths to break over lines by default, but there are a number of restrictions. Specifically, in your case, using
\left...\right
puts everything inside a non-breakable math group, so the first step is to replace them with either just plain\langle...\rangle
or perhaps\bigl\langle...\bigr\rangle
.However, this still isn't enough to permit linebreaking; usually that's still only allowed after relations or operators, not punctuation such as the comma. (I think this is what's going on anyway; I haven't stopped to look this up.) So you want indicate where allowable line breaks may occur by writing
\linebreak[1]
after each comma.Depending how often you have to do this, it may be preferable to write a command to wrap your "tuples" into a nice command. In order to write this in your source:
here's a definition of
\mytuple
that takes all of the above into account:为什么不定义一个新命令:
然后使用
\tuple{sourcelocation}{R/W}{tripcounter}{occurrence}{killed}
Why not define a new command:
Then use
\tuple{sourcelocation}{R/W}{tripcounter}{occurrence}{killed}
似乎有一个软件包可以解决这个问题,名为
breqn
。您可以尝试一下并告诉我们(我没有使用过)。There seems to be a package that addresses that problem, called
breqn
. You can try this and let us know (I haven't used that).我会使用 AMSmath 的align*环境。此外,您可以只添加“\”来换行吗?也应该在数学环境中工作。或者,您可以分离方程。
I'd use the align* environment from AMSmath. Furthermore you could just add "\" to break the lines? Should work in math environments, too. Alternatively you could separate the equations.
在数学表达式中任何需要换行的地方(甚至在两个括号之间)都可以使用 \linebreak。这将强制断线。
Use \linebreak inside the math expression wherever you want a new line even between 2 brackets. This will enforce the line to be broken.