TransWikia.com

Aligning multiline equation in align

TeX - LaTeX Asked on July 18, 2021

begin{align}
    max quad & b_s 
    text{s.t.} quad & Af = b 
    quad & b_d = - b_s 
    quad & b_i = 0 forall i neq s, t 
    quad & 0 leq f_{ij} leq infty
end{align}

I want the equals signs to be aligned but I can’t get it to work. Can someone help?

2 Answers

Do you mean this?

begin{align}

    max quad & b_s 
    text{s.t.} quad  Af & = b 
    quad  b_d & = - b_s 
    quad  b_i & = 0 quad forall i neq s, t 
    quad  0 leq & f_{ij} leq infty

end{align}

Answered by daniel robledo on July 18, 2021

Probably you looking for

enter image description here

documentclass{article}
usepackage{amsmath}

begin{document}
begin{align}
    max quad b_s 
    text{s.t.} quad Af    & = b 
                      b_d   & = - b_s 
                      b_i   & = 0, forall i neq s, t 
                      0     & leq f_{ij} leq infty
end{align}
end{document}

There is also a specific package optidef, with the option maxi!

documentclass[a4paper,12pt]{article}
usepackage{amsmath,amssymb}
usepackage{optidef}

begin{document}
begin{maxi!}|s|[2]<b>
{}{b_s}{}
{}
addConstraint{Af}{=b}
addConstraint{b_d}{=-b_s}
addConstraint{b_i}{=0, quad forall i neq s, t}
addConstraint{}{0 leq f_{ij} leq infty}
end{maxi!}
end{document}

enter image description here

Answered by Zarko on July 18, 2021

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