# emaxima on beamer

I started using the emaxima package on emacs recently.

It provides me with maxima and maximasession environments which work perfectly fine in a latex "article" class document. But while using it on beamer, I am facing issues with the maximasession environment. The error thrown goes like, ERROR: File ended while scanning use of \dom@ximatexsessionverbatim.

Do let me know how I could fix this issue.

Adding an example :- This works

\documentclass[pdftex]{beamer}

\usepackage[lines]{emaxima}

\begin{document}
\begin{frame}
\begin{maxima}
diff(sin(x^2),x);
\maximaoutput*
\m  2\,x\,\cos x^2 \\
\end{maxima}
\end{frame}
\end{document}


But this does not

\documentclass[pdftex]{beamer}

\usepackage[lines]{emaxima}

\begin{document}
\begin{frame}
\begin{maximasession}
diff(sin(x^2),x);
\maximaoutput*
\i4.  diff(sin(x^2),x); \\
\o4.  2\,x\,\cos x^2 \\
\end{maximasession}
\end{frame}
\end{document}


The preamble of the tex output :

Running LaTeX' on beamermaxima' with pdflatex  -file-line-error   -interaction=nonstopmode "\input" beamermaxima.tex''
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2017/01/01> patch level 1
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.


The error message:

Runaway argument?
diff(sin(x^2),x); \\ \o 4. 2\,x\,\cos x^2 \\ \end {maximasession} \end \ETC.
! File ended while scanning use of \dom@ximatexsessionverbatim.

• Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Mar 3 '17 at 23:11
• my bad - I've added one through an edit – Nidish Narayanaa Mar 4 '17 at 19:08

You need to use the fragile option for the frame environment:

\begin{frame}[fragile]
...
\end{frame}


This is also needed for frames with verbatim environments as well as when using Sweave for R code chunks embedded in frames (both the maximasession environment as well as the Schunk environment produced by Sweave internally use verbatim!).

So the full working example should be

\documentclass{beamer}

\usepackage[lines]{emaxima}

\begin{document}
\begin{frame}[fragile]
\begin{maximasession}
diff(sin(x^2),x);
\maximaoutput*
\i4.  diff(sin(x^2),x); \\
\o4.  2\,x\,\cos x^2 \\
\end{maximasession}
\end{frame}
\end{document}


I had to remove the [pdftex] option from the beamer document class on my LaTeX installation (TeX Live 2015.2016032 on Mint 18.1), otherwise I got an option clash for the color package when comiling with pdflatex, it also occurs on my MacBoook with MacTeX 2015. This holds for both of your examples, the working and the non working one.

• I agree that this is probably the problem. Still, it's better if you can add a minimal working example (i.e. complete compliable code), to show that you have actually solved it./ – Andrew Nov 14 '17 at 14:51