4

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?

  • Can you include the information about the differences of Maple compared to Mathematica? It seems that same answers apply directly to any code up to style issues. – percusse Apr 17 '13 at 11:07
  • 1
    Unfortunately, Maple is not one of the predefined languages in listings. You have to create your own style for that. – hpesoj626 Apr 17 '13 at 11:49
  • I was wondering if its possible to Matlab type publish/export maple code into latex although not good. – texenthusiast Apr 17 '13 at 17:24
  • This material may be helpful, or at least get you started: puszcza.gnu.org.ua/support/?153 – Jan Hlavacek May 22 '13 at 12:44
4

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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.