[Tex/LaTex] LaTeX Error: Command \example already defined

beamerbeamerarticle

I use the refman classes refart and refrep to write papers for my user group conference proceedings.

I also use the documentclass beamer to prepare my slides.

Recently I began single-sourcing my slides and handouts
by using three files

  1. my-slides-main
  2. my-slides-ppt
  3. my-slides-handout

%% my-slides-handout.tex
\documentclass{article}
\usepackage{beamerarticle}
\begin{document}
this is doc-class article,
usepackage beamer.
%% input{my-slides-main}
\end{document}


%% my-slides-handout.tex
\documentclass{beamer}
\begin{document}
this is doc-class beamer
%% input{my-slides-main}
\end{document}

I want to use documentclass refart with package beamerarticle
but get the following error

! LaTeX Error: Command \example already defined.
               Or name \end... illegal, see p.192 of the manual.

%% my-test-refart-beamer-article
\documentclass{refart}
\usepackage{beamerarticle}
\begin{document}
this is doc-class refman.article: refart,
usepackage beamerarticle.

the error in the log is

LaTeX Error: Command \example already defined.

\end{document}

I have kludged a work-around
by opening up the refart.cls
and disabling the definition of

 \newenvironment{example}

yes, I am aware that this is -not-

  \newcommand\example

but that kludge works.

of course when I upgrade from TeXlive.2013 to TeXlive.2014
I 'lost' that fix.

so my question is:

Q: what is the politically correct way to resolve a duplication of
commands or environments by class and packages.

\documentclass{refart}
%% i.e. what goes here 
%% to tell the package not to allocate, again \example?
\usepackage{beamerarticle}

note: I have searched the beamer *.sty files looking for
\newcommand\example
and have found nothing.

Best Answer

You can load beamerarticle with the notheorems option, that disables the default definition of all the theorem-like environments.

\documentclass{refart}
\usepackage[notheorems]{beamerarticle}

\begin{document}

This runs without errors.

\end{document}

Of course, you'll have to define yourself the theorem-like environments you need.


Why the refart class calls example an environment that does verse in typewriter font is beyond my comprehension.

Die example-Umgebung erzeugt eine verse-Umgebung, schaltet allerdings auf tt und versucht einen Seitenumbruch vor der Umgebung zu vermeiden.