Eu quero obter a saída da matriz
\begin{pmatrix}
\frac{1}{2} & 0 & \frac{9}{5} \\
-2 & \frac{2}{3} & -\frac{1}{4} \\
12 & 0 & \frac{11}{7} \\
\end{pmatrix}
junto com o código exibido lado a lado usando
\begin{example}[side-by-side]
\end{example}
com cnltx-example
pacote. Quando vou compilar (com amsart
documentclass) isso, dá um erro. Como consertar isto?
Aqui está meu código
\documentclass{amsart}
\usepackage{amsmath,amsthm,amssymb,amsxtra,amsopn}
\usepackage{cnltx-example}
\begin{document}
\begin{example}[side-by-side]
Consider the following example.
\[ (x + y)^2 = x^2 + 2xy + y^2\]
\end{example}
%The following gives an error at the time of compiling
\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{document}
Responder1
Aparentemente, cnltx-example
requer um recuo do código com dois espaços:
\documentclass{amsart}
\usepackage{amssymb}
\usepackage{cnltx-example}
\begin{document}
\begin{example}[side-by-side]
Consider the following example.
\[ (x + y)^2 = x^2 + 2xy + y^2\]
\end{example}
%The following gives an error at the time of compiling
\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{document}