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.
beamerpredefines some theorem-like environments, includingexample. Add thenotheoremsoption to\documentclass{beamer}. – egreg Aug 08 '19 at 09:23