LaTex,在对齐块之间对齐对齐字符

发布于 2024-09-01 01:41:29 字数 778 浏览 2 评论 0原文

我想在两个对齐块之间对齐两个对齐字符,以便我可以在推导中间有一些文本,并用方程保持水平对齐。例如,以下使用对齐的乳胶摘录

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}
some text in the middle
\begin{align*}
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

理想情况下,我希望第二个块中的方程的左侧与第一个块中的第二个方程的左侧对齐。我可以通过不在中间添加文本来解决此问题,但是,我想要此功能。

编辑

我想在两者之间有大量的文字。说出与普通段落一样排列的三到四行。在对齐块中添加文本是我没有提到的解决方法。

I would like to align two alignment characters between two align blocks so that I can have some text in the middle of a derivation with equations maintaining the horizontal alignment. For example the following excerpt of latex using align

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}
some text in the middle
\begin{align*}
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

Ideally I would like the left of the equation in the second block to line up with that of the second equation in the first block. I could do a workaround by not having text in the middle, however, I would like this functionality.

EDIT

I would like to have a good amount of text between. Say three to four lines that line up as normal paragraphs. Adding text in the alignment block is the workaround I poorly alluded to.

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

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

发布评论

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

评论(4

只想待在家 2024-09-08 01:41:29

有一个非常方便的命令:

\begin{align*}
    \int_0^1 x^2 &= \frac{1}{3} \\
    \intertext{I am the intertext. I am typesetted as normal text but dude, 
               the tabbing/alignment is carried over to the next slide. 
               Check it out!}
    \int_0^1 x^3 &= \frac{1}{4}
\end{align*}

据我所知,ams 用户指南中对此进行了描述。但我也是最近才发现的。

There is a very convenient command:

\begin{align*}
    \int_0^1 x^2 &= \frac{1}{3} \\
    \intertext{I am the intertext. I am typesetted as normal text but dude, 
               the tabbing/alignment is carried over to the next slide. 
               Check it out!}
    \int_0^1 x^3 &= \frac{1}{4}
\end{align*}

It's described in the ams userguide as far as I remember. But then, I also only discovered it very recently.

奈何桥上唱咆哮 2024-09-08 01:41:29

使用 \noalign

\begin{align*} 
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\ 
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\ 
    \noalign{\noindent some text in the middle.}
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right] 
\end{align*} 

Use \noalign:

\begin{align*} 
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\ 
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\ 
    \noalign{\noindent some text in the middle.}
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right] 
\end{align*} 
风尘浪孓 2024-09-08 01:41:29

尝试以下操作:

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\
    & \mbox{some text in the middle} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

如果您有很多文本,您可能想要使用 \phantom

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}
Some text in the middle, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text,
\begin{align*}
    \phantom{\frac{\delta \phi}{\delta x_1} = {}} & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

如果您不想使用 \phantom,这是我能想到的唯一解决方案如下:

\usepackage{multirow}
....
\begin{document}
\[ \begin{array}{rl}
        \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
        & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\[5mm]
\multicolumn{2}{l}{\parbox{\linewidth}{Some text in the middle, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text}}\\[1cm]
        & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{array} \]
\end{document}

我认为没有一种直接的方法可以“链接”一个表/eqnarray/与另一个表的一列的宽度。

Try the following:

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\
    & \mbox{some text in the middle} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

If you have lots of text, you probably want to use \phantom:

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}
Some text in the middle, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text,
\begin{align*}
    \phantom{\frac{\delta \phi}{\delta x_1} = {}} & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

If you don't want to use \phantom, the only solution I can come up with is the following:

\usepackage{multirow}
....
\begin{document}
\[ \begin{array}{rl}
        \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
        & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\[5mm]
\multicolumn{2}{l}{\parbox{\linewidth}{Some text in the middle, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text}}\\[1cm]
        & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{array} \]
\end{document}

I don't think there is a straight forward way of "linking up" the width of one column of one table / eqnarray / align with another.

无敌元气妹 2024-09-08 01:41:29

如果不需要太多文本,可以使用数学环境中的 \text 命令在单个 align* 环境中显示文本。

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\
    \text{some text in the middle.}\\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}

If you don't have to much text, you can use the \text command from the math environment to display your text inside a single align* environment.

\begin{align*}
    \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]\\
    \text{some text in the middle.}\\
    & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right]
\end{align*}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文