对齐:在对齐问题中使用对齐

对齐:在对齐问题中使用对齐

我希望前两部分看起来align好像是align环境中仅有的两个项目,其余部分在等号处对齐,并由一些空间隔开以表示不同的等式。

现在编译后的效果如下:

在此处输入图片描述

因此,我想将前两个对齐如下:

在此处输入图片描述

最后我想强调的是

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\begin{document}
\begin{alignat*}{2}
    \vec{x}_1(t) &=
    \begin{pmatrix}
      x_1^{(1)}(t)\\
      x_2^{(1)}(t)
    \end{pmatrix} &&{}=
    \begin{pmatrix}
      X_1^{(1)}\cos(\omega_1t + \phi_1)\\
      r_1X_1^{(1)}\cos(\omega_1t + \phi_1)
    \end{pmatrix}\\
    \vec{x}_2(t) &=
    \begin{pmatrix}
      x_1^{(2)}(t)\\
      x_2^{(2)}(t)
    \end{pmatrix} &&{}=
    \begin{pmatrix}
      X_1^{(2)}\cos(\omega_2t + \phi_2)\\
      r_2X_1^{(2)}\cos(\omega_2t + \phi_2)
    \end{pmatrix}\\
    r_1 &=
    \begin{aligned}
      \frac{3k - m\omega_1^2}{2k} && \qquad
      X_1^{(1)} &&{}= \frac{1}{r_2 - r_1}\bigg[(r_2x_1(0) - x_2(0))^2 +
      \frac{(-r_2\dot{x}_1(0) + \dot{x}_2(0))^2}{\omega_1^2}\bigg]^{1/2}
    \end{aligned}\\
    r_2 &=
    \begin{aligned}
      \frac{3k - m\omega_2^2}{2k} && \qquad
      X_1^{(2)} &&{}= \frac{1}{r_2 - r_1}\bigg[(-r_1x_1(0) + x_2(0))^2 +
      \frac{(r_1\dot{x}_1(0) - \dot{x}_2(0))^2}{\omega_2^2}\bigg]^{1/2}
    \end{aligned}\\
    \phi_1 &=
    \begin{aligned}
      \arctan\bigg[\frac{-r_2\dot{x}_1(0) + \dot{x}_2(0)}
      {\omega_1^2(r_2x_1(0) - x_2(0))}\bigg] && \qquad
      \phi_2 &&{}= \arctan\bigg[\frac{r_1\dot{x}_1(0) - \dot{x}_2(0)}
      {\omega_2^2(-r_1x_1(0) + x_2(0))}\bigg]
    \end{aligned}
  \end{alignat*}
\end{document}

答案1

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\begin{document}
\begin{alignat*}{2}
    \vec{x}_1(t) &=
    \begin{pmatrix}
      x_1^{(1)}(t)\\
      x_2^{(1)}(t)
    \end{pmatrix} =
    \mathrlap{\begin{pmatrix}
      X_1^{(1)}\cos(\omega_1t + \phi_1)\\
      r_1X_1^{(1)}\cos(\omega_1t + \phi_1)
    \end{pmatrix}}\\
    \vec{x}_2(t) &=
    \begin{pmatrix}
      x_1^{(2)}(t)\\
      x_2^{(2)}(t)
    \end{pmatrix} =
    \mathrlap{\begin{pmatrix}
      X_1^{(2)}\cos(\omega_2t + \phi_2)\\
      r_2X_1^{(2)}\cos(\omega_2t + \phi_2)
    \end{pmatrix}}\\
    r_1 &=
      \frac{3k - m\omega_1^2}{2k} &
      X_1^{(1)} &= \frac{1}{r_2 - r_1}\bigg[(r_2x_1(0) - x_2(0))^2 +
      \frac{(-r_2\dot{x}_1(0) + \dot{x}_2(0))^2}{\omega_1^2}\bigg]^{1/2}
\\
    r_2 &=
      \frac{3k - m\omega_2^2}{2k} &
      X_1^{(2)} &= \frac{1}{r_2 - r_1}\bigg[(-r_1x_1(0) + x_2(0))^2 +
      \frac{(r_1\dot{x}_1(0) - \dot{x}_2(0))^2}{\omega_2^2}\bigg]^{1/2}
\\
    \phi_1 &=
      \arctan\bigg[\frac{-r_2\dot{x}_1(0) + \dot{x}_2(0)}
      {\omega_1^2(r_2x_1(0) - x_2(0))}\bigg] &
\phi_2 &= \arctan\bigg[\frac{r_1\dot{x}_1(0) - \dot{x}_2(0)}
      {\omega_2^2(-r_1x_1(0) + x_2(0))}\bigg]
  \end{alignat*}
\end{document}

答案2

我不明白所提议的布局和随之而来的各种符号的对齐方式应该达到什么目的=。为了避免给人留下各种方程式以可能不是预期的方式相互关联的印象,我会简化布局,使用单一align*环境并使用\qquad语句在需要的地方插入一些水平空格。请注意,使用\biggl[而不是仅仅\bigg[遵循这两个\arctan语句很重要;如果省略l(mathopen) 说明符,LaTeX 将插入不适当的空格。

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for "align*" and "pmatrix" environments
\usepackage{newpxtext}             % Palatino text font
\usepackage[euler-digits]{eulervm} % Euler math font
\begin{document}
\begin{align*}
    \vec{x}_1(t) &=
    \begin{pmatrix}
      x_1^{(1)}(t)\\
      x_2^{(1)}(t)
    \end{pmatrix} =
    \begin{pmatrix}
      X_1^{(1)}\cos(\omega_1t + \phi_1)\\
      r_1X_1^{(1)}\cos(\omega_1t + \phi_1)
    \end{pmatrix}\\
    \vec{x}_2(t) &=
    \begin{pmatrix}
      x_1^{(2)}(t)\\
      x_2^{(2)}(t)
    \end{pmatrix} =
    \begin{pmatrix}
      X_1^{(2)}\cos(\omega_2t + \phi_2)\\
      r_2X_1^{(2)}\cos(\omega_2t + \phi_2)
    \end{pmatrix}\\[2ex]  % additional vertical space
    r_1 &=
      \frac{3k - m\omega_1^2}{2k} \qquad
      X_1^{(1)} = \frac{1}{r_2 - r_1}\biggl[(r_2x_1(0) - x_2(0))^2 +
      \frac{(-r_2\dot{x}_1(0) + \dot{x}_2(0))^2}{\omega_1^2}\biggr]^{1/2}\\
    r_2 &=
      \frac{3k - m\omega_2^2}{2k}  \qquad
      X_1^{(2)} = \frac{1}{r_2 - r_1}\biggl[(-r_1x_1(0) + x_2(0))^2 +
      \frac{(r_1\dot{x}_1(0) - \dot{x}_2(0))^2}{\omega_2^2}\biggr]^{1/2}\\[2ex] % additional vertical space
    \phi_1 &=
      \arctan\biggl[\frac{-r_2\dot{x}_1(0) + \dot{x}_2(0)}
      {\omega_1^2(r_2x_1(0) - x_2(0))}\biggr] \qquad
      \phi_2 = \arctan\biggl[\frac{r_1\dot{x}_1(0) - \dot{x}_2(0)}
      {\omega_2^2(-r_1x_1(0) + x_2(0))}\biggr]
  \end{align*}
\end{document}

相关内容