Vertical alignment of nested aligns

I would like to align a rather complicated formula, consisting of an (outer) optimization problem with several (inner) constraint blocks, which should be aligned around equal signs. I have opted to use nested aligns and got around to this:

\begin{equation}
\begin{aligned}
\min_{\vec{y}, \vec{v}}\ & f(\vec{y}) + g(\vec{v})  \\
\textrm{s.t. } &
\begin{aligned}
\dot{\vec{y}} & = f(\vec{y}, \vec{v}) \\
\vec{y}(0) & = \vec{y}_0 \\
\end{aligned}
\end{aligned}
\end{equation}

which yields the following result: Unfortunately, the s.t. is centered with respect to the constraint block, whereas I need both blocks to be aligned at their respective tops, so I need the s.t. to come up.

How can I adjust the code to achieve this effect?

• Use the [t] option with aligned. However, note there exists a dedicated package, optidef, which works fine. – Bernard Apr 24 at 16:31

Like this?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
\min_{\vec{y}, \vec{v}}\ & f(\vec{y}) + g(\vec{v})  \\
\textrm{s.t. } &
\begin{aligned}[t]
\dot{\vec{y}} & = f(\vec{y}, \vec{v}) \\
\vec{y}(0) & = \vec{y}_0 \\
\end{aligned}
\end{aligned}
\end{equation}
\end{document} There is a dedicated package, optidef which simplifies the typing and has many options. Here is a demo of three possibilities, the last two using vector arrows from the esvect package, which look nicer than the default \vec (8 different arrow tips). Also, I prefer not to align the constraints on the = sign:

\documentclass{article}
\usepackage{amsmath}
\usepackage[short]{optidef}
\usepackage[f]{esvect}

\begin{document}

\begin{mini}{\vec{y}, \vec{v}}{ f(\vec{y}) + g(\vec{v})}{\label{eq: example}}{}
\addConstraint{\dot{\vec{y}}}{ = f(\vec{y}, \vec{v})}
\end{mini}

\begin{mini!}{\vv{y}, \vv{v}}{ f(\vv{y}) + g(\vv{v})}{\label{eq: example}}{}
\addConstraint{\vrule}{\dot{\vv{y}} = f(\vv{y}, \vv{v})} 