你如何对齐方程组?

问题描述 投票:3回答:3

我希望这些方程式排列,以便所有变量和运算符直接向下。我尝试了一些不同的技术但却无法使其发挥作用。

enter image description here

不:

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

fiddle

latex mathjax
3个回答
4
投票

使用&=表示与等号对齐:

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

aligned and spaced over a tiny bit

您可以在数学模式中使用它们:

\; - 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 *


6
投票

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

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

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

Sample output

要么

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

Second general example

这可能适合您的口味,也可能不适合您。可以通过在\systeme命令之前指定空分隔符来删除括号

\sysdelim..

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

Second sample

\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在所有行之间添加额外的间距,这是一个缩放因子:

Third sample

\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}

4
投票

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

\begin{align*}
  &x+y+z=1 \\ 
  &x+y+z=\frac{5}{2} \\ 
  &x+y+z=5
\end{align*}
© www.soinside.com 2019 - 2024. All rights reserved.