In beamer, how do I number theorems but not definitions? [duplicate]

I want my theorems numbered, but not my definitions. The options I'm finding turn numbering on or off universally. My attempts at customizing different theorem environments are not having any effect.

This issue is addressed for the article document class, but I cannot find a solution in beamer. There is a solution posted to the issue of making a seperate sequence for different theorem environments, but not for turning the number off entirely in one environment but not another.

Consider this:

\documentclass[t,handout]{beamer}
\mode<presentation>
\usepackage[english]{babel}
%\setbeamertemplate{theorems}[ams style]

\begin{document}
\frame{
\begin{theorem}
\end{theorem}
\begin{definition}
\end{definition}
}
\end{document}


Notice that there is no numbering on the Theorem or Definition. Uncommenting the 4th line places numbers on both (and also bolds the terms, which I could take or leave). How can I do one of the following:

1. Activate the fourth line, then modify its settings so that the definitions are not numbered,
2. With the fourth line de-activated, define the environments separately so that theorems are numbered, but not definitions,
3. Use a different package with which one of the above is possible?

What surprises me especially is that if I leave the template out, and do like I would in an article, which is this:

\newtheorem*{definition}{Definition}
\newtheorem{theorem}{Theorem}


I get an error that these environments are already defined. But if I strip the file down anymore it doesn't even generate a document, so what is defining the environments and why can't I customize it?

marked as duplicate by Andrew, user13907, Henri Menke, Andrew Swann, Thomas F. SturmNov 13 '15 at 8:46

• Welcome to TeX.SX! It is easier to help you if you add a minimal working example that takes the form \documentclass{...}\usepackage{....}\begin{document}...\end{document}. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. This makes it much easier for people to troubleshoot your problem - and much more likely that they will! – Andrew Nov 13 '15 at 6:49
• @Andrew: Gotcha, let me see if I can isolate the problem and I will come back and edit the post. Thanks for the orientation. – j0equ1nn Nov 13 '15 at 6:50
• You can number of theorem-like environments with \setbeamertemplate{theorems}[numbered]. To do different things with different theorem-like environments you want a small variation of: beamer: Different numbering for Theorems, Examples, Definition, and Lemma. Hence, I think this is a duplicate. – Andrew Nov 13 '15 at 6:56
• @Andrew: I am currently fiddling with the solution given in the link you suggested. If the solution is a variation of that, it is not an obvious one, at least to me. There's a lot of extra stuff in that code. But if I get it I will come back and let you know. – j0equ1nn Nov 13 '15 at 7:16
• @Andrew: Wait! Okay, I got it! Thanks for the tip. I'm going to post the solution (and upvote your comments), be it a subcase of another or not.. – j0equ1nn Nov 13 '15 at 7:17

As @Andrew suggested, this can be done by turning numbering off and customizing the environments as in the link he posted. But the particular solution for the desired effect here is:

\documentclass[notheorems]{beamer}
\usepackage[english]{babel}
\setbeamertemplate{theorem}[ams style]
\setbeamertemplate{theorems}[numbered]

\makeatletter
\ifbeamer@countsect
\newtheorem{theorem}{\translate{Theorem}}[section]
\else
\newtheorem{theorem}{\translate{Theorem}}
\fi
\theoremstyle{definition}
\newtheorem*{definition}{\translate{Definition}}

\newenvironment{Theorem}{\begin{theorem}}{\end{theorem}}
\newenvironment{Definition}{\begin{definition}}{\end{definition}}
\makeatother

\begin{document}
\begin{theorem}\end{theorem}
\begin{definition}\end{definition}
\end{document}


The key component here is the * between \newtheorem and {definition}.

• What does the * do actually, just curious? – pushpen.paul Jun 6 at 22:06