将方程式左对齐

将方程式左对齐

我想知道如何整齐地排列这些方程式并将它们一个接一个地排列。我尝试了对齐、对齐等的所有组合,但似乎都没有用。你能告诉我如何排列这些方程式吗?我将不胜感激。谢谢!

\begin{equation}
Minimise \ \  \sum_{i \in M} q_i^{pub} p_i^{pub} + (1 - \mu) z 
\end{equation}
\vspace{-1cm}

\begin{equation}
\begin{aligned}
Subject \ \ to \ \ \ \ \ z \geq p_i^{pub} - p_j^{pub}  \ \ \ \ i,j\in M,  \ i \neq j 
\end{aligned}
\end{equation}


\vspace{-1cm}

\begin{equation}
\begin{algined}
\sum_{i \in M} q_i^{pub} \geq 0.57 D
\end{algined}
\end{equation}


\vspace{-1cm}

\begin{equation}
 q_i^{pub} + bp_i^{pub} - cp_j^{pub} = a^{pub} \ \  \ \ i,j\in M,  \ i \neq j 

\end{equation}

\vspace{-1cm}

\begin{equation}
\sum_{s \in S} q_i^{s} p_i^{s} \geq P_i \ \ \ \ i \in M 
\end{equation}

\vspace{-1cm}

\begin{equation}
\sum_{s \in S} q_i^{s} \leq K_i  \ \ \ \ i \in M 
\end{equation}

\vspace{-1cm}

\begin{equation}
K_i - q_i^{pub} \geq U  \ \ \ \ i \in M 
\end{equation}

\vspace{-1cm}

\begin{equation}
p_i^{pub} \leq \rho_i  \ \ \ \ i \in M 
\end{equation}

\vspace{-1cm}

\begin{equation}
q_i^{pub}, p_i^{pub}, z \geq 0  \ \ \ \ i \in M 
\end{equation}

答案1

像这样吗?

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
&\textup{Minimise}\quad \sum_{i \in M} q_i^{\mathrm{pub}} p_i^{\mathrm{pub}} + (1 - \mu) z
\\
&\begin{alignedat}{3}
&\textup{Subject to}\quad && z \geq p_i^{\mathrm{pub}} - p_j^{\mathrm{pub}}
  &\quad& i,j\in M,\ i \neq j 
\\
&&& \sum_{i \in M} q_i^{\mathrm{pub}} \geq 0.57 D
\\
&&& q_i^{\mathrm{pub}} + bp_i^{\mathrm{pub}} - cp_j^{\mathrm{pub}} = a^{\mathrm{pub}}
  &\quad& i,j\in M,\ i \neq j 
\\
&&& \sum_{s \in S} q_i^{s} p_i^{s} \geq P_i
  &\quad& i \in M 
\\
&&& \sum_{s \in S} q_i^{s} \leq K_i  &\quad& i \in M 
\\
&&& K_i - q_i^{\mathrm{pub}} \geq U  &\quad& i \in M 
\\
&&& p_i^{\mathrm{pub}} \leq \rho_i  &\quad& i \in M 
\\
&&& q_i^{\mathrm{pub}}, p_i^{\mathrm{pub}}, z \geq 0  &\quad& i \in M 
\end{alignedat}
\end{align*}

\end{document}

答案2

或者像这样?

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for 'alignat' environment
\newcommand\pub{\mathrm{pub}}
\begin{document}

\begin{equation}
\text{Minimise} \quad \sum_{i \in M} q_i^{\pub} p_i^{\pub} + (1 - \mu) z 
\end{equation}
subject to
\begin{alignat}{2}
z &\geq p_i^{\pub} - p_j^{\pub} &\quad&i,j\in M,  \ i \neq j \\
\sum\nolimits_{i \in M} q_i^{\pub} &\geq 0.57 D \\
 q_i^{\pub} + bp_i^{\pub} - cp_j^{\pub} &= a^{\pub} && i,j\in M,  \ i \neq j \\
\sum\nolimits_{s \in S} q_i^{s} p_i^{s} &\geq P_i && i \in M  \\
\sum\nolimits_{s \in S} q_i^{s} &\leq K_i && i \in M \\
K_i - q_i^{\pub} &\geq U     && i \in M \\
p_i^{\pub} &\leq \rho_i      && i \in M \\
q_i^{\pub}, p_i^{\pub}, z &\geq 0 && i \in M 
\end{alignat}
\end{document}

答案3

我建议使用optidef专门用于优化问题布局的包。下面的代码提出了两种可能性:

\documentclass{article}
\usepackage{optidef}

\begin{document}

\begin{mini!}[2]{}{\sum_{i \in M} q_i^\text{pub} p_i^\text{pub} + (1 - \mu) z\label{eq; objective}}%
{\label{eq:minimisation}}{}
  \addConstraint{z}{\geq p_i^\text{pub} - p_j^\text{pub}}{\qquad i,j\in M,\enspace i \neq j}
\addConstraint{\sum_{i \in M} q_i^\text{pub}} {\geq 0.57 D}
\addConstraint{q_i^\text{pub} + bp_i^\text{pub} - cp_j^\text{pub}}{= a^\text{pub}}{\qquad i,j\in M, \enspace i
\neq j}
\addConstraint{\sum_{s \in S} q_i^{s} p_i^{s}}{\geq P_i } {\qquad i \in M}
\addConstraint{\sum_{s \in S} q_i^{s}}{\leq K_i}{\qquad i \in M}
\addConstraint{K_i - q_i^\text{pub}}{\geq U }{\qquad i \in M}
\addConstraint{p_i^\text{pub}}{\leq \rho_i}{\qquad i \in M}
\addConstraint{q_i^\text{pub}, p_i^\text{pub}, z}{\geq 0}{\qquad i \in M}
\end{mini!}

\begin{mini!}{}{\sum_{i \in M} q_i^\text{pub} p_i^\text{pub} + (1 - \mu) z\label{eq; objective}}%
{\label{eq:minimisation}}{}
  \addConstraint{z}{\geq p_i^\text{pub} - p_j^\text{pub}}{\quad i,j\in M,\enspace i \neq j}
\addConstraint{\sum_{i \in M} q_i^\text{pub}} {\geq 0.57 D}
\addConstraint{q_i^\text{pub} + bp_i^\text{pub} - cp_j^\text{pub}}{= a^\text{pub}}{\quad i,j\in M, \enspace i
\neq j}
\addConstraint{\sum_{s \in S} q_i^{s} p_i^{s}}{\geq P_i } {\quad i \in M}
\addConstraint{\sum_{s \in S} q_i^{s}}{\leq K_i}{\quad i \in M}
\addConstraint{K_i - q_i^\text{pub}}{\geq U }{\quad i \in M}
\addConstraint{p_i^\text{pub}}{\leq \rho_i}{\quad i \in M}
\addConstraint{q_i^\text{pub}, p_i^\text{pub}, z}{\geq 0}{\quad i \in M}
\end{mini!}

\end{document} 

在此处输入图片描述

相关内容