我尝试在不支持的 Jupyter Notebook 中用这种格式编写一个线性方程组 \systeme
,我可以通过以下方式执行包含两边方程的第一个块
\begin{align*}
\left\{
\begin{alignedat}{5}
\color{green} x& {}\color{green}{+}{} & \color{green}{2y}& {}\color{green}+{} & \color{green}{3z} & \color{green}{=} &\color{green}{6} \\
2x& {}-{} & 3y& {}+{} & 2z & = &14 \\
3x& {}+{} & y& {}-{} & z & = &-2
\end{alignedat}
\right . \xrightarrow{\text{multiply first by -3}}
\left\{
\begin{alignedat}{5}
\color{green} {-3x}& {}\color{green}{+}{} & \color{green}{-6y}& {}\color{green}-{} & \color{green}{9z} & \color{green}{=} &\color{green}{-18} \\
2x& {}-{} & 3y& {}+{} & 2z & = &14 \\
3x& {}+{} & y& {}-{} & z & = &-2
\end{alignedat}
\\
\\
\left\{
\begin{alignedat}{5}
{}& {}{}{} & {}{}{} & {} & {} {} \\
\\
\\
\end{alignedat}
\right . \xrightarrow{\text{multiply first by -3}}
\right .
\left\{
\begin{alignedat}{5}
\color{green} {-3x}& {}\color{green}{+}{} & \color{green}{-6y}& {}\color{green}-{} & \color{green}{9z} & \color{green}{=} &\color{green}{-18} \\
2x& {}-{} & 3y& {}+{} & 2z & = &14 \\
3x& {}+{} & y& {}-{} & z & = &-2
\end{alignedat}
\right .
\end{align*}
但我不知道如何对齐其他块。
答案1
您发布的代码和屏幕截图似乎没有太多共同点。以下解决方案采用了第 1 行中的部分代码,但在接下来的两行中切换到屏幕截图中的材料。
\documentclass{article}
\usepackage{amsmath,array,xcolor}
\newcolumntype{C}{>{{}}c<{{}}}
\newcommand\myarray[1]{%
\begingroup
\renewcommand\arraystretch{1.33}
\setlength\arraycolsep{0pt}
\left\{
\begin{array}{ rCrCrCr }
#1
\end{array}\right.
\endgroup}
\newcommand\cgr{\color{green}}
\begin{document}
\begin{alignat*}{3}
&\myarray{%
\cgr x &\cgr + &\cgr 2y &\cgr + &\cgr 3z &\cgr = &\cgr 6 \\
2x & - & 3y & + & 2z & = & 14 \\
3x & + & y & - & z & = & -2 }
&\quad &\xrightarrow{\text{multiply first by $-3$}} &\quad
&\myarray{%
\cgr -3x &\cgr - &\cgr 6y &\cgr - &\cgr 9z &\cgr = &\cgr -18 \\
2x & - & 3y & + & 2z & = & 14 \\
3x & + & y & - & z & = & -2 }
\\
&&&\xrightarrow{\text{2nd}=\text{2nd}-2\times\text{1st}} &
&\myarray{%
x & + & 2y & + & 3z & = & 6 \\
& - & 7y & - & 4z & = & 2 \\
3x & + & y & - & z & = &-2 }
\\
&&&\xrightarrow{\text{3rd}=\text{3rd}-3\times\text{1st}} &
&\myarray{%
x & + & 2y & + & 3z & = & 6 \\
& - & 7y & - & 4z & = & 2 \\
& - & 5y & - & 10z & = & -20 }
\end{alignat*}
\end{document}
答案2
如果第一个方程不需要颜色,那么您可以使用一个对齐点并借助systeme
和eqparbox
包的简单解决方案:
\documentclass{article}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{systeme}
\usepackage{amssymb}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[1]{$\scriptstyle#2$}}
\begin{document}
\begin{align*}
\systeme{x + 2y + 3z = 6, 2x - 3y + 2z = 14, 3x + y - z = -2 }
& \xrightarrow[\eqmathbox{\scriptstyle\text{line 3}\leftarrow \text{line 3} -3\,\text{line 1}}]{\text{line 2}\leftarrow \text{line 2}- 2\,\text{line 1}}
\systeme{x + 2y+ 3z = 6, -7y - 4z = 2, -5y - 10z = -20} \\
& \xrightarrow{\eqmathbox{\text{line 3}\leftarrow \text{line 3}\div -5}}
\systeme{x + 2y+ 3z = 6, -7y - 4z = 2, y + 2z = 4} \\
& \xrightarrow{\eqmathbox{\text{line 2}\leftrightarrow \text{line 3}}}
\systeme{x + 2y+ 3z = 6, y + 2z = 4, -7y - 4z = 2} \\
& \xrightarrow[]{\eqmathbox{\text{line 3}\leftrightarrow \text{line 3} + 7\,\text{line}2}}
\systeme{x + 2y+ 3z = 6, y + 2z = 4, 10z = 30}
\end{align*}
\end{document}
答案3
我尝试这样做,但如果有更好的方法,我将不胜感激。这不是一个好方法,但在 Jupyter 中是可行的。
**Example 5.2**
$$
\begin{gather*}
\left\{
\begin{alignedat}{7}
x& {}+{} & 2y& {}+{} & 3z& = &6 \\
2x& {}-{} & 3y& {}+{} & 2z& = &14 \\
3x& {}+{} & y& {}-{} & z& = &-2
\end{alignedat}
\right . \xrightarrow{(2) = (2) - 2 \times (1)}
\left\{
\begin{alignedat}{7}
x& {}+{} & 2y& {}+{} & 3z & = &6 \\
& {}-{} & 7y& {}-{} & 4z & = &2 \\
3x& {}+{} & y& {}-{} & z & = &-2
\end{alignedat}
\\
\\
\begin{alignedat}{7}
\quad& \quad & \quad& \quad & \quad & \quad &\qquad \\
\\
\\
\end{alignedat}
\right . \xrightarrow{(3) = (3) - 3 \times (1)}
\left\{
\begin{alignedat}{7}
x& {}+{} & 2y& {}+{} & 3z & = &6 \\
& {}-{} & 7y& {}-{} & 4z & = &2 \\
& {}-{} & 5y& {}-{} & 10z& = &-20
\end{alignedat}
\right .
\\
\begin{alignedat}{7}
\quad& \quad & \quad& \quad & \quad & \quad &\qquad \\
\\
\\
\end{alignedat}
\xrightarrow{\quad(2) \leftrightarrow (3)\quad}
\left\{
\begin{alignedat}{7}
x& {}+{} & 2y& {}+{} & 3z & = &6 \\
& {}-{} & 5y& {}-{} & 10z & = &-20 \\
& {}-{} & 7y& {}-{} & 4z & = &2
\end{alignedat}
\right .
\\
\begin{alignedat}{7}
\quad& \quad & \quad& \quad & \quad & \quad &\; \\
\\
\\
\end{alignedat}
\xrightarrow{\;(2)=(2)\div -5\quad}
\left\{
\begin{alignedat}{7}
x& {}+{}& 2y& {}+{} & 3z & = &6 \\
& {}{}{}& y& {}+{} & 2z & = &4 \\
& {}-{}& 7y& {}-{} & 4z & = &2
\end{alignedat}
\right .
\\
\begin{alignedat}{7}
\quad& \quad & \quad& \quad & \quad & \quad &\; \\
\\
\\
\end{alignedat}
\xrightarrow{\;(3)=(3) + 7 \times (2) \quad}
\left\{
\begin{alignedat}{7}
x& {}+{}& 2y& {}+{} & 3z & = &6 \\
& {}{}{}& y& {}+{} & 2z & = &4 \\
& {}{}{}& {}& {}{}{} & 10z & = &30
\end{alignedat}
\right .
\end{gather*}
$$