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.

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

2 Answers

up vote 4 down vote accepted

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}

\addtocounter{theorem}{-1}

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

enter image description here


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}

\setcounter{theorem}{\getrefnumber{def:first}}\addtocounter{theorem}{-1}

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

enter image description here

share|improve this answer
    
But it would create problem if the old and new definition are not adjacent. –  pushpen.paul Feb 5 at 22:18
add comment

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

enter image description here

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

\setcounterref{theorem}{first-def}\addtocounter{theorem}{-1}% Adjust theorem counter
\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}
share|improve this answer
add comment

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.