\RequirePackage{amsbsy}          % AMS boldsymbol: defines `\boldsymbol'
\RequirePackage{alltt}           % {verbatim} allowing \..
\RequirePackage{verbatim}        % small example code

\addtolength{\textheight}{12mm}
\addtolength{\topmargin}{-9mm}   % still fits on US paper
\addtolength{\textwidth}{24mm}   % still fits on US paper
\setlength{\oddsidemargin}{10mm}
\setlength{\evensidemargin}{\oddsidemargin}

\newlength{\middle}
\setlength{\middle}{\textwidth}
\addtolength{\middle}{-2.25in}
\addtolength{\middle}{-4pt}

\newenvironment{display}[0]%
  {\begin{list}{}{\setlength{\leftmargin}{30pt}}\item}%
  {\end{list}}
\newcommand{\HTML}{\textsc{html}}
\newcommand{\R}{\textsc{R}}

\def\href#1#2{\special{html:<a href="#1">}{#2}\special{html:</a>}}

\newcommand{\vneed}[1]{%
  \penalty-1000\vskip#1 plus 10pt minus #1\penalty-1000\vspace{-#1}}

\newcommand{\Header}[2]{%
  \vneed{1ex}
  \markright{#1}
  \noindent
  \nopagebreak
  \begin{center}
    \begin{tabular}{c}
      \hline \rule[-0.275cm]{0cm}{0.8cm}
      \makebox[1in][l]{\texttt{#1}}
      \makebox[\middle]{\emph{#2}}
      \makebox[1in][r]{\texttt{#1}} \\ \hline
    \end{tabular}
  \end{center}}

\newlength{\ldescriptionwidth}
\newcommand{\ldescriptionlabel}[1]{%
  \settowidth{\ldescriptionwidth}{{#1}}%
  \ifdim\ldescriptionwidth>\labelwidth
    {\parbox[b]{\labelwidth}%
      {\makebox[0pt][l]{#1}\\[1pt]\makebox{}}}%
  \else  
    \makebox[\labelwidth][l]{{#1}}%
  \fi
  \hfil\relax}
\newenvironment{ldescription}[1][1in]%
  {\begin{list}{}%
    {\setlength{\labelwidth}{#1}%
      \setlength{\leftmargin}{\labelwidth}%
      \addtolength{\leftmargin}{\labelsep}%
      \renewcommand{\makelabel}{\ldescriptionlabel}}}%
  {\end{list}}

\newenvironment{Rdsection}[1]{%
  \ifx\@empty#1\else\subsubsection*{#1}\fi
  \begin{list}{}{\setlength{\leftmargin}{0.25in}}\item}
  {\end{list}}

\newenvironment{Arguments}{%
  \begin{Rdsection}{Arguments}}{\end{Rdsection}}
\newenvironment{Author}{%
  \begin{Rdsection}{Author(s)}}{\end{Rdsection}}
\newenvironment{Description}{%
  \begin{Rdsection}{Description}}{\end{Rdsection}}
\newenvironment{Examples}{%
  \begin{Rdsection}{Examples}}{\end{Rdsection}}
\newenvironment{Note}{%
  \begin{Rdsection}{Note}}{\end{Rdsection}}
\newenvironment{References}{%
  \begin{Rdsection}{References}}{\end{Rdsection}}  
\newenvironment{SeeAlso}{%
  \begin{Rdsection}{See Also}\raggedright}{\end{Rdsection}}
\newenvironment{Section}[1]{%
  \begin{Rdsection}{#1}}{\end{Rdsection}}
\newenvironment{Usage}{%
  \begin{Rdsection}{}}{\end{Rdsection}}
\newenvironment{Value}{%
  \begin{Rdsection}{Value}}{\end{Rdsection}}

\newenvironment{ExampleCode}{\small\verbatim}{\endverbatim}

\newcommand{\eqn}[2]{$#1$}
\newcommand{\bold}[1]{\ifmmode\mbox{\boldmath $#1$}\else\textbf{#1}\fi}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\deqn}[2]{\[#1\]}
\newcommand{\link}[1]{#1}
\newcommand{\email}[1]{\textless{#1}\textgreater}
