# Change definition number in beamer

In a beamer presentation, I need to redefine one definition (the definition numbers have to be same). How can I do that?

Here is my code.

\documentclass{beamer}
\setbeamertemplate{theorems}[ams style]
\begin{document}
\begin{frame}

\begin{definition}[A definition]
Some text.
\end{definition}

\begin{definition}[That definition again]
I need that definition number is repeated (it should be 1 instead of 2).
\end{definition}

\end{frame}
\end{document}

-

Since definition is based on theorem, it suffices to add -1 to the counter theorem:

\addtocounter{theorem}{-1}


MWE:

\documentclass{beamer}
\setbeamertemplate{theorems}[ams style]
\begin{document}
\begin{frame}

\begin{definition}[A definition]
Some text.
\end{definition}

\begin{definition}[That definition again]
I need that definition number is repeated (it should be 1 instead of 2).
\end{definition}

\end{frame}
\end{document}


Output:

## EDIT

If you have non-adjacent definitions the only way I know is to use the refcount package.

Here I use the command \getrefnumber to retrieve the right number.

\documentclass{beamer}
\setbeamertemplate{theorems}[ams style]
\usepackage{refcount}
\begin{document}
\begin{frame}

\begin{definition}[A definition]\label{def:first}
Some text.
\end{definition}

\begin{definition}[Another definition]\label{def:second}
Some text.
\end{definition}

\begin{definition}[That definition again]
I need that definition number is repeated (it should be 1 instead of 2).
\end{definition}

\setcounter{theorem}{\getrefnumber{def:second}}

\begin{definition}[One more definition]
Some text.
\end{definition}

\end{frame}
\end{document}


-
But it would create problem if the old and new definition are not adjacent. –  pushpen.paul Feb 5 '14 at 22:18

The following uses refcount that provides assigning \labels to counters. It allows one to "recall" an older structure in an easy way:

\documentclass{beamer}% http://ctan.org/pkg/beamer
\setbeamertemplate{theorems}[ams style]
\usepackage{refcount}% http://ctan.org/pkg/refcount
\begin{document}

\begin{frame}

\begin{definition}[A definition]\label{first-def}
First definition.
\end{definition}

\begin{definition}[A new definition]\label{second-def}
Second definition.
\end{definition}

\begin{definition}[That definition again]
First definition again.
\end{definition}

\setcounterref{theorem}{second-def}% Restore theorem counter
\begin{definition}[Another new definition]
Third definition.
\end{definition}

\end{frame}

\end{document}

-