中断和恢复子方程 2

中断和恢复子方程 2

我使用了与原始帖子因为在我看来这似乎是正确的。

过了一段时间,我遇到了同样的问题,但无法妥善解决。

在写作之前我做了许多尝试,尝试了不同的解决方案,但都无法得到我想要的结果。

我已经写了 240 页,这些是完成大学管道工程前最后 10 页的方程式

你能给我一个建议吗?

    \documentclass{article}
\usepackage{amsmath}
\usepackage[colorlinks]{hyperref}

% original amsmath definition
% \subequations:
% \long macro:->\refstepcounter {equation}\protected@edef \theparentequation {\theequation }\setcounter {parentequation}{\value {equation}}\setcounter {equation}{0}\def \theequation {\theparentequation \alph {equation}}\ignorespaces 

% saved by hyperref in
% > \HyOrg@subequations=\long macro:

% hyperref-patched \subequations: (\endsubequations not modified)
% > \subequations=macro:
% ->\stepcounter {equation}\protected@edef \theHparentequation {\@ifundefined {th
% eHequation}\theequation \theHequation }\addtocounter {equation}{-1}\HyOrg@subeq
% uations \def \theHequation {\theHparentequation \alph {equation}}\ignorespaces 
% .


% extending the environment
%   1. with optional parameter: expected values resume or intermezzo or none.
%   2. while keeping the hyperref customization.

\makeatletter
\def\user@resume{resume}
\def\user@intermezzo{intermezzo}
%
\newcounter{previousequation}
\newcounter{lastsubequation}
\newcounter{savedparentequation}
\setcounter{savedparentequation}{1}
% 
\renewenvironment{subequations}[1][]{%
    \def\user@decides{#1}%
    \setcounter{previousequation}{\value{equation}}%
    \ifx\user@decides\user@resume 
    \setcounter{equation}{\value{savedparentequation}}%
    \else  
    \ifx\user@decides\user@intermezzo
    \refstepcounter{equation}%
    \else
    \setcounter{lastsubequation}{0}%
    \refstepcounter{equation}%
    \fi\fi
    \protected@edef\theHparentequation{%
        \@ifundefined {theHequation}\theequation \theHequation}%
    \protected@edef\theparentequation{\theequation}%
    \setcounter{parentequation}{\value{equation}}%
    \ifx\user@decides\user@resume 
    \setcounter{equation}{\value{lastsubequation}}%
    \else
    \setcounter{equation}{0}%
    \fi
    \def\theequation  {\theparentequation  \alph{equation}}%
    \def\theHequation {\theHparentequation \alph{equation}}%
    \ignorespaces
}{%
    %  \arabic{equation};\arabic{savedparentequation};\arabic{lastsubequation}
    \ifx\user@decides\user@resume
    \setcounter{lastsubequation}{\value{equation}}%
    \setcounter{equation}{\value{previousequation}}%
    \else
    \ifx\user@decides\user@intermezzo
    \setcounter{equation}{\value{parentequation}}%
    \else
    \setcounter{lastsubequation}{\value{equation}}%
    \setcounter{savedparentequation}{\value{parentequation}}%
    \setcounter{equation}{\value{parentequation}}%
    \fi\fi
    %  \arabic{equation};\arabic{savedparentequation};\arabic{lastsubequation}
    \ignorespacesafterend
}
\makeatother

\begin{document}\thispagestyle{empty}
    
    \begin{subequations}\label{eq:170}
        \begin{equation}
            a  = b \label{eq:170:a}
        \end{equation}
    \end{subequations}

    \begin{subequations}\label{eq171}
        \begin{equation}
            c  = d \label{eq:171:a}\\
        \end{equation}
\end{subequations}

    \begin{subequations}\label{eq172}
        \begin{equation}
            e  = f \label{eq:172:a}
        \end{equation}
\end{subequations}


I need resuming the equation. \eqref{eq:170}, this in reality would correspond to some complex equations that describe the main equation \eqref{eq:170}

\begin{subequations}[resume]
    \begin{equation}
        a  = b \label{eq:170:b}
    \end{equation}
\end{subequations}

\begin{subequations}[resume]
    \begin{equation}
        a  = b \label{eq:170:c}
    \end{equation}
\end{subequations}

\begin{subequations}[resume]
    \begin{equation}
        a  = b \label{eq:170:d}
    \end{equation}
\end{subequations}

--------------------
after reuming \eqref{eq171}, this represents the next mathematical proof for the equation\eqref{eq171}

\begin{subequations}[resume]
    \begin{align}
        a  = b \label{eq:171:b}
    \end{align}
\end{subequations}


and bla bla

在此处输入图片描述

相关内容