TransWikia.com

Group of equations together - middle one getting unexpected indentation

TeX - LaTeX Asked on December 26, 2020

Here I am want to create three lines of equations together so that they will get the same equation numbering for all three equations. However, when I use aligned or split, I get an unexpected indentation. I want the second line to be aligned with the first and third line.

documentclass[twoside]{article}

usepackage{amsmath}

begin{document}

We recall the Bellman equation

begin{equation}
    begin{split} label{eq:bellman-eq} 
    Q^{pi}_{h}(s, a) &= (r_h + mathbb{P}_h V^{pi}_{h+1})(s, a),
    V^{pi}_{h}(s) &= langle Q^{pi}_{h}(s,cdot), pi_h(cdot mid s) rangle, 
    V^{pi}_{H+1}(s) &= 0 
end{split}
end{equation}

end{document}


Here is the screenshot:

enter image description here

2 Answers

If you want both the material to the left of the = symbols to be left-aligned and the = symbols to be aligned vertically as well, you should use an alignedat environment instead of a split environment.

enter image description here

documentclass[twoside]{article}
usepackage{amsmath,amssymb}
begin{document}
We recall the Bellman equation
begin{equation} label{eq:bellman-eq} 
    begin{alignedat}{2} 
    &Q^{pi}_{h}(s, a) &&= (r_h + mathbb{P}_h V^{pi}_{h+1})(s, a),
    &V^{pi}_{h}(s)    &&= langle Q^{pi}_{h}(s,cdot), pi_h(cdot mid s) rangle, 
    &V^{pi}_{H+1}(s)  &&= 0 
end{alignedat}
end{equation}
end{document}

Correct answer by Mico on December 26, 2020

documentclass[twoside]{article}
usepackage{amsmath, amssymb}

begin{document}

We recall the Bellman equation
begin{align} label{eq:bellman-eq} 
  &Q^{pi}_{h}(s, a) = (r_h + mathbb{P}_h V^{pi}_{h+1})(s, a),notag 
  &V^{pi}_{h}(s) = langle Q^{pi}_{h}(s,cdot), pi_h(cdot mid s) rangle, 
  &V^{pi}_{H+1}(s) = 0 notag
end{align}

end{document}

Also, split and aligned can be used:

begin{equation}
  begin{split} label{eq:bellman-eq} 
    &Q^{pi}_{h}(s, a) = (r_h + mathbb{P}_h V^{pi}_{h+1})(s, a),
    &V^{pi}_{h}(s) = langle Q^{pi}_{h}(s,cdot), pi_h(cdot mid s) rangle, 
    &V^{pi}_{H+1}(s) = 0 
  end{split}
end{equation}

Answered by AboAmmar on December 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP