[Tex/LaTex] How to include Maple code in LaTeX

codelistings

At here Fanciest way to include Mathematica code in LaTeX we can include Mathematica in LaTeX.
I want to include the code

restart:
with(geom3d):
eqS:=Equation(sphere(S,(x-1)^2 + (y-1)^2 +(z-1)^2 -121=0,[x,y,z],'centername'=T)):
L:=[]:
for x from -5 to 10  do
for y from -5 to 10  do
for z from -5 to 10  do  if  x<>xcoord(T) and y<>ycoord(T) and z <> zcoord(T) and   type(x,integer) and type(y,integer)and type(z,integer) and eqS then
L:=[op(L), [x,y,z]] fi;
od: od: od: 
nops(L);  

I tried

\begin{lstlisting}[language=Maple,caption={}]
restart:
with(geom3d):
eqS:=Equation(sphere(S,(x-1)^2 + (y-1)^2 +(z-1)^2 -121=0,[x,y,z],'centername'=T)):
L:=[]:
for x from -5 to 10  do
for y from -5 to 10  do
for z from -5 to 10  do  if  x<>xcoord(T) and y<>ycoord(T) and z <> zcoord(T) and   type(x,integer) and type(y,integer)and type(z,integer) and eqS then
L:=[op(L), [x,y,z]] fi;
od: od: od: 
nops(L);  
L;
\end{lstlisting}

How to include Maple code in LaTeX?

Best Answer

Maplesoft provides a LaTeX package that helps include Maple code into a LaTeX document. Unfortunately, it is quite bad I think. You have to modify the files yourself if you want to have the Maple commands in red for instance, and the output in blue.

Related Question