1

I have four equations and the second one is not aligned with the others. I have tried 'aligned' in the code below but it doesn't work as expected.

    \begin{equation}
    \begin{aligned}
    \min_{w} \quad & \frac{\mu_{s_i}^Tw - r_f}{\sqrt{w^T\sum_{s_i} w}} 
     + \gamma w^T w\\
    \textrm{s.t.} \quad & 1^T w = 1\\
    & 0 \leq w_i \leq 0.5 \quad & \textrm{i = 1,2,..,7}   \\
    \end{aligned}
    \end{equation}
    
    
    \begin{equation}
    \begin{aligned}
    \max_{w} \quad & \mu_{s_i}^Tw + \gamma w^T w\\
    \textrm{s.t.} \quad & \sqrt{w^T\sum_{s_i} w} = \sigma_{s_i}\\
      & 1^T w = 1\\
      & 0 \leq w_i \leq 0.5 \quad & \textrm{i = 1,2,..,7}   \\
    \end{aligned}
    \end{equation}
    
    
    \begin{equation}
    \begin{aligned}
    \min_{w} \quad & \sqrt{w^T\sum_{s_i} w} + \gamma w^T w\\
    \textrm{s.t.} \quad & \mu_{s_i}^Tw = R_{s_i}\\
      & 1^T w = 1\\
      & 0 \leq w_i \leq 0.5 \quad & \textrm{i = 1,2,..,7}   \\
    \end{aligned}
    \end{equation}
    
   
    \begin{equation}
    \begin{aligned}
    \min_{w} \quad & \sqrt{w^T\sum_{s_i} w} + \gamma w^T w\\
    \textrm{s.t.} \quad & 1^T w = 1\\
      & 0 \leq w_i \leq 0.5 \quad & \textrm{i = 1,2,..,7}   \\
    \end{aligned}
    \end{equation}

Here is the screen shot:

enter image description here

2
  • 1
    Welcome to TSE.
    – user108724
    Commented Aug 7, 2020 at 4:52
  • 4
    What exactly are you asking? Equations are centered, your equations does not have the same width and thus are not "aligned" when compared to each other. Btw use \dots for the ... part
    – daleif
    Commented Aug 7, 2020 at 5:09

1 Answer 1

2

Your equations are completely distinct and are not grouped in one environment. eqs 15, 17, 18 are aligned properly by chance because their widths are equal. here is a simple example (also there are many tricks and ways for doing this):

\begin{align}
&\begin{aligned}
\min_{w} \quad & \frac{\mu_{s_i}^Tw - r_f}{\sqrt{w^T\sum_{s_i} w}} 
+ \gamma w^T w\\
\textrm{s.t.} \quad & 1^T w = 1\\
& 0 \leq w_i \leq 0.5 \quad & \textrm{i = 1,2,..,7}   \\
\end{aligned}\\
&\begin{aligned}
\max_{w} \quad & \mu_{s_i}^Tw + \gamma w^T w\\
\textrm{s.t.} \quad & \sqrt{w^T\sum_{s_i} w} = \sigma_{s_i}\\
& 1^T w = 1\\
& 0 \leq w_i \leq 0.5 \quad & \textrm{i = 1,2,..,7}   \\
\end{aligned}
\end{align}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .