在子方程和对齐环境中编号

在子方程和对齐环境中编号

我使用subequationsalign环境如下:

 \begin{subequations}
 \begin{align}
   \sum_{a \in \delta^+_G(v)} f^k_a -  \sum_{a \in \delta^-_G(v)} f^k_a  &= d^k_v, & \forall v \in V, k \in K \\ 
    \sum_{k \in K} f^k_a  &\le \sum_{m \in M}c^m x^m_a, & \forall a \in A   & \quad \texttt{Directed}\\
    \max \left\{\sum_{k \in K} \{f^k_{e+},f^k_{e-}\}  \right\}&\le \sum_{m \in M}c^m x^m_a, & \forall e \in E   & \quad \texttt{Bidirected}\\
    \sum_{k \in K} (f^k_{e+}+f^k_{e-})&\le \sum_{m \in M}c^m x^m_e, & \forall e \in E   & \quad \texttt{Undirected}
 \end{align}
 \end{subequations}

显示方程式编号为
1.a
1.b
1.c
1.d

但是,我希望编号显示为
1
2.a
2.b
2.c

答案1

我建议你 (a) 将所有四个语句嵌入到gather环境中,以及 (b) 嵌入三个不平等在组合subequationsalignat环境中。我还建议使用\smashoperator指令,以便更紧凑地排版第一行中的求和表达式。

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools} % for \smashoperator macro

\begin{document}
\begin{gather}
   \smashoperator{\sum_{a \in \delta^+_G(v)}} f^k_a -  
   \smashoperator{\sum_{a \in \delta^-_G(v)}} f^k_a  = 
   d^k_v, \quad \forall v \in V,\ k \in K
\\[\jot]
\begin{subequations}
\begin{alignat}{3}
  \sum_{k \in K} f^k_a  
  &\le \sum_{m \in M}c^m x^m_a, 
  &\qquad& \forall a \in A   
  & \quad& \texttt{Directed} \\
  \max \biggl\{\sum_{k \in K} \{f^k_{e+},f^k_{e-}\}  \biggr\}
  &\le \sum_{m \in M}c^m x^m_a, 
  && \forall e \in E   
  && \texttt{Bidirected} \\
  \sum_{k \in K} (f^k_{e+}+f^k_{e-})
  &\le \sum_{m \in M}c^m x^m_e, 
  && \forall e \in E   
  &&  \texttt{Undirected}
\end{alignat}
\end{subequations}
\end{gather}
\end{document}

答案2

在我写这篇文章的时候,Mico 刚刚发布了他的答案,你应该考虑一下,但要直接回答这个问题,align我可能不会使用subequations,而只是标记后面的方程式,所以

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath}

\begin{document}

 \begin{align}
   \sum_{a \in \delta^+_G(v)} f^k_a -  \sum_{a \in \delta^-_G(v)} f^k_a  &= d^k_v, & \forall v \in V, k \in K \\ 
    \sum_{k \in K} f^k_a  &\le \sum_{m \in M}c^m x^m_a, & \forall a \in A   & \quad \texttt{Directed} \refstepcounter{equation}\tag{\theequation a}\\
    \max \left\{\sum_{k \in K} \{f^k_{e+},f^k_{e-}\}  \right\}&\le \sum_{m \in M}c^m x^m_a, & \forall e \in E   & \quad \texttt{Bidirected} \tag{\theequation b}\\
    \sum_{k \in K} (f^k_{e+}+f^k_{e-})&\le \sum_{m \in M}c^m x^m_e, & \forall e \in E   & \quad \texttt{Undirected}  \tag{\theequation c}
 \end{align}
\end{document}

答案3

您可以定义一个新specialsubequations环境,其中第一个项目在 的帮助下得到特殊处理\specialequation

\documentclass{article}
\usepackage{amsmath}
%\usepackage{hyperref} % not mandatory

\usepackage{lipsum} % for mock text, don't load it in your document

\makeatletter
\newcounter{specialsubequations}
\newenvironment{specialsubequations}
 {%
  \stepcounter{specialsubequations}%
  \stepcounter{equation}%
  \let\@currentlabel\theequation
  \label{@@@fake\thespecialsubequations @@@}%
  \subequations
 }
 {\endsubequations}
\@ifpackageloaded{hyperref}{%
  \newcommand{\specialequation}{\tag{\ref*{@@@fake\thespecialsubequations @@@}}}%
}{%
  \newcommand{\specialequation}{\tag{\ref{@@@fake\thespecialsubequations @@@}}}%
}
\makeatother

\begin{document}

\lipsum[1][1-3]
\begin{specialsubequations}
\begin{align}
  \sum_{a \in \delta^+_G(v)} f^k_a -  \sum_{a \in \delta^-_G(v)} f^k_a
  &= d^k_v, & \forall v \in V, k \in K \specialequation\label{1}
  \\ 
  \sum_{k \in K} f^k_a  &\le \sum_{m \in M}c^m x^m_a, 
  & \forall a \in A   & \quad \texttt{Directed}
  \\
  \max \left\{\sum_{k \in K} \{f^k_{e+},f^k_{e-}\}  \right\}
  &\le \sum_{m \in M}c^m x^m_a, & \forall e \in E   & \quad \texttt{Bidirected}
  \\
  \sum_{k \in K} (f^k_{e+}+f^k_{e-})&\le \sum_{m \in M}c^m x^m_e,
  & \forall e \in E   & \quad \texttt{Undirected}
\end{align}
\end{specialsubequations}
\lipsum[2][1-3]

\end{document}

您可以将 添加\label到特殊方程式中;hyperref加载后链接将起作用。

在此处输入图片描述

但我建议不要更改该号码。

\documentclass{article}
\usepackage{amsmath}
%\usepackage{hyperref} % not mandatory; use `\ref*` if hyperref is loaded

\usepackage{lipsum} % for mock text

\begin{document}

\lipsum[1][1-3]
\begin{subequations}\label{main}
\begin{align}
  \sum_{a \in \delta^+_G(v)} f^k_a -  \sum_{a \in \delta^-_G(v)} f^k_a
  &= d^k_v, & \forall v \in V, k \in K \tag{\ref{main}}
  \\ 
  \sum_{k \in K} f^k_a  &\le \sum_{m \in M}c^m x^m_a, 
  & \forall a \in A   & \quad \texttt{Directed}
  \\
  \max \left\{\sum_{k \in K} \{f^k_{e+},f^k_{e-}\}  \right\}
  &\le \sum_{m \in M}c^m x^m_a, & \forall e \in E   & \quad \texttt{Bidirected}
  \\
  \sum_{k \in K} (f^k_{e+}+f^k_{e-})&\le \sum_{m \in M}c^m x^m_e,
  & \forall e \in E   & \quad \texttt{Undirected}
\end{align}
\end{subequations}
\lipsum[2][1-3]

\end{document}

在此处输入图片描述

相关内容