


%% Meta-macros for language name, language piece

\def\Language#1{{\textsf{\small #1}}}
\def\LanguageTitle#1{{\textsf{ #1}}}
\def\LangPiece#1{\texttt{\small{}#1}}
\def\LangPieceIndex#1{\index{\protect\LangPiece{#1}}\LangPiece{#1}}
\def\LanguagePiece#1{\LangPiece{#1}}
\def\LangExample#1{\texttt{#1}} %% This allows \cmds to be expanded:
                                %% LangPiece does not.

\def\Cq#1{\LangPiece{"#1"}}

%% S material

\def\Splus{\Language{S-Plus}}
\def\SNull{\LangPiece{NULL}}

\def\SFunction#1{{\SFunctionX{#1}}}
\def\SFunctionName#1{{\LangPiece{#1}}}
\def\SFunctionNX#1{{\LangPiece{#1()}}} % no index term
\def\SFunctionX#1{{\LangPiece{#1()}\funIndex{#1}}} % with index term
\def\SCallX#1#2{\SExpression{#1(#2)}\funIndex{#1}}
\def\SOperator#1{{\LangPiece{"#1"}}\funIndex{#1@\LangPiece{#1}}}
%%\def\funIndex#1{\index[fun]{#1}}
\def\funIndex#1{}
%% only one index \def\funIndex#1{\index{#1}}
\def\SDocumentation#1{{\LangPiece{?#1}}}

\def\SVariable#1{{\LangPiece{#1}}}
\def\SMethod#1{{\LangPiece{#1}}}
\def\SClass#1{{\LangPiece{"#1"}}}
\def\RType#1{{\LangPiece{"#1"}}}
\def\SPackage#1{{\LangPiece{#1}}}
\def\SFile#1{{\LangPiece{"#1"}}}
\def\SSlot#1{{\LangPiece{"#1"}}}
\def\SExpression#1{{\LangPiece{#1}}} %% NB: distinguish from Sweave's
                                  %% \Sexpr, which evaluates the
                                  %% argument!
\def\STerm#1{{\LangPieceIndex{#1}}} %like SExpression but with an index term
\def\SInput#1{{\LangPiece{#1}}} %%Eventually could use a different font?
\def\SField#1{{\LangPiece{#1}}} %% Does this make sense?
\def\SUtility#1{{\LangPiece{#1}}}

\def\SPrompt{> }
\def\SContinue{+ }
\def\S={<-}
\def\STrue{{\LangPiece{TRUE}}}
\def\SFalse{{\LangPiece{FALSE}}}
\def\SOutput#1{{\texttt{#1}}}
\def\Namespace{\SExpression{NAMESPACE}\index{namespace@\SExpression{NAMESPACE}}}
\def\dotsArg{\Cq{...}\index{...@\Cq{...}}}

\def\RError#1{\Cq{#1}\index{error messages!{#1}}}

\def\OOP{\Language{OOP}}
\def\OOPClass#1{\LangPiece{#1}}
\def\OOPMethod#1{\LangPiece{#1}}
\def\OOPField#1{\LangPiece{#1}}


\def\CRoutine#1{{\LangEscape{#1}}}
\def\FRoutine#1{{\LangEscape{#1}}}


\def\CPP#1{\texttt\#\Escape{#1}}
%% Wanted: UTF8 or Unicode 60 \def\BackApos{\`}


\def\URL#1{\textbf{#1}}  %{#1}

% Directories and files.
\def\extension#1{\textbf{.#1}}
\def\file#1{\HREF{#1}{\textbf{small \Escape{#1}}}}
\def\dir#1{\HREF{#1}{\textbf{\small \Escape{#1}}}}
%%\def\url#1{\HREF{#1}{\textbf{\Escape{#1}}}}

\def\file#1{\textbf{\Escape{#1}}}
\def\dir#1{\textbf{\Escape{#1}}}
%\def\url#1{\textbf{\Escape{#1}}}

\def\executable#1{{\texttt{\file{#1}}}}

\def\Env#1{{\LangPiece{#1}}}
\def\Environment#1{\Env{#1}}

\def\C{\Language{C}}
\def\CTitle{\LanguageTitle{C}}
\def\Cpp{\Language{C{\footnotesize{}++}}}
\def\CppTitle{\textsf{C{\footnotesize{}++}}}
\def\Csharp{\Language{C{\footnotesize{}\#}}}
\def\Fortran{\Language{Fortran}}
\def\Unix{\Language{Unix}}
\def\Linux{\Language{Linux}}
\def\MacOSX{\Language{Mac OS X}}
\def\Windows{\Language{Windows}}
\def\CRoutine#1{\LangEscape{\Escape{#1()}}}

\def\S{\Language{S}}
\def\R{\Language{R}}
\def\RTitle{\LanguageTitle{R}}
\def\STitle{\LanguageTitle{S}}
\def\PerlTitle{\LanguageTitle{Perl}}
\def\Xlisp{\Language{Xlisp-Stat}}
\def\Rcore{\Language{R-core}} %% not the best def.  sort of a citation
\def\CRAN{\URL{CRAN}}

\newcommand{\3}{\LanguageTitle{S3}}
\newcommand{\4}{\LanguageTitle{S4}}

\def\Java{\Language{Java}}
\def\Lisp{\Language{Lisp}}

\def\Command#1{\LangPiece{#1}}

%% Caligraphic letters

\def\calA{$\mathcal{A}$}
\def\calB{$\mathcal{B}$}
\def\calC{$\mathcal{C}$}

\def\Sgets{<-}
\def\Sdblegets{<<-} %

\newcommand{\dQuote}[1]{``#1''}

\def\docspecials{\do\ \do\$\do\&%
  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}

\def\alltt{\trivlist \item[]\if@minipage\else\vskip\parskip\fi
\leftskip\@totalleftmargin\rightskip\z@
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\obeylines \small \tt \upshape \catcode``=13 \@noligs \let\do\@makeother \docspecials
 \frenchspacing\@vobeyspaces}

\let\endalltt=\endtrivlist

\newenvironment{Example}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item
\begin{alltt}}{\end{alltt}\end{list}}
