% style commands for 12 pt articles -- RWCox
%------------------------------------------------------------------------
% some page layout parameters

\setlength{\oddsidemargin}{.51in}
\setlength{\evensidemargin}{.51in}
\setlength{\topmargin}{0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\footheight}{1ex}
\setlength{\footskip}{.5in}
\setlength{\textheight}{8.50in}
\setlength{\textwidth}{5.99in}
%\parfillskip=0pt plus 4.45in
\setlength{\parskip}{0.3ex plus 0.3ex}
\setlength{\parindent}{1.2em}
\pagestyle{plain}
\hyphenpenalty=9876
\clubpenalty=10000
\widowpenalty=10000
\brokenpenalty=10000

\newcommand{\widemargins}{
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\parfillskip=0pt plus 4.95in
}

\newcommand{\skippar}{
\setlength{\parskip}{1.1ex plus 0.1ex minus 0.1ex}
\setlength{\parindent}{0.9em}}

\newcommand{\nth}[1]{$\hbox{#1}^{\hbox{th}}$}

%------------------------------------------------------------------------
% an alphabetic numbering set of commands

\newif\ifazinline\azinlinetrue
\newcounter{azcount}

\newcommand{\azstring}{\alph}

\newcommand{\azlist}{\setcounter{azcount}{0}%
\ifazinline{}%
\else\begin{description}%
\fi}

\newcommand{\azitem}[1]{\addtocounter{azcount}{1}%
\ifazinline{\bf [\azstring{azcount}]}~{#1}%
\else\item[{\makebox[1.2em]{[\makebox[0.8em]{\azstring{azcount}}]}}] {#1}%
\fi}

\newcommand{\azlend}{%
\ifazinline{}%
\else\end{description}%
\fi}

%------------------------------------------------------------------------
% page numbering commands
%   \boxpage will put the page number at the bottom in a box
%   \plainpage will just put the page number at the bottom [default]

\newcommand{\mypagebot}%
{\def\@oddfoot{\makebox[0pt][l]{\mypleft}\hfil\mypagenum\hfil\makebox[0pt][r]{\mypright}}%
\let\@evenfoot\@oddfoot}

\def\mypleft{}
\def\mypright{}

\newcommand{\boxpage}{\def\mypagenum{\fbox{\fbox{\rm\thepage}}}\mypagebot}
\newcommand{\plainpage}{\def\mypagenum{\rm\thepage}\mypagebot}
\newcommand{\dashpage}{\def\mypagenum{\rm--\thepage--}\mypagebot}
%------------------------------------------------------------------------
% allow for single and double spacing

\def\@normalsize{\@setsize\normalsize{\normalbskip}\xiipt\@xiipt
\abovedisplayskip 10pt plus3pt minus5pt%
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3pt% 
\belowdisplayshortskip  6.5pt plus3.5pt minus3pt}
\newlength{\normalbskip}
\newcommand{\singlespace}%
{\setlength{\normalbskip}{14.5pt}\@normalsize}
\newcommand{\doublespace}%
{\setlength{\normalbskip}{24.6pt plus.6pt minus.6pt}\@normalsize}
\singlespace
%------------------------------------------------------------------------
%  Allow user to change the way equations are numbered

\def\@eqnnum{{\rm \eqnleft\theequation\eqnright}}
\def\eqnleft{(}
\def\eqnright{)}
%------------------------------------------------------------------------
%  Allow user to change the way the bibliography and citations work
%  \boxcitetrue will produce citations like [1]
%  \boxcitefalse will produce citations like ^1.

\def\citeleft{[}
\def\citeright{]}
\def\citemiddle{}

\newif\ifboxcite\boxcitetrue
\def\@cite#1#2%
{\ifboxcite{\citeleft{\citemiddle#1\if@tempswa, #2\fi}\citeright}%  %[#1,#2]
\else{$\!\!{}^{{}^{#1}}$\,}\fi}                                     %^#1

\newif\ifboxcitelabel\boxcitelabeltrue

\def\@biblabel#1%
{\ifboxcitelabel{\citeleft#1\citeright\hfill}%     %[#1] label
\else{{#1.}\hfill}\fi}   %#1. label

\def\@bibitem#1{\addtocounter{enumi}{1}\item[\@biblabel{\arabic{enumi}}]
        \if@filesw\immediate
        \write\@auxout{\string\bibcite{#1}{\the\c@enumi}}\fi\ignorespaces}
%------------------------------------------------------------------------
% change footnotes to the standard symbols

\@addtoreset{footnote}{page}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%------------------------------------------------------------------------
% increase the minimum subscript dimension for the math fonts.  This
% should make subscripts on Greek letters look better

%% \fontdimen16\fivsy=1.3pt  \fontdimen17\fivsy=1.3pt
%% \fontdimen16\sixsy=1.6pt  \fontdimen17\sixsy=1.6pt
%% \fontdimen16\sevsy=1.9pt  \fontdimen17\sevsy=1.9pt
%% \fontdimen16\egtsy=2.1pt  \fontdimen17\egtsy=2.1pt
%% \fontdimen16\ninsy=2.4pt  \fontdimen17\ninsy=2.4pt
%% \fontdimen16\tensy=2.7pt  \fontdimen17\tensy=2.7pt  %from Knuth, p.179.
%% \fontdimen16\elvsy=2.9pt  \fontdimen17\elvsy=2.9pt
%% \fontdimen16\twlsy=3.2pt  \fontdimen17\twlsy=3.2pt
%% \fontdimen16\frtnsy=3.7pt \fontdimen17\frtnsy=3.7pt
%% \fontdimen16\svtnsy=4.6pt \fontdimen17\svtnsy=4.6pt
%% \fontdimen16\twtysy=5.4pt \fontdimen17\twtysy=5.4pt
%------------------------------------------------------------------------
%  define a couple of fonts
%
%%%\newfont{\inchhigh}{cminch}                   % inch-high letters
%%%\newfont{\fraktur}{eufm10 scaled\magstep1}    % Fraktur scaled to 12pt
%------------------------------------------------------------------------
% some hyphenations (from the TUGboat list)

\hyphenation{acad-e-my an-a-lyze anom-aly an-tin-o-my an-tin-o-mies ap-pen-dix
             as-ymp-tot-ic at-mos-phere band-leader brown-ian data-base
             dis-trib-ute eng-lish euler-ian gauss-ian
             geo-met-ric hamil-ton-ian her-mit-ian hexa-dec-i-mal
             le-gendre lip-schitz mar-kov-ian mass-a-chu-setts mono-pole
             mul-ti-plic-able par-a-bol-ic pa-ram-eter pa-ram-eters
             pa-ram-e-trized poin-care
             qua-drat-ics rie-mann-ian schro-ding-er schwarz-schild
             semi-definite set-up wave-guide data-set sub-dir-ec-tory
             sub-dir-ec-tories dir-ec-tory dir-ec-tories ver-sion}
%-------------------------------------------------------------------------------
% miscellaneous additions
%  \displayline{x} will produce a bold, underlined header
%  \topline{x} will make a centered, large header
%  \marginnote{x} will put a marginal note on the right

\newcommand{\displayline}[1]%
{\vspace{0.9ex plus 0.1ex}\goodbreak\noindent%
\underline{\bf$\vphantom{y}$#1}\\*[.3ex]\nopagebreak}

\newcommand{\topline}[1]%
{\goodbreak\vspace{2ex plus 1ex}\centerline{\large\sf #1}%
\nopagebreak\vspace{1ex}\nopagebreak}

\newif\ifmarginnote\marginnotetrue
\setlength{\marginparsep}{0.25in}
\setlength{\marginparwidth}{0.70in}
\reversemarginpar
\newcommand{\marginnote}[1]%
{\ifmarginnote{\marginpar{\tiny\flushright #1}}\else{}\fi}

%%% \memohead{To}{From}{Subject}

\newcommand{\memohead}[3]%
{\begin{tabbing}
SUBJECT  \=\kill
\sf To:     \> \bf #1 \\
\sf From:   \>     #2 \\
\sf Subject:\>     #3 \\
\sf Date:   \> \today
\end{tabbing}
}

% \underl <underlined text> & 
% Allows you underline large blocks of text and still have line-breaking work.
% (But NOT hyphenation!  \raggedright mode is best for this stuff.)
% The space before "&" is important. (And you may need "\ \ " after it too.)

\def\underl#1 {\leavevmode\let\first=\relax\underli #1 }
\def\underli#1 {\ifx&#1\let\next=\relax\unskip
                \else\let\next=\underli\first\ulinebox{#1}\fi\let\first=\undersp\next}
\def\undersp{\penalty10000\ulinebox{\space}\penalty0}
\def\ulinebox#1{\vtop{\hbox{\rule[-3.9pt]{0pt}{3.9pt}#1}\hrule}}

%-------------------------------------------------------------------------------
% Within the subequations environment, the only change is that
% equations are labeled differently.  The number stays the same,
% and lower case letters are appended.  For example, if after doing
% three equations, numbered 1, 2, and 3, you start a subequations
% environmment and do three more equations, they will be numbered
% 4a, 4b, and 4c.  After you end the subequations environment, the
% next equation will be numbered 5.  If you use a \label command
% immediately after the \begin{subequations} command, then a
% reference to that label will generate a reference to the equation
% number without the alphabetic extension.  Both text and equations
% can be put inside the subequations environment.

\newtoks\@stequation

\def\subequations{\refstepcounter{equation}%
  \edef\@savedequation{\the\c@equation}%
  \@stequation=\expandafter{\theequation}%   %only want \theequation
  \edef\@savedtheequation{\the\@stequation}% %expanded once
  \edef\oldtheequation{\theequation}%
  \setcounter{equation}{0}%
  \def\theequation{\oldtheequation\alph{equation}}}%

\def\endsubequations{%
  \setcounter{equation}{\@savedequation}%
  \@stequation=\expandafter{\@savedtheequation}%
  \edef\theequation{\the\@stequation}\global\@ignoretrue}
%-------------------------------------------------------------------------------
% math additions  [see also the amssymbols.sty file]

\newcommand{\thalf}{{\textstyle\frac{1}{2}}}      %shorthands for 1/2
\newcommand{\half}%
{\mathchoice{\frac{1}{2}}{\frac{1}{2}}{1/2}{1/2}}

\newcommand{\qqqq}{\qquad\qquad}                  %spacing

% \stackthree is like the LaTeX \stackrel command, but stacks up 3
% symbols instead

\newcommand{\stackthree}[3]{\mathrel{\mathop{\kern0pt #1}\limits_{#3}^{#2}}}

% \pvint does \int with a bar thru it

\newcommand{\pvint}%
{\mathchoice{\hbox{\bf---}\mkern-21mu}{\hbox{\bf--}\mkern-13.5mu}{}{}\int}

%  define some commands to do differentiation in different text styles:
%  in displaystyle, use  dy
%                        --;  in other styles, use dy/dx
%                        dx

\newcommand{\dif}[2]%
{\mathchoice{\frac{d#1}{d#2}}{d#1/d#2}{d#1/d#2}{d#1/d#2}}

\newcommand{\difn}[3]%
{\mathchoice{\frac{d^#3#1}{d#2^#3}}%
{d^#3#1/d#2^#3}{d^#3#1/d#2^#3}{d^#3#1/d#2^#3}}

\newcommand{\pardif}[2]%
{\mathchoice{\frac{\partial#1}{\partial#2}}%
{\partial#1/\partial#2}{\partial#1/\partial#2}{\partial#1/\partial#2}}

\newcommand{\pardifn}[3]%
{\mathchoice{\frac{\partial^#3#1}{\partial#2^#3}}%
{\partial^#3#1/\partial#2^#3}{\partial^#3#1/\partial#2^#3}%
{\partial^#3#1/\partial#2^#3}}

\newcommand{\pardiftwo}[3]%
{\mathchoice{\frac{\partial^2#1}{\partial#2\partial#3}}%
{\partial^2#1/\partial#2\partial#3}{\partial^2#1/\partial#2\partial#3}%
{\partial^2#1/\partial#2\partial#3}}

%==========================================================================
\newcommand{\V}[2]{\newcommand{#1}{{\bf #2{}}}}

\V{\vA}{A} \V{\vB}{B} \V{\vC}{C} \V{\vD}{D} \V{\vE}{E}
\V{\vF}{F} \V{\vG}{G} \V{\vH}{H} \V{\vI}{I} \V{\vJ}{J}
\V{\vK}{K} \V{\vL}{L} \V{\vM}{M} \V{\vN}{N} \V{\vO}{O}
\V{\vP}{P} \V{\vQ}{Q} \V{\vR}{R} \V{\vS}{S} \V{\vT}{T}
\V{\vU}{U} \V{\vV}{V} \V{\vW}{W} \V{\vX}{X} \V{\vY}{Y} \V{\vZ}{Z}

\V{\va}{a} \V{\vb}{b} \V{\vc}{c} \V{\vd}{d} \V{\ve}{e}
\V{\vf}{f} \V{\vg}{g} \V{\vh}{h} \V{\vi}{i} \V{\vj}{j}
\V{\vk}{k} \V{\vl}{l} \V{\vm}{m} \V{\vn}{n} \V{\vo}{o}
\V{\vp}{p} \V{\vq}{q} \V{\vr}{r} \V{\vs}{s} \V{\vt}{t}
\V{\vu}{u} \V{\vv}{v} \V{\vw}{w} \V{\vx}{x} \V{\vy}{y} \V{\vz}{z}

\newcommand{\gV}[2]{\newcommand{#1}{\hbox{\boldmath$#2$}}}

\gV{\valpha}{\alpha}
\gV{\vbeta}{\beta}
\gV{\vgamma}{\gamma}
\gV{\vdelta}{\delta}
\gV{\vepsilon}{\epsilon}  \gV{\veps}{\epsilon}  \newcommand{\eps}{\epsilon}
\gV{\vxi}{\xi}
\gV{\veta}{\eta}
\gV{\vtheta}{\theta}
\gV{\vphi}{\phi}
