%
% kg, 23/05/94
%
% mupad_help.tex -- tex macros for MuPAD help pages
%

\newcommand{\muTHIS}{this}
\newcommand{\muTHISLIB}{\empty}
\newcounter{muLASTSECT}
\newcounter{muACTSECT}

\newcommand{\muNOSECTION}[1]{\subparagraph*{\sf #1}}
\newcommand{\muSECTION}[1]%
{\ifnum\value{muLASTSECT}=\value{muACTSECT}\else\subparagraph*{\sf #1:}\fi%
\setcounter{muLASTSECT}{\value{muACTSECT}}}

\newcommand{\muHELPHEADER}[3]{%
\renewcommand{\muTHIS}{#1}%
\setcounter{muLASTSECT}{0}%
\setcounter{muACTSECT}{0}%
\markright{{\tt #1\hfill}}%
\addcontentsline{toc}{subsection}{{\tt #1}}%
\label{help-#1}%
\index{#3!#1@{\bf #1}}%
\subsection*{\hspace*{-4ex}\rule{1.5ex}{1.5ex}\hspace*{2.5ex}%
{\tt #1} --- #2}}

\newcommand{\muHELPFOOTER}{%
\nopagebreak\vskip 0ex\noindent\nopagebreak\hrule}

% Bereits in Mhelp.sty definert
% \mupad{}
%\newcommand{\mupad}{{\sf MuPAD}}

% \muEx{expression}
\newcommand{\muEx}[1]{{\tt #1}}

% \muThis{}
\newcommand{\muThis}{{\bf \muTHIS}}

% \muFunc{name}
\newcommand{\muFunc}[1]{{\bf #1}}

% \muLib{name}
\newcommand{\muLib}[1]{{\bf #1}}

% \muMeth{name}
\newcommand{\muMeth}[1]{{\bf #1}}

% \muCall{name}{args}
\newcommand{\muCall}[2]{{\rm\muFunc{#1}\,({\it #2})}}

% \muConst{name}
\newcommand{\muConst}[1]{{\small\bf #1}}

% \muTRUE{}, \muFALSE{}, \muFAIL{}, \muNIL{}
\newcommand{\muTRUE}{\muConst{TRUE}}
\newcommand{\muFALSE}{\muConst{FALSE}}
\newcommand{\muFAIL}{\muConst{FAIL}}
\newcommand{\muNIL}{\muConst{NIL}}

% \muId{ident}
\newcommand{\muId}[1]{{\it #1}}

% \muIdX{ident}{subscript}
\newcommand{\muIdX}[2]{{$\mbox{\it #1}_{#2}$}}

% \muDom{name}{args}
\newcommand{\muDom}[2]{%
\def\muARG{#2}%
\ifx\muARG\empty
    {\bf #1}%
\else
    \muCall{#1}{#2}%
\fi}

% \muCat{name}{args}
\newcommand{\muCat}[2]{%
\def\muARG{#2}%
\ifx\muARG\empty
    {\bf #1}%
\else
    \muCall{#1}{#2}%
\fi}

% \muAx{name}{args}
\newcommand{\muAx}[2]{%
\def\muARG{#2}%
\ifx\muARG\empty
    {\bf #1}%
\else
    \muCall{#1}{#2}%
\fi}

% \muArg{type}{ident}
\newcommand{\muArg}[2]{\mbox{{\it #1} {\bf #2}}}

% \muArgX{type}{ident}{subscript}
\newcommand{\muArgX}[3]{\mbox{{\it #1} $\mbox{\bf #2}_{#3}$}}

% \muSeq{argument}
\newcommand{\muSeq}[1]{#1~$\ldots$}

% \muOpt{arguments}
\newcommand{\muOpt}[1]{$\langle$~#1~$\rangle$}

% \muOr{}
\newcommand{\muOr}{$\|$}

% \muSyntax{arguments}
\newcommand{\muSyntax}[1]{{%
    \setcounter{muACTSECT}{1}%
    \muSECTION{Syntax}%
    \begin{itemize}\item[]\raggedright\muCall{\muTHIS}{#1}\end{itemize}}}

% \muConstSyntax{}
\newcommand{\muConstSyntax}[1]{{%
    \setcounter{muACTSECT}{1}%
    \muSECTION{Syntax}%
    \begin{itemize}\item[]{\bf \muTHIS}\end{itemize}}}

% \muSuperDomain{domain}
\newcommand{\muSuperDomain}[1]{%
\setcounter{muACTSECT}{2}%
\def\muARG{#1}%
\ifx\muARG\empty
    {\muNOSECTION{No Super-Domain}\ }
\else
    {\muSECTION{Super-Domain}\begin{itemize}\item[]{\it #1}\end{itemize}}
\fi}

% \muCategories{categories}
\newcommand{\muCategories}[1]{%
\setcounter{muACTSECT}{3}%
\def\muARG{#1}%
\ifx\muARG\empty
    {\muNOSECTION{No Category}\ }
\else
    {\muSECTION{Categories}\begin{itemize}\item[]\raggedright{\it #1}\end{itemize}}
\fi}

% \muAxioms{axioms}
\newcommand{\muAxioms}[1]{%
\setcounter{muACTSECT}{4}%
\def\muARG{#1}%
\ifx\muARG\empty
    {\muNOSECTION{No Axiom}\ \vspace{3ex}}
\else
    {\muSECTION{Axioms}\begin{itemize}\item[]\raggedright{\it #1}\end{itemize}}
\fi}

% \muMethod{name}{argumets}{description}
\newcommand{\muMethod}[3]{\item\muCall{#1}{#2}%
\index{methods!#1@{\bf #1}} #3}

% \muEntry{name}{description}
\newcommand{\muEntry}[2]{\item{\bf #1}%
\index{entries!#1@{\bf #1}} #2}

% \begin{muFunction}{name}{short descrition} function description
% \end{muFunction}
\newenvironment{muFunction}[2]%
{\ifx\muTHISLIB\empty\def\muARG{#1}\else\def\muARG{\muTHISLIB??#1}\fi%
\muHELPHEADER{\muARG}{#2}{functions}}%
{\muHELPFOOTER}

% \begin{muLibrary}{name}{short descrition} library description
% \end{muLibrary}
\newenvironment{muLibrary}[2]%
{\renewcommand{\muTHISLIB}{#1}\muHELPHEADER{#1}{#2}{libraries}}%
{\muHELPFOOTER\renewcommand{\muTHISLIB}{\empty}}

% \begin{muDomain}{name}{short descrition} domain description
% \end{muDomain}
\newenvironment{muDomain}[2]{\muHELPHEADER{#1}{#2}{domains}}{\muHELPFOOTER}

% \begin{muCategory}{name}{short descrition} category description
% \end{muCategory}
\newenvironment{muCategory}[2]{\muHELPHEADER{#1}{#2}{categories}}{\muHELPFOOTER}

% \begin{muAxiom}{name}{short descrition} axiom description \end{muAxiom}
\newenvironment{muAxiom}[2]{\muHELPHEADER{#1}{#2}{axioms}}{\muHELPFOOTER}

% \begin{muExamples} examples \end{muExamples}
\newenvironment{muExamples}{%
\setcounter{muACTSECT}{5}%
\muSECTION{Examples} \begin{sloppypar}\begin{itemize}\item[]}{\end{itemize}\end{sloppypar}}

% \begin{muMethods} domain methods \end{muMethods}
\newenvironment{muMethods}{%
\setcounter{muACTSECT}{6}%
\muSECTION{Methods} \begin{description}\sloppy}{\end{description}}

% \begin{muBaseMethods} basic domain methods \end{muBaseMethods}
\newenvironment{muBaseMethods}{%
\setcounter{muACTSECT}{7}%
\muSECTION{Basic Methods} \begin{description}\sloppy}{\end{description}}

% \begin{muEntries} domain entries \end{muEntries}
\newenvironment{muEntries}{%
\setcounter{muACTSECT}{8}%
\muSECTION{Entries} \begin{description}\sloppy}{\end{description}}

% \begin{muBaseEntries} basic domain entries \end{muBaseEntries}
\newenvironment{muBaseEntries}{%
\setcounter{muACTSECT}{9}%
\muSECTION{Basic Entries} \begin{description}\sloppy}{\end{description}}

% \begin{muEntryList} list of \muOrig macros \end{muEntryList}
\newenvironment{muEntryList}{%
\setcounter{muACTSECT}{10}%
\muSECTION{All Domain Entries} \begin{longtable}{llll}%
{\small\bf Entry} & {\small\bf Definition} & {\small\bf Description} & 
{\small\bf Page} \\ \hline}%
{\end{longtable}}

% \muOrig{entry name}{defining constructor}{original category contructor(s)}
\newcommand{\muOrig}[3]{{\small\bf #1} & {\small #2} & {\small #3} & 
{\small{\pageref{help-#3}}} \\}

% \begin{muItemize} item list \end{muItemize}
\newenvironment{muItemize}%
{\begin{itemize}}{\end{itemize}}

% \muItem{item}
\newcommand{\muItem}[1]{\item #1}

% \begin{muFuncList} list of \muFuncItem's \end{muFuncList}
\newenvironment{muFuncList}%
{\begin{quote}\begin{tabular}[t]{lll}}{\end{tabular}\\\ \end{quote}}

% \muFuncItem{name1}{name2}{name3}
\newcommand{\muFuncItem}[3]{%
\muFunc{#1} & \muFunc{#2} & \muFunc{#3} \\}

% \muSee{list of functions}
\newcommand{\muSee}[1]{%
\setcounter{muACTSECT}{11}%
\muSECTION{See Also} \begin{itemize}\item[]\raggedright{\it #1}\end{itemize}}

%
% Der Rest ist aus verbatimwrite.sty von kamo uebernommen, nur dass
% vinn in muIn und vout in muOut umbenannt wurden. Weiter wurde
% die Schriftgroesse auf \footnotesize geaendert.
%

% $Date: 2004/10/04 17:25:17 $  $Author: nthiery $  $Revision: 1.1.1.2 $ 
%% 
\def\fileversion{v1.1a}
\def\filedate{94/01/14}

\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
\newtoks\every@verbatim
\every@verbatim={}
\def\@makeother#1{\catcode`#112\relax}
\begingroup
 \catcode`\ =\active%
\gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}%
\endgroup
\def\@xobeysp{\leavevmode\penalty\@M\ }
\newtoks\verbatim@line
\def\verbatim@startline{\verbatim@line{}}
\def\verbatim@addtoline#1{%
  \verbatim@line\expandafter{\the\verbatim@line#1}}
\def\verbatim@processline{\the\verbatim@line\par}
\def\verbatim@finish{\ifcat$\the\verbatim@line$\else
  \verbatim@processline\fi}
\begingroup
 \catcode`\`=\active
 \gdef\verbatim@font{\footnotesize\tt \catcode96\active % \footnotesize (kg)
   \def`{\leavevmode\kern\z@\char96 }}
\endgroup
\def\@verbatim{%
  \trivlist \item[]%
  \leftskip\@totalleftmargin\rightskip\z@
  \parindent\z@\parfillskip\@flushglue\parskip\z@
  \@@par
  \def\par{\leavevmode\null\@@par\penalty\interlinepenalty}%
  \obeylines
  \verbatim@font
  \let\do\@makeother \dospecials}
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces\verbatim@start}
\@namedef{verbatim*}{\@verbatim\verbatim@start}
\let\endverbatim=\endtrivlist
\expandafter\let\csname endverbatim*\endcsname =\endtrivlist
%
% new environment 'muIn'
%
\def\muIn{%
  \@bsphack
  \let\do\@makeother\dospecials%
  \catcode`\^^M\active%
  \def\@verbatim{\the\every@verbatim
     \trivlist   
     \item[\hspace*{2.12mm}{\footnotesize\tt >>}\hspace*{-6.1mm}\hss]% (kg)
     \leftskip\@totalleftmargin\rightskip\z@
     \parindent\z@\parfillskip\@flushglue\parskip\z@
     \@@par
     \def\par{\leavevmode\null\@@par\penalty\interlinepenalty}%
     \obeylines  
     \verbatim@font
     \let\do\@makeother \dospecials}
  \def\verbatim@startline{\verbatim@line{}} 
  \def\verbatim@processline{\hspace*{7mm}%
   \the\verbatim@line\par
     }%  
   \@verbatim \frenchspacing\@vobeyspaces\verbatim@start}
\def\endmuIn{%
  \@esphack}
%
% new environment 'muOut'
%
\def\muOut{%
  \@bsphack
  \let\do\@makeother\dospecials%
  \catcode`\^^M\active%
  \def\@verbatim{%
     \trivlist 
     \item[]%
     \leftskip\@totalleftmargin\rightskip\z@
     \parindent\z@\parfillskip\@flushglue\parskip\z@
     \@@par
     \def\par{\leavevmode\null\@@par\penalty\interlinepenalty}%
     \obeylines
     \verbatim@font
     \let\do\@makeother \dospecials}
  \def\verbatim@startline{\verbatim@line{}}
  \def\verbatim@processline{\hspace*{10mm}%
   \the\verbatim@line\par
     }%
   \@verbatim \frenchspacing\@vobeyspaces\verbatim@start}
\def\endmuOut{%
  \@esphack}
%
%
\@ifundefined{vrb@catcodes}%
  {\def\vrb@catcodes{%
     \catcode`\!12\catcode`\[12\catcode`\]12}}{}
\begingroup
 \vrb@catcodes
 \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
 \catcode`\~=\active \lccode`\~=`\^^M
 \lccode`\C=`\C
 \lowercase{%
    \gdef\verbatim@start#1{%
      \verbatim@startline
      \if\noexpand#1\noexpand~%
        \let\next\verbatim@
      \else \def\next{\verbatim@#1}\fi
      \next}%
    \gdef\verbatim@#1~{\verbatim@@#1!end\@nil}%
    \gdef\verbatim@@#1!end{%
       \verbatim@addtoline{#1}%
       \futurelet\next\verbatim@@@}%
    \gdef\verbatim@@@#1\@nil{%
       \ifx\next\@nil
         \verbatim@processline
         \verbatim@startline
         \let\next\verbatim@
       \else
         \def\@tempa##1!end\@nil{\toks@{##1}}%
           \@tempa#1\@nil
         \@temptokena{!end}%
         \edef\next{\noexpand\verbatim@test\the\toks@\noexpand~}%
       \fi \next}%
 \gdef\verbatim@test#1{%
           \let\next\verbatim@test
           \if\noexpand#1\noexpand~%
             \expandafter\verbatim@addtoline
               \expandafter{\the\@temptokena}%
             \verbatim@processline
             \verbatim@startline
             \let\next\verbatim@
           \else \if\noexpand#1
             \@temptokena\expandafter{\the\@temptokena#1}%
           \else \if\noexpand#1\noexpand[%
             \let\@tempc\@empty
             \let\next\verbatim@testend
           \else
             \expandafter\verbatim@addtoline
               \expandafter{\the\@temptokena}%
             \def\next{\verbatim@#1}%
           \fi\fi\fi
           \next}%
    \gdef\verbatim@testend#1{%
         \if\noexpand#1\noexpand~%
           \expandafter\verbatim@addtoline
             \expandafter{\the\@temptokena[}%
           \expandafter\verbatim@addtoline
             \expandafter{\@tempc}%
           \verbatim@processline
           \verbatim@startline
           \let\next\verbatim@
         \else\if\noexpand#1\noexpand]%
           \let\next\verbatim@@testend
         \else\if\noexpand#1\noexpand!%
           \expandafter\verbatim@addtoline
             \expandafter{\the\@temptokena[}%
           \expandafter\verbatim@addtoline
             \expandafter{\@tempc}%
           \def\next{\verbatim@!}%
         \else \expandafter\def\expandafter\@tempc\expandafter
           {\@tempc#1}\fi\fi\fi
         \next}%
    \gdef\verbatim@@testend{%
       \ifx\@tempc\@currenvir
         \verbatim@finish
         \edef\next{\noexpand\end{\@currenvir}%
                    \noexpand\verbatim@rescan{\@currenvir}}%
       \else
         \expandafter\verbatim@addtoline
           \expandafter{\the\@temptokena[}%
           \expandafter\verbatim@addtoline
             \expandafter{\@tempc]}%
         \let\next\verbatim@
       \fi
       \next}%
  \gdef\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else
        \@warning{Characters dropped after `\string\end{#1}'}\fi}}
\endgroup
\def\verbatiminput{\begingroup
  \@ifstar\sverbatim@input\verbatim@input}
\def\sverbatim@input#1{\@verbatim
  \@input{#1}\endtrivlist\endgroup\@doendpe}
\def\verbatim@input#1{\@verbatim
  \frenchspacing \@vobeyspaces
  \@input{#1}\endtrivlist\endgroup\@doendpe}
\begingroup
  \lccode`\~=`\^^M
  \lowercase{%
    \gdef\verb{\begingroup
      \verbatim@font
      \catcode`\^^M\active
      \def~{\endgroup\@latexerr{\string\verb\space command ended by
                                end of line.}\@ehc}%
    \let\do\@makeother \dospecials
    \@ifstar\@sverb{\@vobeyspaces \frenchspacing \@sverb}}}
\endgroup
\def\@sverb#1{%
  \catcode`#1\active
  \lccode`\~`#1%
  \lowercase{\let~\endgroup}%
  \leavevmode\null}
\endinput
%% 
%% End of file `verbatim.sty'.
% end of file
