I am trying to include a Mathematica code in Beamer. I tried lstlisting and verbatim environments but I am not satisfied with the outcome. A fancy way to include Mathematica code in LaTeX has been introduced here: Fanciest way to include Mathematica code in LaTeX. Nevertheless, this approach does not seem to work in beamer:


(above there is my pramble). Any ideas on how to include Mathematica code in a fancy way?

Mathematica code:

sequence := "all work and no play makes jack a dull boy"
(sequence <> # & /@ NestList["y" <> # &, "y", 10])
ListLinePlot[ N /@ Entropy /@ (sequence <> # & /@ NestList["y" <> # &, "y", 
10]),  Frame -> True, PlotStyle -> Thickness[.02], PlotTheme -> "Web", 
ImageSize -> Medium, PlotMarkers -> Automatic, FrameLabel -> (Style[#, Bold, 
14, Black] & /@ {"y Redundancy", "Entropy"})]
  • 1
    Please add a compilable code! – user156344 May 14 at 14:22
  • 2
    Fancyness is subjective. “Not working in beamer” is not and it means you tried. We need to see what you tried and how it failed to be able to help you. – Phelype Oleinik May 14 at 14:30
  • If you use mmacells package in beamer you must use \begin{frame}[fragile]. – vi pa May 16 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.