iopart 中的子方程式編號

iopart 中的子方程式編號

給定一個方程組 (1a)、(1b) 等。這對 來說是微不足道的subequations,但在iopart文件中似乎不支援此環境(amsmath我猜不支援),建議使用\numparts ... \endnumparts.但是,對於\numparts,我無法正確引用。首先,eqnarrays 似乎不可引用(不是 的問題numparts,但仍然如此),其次,即使我將所有內容放入equation可引用的環境中,我仍然無法引用整個系統。

微量元素:

\documentclass[10pt]{iopart}
\usepackage{cleveref}
\crefname{equation}{}{}
\begin{document}
    
    \section{Example}
    
    \numparts\begin{eqnarray} \label{system1}
    a=1, \\
    b=2
    \end{eqnarray}\endnumparts
    
    \numparts\begin{equation} \label{system2a}
    a=1
    \end{equation}\begin{equation} \label{system2b}
    b=2
    \end{equation}\endnumparts
    
    \cref{system1} should read (1) but instead labels the section\\
    \cref{system2a,system2b} should read (2) but instead reads (2a) and (2b)\\
\end{document}

答案1

該類別iopart犯了幾個基本錯誤,主要錯誤是做了一件愚蠢的事情,使其與amsmath.

我嘗試聯繫支援團隊,但根本沒有得到答案。

另一個錯誤在於\numparts其中的定義equation步進位置的定義\addtocounter,而不是\refstepcounter

但是,eqnarray與 的表現不佳cleveref,因此為了引用單個方程,您需要使用普通的\ref.

\documentclass[10pt]{iopart}
\usepackage{cleveref}
\usepackage{etoolbox}

\crefname{equation}{}{}

\patchcmd{\numparts}{\addtocounter{equation}{1}}{\refstepcounter{equation}}{}{}

\begin{document}

\setcounter{section}{8} % just to test
    
\section{Example}
    
\begin{numparts}\label{system1}
\begin{eqnarray}
  a&=&1,\label{system1a}\\
  b&=&2\label{system1b}
\end{eqnarray}
\end{numparts}
\begin{numparts}\label{system2}
\begin{equation} \label{system2a}
  a=1
\end{equation}
\begin{equation} \label{system2b}
  b=2
\end{equation}
\end{numparts}

\cref{system1} refers to the first system; separately \ref{system1a} and \ref{system1b}

\cref{system2} refers to the second system; separately \cref{system2a,system2b}

\end{document}

在此輸入影像描述

另一方面,我會簡單地忽略 IOP 的人的想法和使用amsmath

\documentclass[10pt]{iopart}

% for using amsmath
\expandafter\let\csname equation*\endcsname\relax
\expandafter\let\csname endequation*\endcsname\relax

\usepackage{amsmath}
\usepackage{etoolbox}

\patchcmd{\subequations}{\alph{equation}}{\textit{\alph{equation}}}{}{}

\usepackage{cleveref}

\crefname{equation}{}{}

\begin{document}

\setcounter{section}{8} % just to test
    
\section{Example}
    
\begin{subequations}\label{system1}
\begin{align}
  a&=1,\label{system1a}\\
  b&=2\label{system1b}
\end{align}
\end{subequations}
\begin{subequations}\label{system2}
\begin{equation} \label{system2a}
  a=1
\end{equation}
\begin{equation} \label{system2b}
  b=2
\end{equation}
\end{subequations}

\cref{system1} refers to the first system; separately \cref{system1a,system1b}

\cref{system2} refers to the second system; separately \cref{system2a,system2b}

\end{document}

我敢打賭他們不會發現它。類比輸出的補丁iopart必須在加載之前製作用於cleveref

相關內容