结合使用子方程和 alignat 时对齐不正确

结合使用子方程和 alignat 时对齐不正确
\documentclass[a4paper, 12pt, fleqn]{book}
\usepackage[utf8,ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{siunitx}  
\usepackage[fleqn,centertags]{mathtools}
\begin{document}

This is ordinary text and below 3 blocks of equations. The first one without using subequations.
\begin{alignat}{2}
 &a     &&=b ~,\label{1a}\\[1ex]
 &alpha &&=beta~,\label{1b} \\[1ex]
 &c     &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923}{kN/m^2} \label{1c} \\[1ex]
 &cc    &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923.08}{kN/m^2} \label{1d}
\end{alignat}%
The second block uses the subequation environment.
{\allowdisplaybreaks [4]
\begin{subequations}\label{1}
%\noeqref{1a,1b,1c,1d}
\begin{alignat}{2}
 &a     &&=b ~,\label{1a}\\[1ex]
 &alpha &&=beta~,\label{1b} \\[1ex]
 &c     &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923}{kN/m^2} \label{1c} \\[1ex]
 &cc    &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923.08}{kN/m^2} \label{1d}
\end{alignat}
\end{subequations}}%
The alignment on the left side is fine in both cases. However, in the second case there is too much horizontal space left of the "=" sign. When the equation (5d) is removed, or if I reduce the length of (5d) by deleting one or more digits again, the alignment is fine, as can be seen below.
{\allowdisplaybreaks [4]
\begin{subequations}\label{1}
%\noeqref{1a,1b,1c,1d}
\begin{alignat}{2}
 &a     &&=b ~,\label{1a}\\[1ex]
 &alpha &&=beta~,\label{1b} \\[1ex]
 &c     &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923}{kN/m^2} \label{1c} \\[1ex]
 &cc    &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923}{kN/m^2} \label{1d}
\end{alignat}
\end{subequations}}
\end{document}   

这是我得到的:

在此处输入图片描述

答案1

你运气不好。如你所见,第二个显示中的标签未对齐:amsmath在这种情况下可能应该做得更好,至少发出对齐太宽的警告。

由于您使用的是fleqn,您可以通过假装长方程实际上稍微短一些来解决问题。

\documentclass[a4paper, 12pt, fleqn]{book}
\usepackage[T1]{fontenc}
\usepackage{siunitx}  
\usepackage[fleqn,centertags]{mathtools}
\usepackage{amsmath}

\begin{document}

This is ordinary text and below 3 blocks of equations. The first one without using subequations.
\begin{alignat}{2}
 &a     &&=b ~,\label{1a}\\[1ex]
 &alpha &&=beta~,\label{1b} \\[1ex]
 &c     &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923}{kN/m^2} \label{1c} \\[1ex]
 &cc    &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923.08}{kN/m^2} \label{1d}
\end{alignat}
The second block uses the subequation environment.
\begin{subequations}\label{1}
\begin{alignat}{2}
 &a     &&=b ~,\label{x1a}\\[1ex]
 &alpha &&=beta~,\label{x1b} \\[1ex]
 &c     &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923}{kN/m^2} \label{x1c} \\[1ex]
 &cc    &&=\frac{\num{72000}\cdot\num{50000}\,(1 - \num{0.30})}{\num{50000}\,(1 - \num{0.30}) -
           2\cdot\num{72000}\cdot\num{0.25}^2} = \SI{96923.08}{kN/m^2}
           \hspace{-2em}
           \label{x1d}
\end{alignat}
\end{subequations}

\end{document}  
  1. 切勿\allowdisplaybreaks在文档的最终版本中使用。您可以在撰写文档时在序言中使用它,但在文档结尾处显示的分页符必须谨慎选择。

  2. 加载毫无意义ansinew。删除该inputenc调用。

  3. 为什么要将左侧对齐?

在此处输入图片描述

相关内容