%Below is the updated mapleenv.sty file.
%
%The updates are for latex2e, and include a number of display options which,
%in effect can be used to selectively supress maple regions.
%
%mapleenv.sty defines how to print the special maple styles.
%
%\begin{mapleinput}...\end{mapleinput}
%\begin{mapleinput}[q]...\end{mapleinput}
%
%\begin{maplettyout}...\end{maplettyout}
%\begin{maplettyout}[q]...\end{maplettyout}
%
%\begin{maplelatex}...\end{maplelatex}
%\begin{maplelatex}[q]...\end{maplelatex}
%
%and others ...
%
%There are other options.  They are organized as a package.
%These are used by the "export to latex" of the maple worksheets.
% 
%
%
%% $Source: /doc1/tex/local/latex/RCS/mapleenv.sty,v $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fileversion{$Revision: 3.17 $}
\def\filedate{94/8/07}
\typeout%
{Maple Latex2e Environment Definitions Package -- \fileversion\space\filedate}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mapleenv}[\filedate\space\fileversion
Special Maple Environment definitions]
%
% Copyright (c) 1994 by Waterloo Maple Software, all rights reserved.
%
% Permission is granted to use this style without charge. It may
% also be redistributed providing that it is distributed as is
% and without charge.  You may modify these macros for your own use,
% and redistributed subject to the following condition:
%
% 1. The style name used for any modified version of this file is 
%    different from mapleenv.sty. 
%
% 2. You acknowledge this file as the source.
%
% 3. It is redistributed under the same terms and conditions 
%    as indicated here.
%
% Please send recommendations or requests for changes to:
%
%  support@maplesoft.on.ca
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Environments recognized by the Maple Filter.
% --------------------------------------------
%
% This latex style file defines environments suitable for 
% processing the latex documents exported from Maple worksheets.
% In particular, it defines each of:
%
%   maple commands,   \begin{mapleinput}...\end{mapleinput}, 
%   (default)         \begin{mapleinput}[a]...\end{mapleinput}, 
%                     \begin{mapleinput}[q]...\end{mapleinput}, 
%                     \begin{mapleinput}[ni]...\end{mapleinput}, 
%                     \begin{mapleinput}[no]...\end{mapleinput}, 
%
% The [q] option indicates that for a particular input/output pair,
% both the commands and any results should be suppressed.
%
% The [ni] option indicates that for a particular input/output pair,
% only the output region is displayed by latex.
%
% The [no] option indicates that for a particular input/output pair,
% only the input region is displayed by latex.
% 
%   maple text output, \begin{maplettyout}...\end{maplettyout}, 
%
%   maple generated latex, \begin{maplelatex}...\end{maplelatex}
%   (default)              \begin{maplelatex}[a]...\end{maplelatex}, 
%                          \begin{maplelatex}[q]...\end{maplelatex}, 
%                          \begin{maplelatex}[ni]...\end{maplelatex}, 
%                          \begin{maplelatex}[no]...\end{maplelatex}, 
%
%   maple separator lines, \maplesepline
%
%   maple plots , \mapleplot{filename}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Environments ignored by the Maple filter.
% -----------------------------------------
%
% The following are ignored by the maple filter, but provide
% exactly the same functionality as their counterparts above.
% The options (other than np) are meaningless in this context 
% as the environments are inert.
%
% 
%   \begin{maplequote}...\end{maplequote}  like mapleinput
%   \begin{maplequote}[p]...\end{maplequote} as above, default case
%   \begin{maplequote}[np]...\end{maplequote} like maplettyout but no
%      prompt
%   \begin{imaplelatex}...\end{imaplelatex} like maplelatex
%   \imapleplot{filename}   like mapleplot
%   \imaplesepline   like \maplesepline, but ignored by the filter.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% A General Description
% ---------------------
% The mapleinput, and maplettyout environments are similar to 
% \begin{verbatim}...\end{verbatim} in effect.  
% but there are several important differences.
%
% - the spacing relative to the surrounding environment is different.
%
% - page breaks are encourages before commands, or after results.
%
% - maplettyout and maplelatex environments are assumed to follow
% mapleinput regions and so have less space above.  This allows us to
% reduce the space between adjacent Maple regions without any
% elaborate mechanism to detect when there have been intervening
% paragraphs of text.
%
% - the size of the font for text regions is definable.
%
% - the  indentation of the environments can be indented by setting 
% the value of \LeftMapleSkip  .
%
% The current definition of \mapleplot is appropriate for use with 
% the psfig macros and has been tested with psfig Version 1.9. It
% assumes that the plot is in landscape mode, but parameters can be
% changed to deal with rotation, etc.
%
% J. S. Devitt,  February, 1994.
%
% The optional parameter can be used to indicate which
% what kind region it is.  The option [a] corresponds
% to the standard behaviour.  Thus 
%
% \begin{mapleinput}[a]  ===  \begin{mapleinput}
%
% Options are used, for example, to indicate quiet mode.
% To use it, write one of:
%
% \begin{mapleinput}[q]     (input suppressed, output displayed...)
% \begin{maplelatex}[q]     (input suppressed, output displayed...)
% \begin{mapleinput}[ni]    (input displayed, output supressed... )
% \begin{maplelatex}[no]    (input displayed, output supressed... )
% 
% prior to running the source file through the Maple filter.  The
% filter will automatically transfer the option to the resulting
% output field
%%
% J. S. Devitt, July, 1994. 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters 
% -----------
% The User Definable parameters are
% \AboveMaplePlot - space above a Maple Plot 
% \BelowMaplePlot - space below a Maple Plot
% \MaplePlotHeight - vertical space reserved for a plot
% \MaplePlotWidth - width reserved for a plot
% \MaplePlotAngle - angle of rotatation
% \AboveMapleSkip - space above an environment
% \BelowMapleSkip - space below an environment
% \LeftMapleSkip  - the amount of left indentation
% \MapleFont   - The Maple font 
% \MapleSize   - The size of the Maple font in mapleinput and 
%                          maplettyout
% \MapleLatexSize - The size of the Maple fonts in maplelatex
% \MapleFirstLine - controls ingoring first line feed
% \MaplePrompttrue  - controls insertion of prompt char
% \MaplePromptString - defines the prompt character
% \MapleSkip  - amount of glue before and after
%   displayed text
% \MapleTab  - number of spaces per tab (8)
% \MapleParCount - counter used to detect adjacent Maple
%   regions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definitions of dimensions, etc.  Those which can be reset are "set" to 
% specific values in the following section.  CHANGE THEIR VALUES THERE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newskip\AboveMaplePlot
\newskip\BelowMaplePlot
\newskip\AboveMapleSkip
\newskip\BelowMapleSkip
\newdimen\LeftMapleSkip 
\newdimen\MaplePlotHeight 
\newdimen\MaplePlotWidth 
% \newcount\MaplePlotAngle 
\newdimen\MapleSepLineWidth 
\newdimen\MapleSepLineHeight \MapleSepLineHeight = 0.01in
\newif\ifMaple  \Maplefalse
\newif\ifMapleFirstLine
\newif\ifMaplePrompt
\newcount\MapleTab \MapleTab = 8
\newcount\MapleParCount   \MapleParCount=0 
\newtoks\MaplePromptString \MaplePromptString = {}
\newtoks\MapleIOType \MapleIOType = {a}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set All User-Setable Parameters in this section 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\MaplePromptString = {\raise 1pt \hbox{$\scriptstyle>$\space}}
%
%  output environment spacing
\AboveMapleSkip = .75ex plus 2 pt minus 1 pt
\BelowMapleSkip = \AboveMapleSkip
\LeftMapleSkip  = 5ex    % environment spacing
%
%  plot parameters
\AboveMaplePlot = 2\AboveMapleSkip
\BelowMaplePlot = 2\AboveMapleSkip
\MaplePlotHeight = 40ex 
\MaplePlotWidth = 60ex
\edef\MaplePlotAngle{270}    % plots in landscape mode
%
% separator line parameters
\let\MapleSepLineWidth\linewidth  % \let so it will be redefined 
      % properly for narrow environments.
\MapleSepLineHeight = 1pt
\def\MapleSize{\small}
\def\MapleFont{\normalfont\ttfamily}
\def\@MapleFont{\MapleFont\MapleSize\@noligs}  % used in mapletty envs.
% \def\MapleFont{\normalfont\small\ttfamily%
% \@noligs}
\def\MapleLatexSize{\normalsize} % change this to change maplelatex size
\MapleFirstLinefalse  % Ignore first \cr after \begin{mapleinput}  
\MaplePrompttrue      % Include the prompt string for each input line.
\MapleTab = 8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Utilities used to define the main environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\makeatletter
% Utilities for changing character codes
%
\makeatletter
\def\MakeTab#1{\catcode `#1 = 4 }        % &
\def\MakeParameter#1{\catcode `#1 = 6 }  % #
\def\MakeSuperScript#1{\catcode `#1 = 7 } % ^
\def\MakeSubScript#1{\catcode `#1 = 8 }  % _
\def\MakeLetter#1{\catcode `#1 = 11 }
\def\MakeOther#1{\catcode `#1 = 12 }
\def\MakeActive#1{\catcode `#1 = \active\relax }
\def\MakeTabActive{\MakeActive{\^^I}}
\def\MakeEolActive{\MakeActive{\^^M}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Flag to control treatment of first new line char in maple envs
\newif\if@IgnoreNewLine
\@IgnoreNewLinetrue
%
% In a Maple tty environment every line is treated as a paragraph.
% The behavior at the end of every Maple paragraph (line) is given
% by, thereby inhibiting page breaks in such environments.
\def\@MaplePar{\nopagebreak[3]\par\@@par}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Characters requiring special treatment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Spaces
%%%%%%%%%%%%%%%%%%%%%%%
\def\MapleSpace{\ }
\def\@ObeySpaces{\MakeActive{\ }\@@ObeySpaces\relax}
{%
\MakeActive{\ }\gdef\@@ObeySpaces{\edef {\MapleSpace}}%
}%
%%%%%%%%%%%%%%%%%%%%%%%
% Tabs
%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\@MapleTabSize
\def\@ObeyTabs{\MakeTabActive\@@ObeyTabs\relax}
{%
\MakeTabActive\gdef\@@ObeyTabs{\def^^I{\@MapleTab}}  
}%
\def\@MapleTab{%
  \leavevmode   % ensure that we are in horizontal mode
  \egroup      % Terminate box register 0
  \dimen0=\wd0 % store its length and round up to next stop
  \divide\dimen0 by \@MapleTabSize
  \advance\dimen0 by 1sp
  \multiply \dimen0 by \@MapleTabSize
  \wd0 = \dimen0
  \box0
  \setbox0 = \hbox\bgroup
}
%%%%%%%%%%%%%%%%%%%%%%%
% End of Line Character
%%%%%%%%%%%%%%%%%%%%%%%
\def\@ObeyEol{\MakeEolActive\@@ObeyEol\relax}%
{%
  \MakeEolActive %
  \gdef\@@ObeyEol{%
    \let^^M=\@MapleEol%
  }%
}
\def\@MapleEol{%
  \if@IgnoreNewLine
  \else
    \leavevmode%
    \egroup%
    \box 0%
    \@MaplePar%
  \fi
  \@IgnoreNewLinefalse
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definitions of Utilities for the Main Environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macro for setting up the verbatim like environents
% This is executed in the preamble to the corresp latex environment.
% The spacing above and below the environment is done in the
% preamble instead of here to enable this to be used in a variety
% of such environments.
\edef\@MapleQuiet{q}   % used to indicate a silent command or result
\edef\@MapleVerbose{a}  % The standard or default behavior in which
                        % results are generated and displayed.
\edef\@MapleNoPrompt{np} % specify no prompts in environment
\edef\@MaplePrompt{p} % specify prompts for this environment
\edef\@MapleNoInput{ni} % No input appears in output stream.
\edef\@MapleNoOutput{no} % No output appears in outputstream.
%
% The next macro is used by the verbatim like environments to
% reset character codes, and change the treatment of new lines, etc.
% Actions  can be made conditional on the value of \@MapleIOType which
% is always set to 'a' , or to 'q' as in the value of the 
% optional parameter used in \begin{mapleinput}[q]
% 
\def\@SetupMapleTty#1{%
\begingroup
  %%%  Compute and set tab positions
  \setbox 0 = \hbox{\@MapleFont X}
  \@MapleTabSize = \wd0
  \multiply\@MapleTabSize by \MapleTab
  \setbox0 = \hbox{\relax}  % Clearing \box 0
  %
  %%% set paragraph dimensions and line spacing
  \rightskip = 0pt 
  \parindent=0pt
  \parskip = 0pt 
  \leftskip=\LeftMapleSkip
  \parfillskip = 0pt plus 1fil
  %
  %%%  The next two parameters may have been changed 
  %%%  by a \raggedright so they are reset here.
  \spaceskip = 0pt   \xspaceskip = 0pt
  %
  %%%  Should the first new line of the environment
  %%%  be ignored?  Making this conditional allows us 
  %%%  to place \begin... to be on a separate line
  \ifnum #1 = 0 \@IgnoreNewLinetrue\else\@IgnoreNewLinefalse\fi%
  %
  %%% Get ready to handle every paragraph (recall paragraph == line )
  %% \@MapleFont%
  \everypar = {\EveryParZ}%
  \def\EveryParZ{%
    \ifMaplePrompt
    \the\MaplePromptString
    \fi
    \setbox0 = \hbox \bgroup
  }%
%
%%%  Choose the type size and font - order of these commands
%%%  may be important
\@MapleFont%
\lineskiplimit=0\normalbaselineskip
\baselineskip=0.85\normalbaselineskip
\@noligs%
%\MakeAllActive%
\let\do\@makeother \dospecials
\catcode ``=\active%
\frenchspacing%
\@ObeySpaces% 
\@ObeyTabs%
\@ObeyEol%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Behavior on exiting of special tty environments
\def\@EndMapleTty{%
  \endgroup  %% matches the \begingroup inside of @SetupMapleTty
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Macros executed to start Verbatim like environments
% for special Maple regions.  These calls do all the work
% of scanning for the environment terminator.
%
% Conditional parameter as in \begin{...}[q] etc. denotes the
% different class of Maple Regions.
\begingroup
  \catcode`| = 0  % becomes the escape character
  \catcode`( = 1  % becomes a begin group
  \catcode`) = 2  % becomes an end group
  \catcode`@ = 11 % becomes a regular character (for macro names)
  \catcode`\{ = 12 % becomes an other character
  \catcode`\} = 12 % becomes a other character
  \catcode`\\ = 12 % becomes a other character
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Handle the full parameterized version of the tty environments.
%  type a   standard (verbose) usage
%  type q   quiet command
%  type np  no prompt  (maplequote only at this time...)
%  type ni  no input  
%  type no  no output  
%
% Maple Quote  (looks like mapleinput environment, but does not execute)
|gdef|@BeginMapleQuote[#1]#2\end{maplequote}(%
|edef|@MapleIOType(#1)%
|ifx|@MapleIOType|@MapleNoPrompt%
|typeout(.............No Maple Prompt #1)%
|MaplePromptfalse|fi%
#2%
|end(maplequote))%
%
% TTY Input 
|gdef|@BeginMapleInput[#1]#2\end{mapleinput}(%
|edef|@MapleIOType(#1)%
|gdef|MapleIOType(#1)%
|ifx|@MapleIOType|@MapleNoPrompt|MaplePromptfalse|fi%
|ifx|@MapleIOType|@MapleNoInput|edef|@MapleIOType(q)|fi%
|ifx|@MapleIOType|@MapleQuiet%
|typeout(.............Quiet Maple Command #1)%
|removelastskip%
|else%
%|typeout(.............Verbose Maple Command)%
#2%
|fi%
|end(mapleinput))%
%%%
% TTY Output
|gdef|@BeginMapleTtyout[#1]#2\end{maplettyout}(%
%%|typeout(TTYout Environment of type #1)%
|edef|@MapleIOType(#1)%
|gdef|MapleIOType(#1)%
|ifx|@MapleIOType|@MaplePrompt|MaplePromptfalse|fi%
|ifx|@MapleIOType|@MapleNoOutput|edef|@MapleIOType(q)|fi%
|ifx|@MapleIOType|@MapleQuiet%
|typeout(.............Quiet Maple Tty Out)%
|else%
|vskip%
|AboveMapleSkip%
#2%
|fi%
|end(maplettyout))%
%%%
% Suppressed Latex Output
% Treat suppressed Latex output from Maple the same way as
% suppressed tty output.
|gdef|@GobbleMapleLatex#1\end{maplelatex}(%
%|typeout(.............Gobbling Maple Latex)
|end(maplelatex))%
|endgroup
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page breaks are inhibited immediately following the input
% environment.  This assumes that no extra space is 
% required below the region as it is followed by some
% form of Maple output region.
%
% Latex environments can be defined by newenvironment, or by
% defining two macros   \newmacro   and \endnewmacro
% The latter is necessary here because of the verbatim like
% emulation, and the optional parameter.
% 
% This code handles the recognition and the processing of 
% the optional parameter  by mapping the case of no parameter
% onto the case \begin{...}[a].
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of a Maple Verbatim environment that is ignored by
% the Maple Filter.  
% 
% \begin{maplequote} ...\end{maplequote}
% \begin{maplequote}[p] ...\end{maplequote}
% \begin{maplequote}[np] ...\end{maplequote}
% 
% This environment is not passed through Maple, and does not generate
% new Maple results.
%
% the [p] case is the default,  the [np] case does not insert prompts.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\maplequote{
\@MaplePar%
\if@minipage\removelastskip\vskip-1.3ex
\else\vskip\AboveMapleSkip\fi%   Extra space at top of display
% \MaplePrompttrue  %% prompt flag is reset in \@BeginMapleQuote
\@SetupMapleTty{0}% %% The 0 indicates ignore first new line
\@ifnextchar [{\@BeginMapleQuote}{\@BeginMapleQuote[p]}% [p] or [np] 
}
%%%
%%%
\def\endmaplequote{%
  \@EndMapleTty%
  \ifx\@MapleIOType\@MapleQuiet%
  \else%
    \vskip\BelowMapleSkip%
    \pagebreak[3]%
  \fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of actual mapleinput environment.
% 
% \begin{mapleinput} ...\end{mapleinput}
% 
% This environment represents input that is passed through Maple to
% produce output.
% The [a] case is used by default.  The [q] is the quiet 
% (suppressed)  mode.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\mapleinput{
%%%  Include Extra Spacing at top of display
\MaplePrompttrue  % prompt is required in this environment.
\@MaplePar%
\if@minipage\removelastskip\vskip-1.3ex
\else\vskip\AboveMapleSkip\fi%
\@SetupMapleTty{0}% The 0 indicates ignore first new line
\@ifnextchar [{\@BeginMapleInput}{\@BeginMapleInput[a]}%
}
%%%
\def\endmapleinput{%
  \@EndMapleTty%
  \edef\@MapleIOType{\MapleIOType}
  \ifx\@MapleIOType\@MapleQuiet%
    \typeout{.............Quiet Maple Command finished}
  \else
    \vskip.25\BelowMapleSkip%
    \nopagebreak[3]
  \fi%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of the actual \maplettyout environment
% usage: \begin{maplettyout} ... \end{maplettyout}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This can use almost exactly the same setup and exit as for input. 
% The main difference is the treatment of prompts, and in page breaking
% Page breaks are inhibited before, and encouraged after.
\def\maplettyout{
  \MaplePromptfalse   % No prompt is required in this environment.
  \nopagebreak[3]\@MaplePar
  \removelastskip
  \@SetupMapleTty{1}   % The 1 indicates "respect first new line"
  \@ifnextchar [{\@BeginMapleTtyout}{\@BeginMapleTtyout[a]}%
}
% It can still use the same terminator as \mapleinput.  However, 
% a space is required after this environment -- not before.
\def\endmaplettyout{%
  \@EndMapleTty%
  \edef\@MapleIOType{\MapleIOType}
  \ifx\@MapleIOType\@MapleQuiet%
    \typeout{.............Quiet Maple TTY finished}
  \else%
    \nopagebreak[3]%
    \vskip\BelowMapleSkip%
    \pagebreak[3]%
    \par%
  \fi%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Maple Latex Environment
% \begin{maplelatex} ....\end{maplelatex}
% This environment is basically a wrapper around a display
% math environment.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \newenvironment{maplelatex}{}{}
% We define the environment in the long form to support
% optional parameterized environments.
%
\def\maplelatex{\@ifnextchar [{\@maplelatex}{\@maplelatex[a]}}
%
\def\@maplelatex[#1]{%
  \MakeSuperScript{^}%
  \MakeSubScript{_}%
  \MakeTab{&}%
  \edef\@MapleIOType{#1}  %% for \ifx test%
  \gdef\MapleIOType{#1}   %% for consultation by exit routine
  \ifx\@MapleIOType\@MapleNoOutput%
 \edef\@MapleIOType{q}%
  \fi%
  \ifx\@MapleIOType\@MapleQuiet% 
    \typeout{.............Quiet Maple Latex }%
    \@SetupMapleTty{0}%
    \let\MapleStartLatex\@GobbleMapleLatex%   similar to a quiet tty region.
    \relax%
  \else%
    %% \typeout{other type:  ...printing as Latex}
    \let\MapleStartLatex\relax%
    \parindent=0pt%
    \parskip = 0pt%
    \parfillskip = 0pt plus 1fil%
    \lineskiplimit=0\normalbaselineskip%
    \baselineskip=0.8\normalbaselineskip%
    \abovedisplayskip=.5\AboveMapleSkip%
    \belowdisplayskip=\AboveMapleSkip%
    \def\arraystretch{1.5}%
    \removelastskip%
    \nopagebreak[3]\@@par%
  \fi%
  \MapleLatexSize
  \MapleStartLatex%
}%
%%% Finish the maplelatex environment
\def\endmaplelatex{%
\edef\@MapleIOType{\MapleIOType}%
\ifx\@MapleIOType\@MapleQuiet%   End the same as the verbatim's
    \typeout{.............Quiet Maple Latex finished}%
    \let\MapleLatexFinish\@EndMapleTty %
\else%
    \let\MapleLatexFinish\relax%
    \baselineskip=\normalbaselineskip%
    \pagebreak[3]%
\fi%
\MapleLatexFinish%
}%
%
%%% inert maple latex environment  (ignored by the filter)
%
\newenvironment{imaplelatex}%
{\begin{maplelatex}[a]}%
{\end{maplelatex}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Separator Lines
% \maplesepLine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The %'s at the end of the lines are important here to
% avoid inserting unwanted newlines in the output stream.
\newcommand{\maplesepline}{\vskip \parskip%
\hrule\@height\MapleSepLineHeight\@width\MapleSepLineWidth%
\vskip \parskip\relax}
%
% inert form
\let\imaplesepline\maplesepline
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The following assumes you have already installed the psfig 
% macros on your system.  It has been tested with 
% psfig Version 1.9.
%
\input psfig.sty
\psrotatefirst
\def\mapleplot#1{
\vskip\AboveMaplePlot
\centerline{\vbox{\psfig{figure=#1,%
height=\MaplePlotHeight,%
width=\MaplePlotWidth,%
angle=\MaplePlotAngle}}}
\vskip\BelowMaplePlot%
}
%
%%% An form of maple plot that is inert to the filter.
% JSD, July 21, 94
\let\imapleplot\mapleplot
\makeatother
\endinput
%%%%%% The End %%%%%

