Question: How to make the export from Maple 8 to LaTeX to show commands in red and the results in blue like Maple does? Quick answer: $ cd /usr/share/texmf/tex/latex/base $ diff mapleenv.sty mapleenv.sty.bak 7d6 < \usepackage{color} 452,453c451 < \setbox\@inlinebox=\hbox{\textcolor{blue}{#1}}% < %\setbox\@inlinebox=\hbox{#1}% --- > \setbox\@inlinebox=\hbox{#1}% 474,475c472 < \def\@doOneD#1{\MakeOther{\ } \textcolor{red}{#1}\egroup\unvbox\@inlinebox\relax\@mgobbleone} < %\def\@doOneD#1{\MakeOther{\ } #1\egroup\unvbox\@inlinebox\relax\@mgobbleone} --- > \def\@doOneD#1{\MakeOther{\ } #1\egroup\unvbox\@inlinebox\relax\@mgobbleone} Detailed answer: Text exported from Maple 8 in LaTeX format contains the output as parameters of the function \mapleinline. This function has 4 parameters. This function (along with the other two functions to be modified) is defined in the file mapleenv.sty. In Linux the file mapleenv.sty is in the directory /usr/share/texmf/tex/latex/base. If the second parameter of \mapleinline is 1d, then the third parameter is the Maple command (the input) and it is processed by the function \@doOneD (defined also in mapleenv.sty). When we wrap the only parameter of \@doOneD, namely #1, using textcolor, i.e. when we replace the string #1 by \textcolor{red}{#1} in the body of the function (not in the header), then the Maple commands will be shown in red. If the second parameter of \mapleinline is 2d, then the third parameter is the Maple result (the output) and it is processed by the function \@@doTwoD (defined also in mapleenv.sty). When we wrap the only parameter of \@@doTwoD, namely #1, using textcolor, i.e. when we replace the string #1 by \textcolor{blue}{#1} in the body of the function (not in the header), then the Maple results will be shown in blue. Note: actually, \mapleinline uses \@doTwoD which in turn uses \@@doTwoD. To be able to use \textcolor and red and blue, we need the package color. Thus, we have to do 3 changes in the file mapleenv.sty: (1) insert the line \usepackage{color} (2) change the definition of \@doOneD from \def\@doOneD#1{\MakeOther{\ } #1\egroup\unvbox\@inlinebox\relax\@mgobbleone} to \def\@doOneD#1{\MakeOther{\ } \textcolor{red}{#1}\egroup\unvbox\@inlinebox\relax\@mgobbleone} (3) change the definition of \@@doTwoD from \def\@@doTwoD#1{% \ignorespaces% \setbox\@inlinebox=\hbox{#1}% to \def\@@doTwoD#1{% \ignorespaces% \setbox\@inlinebox=\hbox{\textcolor{blue}{#1}}% Bug: Maple sometimes mixes (intentionally) blue and black color in the output. In such a case, our hack makes everything blue only. Antibug: The Maple prompt > is in black which is correct. Possible cause of problem: if there are more copies of the file mapleenv.sty in your system and you change other copy than the one which is used by LaTeX, then your change will have no effect. -- Pavel Pokorny Prague, 13.December 2004 Math Dept, Prague Institute of Chemical Technology http://www.vscht.cz/mat/Pavel.Pokorny