[Tex/LaTex] align for subequations

alignsubequations

The output with the code is all wrong. How can I get it to start "X" centimeters from the left margin?

\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}

Thanks!!

Best Answer

The main two problems in your code are the place of the first & and the \text command in the middle of the equations. Use \intertext{...} for a text in the middle of aligned equations and to adjust the indentation use \qquads or any other \hspace{<length>} as you want in combination with \phantoms. A final note is for the 11 option to the \documentclass, this should be 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}

enter image description here

Related Question