align for subequations

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\\
\text{after tedius manipulation, can be reduced to}\\
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
\end{align}
\end{subequations}

\end{document}


Thanks!!

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})]  \\
\intertext{After tedius manipulation, can be reduced to}
\end{align}
\end{subequations}

\end{document}


• Thank you all! All the answers work and produce results way better than what I have....I think I'll go with the last one; it's producing the exact look that I want. Thanks everyone for the help:)
– Chet
Nov 27, 2016 at 2:52
• Instead of saying "thank you" is better to up-vote all answer, if they are helped you :). Also I encourage you to read some text about settings of equation. For example manual for amsmath or mathtools, en.wikibooks.org/wiki/LaTeX/Mathematics, ctan.ijs.si/tex-archive/obsolete/info/math/voss/mathmode/… (regardless that it is obsolete, it is still very informative) etc. From all this literature you can see, that your approach to write multi line equations (as well corrected in accepted answer) is unusual. Happy TeX-ing! Nov 27, 2016 at 3:45
• Zarko - done! I'm a total newbie at Latek...so there's definitely a lot to learn. Thanks!
– Chet
Nov 27, 2016 at 19:09

It's somewhat unclear in what manner the output is all wrong but both the lines -E[2P_hL_hQ(P_h-\bar{P})]\\ and \text{after tedius manipulation, can be reduced to}\\ lack alignment points which will cause some trouble. By adding some negative space at the front of the first line the first equality can in fact sit on a single line. Using \interline as suggested in this answer to have text without disturbing the alignment either side, this seems more well suited than simply using \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\\
\intertext{after tedius manipulation, can be reduced to}
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})\nonumber\\
\end{align}
\end{subequations}

\end{document}


or

\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      \\
\intertext{after tedius manipulation, can be reduced to:}
&=-2QE(P_h-\bar{P})^2(L_h-\bar{L})              \notag      \\
\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}

• I see our answers are again very close! :o) Nov 27, 2016 at 1:06

Use \intertext instead of \text, so that it's not taken into account for the alignment. Since you use mathtools, \shortintertext is even better-looking here. Note you don't have to load amstext if you load amsmath, and you don't have to load the latter if you load mathtools, which is an extension of amsmath.

Also the first line should be introduced with \MoveEqLeft.

As there's now room for longer lines, I propose a layout with less lines as a possible variant:

\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 \\
\shortintertext{after tedious manipulation, can be reduced to}
& =-2QE(P_h-\bar{P})²(L_h-\bar{L})\nonumber \\
\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}