我正在尝试排版一个线性方程组,我想将每个项对齐以便于阅读。我所能做到的最好方法是使用 alignat 环境。
以下是我所写的和我得到的结果:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{alignat}{6}
&\text{Loop 1: } (\text{Z}_{\text{R}_1} +
\text{Z}_{\text{C}_1} +
\text{Z}_{\text{R}_2})&\text{I}_1(\omega) &-
(\text{Z}_{\text{C}_1} +
\text{Z}_{\text{R}_2})&\text{I}_2(\omega)
& & &= 1 \\
&\text{Loop 2: } \qquad -(\text{Z}_{\text{R}_2} +
\text{Z}_{\text{C}_1})&\text{I}_1(\omega) &+
(\text{Z}_{\text{L}_1} + \text{Z}_{\text{R}_4} +
\text{Z}_{\text{R}_2} +
\text{Z}_{\text{C}_1})&\text{I}_2(\omega)
&- (\text{Z}_{\text{L}_1})&\text{I}_3(\omega) &= 0 \\
&\text{Loop 3: } & & -
(\text{Z}_{\text{L}_1})&\text{I}_2(\omega)
&- (\text{Z}_{\text{R}_3} + \text{Z}_{\text{C}_2}, +
\text{Z}_{\text{L}_1})&\text{I}_3(\omega) &= 0
\end{alignat}
\end{document}
我将非常感激任何帮助我正确调整条款的帮助。
答案1
这是一个使用array
环境的解决方案。
\documentclass{article}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{C}{>{{}}c<{{}}} % for binary and relational operators
\newcolumntype{L}{>{$}l<{$}} % for the first (text) column
\begin{document}
\[
\setlength\arraycolsep{0pt}
\renewcommand{\arraystretch}{1.3}
\begin{array}{@{} L @{\quad} rCrCrCl @{}}
Loop 1:& (Z_{R_1} + Z_{C_1} + Z_{R_2})I_1(\omega)
&-&(Z_{C_1} + Z_{R_2})I_2(\omega)
& &
&=& 1 \\
Loop 2:&-(Z_{R_2} + Z_{C_1})I_1(\omega)
&+&(Z_{L_1}+Z_{R_4}+Z_{R_2}+Z_{C_1})I_2(\omega)
&-&(Z_{L_1})I_3(\omega)
&=& 0 \\
Loop 3:&
& &(Z_{L_1})I_2(\omega)
&-&(Z_{R_3} + Z_{C_2} + Z_{L_1})I_3(\omega)
&=& 0
\end{array}
\]
\end{document}
答案2
我建议这样做,将“循环”放在 中\shortintertext
。它要求几何图形具有适当的边距(您还可以使用 中的中等尺寸命令减小等式中的字体大小nccmath
:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{alignat}{4}
\shortintertext{Loop 1: \vskip -1ex}%
(\text{Z}_{\text{R}_1} + \text{Z}_{\text{C}_1} + \text{Z}_{\text{R}_2}) & \text{I}_1(\omega) & {}- (\text{Z}_{\text{C}_1} + \text{Z}_{\text{R}_2}) & \text{I}_2(\omega)& & & & = 1 \\
\shortintertext{Loop 2: \vskip -4ex}%
-(\text{Z}_{\text{R}_2} + \text{Z}_{\text{C}_1}) & \text{I}_1(\omega) & {}+ (\text{Z}_{\text{L}_1} + \text{Z}_{\text{R}_4} + \text{Z}_{\text{R}_2} + \text{Z}_{\text{C}_1}) & \text{I}_2(\omega) & {}- (\text{Z}_{\text{L}_1}) & \text{I}_3(\omega) & & = 0 \\
\shortintertext{Loop 3: \vskip -4ex} & & - (\text{Z}_{\text{L}_1})&\text{I}_2(\omega) &- (\text{Z}_{\text{R}_3} + \text{Z}_{\text{C}_2}, + \text{Z}_{\text{L}_1})&\text{I}_3(\omega) & & = 0
\end{alignat}
\end{document}