
Dado un sistema de ecuaciones (1a), (1b), etc. Quiero poder hacer referencia tanto a (1a) como al sistema completo (1). Esto es trivial con subequations
, pero en un iopart
documento este entorno no parece ser compatible (no amsmath
, supongo) y la recomendación es usar \numparts ... \endnumparts
. Sin embargo, con \numparts
, no puedo hacer referencia correctamente. En primer lugar, eqnarray
no parece que se pueda hacer referencia a s (no es un problema con numparts
, pero aún así), y en segundo lugar, incluso si coloco todo en equation
entornos a los que se puede hacer referencia, todavía no puedo hacer referencia a todo el sistema.
MWE:
\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}
Respuesta1
La iopart
clase comete varios errores fundamentales, el principal es hacer una tontería que la hace incompatible con amsmath
.
Intenté comunicarme con el equipo de soporte, pero no obtuve ninguna respuesta.
Otro error está en la definición de dónde se pisa \numparts
el contador en lugar de .equation
\addtocounter
\refstepcounter
Sin embargo, eqnarray
no se comporta bien con cleveref
, por lo que para hacer referencia a las ecuaciones simples es necesario utilizar el formato simple \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}
Por otro lado, simplemente ignoraría lo que piensa y usa la gente de 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}
Apuesto a que no lo descubrirían. El parche para emular la salida iopart
con la letra de subecuación en cursiva debe realizarse antes de cargar cleveref
.