
Tengo una sección donde describo listas con:
\renewcommand{\labelenumi}{\arabic*{enumi}.}
y ecuaciones con:
\renewcommand{\theequation}{\labelenumi-\arabic{equation}}
Entonces, por supuesto, la numeración de mis ecuaciones termina pareciéndose a:
1.-1
Pero preferiría etiquetar mis listas como 1., 2. y 3. y mis ecuaciones 1-1, 1-2 y 1-3. ¿Hay alguna forma de hacer esto?
mwe:
\documentclass[fleqn]{book}
\usepackage{enumitem}
\begin{document}
\textbf{PROBLEMS}
\renewcommand{\labelenumi}{\arabic*{enumi}.}
\renewcommand{\theequation}{\labelenumi-\arabic{equation}}
\begin{enumerate}[label=\arabic*.]
\setcounter{equation}{0}
%%1%%
\item Consider:
\begin{equation}\label{eq: 5.1.1}
a \times b = c
\end{equation}
\begin{equation}\label{eq: 5.1.2}
a = \sqrt{bc}
\end{equation}
\setcounter{equation}{0}
%%2%%
\item Another problem.
\end{enumerate}
\end{document}
Respuesta1
En lugar de
\renewcommand{\theequation}{\labelenumi-\arabic{equation}}
puedes usar
\renewcommand{\theequation}{\arabic{enumi}-\arabic{equation}}
El código:
\documentclass[fleqn]{book}
\usepackage{enumitem}
\begin{document}
\textbf{PROBLEMS}
\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\theequation}{\arabic{enumi}-\arabic{equation}}
\begin{enumerate}[label=\arabic*.]
\setcounter{equation}{0}
%%1%%
\item Consider:
\begin{equation}\label{eq: 5.1.1}
a \times b = c
\end{equation}
\begin{equation}\label{eq: 5.1.2}
a = \sqrt{bc}
\end{equation}
\setcounter{equation}{0}
%%2%%
\item Another problem.
\end{enumerate}
\end{document}
Respuesta2
Deberías usar amsmath
, en primer lugar. Entonces puedes explotar enumitem
las características de:
\documentclass[fleqn]{book}
\usepackage{amsmath}
\usepackage{enumitem}
\newenvironment{enumeq}
{\renewcommand{\theequation}{\arabic{enumi}-\arabic{equation}}%
\begin{enumerate}[label=\arabic*.,before=\changeitem]}
{\end{enumerate}}
\newcommand{\changeitem}{%
\let\ORIitem\item
\renewcommand\item{%
\setcounter{equation}{0}%
\ORIitem
}%
}
\begin{document}
\textbf{PROBLEMS}
\begin{enumeq}
\item Consider:
\begin{gather}
a \times b = c
\label{eq: 5.1.1}
\\
a = \sqrt{bc}
\label{eq: 5.1.2}
\end{gather}
\item Another problem
\begin{equation}
a=b
\end{equation}
\end{enumeq}
Here are the references: \eqref{eq: 5.1.1} and \eqref{eq: 5.1.2}
\end{document}