[Tex/LaTex] Multiple indented sub-equations within an align environment

align

\documentclass{article}

\usepackage{amsmath,amssymb}

\begin{document}

\begin{flalign}

& E=MC^2 \\

\begin{flalign}

& U = \frac{1}{2} + bh & V = \frac{1}{2} - bh & B=H \\ % want to have this sub equation indented\\

& H= \frac{1}{2}(S-X) & H1= \frac{1}{2}(S+X) & B=H \\ % want to have this sub equation indented

\end{flalign}

& Y=MX +b 

\end{flalign}

\end{document}

Please I would appreciate it if I could be helped align my sub equations within an align environment with numbering of sub equations as (2.1 a) and major equations as (2.1)

Best Answer

Like this?

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\numberwithin{equation}{section} % for equation numbering section.equation
\usepackage{blindtext} % just for demo

\begin{document}    
    \blindtext
    \setcounter{section}{2} % just for demo
    \begin{align}       
         e&=mc^2  \\                
            &&U&= \frac{1}{2} + bh  &V&= \frac{1}{2} - bh  &B&=H \tag{\theequation{} a} \\          
            &&H&= \frac{1}{2}(S-X)  &H_1&= \frac{1}{2}(S+X) &B&=H \tag{\theequation{} b} \\         
         Y&=mX +b       
    \end{align}
    \blindtext  
\end{document}

enter image description here


or alternatively:

\begin{align}       
    \MoveEqLeft[3] e=mc^2  \\ % change the number [3] to other values in order to change the indent             
        U&= \frac{1}{2} + bh  &V&= \frac{1}{2} - bh  &B&=H \tag{\theequation{} a}\\     
        H&= \frac{1}{2}(S-X)  &H_1&= \frac{1}{2}(S+X) &B&=H \tag{\theequation{} b}\\                
    \MoveEqLeft[3] Y=mX +b      
\end{align}

enter image description here


or a third alternative:

\begin{alignat}{7}  
    e&=mc^2  \\                 
        & &&U&&= \frac{1}{2} + bh,  &&V&&= \frac{1}{2} - bh,  &&B&&=H \tag{\theequation{} a}\\      
        & &&H&&= \frac{1}{2}(S-X),\quad  &&H_1&&= \frac{1}{2}(S+X),\quad &&B&&=H \tag{\theequation{} b}\\               
     Y&=mX +b       
\end{alignat}

enter image description here


And finally:

If you want to change the indent in the last example, just change the kerning in the first row:

\begin{alignat}{7}  
    e&=mc^2\mkern-20mu  \\ % change this value to nevative or positive values in order to change the indent             
        & &&U&&= \frac{1}{2} + bh,  &&V&&= \frac{1}{2} - bh,  &&B&&=H \tag{\theequation{} a}\\      
        & &&H&&= \frac{1}{2}(S-X),\quad  &&H_1&&= \frac{1}{2}(S+X),\quad &&B&&=H \tag{\theequation{} b}\\               
     Y&=mX +b\mkern-10000mu % leave this value      
\end{alignat}