
Tenho uma seção onde descrevo listas com:
\renewcommand{\labelenumi}{\arabic*{enumi}.}
e equações com:
\renewcommand{\theequation}{\labelenumi-\arabic{equation}}
Então, é claro, a numeração da minha equação acaba ficando assim:
1.-1
Mas eu preferiria rotular minhas listas como 1., 2. e 3. e minhas equações 1-1, 1-2 e 1-3. Existe uma maneira de fazer isso?
nós:
\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}
Responder1
Em vez de
\renewcommand{\theequation}{\labelenumi-\arabic{equation}}
você pode usar
\renewcommand{\theequation}{\arabic{enumi}-\arabic{equation}}
O 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}
Responder2
Você deve usar amsmath
, antes de tudo. Então você pode explorar enumitem
os recursos do:
\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}