请帮帮我,这个代码空格太多而太少,我该如何修复?
\begin{subequations}
\begin{alignat}{2}
\forall i \in[m] && \sum \limits_{e \in N_{out(s_{i})}} y(i,e) - \sum \limits_{e \in N_{in(s_{i})}} y(i,e) =1\\
\forall i \in[m], v \in V \{s_{i}, v_{i}\} && \sum \limits_{e \in N_{out(v)}} y(i,e) - \sum \limits_{e \in N_{in(v)}} y(i,e) =0\\
\forall i \in[m] && \sum \limits_{e \in E} y(i,e) \leq w\\
\forall i \in[m], v \in V && \sum \limits_{e'=u',v'} y(i,e') \min \left\{1, \frac{d(u',v')^ \alpha}{d(u',v)^ \alpha}\right\} \leq w\\
\forall i \in[m], e \in E && y(i,e) \in \{0,1\}
\end{alignat}
\end{subequations}
这就是我所拥有的:
这就是我需要的:
答案1
您还没有理解,要有两个对齐组,您需要三个&
。我将其替换amsmath
为mathtools
(加载前者),以便使用命令\mathclap
,在(对齐的)Σ 周围获得更好的水平间距。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{amssymb,mathtools}
\usepackage{amsfonts}
\geometry{a4paper}
\renewcommand*{\d}{\mathop{}\mathopen{}\mathrm{d}}
\begin{document}
\begin{subequations}
\begin{alignat}{2}
& \forall i \in[m] && \sum_{\mathclap{e \in N_{\mathrm{out}(s_{i})}}} y(i,e) - \sum_{\mathclap{e \in N_{\mathrm{in}(s_{i})}}} y(i,e) =1\\
& \forall i \in[m], v \in V \{s_{i}, v_{i}\} & \hspace{3em} & \sum_{\mathclap{e \in N_{\mathrm{out}(v)}}} y(i,e) - \sum_{\mathclap{e \in N_{\mathrm{in}(v)}}} y(i,e) =0\\
& \forall i \in[m] && \sum_{e \in E} y(i,e) \leq w\\
& \forall i \in[m], v \in V && \sum_{\mathclap{e'=u',v'}} y(i,e') \min \left\{1, \frac{d(u',v')^ \alpha}{d(u',v)^ \alpha}\right\} \leq w\\
& \forall i \in[m], e \in E && y(i,e) \in \{0,1\}
\end{alignat}
\end{subequations}
\end{document}