% LaTeX customization


\catcode`\@=11				% for a little while


% plain TeX compatibility

\def\oldstyle{\xdef\@oldstyle{\the\textfont\@ne}\mit\@oldstyle}


% PhD-TeX compatibility

\def\showsummary{%
    \begingroup
	\def\note##1{%
	    \ifcase\value{##1}no ##1s\or
		1 ##1\else
		\the\value{##1} ##1s\fi
	}%
	\tell{LaTeX summary: \note{figure}, \note{table}, \note{footnote}.}%
    \endgroup
}

\let\nfootnote=\footnote

\let\tell=\typeout

\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}

\def\implies{\quad\supset\ }

\def\tdots{\ldots\thinspace}

\let\bop=\newpage

\def\hbreak{\hfil\break}

\def\lp{\par\noindent}

\def\boxit#1{\fbox{\sc#1}}


% Figure Support

\def\tagfigure#1#2#3{%
    \begin{figure}[t]
	\hrule
	\vskip .5\baselineskip
	{\small\rm\input figure#1\relax\centerline{\box\graph}}%
	\vskip .5\baselineskip plus .5\baselineskip
	\caption{#2}%
	\label{#3}%
	\vskip 2pt
	\hrule
    \end{figure}%
}

\def\tagdiagram#1#2#3{%
    \begin{figure}[t]
	\hrule
	\vskip .5\baselineskip
	{\small\rm\input diagram#1\relax}%
	\vskip .5\baselineskip plus .5\baselineskip
	\caption{#2}%
	\label{#3}%
	\vskip 2pt
	\hrule
    \end{figure}%
}

\def\tagtable#1#2#3{%
    \begin{table}[t]
	\hrule
	\vskip .5\baselineskip
	{\small\rm\input table#1\relax}%
	\vskip .5\baselineskip plus .5\baselineskip
	\caption{#2}%
	\label{#3}%
	\vskip 2pt
	\hrule
    \end{table}%
}


% Draft Stuff

\newif\ifdraft	\draftfalse

\def\draftstring{{\ifdraft \tt Draft\fi}}

\def\draftext{%
    \ifdraft
	\begingroup
	    \tt
	    \ifodd\thepage
		\LaTeX set \today\ with \fmtname\ v\fmtversion
	    \else
		Draft \versiontag/ of \versiondate/
	    \fi
	\endgroup
    \fi
}

\def\versiontag/{\errmessage{version.tex not loaded!}}
\let\versiondate=\versiontag

\def\ds@DScustom{\ifdraft \@ifundefined{ds@draft}{}{\ds@draft}\fi}

\def\note#1{\ifdraft\marginpar{\tt#1}\fi}


% Galley style				% TODO


% Trademarks...

\input trademark


\catcode`\@=12				% back to normal
