Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a section where I describe lists with:

\renewcommand{\labelenumi}{\arabic*{enumi}.}

and equations with:

\renewcommand{\theequation}{\labelenumi-\arabic{equation}}

So of course, my equation numbering ends up looking like:

1.-1

But I would prefer to both label my lists 1., 2., and 3. and my equations 1-1, 1-2, & 1-3. Is there a way to do this?

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}
share|improve this question

2 Answers 2

up vote 5 down vote accepted

Instead of

\renewcommand{\theequation}{\labelenumi-\arabic{equation}}

you can use

\renewcommand{\theequation}{\arabic{enumi}-\arabic{equation}}

The code:

\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}

enter image description here

share|improve this answer

You should use amsmath, first of all. Then you can exploit enumitem's features:

\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}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.