对齐子方程

对齐子方程

代码的输出全是错的。我怎样才能让它从左边距“X”厘米处开始?

\documentclass[11,fleqn]{article}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{mathtools}
\usepackage{hyperref,parskip}
\usepackage{booktabs,multicol,multirow,tabularx}
\usepackage{longtable}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\title{TEST}

\begin{document}
\noindent
\maketitle    

The third term can be expanded as follows:
\begin{subequations}
\begin{align}
-E[2P_hL_hQ(P_h-\bar{P})]\\
&=-2QE[(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})]\\
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
&\qquad -2QE(P_h-\bar{P})^2\bar{L}\nonumber\\
&\qquad -2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L})\nonumber\\
&\qquad -2QE\bar{P}\bar{L}(P_h-\bar{P})\nonumber\\
\text{after tedius manipulation, can be reduced to}\\
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
&\qquad -2Q\bar{L}\sigma_{P_hL_h}
\end{align}
\end{subequations}

\end{document}

谢谢!!

答案1

您的代码中主要有两个问题,第一个命令的位置&\text方程式中间的命令。使用\intertext{...}表示对齐方程式中间的文本,使用\qquad或任何其他\hspace{<length>}您想要的与\phantoms 组合的命令来调整缩进。最后要注意的是11的选项\documentclass,应该是11pt

\documentclass[11pt,fleqn]{article}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{mathtools}
\usepackage{hyperref,parskip}
\usepackage{booktabs,multicol,multirow,tabularx}
\usepackage{longtable}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\title{TEST}
\setlength{\parindent}{0in}    
\begin{document}
\maketitle    

The third term can be expanded as follows:
\begin{subequations}
\begin{align}
&{-E}[2P_hL_hQ(P_h-\bar{P})]  \\
&\qquad =-2QE(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})\nonumber\\
&\qquad =-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
&\qquad =-2QE(P_h-\bar{P})^2\bar{L}\nonumber\\
&\qquad \phantom{={}}-2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L})\nonumber\\
&\qquad \phantom{={}}-2QE\bar{P}\bar{L}(P_h-\bar{P})\nonumber\\
\intertext{After tedius manipulation, can be reduced to}
&\qquad =-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
&\qquad \phantom{={}}-2Q\bar{L}\sigma_{P_hL_h}
\end{align}
\end{subequations}

\end{document}

在此处输入图片描述

答案2

目前还不清楚输出的方式全部错误但两条线-E[2P_hL_hQ(P_h-\bar{P})]\\\text{after tedius manipulation, can be reduced to}\\都缺少对齐点,这将导致一些麻烦。通过在第一行前面添加一些负空间,第一个等式实际上可以放在一行上。\interline使用这个答案为了让文本不干扰两侧的对齐,这似乎比简单地使用更合适\text

在此处输入图片描述

\documentclass[11,fleqn]{article}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{mathtools}
\usepackage{hyperref,parskip}
\usepackage{booktabs,multicol,multirow,tabularx}
\usepackage{longtable}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\title{TEST}

\begin{document}
\noindent
\maketitle    

The third term can be expanded as follows:
\begin{subequations}
\begin{align}
\hspace{-1em}-E[2P_hL_hQ(P_h-\bar{P})]
&=-2QE[(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})]\\
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
&\qquad -2QE(P_h-\bar{P})^2\bar{L}\nonumber\\
&\qquad -2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L})\nonumber\\
&\qquad -2QE\bar{P}\bar{L}(P_h-\bar{P})
\intertext{after tedius manipulation, can be reduced to}
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
&\qquad -2Q\bar{L}\sigma_{P_hL_h}
\end{align}
\end{subequations}

\end{document}

答案3

使用\intertext而不是\text,这样对齐时就不会考虑它。由于您使用mathtools,因此在这里看起来更好。请注意,如果您加载,\shortintertext则不必加载 ,如果您加载 ,则不必加载后者,这是 amsmath 的扩展。amstextamsmathmathtools

第一行也应该以 来引入\MoveEqLeft

由于现在有空间容纳更长的行,我建议采用行数较少的布局作为可能的变体:

\documentclass[11,fleqn]{article}
\usepackage{verbatim}
\usepackage[showframe]{geometry} %
\usepackage{caption}
\usepackage{mathtools}
\usepackage{hyperref,parskip}
\usepackage{booktabs,multicol,multirow,tabularx}
\usepackage{longtable}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\title{TEST}

\begin{document}
\noindent
\maketitle

The third term can be expanded as follows:
\begin{subequations}
  \begin{align}
    \MoveEqLeft -E[2P_hL_hQ(P_h-\bar{P})]\\
      & =-2QE[(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})] \\
      & =-2QE(P_h-\bar{P})²(L_h-\bar{L})\nonumber \\
      & \qquad -2QE(P_h-\bar{P})²\bar{L}\nonumber \\
      & \qquad -2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L})\nonumber \\
      & \qquad -2QE\bar{P}\bar{L}(P_h-\bar{P})\nonumber \\
    \shortintertext{after tedious manipulation, can be reduced to}
      & =-2QE(P_h-\bar{P})²(L_h-\bar{L})\nonumber \\
      & \qquad -2Q\bar{L}\sigma_{P_hL_h}
  \end{align}
\end{subequations}

The third term can be expanded as follows:
\begin{subequations}
  \begin{align}
    \MoveEqLeft -E[2P_hL_hQ(P_h-\bar{P})]\\
    &=-2QE[(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})]\\
      & =\!\begin{aligned}[t] -2QE(P_h & -\bar{P})²(L_h-\bar{L}) -2QE(P_h-\bar{P})²\bar{L} \\
    & -2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L}) -2QE\bar{P}\bar{L}(P_h-\bar{P})%
    \end{aligned}\nonumber\\
    \shortintertext{after tedious manipulation, can be reduced to}
    &=-2QE(P_h-\bar{P})²(L_h-\bar{L})-2Q\bar{L}\sigma_{P_hL_h}
  \end{align}
\end{subequations}

\end{document} 

在此处输入图片描述

答案4

在此处输入图片描述

或者

在此处输入图片描述

\documentclass[11,fleqn]{article}
\usepackage{mathtools}
\usepackage{hyperref,parskip}

\usepackage{showframe}
\renewcommand*\ShowFrameColor{\color{red}}
\begin{document}
The third term can be expanded as follows:
\begin{subequations}
    \begin{align}
    \MoveEqLeft
-E[2P_hL_hQ(P_h-\bar{P})]       &                   \notag      \\
    &=-2QE[(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})]\\
    &=-2QE(P_h-\bar{P})^2(L_h-\bar{L})              \notag      \\
    &\qquad -2QE(P_h-\bar{P})^2\bar{L}              \notag      \\
    &\qquad -2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L})   \notag      \\
    &\qquad -2QE\bar{P}\bar{L}(P_h-\bar{P})         \notag       
\intertext{after tedius manipulation, can be reduced to:} 
    &=-2QE(P_h-\bar{P})^2(L_h-\bar{L})              \notag      \\
    &\qquad -2Q\bar{L}\sigma_{P_hL_h}
\end{align}
\end{subequations}

\begin{subequations}
    \begin{align}
    \MoveEqLeft
-E[2P_hL_hQ(P_h-\bar{P})]       &                   \notag      \\
    & = -2QE[(P_h-\bar{P}+\bar{P})(L_h-\bar{L}+\bar{L})(P_h-\bar{P})]\\
    & = \begin{multlined}[t][0.7\textwidth]
        -2QE(P_h-\bar{P})^2(L_h-\bar{L}) - 2QE(P_h-\bar{P})^2\bar{L}    \\
        -2QE\bar{P}(P_h-\bar{P})(L_h-\bar{L}) - 2QE\bar{P}\bar{L}(P_h-\bar{P})         \end{multlined}                             \notag
\intertext{after tedius manipulation, can be reduced to:}
    &=-2QE(P_h-\bar{P})^2(L_h-\bar{L}) - 2Q\bar{L}\sigma_{P_hL_h}
\end{align}
\end{subequations}

\end{document}

相关内容