你如何排列方程组?

How do you align a system of equations?

我希望这些方程排成一行,以便所有变量和运算符都直线下降。我已经尝试了几种不同的技术,但一直无法让它发挥作用。

没有:

\begin{align*}
  x+y+z=1 \ 
  x+y+z=\frac{5}{2} \ 
  x+y+z=5
\end{align*}

fiddle.

使用&=表示等号对齐:

\begin{align*}
  x+y+z &= \,1 \ 
  x+y+z &= \frac{5}{2} \ 
  x+y+z &= \,5
\end{align*}

您可以在数学模式下使用这些:

\; - a thick space
\: - a medium space
\, - a thin space     <-- used this here in front of the simple numbers
\! - a negative thin space

来源:http://www.emerson.emory.edu/services/latex/latex_119.html

您可以重新阅读 align* 环境 f.e。这里:https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics#align_and_align*

只需在每行前添加 & 即可得到所需的输出。

\begin{align*}
  &x+y+z=1 \ 
  &x+y+z=\frac{5}{2} \ 
  &x+y+z=5
\end{align*}

有一个包 systeme 用于线性方程组,可以自动对齐变量和值 - 它甚至可以为您检测变量。

在标准设置中,您只需编写

\begin{equation*}
  \systeme{
  x+y+z = 1,
  x+y+z = \frac{5}{2},
  x+y+z = 5
  }
\end{equation*}

\begin{equation*}
  \systeme{
  3x +7z = 20,
  y - 17z = -3,
  24x + 15y = 7
  }
\end{equation*}

这可能适合也可能不适合您的口味。可以通过在 \systeme 命令前加上

指定空定界符来删除括号
\sysdelim..

. 是一个空的占位符,\sysdelim 需要两个,因为它指定了一个左分隔符和一个右分隔符)。 要使分数更大,您可以使用 amsmath 包(您已经加载)中的 \dfrac,但是您必须帮助调整行距:

\documentclass{article}

\usepackage{amsmath,systeme}

\begin{document}

\begin{equation*}
  \systeme{
  x+y+z = 1,
  x+y+z = \frac{5}{2},
  x+y+z = 5
  }
\end{equation*}

No delimeter, displaystyle fraction and line spacing
\begin{equation*}
  \sysdelim..\systeme{
  x+y+z = 1,
  x+y+z = \dfrac{5}{2}\rule[-3ex]{0pt}{7ex},
  x+y+z = 5
  }
\end{equation*}

\end{document}

或者,可以通过命令 \syslineskipcoeff 在所有行之间添加额外的间距,这是一个比例因子:

\documentclass{article}

\usepackage{amsmath,systeme}

\begin{document}

No delimeter, displaystyle fraction and line spacing
\begin{equation*}
  \sysdelim..\syslineskipcoeff{2}\systeme{
  x+y+z = 1,
  x+y+z = \dfrac{5}{2},
  x+y+z = 5
  }
\end{equation*}

\end{document}

这是一个仿照 Yossi Farjoun 在 https://tex.stackexchange.com/questions/4273/align-two-inequalities 中的第二个答案的解决方案。 它需要在 \!\!\: 的两列之间进行水平 space 调整。 \vphantom 命令同步它们的垂直间距。

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
\begin{aligned}  x+y+z &=\ x+y+z &= \vphantom{\frac{5}{2}}\ x+y+z &= \end{aligned}\!\!\:
\begin{gathered} 1       \ \frac{5}{2}                    \ 5        \end{gathered}
\end{equation*}

\end{document}