# Align Equations in Subequations

I would like to align these equations as shown in the picture by eq. 3.1.

I tried to use the command \begin{align*} unsuccessfully. My equations are automatically set to the centre, I've also tried to itemise the equations but I do get an error.

% --------------
%\begin{align*}
\begin{subequations} \label{eq:optimalsteuerungsprob_zeitkont}
$$\label{eq:optProb_J_Phi_l} \min_{\textbf{u} \in \mathcal{A}} \quad J[\textbf{u}(\cdot)] = \varphi\big(t_f, \textbf{x}(t_f)\big) + \int_{t_s}^{t_f} l\big(t,\textbf{x}(t),\textbf{u}(t)\big)\,\mathrm{d}t$$
$$\text{u.B.v.} \quad \dot{\textbf{x}}(t) = \textbf{f}(t,\textbf{x}(t), \textbf{u}(t)) \qquad , \qquad \textbf{x}(0)=\textbf{x}_{0}$$
$$\label{eq:optProb_endbedin_PSI} \psi\big(\,t_f,\textbf{x}(t_f)\big) = \textbf{0}$$
$$\textbf{h}\big(t,\textbf{x}(t),\textbf{u}()t\big) \le \textbf{0} \quad , \quad \forall t \in [t_{s},t_{f}]$$
\end{subequations}
%\end{align*}
%-----------------



Many thanks

Here is how to do that with alignat. I systematically replaced \textbf with \mathbf. Note there also exists a package for optimisation problems formatting, optidef.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{subequations} \label{eq:optimalsteuerungsprob_zeitkont}
\begin{alignat}{3} \label{eq:optProb_J_Phi_l}
& \min_{\mathbf{u} \in \mathcal{A}} & & J[\mathbf{u}(\cdot)] = \varphi\big(t_f, \mathbf{x}(t_f)\big)+ {}& & \int_{t_s}^{t_f} l\big(t,\mathbf{x}(t),\mathbf{u}(t)\big)\,\mathrm{d}t \\[2ex]
& \text{u.B.v.} & \quad & \dot{\mathbf{x}}(t) = \mathbf{f}(t,\mathbf{x}(t), \mathbf{u}(t)),%
& & \mathbf{x}(0)=\mathbf{x}_{0} \\ \label{eq:optProb_endbedin_PSI}
& & & \psi\big(\,t_f,\mathbf{x}(t_f)\big) = \mathbf{0} \\
& & & \mathbf{h}\big(t,\mathbf{x}(t),\mathbf{u}()t\big) \le \mathbf{0}, %
& & \forall t \in [t_{s},t_{f}]
\end{alignat}
\end{subequations}

\end{document}


I would use alignat inside subequations without any additional space between columns. The code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations} \label{eq:optimalsteuerungsprob_zeitkont}
\begin{alignat}{2}
\min_{\textbf{u} \in \mathcal{A}} \quad &J[\textbf{u}(\cdot)] = \varphi\big(t_f, \textbf{x}(t_f)\big)+{}&&\int_{t_s}^{t_f}
l\big(t,\textbf{x}(t),\textbf{u}(t)\big)\,\mathrm{d}t\label{eq:optProb_J_Phi_l}\\
\text{u.B.v.} \quad &\dot{\textbf{x}}(t) = \textbf{f}(t,\textbf{x}(t), \textbf{u}(t)),
&&\textbf{x}(0)=\textbf{x}_{0}\\
&\psi\big(\,t_f,\textbf{x}(t_f)\big) = \textbf{0}\label{eq:optProb_endbedin_PSI}\\
&\textbf{h}\big(t,\textbf{x}(t),\textbf{u}()t\big) \le \textbf{0}, &&\forall t \in [t_{s},t_{f}]
\end{alignat}
\end{subequations}
\end{document}


The result (see that the second columns in rows 2 and 4 are aligned to the integral sign):

The layout and numbering seems a little unusual, I ended up having to have align immediately following another display, then correcting for the bad space that causes.

Because you are numbering each line of the conditions in the same sequence as the equation you can't use aligned as a sub-term, which is what I'd normally use here.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

% --------------

\begin{subequations} \label{eq:optimalsteuerungsprob_zeitkont}
$$\label{eq:optProb_J_Phi_l} \min_{\textbf{u} \in \mathcal{A}} \quad J[\textbf{u}(\cdot)] = \varphi\bigl(t_f, \textbf{x}(t_f)\bigr) + \int_{t_s}^{t_f} l\bigl(t,\textbf{x}(t),\textbf{u}(t)\bigr)\,\mathrm{d}t$$
\vspace{-\baselineskip}% sigh
\begin{align}
\text{u.B.v.} \quad&\dot{\textbf{x}}(t) = \textbf{f}(t,\textbf{x}(t), \textbf{u}(t)), && \textbf{x}(0)=\textbf{x}_{0}
\\ & \label{eq:optProb_endbedin_PSI}
\psi\bigl(\,t_f,\textbf{x}(t_f)\bigr) = \textbf{0}
\\&
\textbf{h}\bigl(t,\textbf{x}(t),\textbf{u}()t\bigr) \le \textbf{0},&& \forall t \in [t_{s},t_{f}]
\end{align}
\end{subequations}
%\end{align*}
%-----------------
\end{document}