# horizontal offset of line before align environment

I am trying to define a function as a constrained optimization problem, and I am struggling with the horizontal alignment and vertical spacing. Here is the best I've done:

\documentclass{report}
\usepackage{amsmath}

\begin{document}

\begin{subequations} \label{eq:f}
$$f(A, b, c, S, t) = \notag$$
\begin{align}
\min~~& c^\top x \label{eq:obj} \\
\text{s.t.}~~
& Ax \le b \label{eq:con_le} \\
& Sx \ge t \label{eq:con_ge} \\
& x \ge 0 \label{eq:con_nonneg}
\end{align}
\end{subequations}

\end{document}


The equation numbering in the picture is as I desire, and that is why I am using subequations. I am trying to get the vertical space between the first and second line to be consistent with the line spacing within the align environment. Furthermore, I would like for the first line to be shifted more to the left so that "min" on the second line is staggered further to the right of the "f" on the first line, preferably by a customizable distance. However, I do not want the staggering to affect the alignment points within the align environment. I have attempted to do this using a variety of environment combinations to no avail. Your help is appreciated.

Update: Starting with @Celdor's solution below, I settled on the following:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{calc}

\begin{document}
\begin{subequations} \label{eq:f}
\begin{align}
\mathllap{f(A, b, c, S, t) =}
% the 2.5em below is the exact distance between the left side of the "f"
% on the first line and the left side of the "min" on the second line
\hspace{\widthof{$\min~~$} - \widthof{$f(A, b, c, S, t) =$} + 2.5em} & \notag \\
% and the additional 2.5em below ensures centering of all content
\hspace{2.5em}
\min~~          & c^\top x \label{eq:obj} \\
\textrm{s.t.}~~ & Ax \le b \label{eq:con_le} \\
& Sx \ge t \label{eq:con_ge} \\
&  x \ge 0 \label{eq:con_nonneg}
\end{align}
\end{subequations}
\end{document}


Don't split equations and keep everything inside align environment. Otherwise, each additional environment will add extra vertical space.

You can control the spacing between rows inside equations either globally by changing \jot or per line by adding extra space after \\ e.g. \\[3pt].

Also, the first two equations can be centred around a column separator &, depending on which side it is placed at. The macro \mathclap{} is particularly convenient. It reduces a box of its argument to 0 effectively overlapping the surrounding content equally on both sides (centred). The first two lines can be formatted this way at the point of a column separator and then the size of the whole expression can be determined by the remaining rows (constraints). This will give the expected effect or at least ti will be close to it. If centring can be corrected by additional \hspace{}.

\documentclass{report}
\usepackage{mathtools}

\begin{document}

\begin{subequations} \label{eq:f}
\setlength\jot{0pt}   % Vertical spacing between lines (default = 3pt)
\begin{align}
\mathclap{f(A, b, c, S, t) =}
\hspace{0.0em} & \notag \\[2pt]
\mathclap{\min\,c^\top\!x} &       \label{eq:obj} \\
\textrm{s.t.\space} Ax & \le b \label{eq:con_le} \\
Sx & \ge t \label{eq:con_ge} \\
x & \ge 0 \label{eq:con_nonneg}
\end{align}
\end{subequations}
\end{document}


• Thank you. I was able to get exactly what I wanted by adjusting your example a small amount. Basically, I only needed \mathclap for the first line, and I aligned the objective function in the same way as the constraints with the alignment point moved so that "min" and "s.t." are right-aligned and the expressions/inequalities are left-aligned. Feb 21, 2023 at 15:42
• You're welcome :) . Feb 21, 2023 at 15:44