我想水平对齐所有三个或最后两个单独定义的子方程环境的等号。
代码:
\begin{subequations}
\begin{align}
\alpha_1 &=\frac{1}{4}\left[(L-1)^2 + \tan ^2\left(\frac{2\pi}{M}\right)(L+1)^2\right]\\
\alpha_2 &= 1 \\
\alpha_3 &=\alpha_1\\
\alpha_4 &=\alpha_1
\end{align}
\end{subequations}
The angle $\theta$ values are
\begin{subequations}
\begin{align}
\theta_1 &= \tan^{-1} \left[\frac{L+1}{L-1}\tan\left(\frac{2\pi}{M}\right)\right]\\
\theta_2 &= \pi - \theta_1\\
\theta_3 &=\theta_1\\
\theta_4 &=\frac{(M-2)\pi}{M} - \theta_1\\[5pt]
\end{align}
\end{subequations}
and
\begin{subequations}
\begin{align}
\phi_1 &= \frac{\pi}{2} - \theta_1\\
\phi_2 &= \frac{2\pi}{M}\\
\phi_3 &= \phi_1\\
\phi_4 &= \frac{2\pi}{M} + \theta_1
\end{align}
\end{subequations}
输出:
答案1
这是一个使用该eqparbox
包的简单技巧:我将每个第一个子方程的右侧放在\eqmathbox
具有相同标签的(自定义命令)中。这些 \eqmathboxes 是\eqmakebox
来自该包的简单 es,其参数在数学模式和显示样式中左对齐。每个具有相同标签的框都具有最宽内容的宽度。
\documentclass{article}
\usepackage{mathtools}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[#1][l]{$\displaystyle#2$}}
\begin{document}
\begin{subequations}
\begin{align}
\alpha_1 &=\eqmathbox{\frac{1}{4}\left[(L-1)^2 + \tan ^2\left(\frac{2\pi}{M}\right)(L+1)^2\right]}\\
\alpha_2 &= 1 \\
\alpha_3 &=\alpha_1\\
\alpha_4 &=\alpha_1
\end{align}
\end{subequations}
The angle $\theta$ values are
\begin{subequations}
\begin{align}
\theta_1 &= \eqmathbox{\tan^{-1} \left[\frac{L+1}{L-1}\tan\left(\frac{2\pi}{M}\right)\right]}\\
\theta_2 &= \pi - \theta_1\\
\theta_3 &=\theta_1\\
\theta_4 &=\frac{(M-2)\pi}{M} - \theta_1
\end{align}
\end{subequations}\vskip -6ex
\begin{subequations}
\begin{align}
\shortintertext{and}
\phi_1 &=\eqmathbox{ \frac{\pi}{2} - \theta_1}\\
\phi_2 &= \frac{2\pi}{M}\\
\phi_3 &= \phi_1\\
\phi_4 &= \frac{2\pi}{M} + \theta_1
\end{align}
\end{subequations}
\end{document}
答案2
使用changepage
with 包adjustwidth
。此环境有两个强制参数:{<left>}
添加特定量的左边距,以及{<right>}
添加特定量的右边距。参数{<left>}
就是您所需要的,您必须进行一些反复试验才能确定左边距到底需要多少。
\documentclass[]{IEEEtran}
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\usepackage{changepage}
\begin{document}
\begin{subequations}
\begin{align}
\alpha_1 &=\frac{1}{4}\left[(L-1)^2 + \tan ^2\left(\frac{2\pi}{M}\right)(L+1)^2\right]\\
\alpha_2 &= 1 \\
\alpha_3 &=\alpha_1\\
\alpha_4 &=\alpha_1
\end{align}
\end{subequations}
The angle $\theta$ values are
\begin{adjustwidth}{-15.2mm}{0mm}
\begin{subequations}
\begin{align}
\theta_1 &= \tan^{-1} \left[\frac{L+1}{L-1}\tan\left(\frac{2\pi}{M}\right)\right]\\
\theta_2 &= \pi - \theta_1\\
\theta_3 &=\theta_1\\
\theta_4 &=\frac{(M-2)\pi}{M} - \theta_1\\[5pt]
\end{align}
\end{subequations}
\end{adjustwidth}
and
\begin{adjustwidth}{-42mm}{0mm}
\begin{subequations}
\begin{align}
\phi_1 &= \frac{\pi}{2} - \theta_1\\
\phi_2 &= \frac{2\pi}{M}\\
\phi_3 &= \phi_1\\
\phi_4 &= \frac{2\pi}{M} + \theta_1
\end{align}
\end{subequations}
\end{adjustwidth}
\end{document}
答案3
IMNSHO,如果您要对齐 12 个=
符号以便使 12 个方程式具有清晰统一的外观,您还应该使用单个parentequation
计数器,即使用单个subequations
(和align
)环境,以便为方程式的呈现方式提供更多的视觉一致性。
\documentclass{article}
\usepackage{mathtools} % for '\shortintertext' macro
\begin{document}
\begin{subequations}
\begin{align}
\alpha_1 &=\frac{1}{4}\Bigl[(L-1)^2
+\tan^2\Bigl(\frac{2\pi}{M}\Bigr)
(L+1)^2\Bigr]\\
\alpha_2 &= 1 \\
\alpha_3 &=\alpha_1\\
\alpha_4 &=\alpha_1\\
\intertext{The angle $\theta$ values are}
\addtocounter{parentequation}{1}
\theta_1 &= \tan^{-1} \Bigl[\frac{L+1}{L-1}
\tan\Bigl(\frac{2\pi}{M}\Bigr)\Bigr]\\
\theta_2 &= \pi - \theta_1\\
\theta_3 &=\theta_1\\
\theta_4 &=\frac{(M-2)\pi}{M} - \theta_1
\shortintertext{and}
\phi_1 &= \frac{\pi}{2} - \theta_1\\
\phi_2 &= \frac{2\pi}{M}\\
\phi_3 &= \phi_1\\
\phi_4 &= \frac{2\pi}{M} + \theta_1
\end{align}
\end{subequations}
\end{document}
事实上,我甚至会进一步提供“统一”的外观,通过将一些方程式中的分数符号更改为内联分数样式。
\documentclass{article}
\usepackage{mathtools} % for '\shortintertext' macro
\begin{document}
\begin{subequations}
\begin{align}
\alpha_1 &=\tfrac{1}{4}\bigl[(L-1)^2
+\tan^2(2\pi/M)
(L+1)^2\bigr]\\
\alpha_2 &= 1 \\
\alpha_3 &=\alpha_1\\
\alpha_4 &=\alpha_1\\
\intertext{The angle $\theta$ values are}
\addtocounter{parentequation}{1}
\theta_1 &= \tan^{-1} \bigl[(L+1)/(L-1)\tan(2\pi/M)\bigr]\\
\theta_2 &= \pi - \theta_1\\
\theta_3 &=\theta_1\\
\theta_4 &=(M-2)\pi/M - \theta_1
\shortintertext{and}
\phi_1 &= \pi/2 - \theta_1\\
\phi_2 &= 2\pi/M\\
\phi_3 &= \phi_1\\
\phi_4 &= 2\pi/M + \theta_1
\end{align}
\end{subequations}
\end{document}