进入环境时抑制换行

发布于 2024-08-18 22:40:20 字数 357 浏览 6 评论 0原文

在下面的LaTeX片段中,如何抑制进入align*环境后在XXX和YYY之间自动生成的换行符。

XXX
\begin{minipage}{t}{0.1in}
  YYY
  \begin{align*}
     ZZZ...
  \end{align*}
\end{minipage}

XXX YYY
ZZZ...

我想要

XXX YYY ZZZ...

也许 align* 只是错误的环境,但我找不到提供类似功能但不引入换行符的替代方案。

In the following LaTeX fragment, how can I suppress the newline that is automatically generated between XXX and YYY after entering the align* environment.

XXX
\begin{minipage}{t}{0.1in}
  YYY
  \begin{align*}
     ZZZ...
  \end{align*}
\end{minipage}

yields

XXX YYY
ZZZ...

But I want

XXX YYY ZZZ...

Perhaps align* is simply the wrong environment, but I couldn't find an alternative that provides similar functionality, yet doesn't introduce a linebreak.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

枫以 2024-08-25 22:40:20

我不太确定它是否应该像这样使用,但也许 aligned 环境就是您所追求的?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
XXX
\begin{minipage}[t]{1in}
YYY
$
  \begin{aligned}
     ZZZ...
  \end{aligned}
$
\end{minipage}
\end{document}

I'm not really sure if it's supposed to be used like this, but perhaps the aligned environment is what you're after?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
XXX
\begin{minipage}[t]{1in}
YYY
$
  \begin{aligned}
     ZZZ...
  \end{aligned}
$
\end{minipage}
\end{document}
羅雙樹 2024-08-25 22:40:20

Latex 在进入 minipage 环境时强制换行的原因是,您从以水平模式输入文本转变为引入新的类似段落的环境,minipage。您可以使用 \vbox{...} 停止此换行符,因此:

XXX
\vbox{
\begin{minipage}[t]{2in} % Note that the first parameter is optional
  YYY
  ...
\end{minipage}
}

\vbox 不会停止对齐环境的换行符,因为这是由与环境的 Tex 代码:为此使用 Will 建议使用对齐。

The reason Latex forces a linebreak when entering the minipage environment is that you move from entering text in horizontal mode, to introducing a new paragraph-like environment, minipage. You can stop this linebreak by using \vbox{...}, so:

XXX
\vbox{
\begin{minipage}[t]{2in} % Note that the first parameter is optional
  YYY
  ...
\end{minipage}
}

\vbox won't stop the align environment's linebreak, though, because that is explicitly made by with the environment's Tex code: for that use Will's suggestion of using aligned.

旧时光的容颜 2024-08-25 22:40:20

对于单行、内联方程,您可以使用 $ 数学环境分隔符:

XXX
\begin{minipage}{t}{0.1in}
    YYY $ZZZ...$
\end{minipage}

For single-line, in-line equations, you can use the $ math environment delimiter:

XXX
\begin{minipage}{t}{0.1in}
    YYY $ZZZ...$
\end{minipage}
爱的故事 2024-08-25 22:40:20

很难确切地知道您想要什么 - 为什么要使用 align?需要调整的是什么?

也许您正在寻找 tabbing 乳胶?

\begin{tabbing}
text \= more text \= still more text \= last text \\
second row \>  \> more \\
.
.
.
\end{tabbing}

It's hard to know exactly what you want—why are you using align? What is it that needs aligning?

Maybe you're looking for tabbing in Latex?

\begin{tabbing}
text \= more text \= still more text \= last text \\
second row \>  \> more \\
.
.
.
\end{tabbing}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文