I've recently written my own personal package (let's call it mypkg), which contains all the math macros I use on a regular basis. I would like to get this package to work with beamer. My package loads amsthm and then proceeds to define several theorem environments, e.g. theorem, lemma, corollary, etc. However, this clashes with beamer, since beamer defines these environments internally as well. Consequently, I get errors when trying to load mypkg in a beamer document.
What I would like to do is define a beamer option in mypkg, and then I can call \usepackage[beamer]{mypkg} when using mypkg in a beamer document. I see there is a \DeclareOption command which allows you to define certain things if the specified option is declared when calling the package. What I would like to do is the opposite; define those theorem environments only if the beamer option is not entered. How can I do this?
Bonus points if there is a way to automatically feed the documentclass to mypkg and have it do such things as required.
\provideenvironmentto define environments only if necessary: https://tex.stackexchange.com/a/20691/193767 – Apr 16 '20 at 04:13mypkgthat are incompatible withbeamer, e.g.enumitem? Or defining other commands. – Jordan Mitchell Barrett Apr 16 '20 at 04:58\@ifclassloaded{beamer}{stuff only for beamer}{stuff not for beamer}– Ulrike Fischer Apr 16 '20 at 11:52