1

When I am going to compile the following codes,

\documentclass[11pt]{beamer}
\usepackage{amsmath,amsthm,amssymb,amsxtra} 
\usepackage{cnltx-example}

\begin{document} 

\begin{frame}[fragile]{}
\begin{example}[side-by-side]
  Consider the following matrix.
  $\begin{pmatrix}
  \frac{1}{2} & 0 & \frac{9}{5} \\
  -2 & \frac{2}{3} & -\frac{1}{4} \\
  12 & 0 & \frac{11}{7} \\
  \end{pmatrix}$
\end{example}
\end{frame}

\end{document}

it gives an error like

! Package Listings Error: Environment `example' already defined.
See the Listings package documentation for explanation.
Type  H <return>  for immediate help.
...
l.949 \newsourcecodeenv{example}
?

How to fix this? The same code with amsart document class is giving the correct output.

  • 2
    beamer predefines some theorem-like environments, including example. Add the notheorems option to \documentclass{beamer}. – egreg Aug 8 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.