# How to include Mathematica code in LaTeX/Beamer [duplicate]

I found the best (IMHO) way to include Mathematica code in LaTeX: Fanciest way to include Mathematica code in LaTeX (@jkuczm)

To the test I put the TeX code from link above, but it doesn't work with Beamer presentation. File can't be compiled. I get many errors like this:

Integrate[{y^(-3)*(1-(a/y)^2)^(-2)},{y,r,Infinity}] \end {mmaCell} \begin \ETC.
! Paragraph ended before \FV@BeginScanning was complete.

! LaTeX Error: \begin{list} on input line 45 ended by \end{beamer@framepauses}.

! Missing } inserted.

! Extra }, or forgotten \endgroup.

! LaTeX Error: \begin{list} on input line 45 ended by \end{beamer@frameslide}.

! LaTeX Error: \begin{list} on input line 45 ended by \end{document}.

! You can't use \end' in internal vertical mode.

! LaTeX Error: \begin{list} on input line 45 ended by \end{document}.

! Emergency stop.


Any ideas on how to include Mathematica code in Beamer?

Edit: It was enough to use fragile frame. Thanks for @samcarter

• Can you make a complete compilable document? – samcarter_is_at_topanswers.xyz Feb 3 '17 at 18:03
• Did you use a fragile frame? – samcarter_is_at_topanswers.xyz Feb 3 '17 at 18:04
• I didn't use a fragile frame. Thank you for a suggestion. I'll try it for a while. – Rico Feb 3 '17 at 18:08
• Great! It works fine. I would like to thank you :-) – Rico Feb 3 '17 at 18:11

Fragile code, such as listings have to be used in

\begin{frame}[fragile]

\end{frame}
`