Anonymous 12859
I copy Mathematica's code into beamer. How can I get the result?
```
\documentclass[14pt]{beamer}
\usetheme{Warsaw}
%\usetheme{CambridgeUS}
%\usepackage{amsmath}
\begin{document}
\begin{frame
list = Table[{HoldForm[+##] & @@
MonomialList[
x^2 + y^2 + z^2 - 2 a x - 2 b y - 2 c z + a^2 + b^2 + c^2 - r^2,
"DegreeLexicographic"],
TeXForm[(x - a)^2 + (y - b)^2 + (z - c)^2 == r^2]}, {a, 1,
3}, {b, -3, 3}, {c, 1, 3}, {r, {2, 3, 5, 7, 11, 13}} ];
lis = Flatten[list, 3]
\end{frame}
\end{document}
```
Top Answer
samcarter
There are a couple of problems:
- missing `}` after `\begin{frame`
- same as in https://topanswers.xyz/tex?q=7398 : if you want show source code, use the `fragile` frame option
- you could just use the normal `verbatim` environment, however I'd suggest the `listings` package to allow automatic line breaks and other nice features
```
\documentclass[14pt]{beamer}
\usetheme{Warsaw}
%\usetheme{CambridgeUS}
%\usepackage{amsmath}
\usepackage{listings}
\begin{document}
\begin{frame}[fragile]
\begin{lstlisting}[breaklines]
list = Table[{HoldForm[+##] & @@
MonomialList[
x^2 + y^2 + z^2 - 2 a x - 2 b y - 2 c z + a^2 + b^2 + c^2 - r^2,
"DegreeLexicographic"],
TeXForm[(x - a)^2 + (y - b)^2 + (z - c)^2 == r^2]}, {a, 1,
3}, {b, -3, 3}, {c, 1, 3}, {r, {2, 3, 5, 7, 11, 13}} ];
lis = Flatten[list, 3]
\end{lstlisting}
\end{frame}
\end{document}
```
![document-1.png](/image?hash=6537f6c7665d52bf25955449379124fcd8e77bc6a0e1aaac6a0e39f497e9c9cf)