
% Need these for YHMATH article.

% amsfonts redefines these, but I need
% the old versions for comparison so...
\let\oldwidehat\widehat
\let\oldwidetilde\widetilde

\usepackage{amsmath,amsfonts}

\let\amswidehat\widehat
\let\amswidetilde\widetilde
\let\widehat\oldwidehat
\let\widetilde\oldwidetilde



%%%yhmath.sty except put into a new math version so can run both for
%%%comparison

\DeclareMathVersion{yh}
\SetSymbolFont{largesymbols}{yh}{OMX}{yhex}{m}{n}

\DeclareMathAccent{\widetriangle}{\mathord}{largesymbols}{"E6}
\DeclareMathAccent{\wideparen}{\mathord}{largesymbols}{"F3}
\newenvironment{amatrix}{\left\langle\matrix}{\endmatrix\right\rangle}
\def\adots{\mathinner{\mkern2mu\raise\p@\hbox{.}
\mkern2mu\raise4\p@\hbox{.}\mkern1mu
\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}
\edef\@tempa#1#2{\def#1{\mathaccent\string"\noexpand\accentclass@#2 }}
\@tempa\ring{017}
\newcommand{\widering}[1]{\overset{\smash{\lower1.333ex\hbox{$%
\displaystyle\ring{}$}}}{\wideparen{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% For the pstricks series

\RequirePackage{pstcol}
\RequirePackage{pst-grad}
\RequirePackage{pst-text}
\RequirePackage{pst-char}
\RequirePackage{pst-3d}
\RequirePackage{fancyvrb}
\RequirePackage{shortvrb}
\RequirePackage{array,longtable}
\definecolor{wheat}{rgb}{.96, .87, .7}
\definecolor{lightblue}{rgb}{.68, .85, .9}
\definecolor{brown}{rgb}{.65, .16, .16}
\definecolor{pink}{rgb}{1, .75, .8}
\definecolor{palegreen}{rgb}{.6, .98, .6}
\definecolor{white}{rgb}{1, 1, 1 }
\catcode`\<=13
\def\Main#1{{\MainFont\string#1}}
\def\MainFont{\ttfamily\upshape}          % For macro definitions.
\def\ArgFont{\sffamily\mdseries\upshape}           % For meta arguments.
\def\OptArgFont{\sffamily\mdseries\itshape}  % For optional arguments.
%\let\OptArgFont\ArgFont
\def<#1>{{\normalfont\itshape#1\/}}
% parameter descriptions are always in a table
\def\Par#1{\@ifnextchar({\@Par#1}{\@@Par#1()}}
\def\@Par#1=#2(#3){%
    {\normalfont #1}={\ArgFont#2}& #3}
% Short-cuts for coordinates:
\def\x#1{{\normalfont\itshape $x$#1\/}}
\def\y#1{{\normalfont\itshape $y$#1\/}}
\def\z#1{{\normalfont\itshape $z$#1\/}}
\def\x#1{$x_{#1}$}
\def\y#1{$y_{#1}$}
\def\z#1{$z_{#1}$}
\def\c#1{(\x{#1},\kern 1pt\y{#1})}
\def\cAny{(\x{},\kern 1pt\y{})}
% In each case:
%  1. definition is delimited only by end-of-line.
%  2. {}, () and [] are literal, with contents set in \ArgFont
%  3. = and , are literal.
%  4. `foo' is for optional arguments.
%  5. <foo> is meta, as usual.
\begingroup
  \catcode`\<=1 \catcode`\>=2
  \catcode`\{=13 \catcode`\}=12
  \catcode`\[=13
  \gdef\@MD<%
    \catcode`\{=13 \catcode`\}=12 \catcode`\[=13
    \def{##1}<\{<\ArgFont ##1\/>\}>%
    \def[##1]<\string[<\ArgFont ##1\/>]>>
\endgroup
\begingroup
  \catcode`\(=13
  \catcode`\,=13
  \catcode`\==13
  \gdef\MacroDefCodes{%
    \@MD
    \catcode`\(13
    \catcode`\^^M12
    \catcode`\`13
    \catcode`\,13
    \catcode`\!1
    \catcode`\@2
    \def~{}%
    \def={{\fontshape{n}\selectfont\string=}}%
    \def,{{\fontshape{n}\selectfont\string,}}%
    \def(##1){\string({\ArgFont ##1})}}
\endgroup

\begingroup
  \catcode`\`=13 \gdef`#1'{{\OptArgFont #1}}
\endgroup

\begingroup
  \catcode`\^^M=12\relax%
  \gdef\GetMacroDef#1{\begingroup\MacroDefCodes\@GetMacroDef{#1}}%
  \gdef\@GetMacroDef#1#2^^M{#1{#2}\endgroup}%
\endgroup

% For listing macro definitions in a "description" environment:
\def\PSTCom{\GetMacroDef\@PSCom}
\def\@PSCom#1{\@@PSCom#1\@nil}
\def\@@PSCom#1\@nil{\MainFont\Main#1}
\def\PSTComOpt{\GetMacroDef\@PSTComOpt}
\def\@PSTComOpt#1{\@@PSComOpt#1\@nil}
\def\@@PSComOpt#1#2\@nil{\@PSCom{#1{\OptArgFont*[{\ArgFont settings}]}#2}}
\MakeShortVerb{\"}
\DeleteShortVerb{\|}
\def\PST{\textsf{PSTricks}}
\def\PS{\textsc{PostScript}}
\def\Special{{\normalfont\ttfamily\char'134special}}
\def\Lcs#1{{\normalfont\ttfamily\char'134#1}}
\def\Program#1{\emph{#1}}
\def\Lpack#1{\emph{#1}}
%----------- Zandtisms --------------------
\def\Usage#1{{\UsageFont\string#1}}
\def\MainFont{\fontfamily{\ttdefault}\fontseries{bc}\fontshape{n}\selectfont
\large}% For macro definitions.
\def\UsageFont{\fontfamily{\ttdefault}\fontseries{bc}\fontshape{n}\selectfont}
     % For in-line macro names.
\def\InlineFont{\ttfamily}             % For other in-line snipets of code.
\let\main\textbf
\let\usage\emph
% ---------- for array.sty --------------
\def\arraybackslash{\let\\=\@arraycr}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
% ----------- harvard-style citations ------------------
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
\def\ETAL{{\em et al\/}}%

\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
        {b@\@citeb}{$\underline{\mbox{\@citeb}}$\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}%
% label for a bibliography citation not produced
 \def\@biblabel#1{\hfill}  

% with page or fig no
\def\Cite#1#2{\cite[#2]{#1}}%
% year only, with page or fig no
\def\Yearcite#1#2{\yearcite[#2]{#1}}%
\let\@internalcite\cite
\def\cite{\def\citename##1{##1}\@internalcite}%
% \yearcite gives only the date
\def\yearcite{\def\citename##1{}\@internalcite}%
%
\def\endPSExample{%
  \EndExample
\VerbatimInput[gobble=0,fontsize=\small,
%      frame=topline,
framerule=1.5pt]{\EXdir\theeps@counter}%
\begin{center}
    \ifgrid\vskip 8pt \fi
    \expandafter\pspicture\PictureSize
    \ifgrid\usergrid\else\relax\fi
    \input{\EXdir\theeps@counter}
    \endpspicture
    \ifgrid\vskip 8pt \fi
        \EndRuleExample
\end{center}
 }%
\renewenvironment{example**}%
{\def\Write@Ex##1{}\BeginExample}%
{%
\EndExample
\VerbatimInput[gobble=0,fontsize=\small,
      %frame=topline,
framerule=1.5pt]{\EXdir\theeps@counter}%
\begin{center}
\input{\EXdir\theeps@counter}
        \EndRuleExample
\end{center}
}


\catcode`\<=12



%%%%%%%%%%%%%
% for Robin
\def\Question{\@ifnextchar[{\@Question}{\subsection}}
\def\@Question[#1]#2{\subsection{#2}\Qlabel{#1}}

\newcommand{\CTANdirectory}[2]{\@ifundefined{ctan-#1}{%
   \expandafter\gdef\csname ctan-#1\endcsname{#2}%
}{%
   \PackageWarning{faq}{Repeated definition of label: #1}%
}}
\let\CTANfile\CTANdirectory

\newcounter{CTAN@unrefs}
%
% the command itself
\DeclareRobustCommand{\CTANref}[1]{\@ifundefined{ctan-#1}{%
    \PackageWarning{CTAN}{Undefined reference: #1}%
    \stepcounter{CTAN@unrefs}%
}{%
    \edef\@tempa{\noexpand\CTAN{\csname ctan-#1\endcsname}}\@tempa
}}
%
% hook for diagnosing undefined references at the end
\AtEndDocument{\ifthenelse{\theCTAN@unrefs > 0}{%
    \PackageWarning{CTAN}{There were \arabic{CTAN@unrefs} undefined
      references to CTAN}%
    }%
    {}%
  }

%%%%%%

% For my tour

\newenvironment{filedesc}{%
  \description
  \renewcommand\makelabel[1]{\hspace\labelsep
                                \normalfont\ttfamily ##1}}
  {\enddescription}

\let\package\textsf % as in \package{longtable} package
\let\class\textsf
\let\env\textsf

%% Shut up
\setlength\vfuzz{2pt}

