% ============================-*- LaTeX -*-=============================
%
%   jeffe.sty -- macros I use everywhere
%
%   Jeff Erickson (jeffe@cs.uiuc.edu)
%   Last modified 09 Jul 2000
%   This is free; caveat emptor!
%
%   Requirements that may not be part of every TeX distribution: 
%   (1) The standard AMS math packages amsmath and amssymb.  These are
%       absolutely vital to anyone who typesets mathematics of any
%       kind.  If you don't have them, get them NOW!!
%   (2) The textcomp package.  Cosmetic only.
%   (3) Knuth's manual font `manfnt'.  Cosmetic only.
%
% ======================================================================
\RequirePackage{latexsym,amsmath,amssymb,hyperref,url}
\urlstyle{same}

\hyphenation{co-or-din-ate co-or-din-ates half-space stereo-iso-mers
stereo-iso-mer Round-table}

% ----------------------------------------------------------------------
%  Common abbreviations and words with accents
% ----------------------------------------------------------------------

% ---- LATIN ----
\def\etal{\emph{et~al.}}
\def\ie{\emph{i.e.}}
\def\eg{\emph{e.g.}}
\def\vitae{vit\ae{}}
\def\apriori{\emph{a~priori}}
\def\aposteriori{\emph{a~posteriori}}

% ---- FRENCH ----
\def\naive{na\"{\i}ve}
\def\Naive{Na\"{\i}ve}
\def\naively{na\"{\i}vely}	% Okay, I know, this isn't French.
\def\Naively{Na\"{\i}vely}
\def\cafe{caf\'e}

% ---- GERMAN ----
\def\fur{f\"ur}
\def\Universitat{Universit\"at}
\def\Saarbrucken{Saar\-br\"ucken}	% Bypass TeX hyphenation
\def\Zurich{Z\"urich}

% ---- PORTUGESE (Hi Jorge!) ----
\def\Computacao{Computa\c{c}\~ao}

% ---- PROPER NAMES (because I'm lazy) ----
\def\Benes{Bene\v{s}}		% ...network
\def\Bezier{B\'ezier}		% ...spline/curve/surface
\def\Bjorner{Bj\"orner}
\def\Bochis{Bochi\c{s}}		% Daciana
\def\Boruvka{Bor\.uvka}		% ...'s MST algorithm
\def\Bragger{Br\"agger}
\def\Bronnimann{Br\"onnimann}   \def\Herve{Herv\'e}
\def\Bruckner{Br\"uckner}
\def\Caratheodory{Carath\'eodory}	% Constantin
\def\Chvatal{Chv\'atal}         \def\Vasek{Va\v{s}ek}
				\def\Joao{Jo\~ao}	% Compa
\def\Cortes{Cort\'es}		% Carmen
\def\Dujmovic{Dujmovi\'c}	% Vida
				\def\Fredo{Fr\'edo}	% Durand
\def\Erdos{Erd\H{o}s}           \def\Pal{P\'al}
\def\Frechet{Fr\'echet}
\def\Furedi{F\"uredi}           \def\Zoltan{Zolt\'an}
\def\Grobner{Gr\"obner}		% ... basis
\def\Grunbaum{Gr\"unbaum}	% Branko
\def\Hanoi{Hano\"\i}		% Tower of...
\def\Jarnik{Jarn\a'{\i}k}	% ...'s (`Prim's') MST algorithm
\def\Komlos{Koml\'os}
\def\Kovari{K\"ov\'ari}
\def\Lovasz{Lov\'asz}           \def\Laszlo{L\'aszl\'o}
\def\Matousek{Matou\v{s}ek}     \def\Jiri{Ji\v{r}\'\i}
\def\Mnev{Mn\"ev}
\def\Mobius{M\"obius}		% ... strip/transformation/function
\def\Mucke{M\"ucke}		% Ernst
\def\ODunliang{\'O'D\'unliang}
\def\Oleinik{Ole\u{\i}nik}
                                \def\Janos{J\'anos}     % Pach
\def\Palasti{Pal\'asti}
				\def\Belen{Bel\'en}	% Palop
\def\Petrovskii{Petrovski\u{\i}}
\def\Pinar{P\i nar}		% Ali
\def\Plucker{Pl\"ucker}		% ... coordinates
\def\Poincare{Poincar\'e}	% ... duality/halfplane
                                \def\Gunter{G\"unter}   % Rote, Ziegler
\def\Sacristan{Sacrist\'an}	% Vera
\def\Saskin{\v{S}a\v{s}kin}
\def\Schomer{Sch\"omer}
\def\Schonhardt{Sch\"onhardt}	% ... polyhedron
\def\Sos{S\'os}
\def\Stackel{St\"ackel}		% Paul
\def\Szekely{Sz\'ekely}
\def\Szemeredi{Szemer\'edi}
\def\Toth{T\'{o}th}		% Geza
\def\Turan{Tur\'an}
\def\Ungor{\"Ung\"or}		% Alper
\def\Voronoi{Vorono\"i}		% ... diagram [for francophile pedants only]

% Other
\def\Cplusplus{C\raisebox{0.5ex}{\tiny\bf++}}

% ----------------------------------------------------------------------
%  Simple math stuff
% ----------------------------------------------------------------------

% ---- SYMBOLS ----
\let\e\varepsilon               % a ``real'' epsilon

\def\Integer{\mathsf{Z\hspace{-0.4em}Z}}
\def\Natural{\mathrm{I\!N}}
\def\Real{\mathrm{I\!R}}
\def\Proj{\mathrm{I\!P}}	% projective space
\def\Hyper{\mathrm{I\!H}}	% hyperbolic space

%
%  These two look okay in Computer Modern 11pt, or Concrete Roman
%  12pt, but they need serious work in other sizes.  I need to figure
%  out how to draw a vertical bar, or better yet a shallow arc, inside
%  the bowls.  Or maybe I need to learn METAFONT.
%
\def\Complex{\mathrm{\,\raise 0.33ex\hbox{\scriptsize\bf(}\!\!\!C}}
\def\Rational{\mathrm{\,\raise 0.33ex\hbox{\scriptsize\bf(}\!\!\!Q}}

%
%  Here are more standard, but uglier, versions of these symbols.
%  They stick out, because they're all in Times Roman Bold Outline!
%  I *really* want a Concrete Blackboard or Euler Blackboard font, but
%  I'd settle for Computer Modern Blackboard.
%
%\def\Real{\mathbb{R}}
%\def\Proj{\mathbb{P}}
%\def\Hyper{\mathbb{H}}
%\def\Integer{\mathbb{Z}}
%\def\Natural{\mathbb{N}}
%\def\Complex{\mathbb{C}}
%\def\Rational{\mathbb{Q}}

\let\N\Natural
\let\Q\Rational
\let\R\Real
\let\Z\Integer
\def\Rd{\Real^d}
\def\RP{\Real\Proj}
\def\CP{\Complex\Proj}

% ---- OPERATORS (requires amsmath) ----
\def\aff{\operatorname{aff}}		% (\Line is better!)
\def\area{\operatorname{area}}
\def\argmax{\operatornamewithlimits{arg\,max}}
\def\argmin{\operatornamewithlimits{arg\,min}}
\def\Aut{\operatorname{Aut}}		% Automorphism group
\def\card{\operatorname{card}}		% cardinality, deprecated for \abs
\def\conv{\operatorname{conv}}		% (\overline is better!)
\def\E{\operatorname{E}}		% Expectation: $\E[X]$ (like \Pr)
\def\EE{\operatornamewithlimits{E}}
\def\Hom{\operatorname{Hom}}		% Homomorphism group
\def\id{\operatorname{id}}		% identity
\def\im{\operatorname{im}}		% image
\def\lcm{\operatorname{lcm}}
\def\lfs{\operatorname{lfs}}		% local feature size
\def\poly{\operatorname{poly}}
\def\polylog{\operatorname{polylog}}
\def\rank{\operatorname{rank}}
\def\rel{\operatorname{rel\,}}		% relative (interior, boundary, etc.)
\def\sgn{\operatorname{sgn}}
\def\vol{\operatorname{vol}}		% volume

\def\fp#1{^{\underline{#1}}}            % falling powers: $n\fp{d}$
\def\rp#1{^{\overline{#1}}}             % rising powers:  $n\rp{d}$

% --- Cheap displaystyle operators ---
\def\Frac#1#2{{\displaystyle\frac{#1}{#2}}}
\def\Sum{\sum\limits}
\def\Prod{\prod\limits}
\def\Union{\bigcup\limits}
\def\Inter{\bigcap\limits}
\def\Lor{\bigvee\limits}
\def\Land{\bigwedge\limits}
\def\Lim{\lim\limits}
\def\Max{\max\limits}
\def\Min{\min\limits}

% ---- RELATORS ----
\def\deq{\stackrel{\scriptscriptstyle\triangle}{=}}
\def\mapsfrom{\leftarrow\!\mapstochar\,}
\let\into\hookrightarrow		% = one-to-one
\let\onto\twoheadrightarrow
\def\inonto{\DOTSB\lhook\joinrel\twoheadrightarrow}
\let\from\leftarrow
\let\tofrom\leftrightarrow


% ---- DELIMITER PAIRS ----
\def\floor#1{\lfloor #1 \rfloor}
\def\ceil#1{\lceil #1 \rceil}
\def\seq#1{\langle #1 \rangle}
\def\set#1{\{ #1 \}}
\def\abs#1{\mathopen| #1 \mathclose|}	% use instead of $|x|$ 
\def\norm#1{\mathopen\| #1 \mathclose\|}% use instead of $\|x\|$ 
\def\indic#1{\big[#1\big]}		% indicator variable; Iverson notation
					% e.g., Kronecker delta = [x=0]

% --- Self-scaling delmiter pairs ---
\def\Floor#1{\left\lfloor #1 \right\rfloor}
\def\Ceil#1{\left\lceil #1 \right\rceil}
\def\Seq#1{\left\langle #1 \right\rangle}
\def\Set#1{\left\{ #1 \right\}}
\def\Abs#1{\left| #1 \right|}
\def\Norm#1{\left\| #1 \right\|}
\def\Paren#1{\left( #1 \right)}		% need better macro name!
\def\Brack#1{\left[ #1 \right]}		% need better macro name!
\def\Indic#1{\left[ #1 \right]}		% indicator variable; Iverson notation

%
%  Macros to typeset sets like {foo|bar} with all three delimiters
%  correctly scaled to fit.  What I *really* want is a \middle macro
%  that acts just like \left and \right.  Grumble.
%
\def\Bigbar#1{\mathrel{\left|\vphantom{#1}\right.\n@space}}
\def\Setbar#1#2{\Set{#1 \Bigbar{#1 #2} #2}}
\def\Seqbar#1#2{\Seq{#1 \Bigbar{#1 #2} #2}}
\def\Brackbar#1#2{\Brack{#1 \Bigbar{#1 #2} #2}}

%  Math mode fbox
\def\mfbox#1{\mathchoice{{\fbox{\ensuremath{\displaystyle #1}}}}
			{{\fbox{\ensuremath{\textstyle #1}}}}
			{{\fbox{\ensuremath{\scriptstyle #1}}}}
			{{\fbox{\ensuremath{\scriptscriptstyle #1}}}}}

% ---- ``ACCENTS'' ----
%   NB: Commands equivalent to \lrarrowfill and \overlrarrow are
%       already defined in amstex!
\def\lrarrowfill{$\m@th\mathord\leftarrow\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord-\mkern-2mu$}\hfill
  \mkern-6mu\mathord\rightarrow$}
\def\overlrarrow#1{\vbox{\ialign{##\crcr
      \lrarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
      $\hfil\displaystyle{#1}\hfil$\crcr}}}

\def\Line#1{\!\overlrarrow{\vphantom{t}\smash{\,#1\,}}\!}
\def\Ray#1{\overrightarrow{\vphantom{t}#1\,}\!}
\def\Seg#1{\overline{\vphantom{t}#1}}

% --- TEXT STYLES ---
\def\mathsc#1{\text{\textsc{#1}}}
\def\mathbs#1{\text{\boldmath\ensuremath{#1}}}
\def\EMPH#1{\textbf{\emph{\boldmath #1}}}

% ----------------------------------------------------------------------
%  \begin{bigabstract}...\end{bigabstract}
%  For use in documents with title pages.  Use normal-sized text in
%  the abstract!
% ----------------------------------------------------------------------
\newenvironment{bigabstract}%
{\medskip\noindent\centerline{\textbf{\large\abstractname}}\begin{quotation}}%
{\end{quotation}}

% ----------------------------------------------------------------------
%  Make captions smaller than the text, make their titles bold.
%  Arguments:   #1 == figure name: "Figure 5"
%               #2 == caption: "Papers by \Erdos, 1900--2000 (projected)"
%  Less space after floats and before caption, since captions are smaller
% ----------------------------------------------------------------------
\@ifundefined{abovecaptionskip}{\newlength\abovecaptionskip}
\long\def\@makecaption#1#2{
   \vskip \abovecaptionskip
   \setbox\@tempboxa\hbox{{\sf\footnotesize \textbf{#1.} #2}}
   \ifdim \wd\@tempboxa >\hsize         % IF longer than one line:
       {\sf\footnotesize \textbf{#1.} #2\par}% THEN set as ordinary paragraph.
     \else                              %   ELSE  center.
       \hbox to\hsize{\hfil\box\@tempboxa\hfil}
   \fi}
\dbltextfloatsep 18pt plus 2pt minus 4pt% was 20pt plus 2pt minus 4pt
\textfloatsep 18pt plus 2pt minus 4pt   % was 20pt plus 2pt minus 4pt
\abovecaptionskip 6pt			% was 10pt

% ----------------------------------------------------------------------
%  Revised theorem environment:
%  Add a period after the theorem number, and make theorems slanted
%  instead of italic to help distinguish text from math.  Use
%  \boldmath in theorem label in case it includes math.
% ----------------------------------------------------------------------
\def\@opargbegintheorem#1#2#3{\trivlist
	\item[\hskip\labelsep{\bf\boldmath #1\ #2\ (#3).}]\sl}
\def\@begintheorem#1#2{\trivlist
	\item[\hskip\labelsep{\bf\boldmath #1\ #2.}]\sl}

% ----------------------------------------------------------------------
%  \newproof{type}{text}(style)[post]:
%  Define a new type of unnumbered ``theorem'' environment.  The last
%  two arguments are optional; most environments will not use them.
%
%  To change label style, put new style command in label:
%       \newproof{comment}{\sf Comment}
% ----------------------------------------------------------------------
\def\newproof#1#2{\@ifnextchar({\@snproof{#1}{#2}}{\@snproof{#1}{#2}(\rm)}}
\def\@snproof#1#2(#3){\@ifnextchar[{\@xnproof{#1}{#2}{#3}}
                                   {\@xnproof{#1}{#2}{#3}[]}}

\def\@xnproof#1#2#3[#4]{%\expandafter\@ifdefinable\csname #1\endcsname
{\global\@namedef{#1}{\@prf{#2}{#3}}\global\@namedef{end#1}{\@endprf{#4}}}}

\def\@prf#1#2{\@ifnextchar[{\@xprf{#1}{#2}}{\@yprf{#1}{#2}}}
\def\@xprf#1#2[#3]{\@yprf{#1\ (#3)}{#2}}
\def\@yprf#1#2{\begin{trivlist}\item[\hskip\labelsep{\bf\boldmath #1:}]#2}

\def\@endprf#1{#1\end{trivlist}}

%
%  Standard proof envrionment: last line has a halmos at the right margin.
%
\newif\ifneedqed
\global\needqedfalse
\@ifundefined{square}{\let\square\Box}{}	% grumble latex2e 
\def\QED{\ensuremath{{\square}}}
\def\markatright#1{\leavevmode\unskip\nobreak\quad\hspace*{\fill}{#1}}
\def\qed{\ifneedqed\markatright{\QED}\global\needqedfalse\else\null\fi}
\newproof{proof}{Proof\global\needqedtrue}[\qed]
\newproof{sketch}{Proof Sketch\global\needqedtrue}[\qed]

\newenvironment{rawproof}%
   {\begin{trivlist}\item[\hskip\labelsep\textbf{Proof:}\global\needqedtrue]}%
   {\qed\end{trivlist}}

%
%  If the proof ends with a displayed equation, use \aftermath just
%  before \end{proof} to put the halmos in the ``right'' place.  This
%  may not work near page boundaries. 
%
\def\aftermath{\par\vspace{-\belowdisplayskip}\vspace{-\parskip}\vspace{-\baselineskip}}

% ----------------------------------------------------------------------
%  One-shot theoremish environment.  For named things like ``Zorn's
%  Lemma'' or ``The Death Leap Principle'' or ``The Zone Theorem''.
%  To get one-shot proofish environment, put \rm inside.
%  New improved version stolen from Erik Demaine.
% ----------------------------------------------------------------------
\newenvironment{oneshot}[1]{\@begintheorem{#1}{\unskip}}{\@endtheorem}

% ----------------------------------------------------------------------
%  Algorithm and code environments -- Algorithms are set in normal
%  text, with 2em indenting, surrounded by a box.  Code is set in
%  typewriter text, with 4 space indenting, and no box.
%
%  NOTE!  The true width of the minipage environment is determined by
%  the contents of the longest line, but ONLY because the minipage
%  contains a tabbing environment, and nothing else.  It's a HaX!
%
%  Both environments need optional line numbering and comment macros,
%  but bold keywords are just distracting.
% ----------------------------------------------------------------------
\def\begin@lgo{\begin{minipage}{1in}\begin{tabbing}
        \quad\=\qquad\=\qquad\=\qquad\=\qquad\=\qquad\=\qquad\=\kill}
\def\end@lgo{\end{tabbing}\end{minipage}}

\newenvironment{algorithm}
{\begin{tabular}{|l|}\hline\begin@lgo}
{\end@lgo\\\hline\end{tabular}}

\newenvironment{algo}
{\begin{center}\small\begin{algorithm}}
{\end{algorithm}\end{center}}

\def\Comment#1{\textsf{\textsl{$\langle\!\langle$#1\/$\rangle\!\rangle$}}}

\def\beginc@de{\noindent\begin{center}\begin{minipage}{1in}\tt
        \begin{tabbing}~~~~\=~~~~\=~~~~\=~~~~\=~~~~\=~~~~\=~~~~\=\kill}
\def\endc@de{\end{tabbing}\end{minipage}\end{center}}

\newenvironment{code}{\beginc@de}{\endc@de}

%
% I think these only work with <1 line of text.  Use sparingly!!
%
\def\textul#1{\underline{\smash{#1}\vphantom{,}}}
\def\strike#1{\ensuremath{\overline{\text{\smash{#1}\vphantom{.}}}}}

% ----------------------------------------------------------------------
%  Include a file verbatim.  Searches the TEXINPUTS path for the file,
%  even though that's probably not what you really want.  Stolen from
%  ``verbatimfiles.sty'' by Chris Rowley and others.  [Don't use their 
%  \vertbatimlisting macro; it has some bizarre side-effects!]
% ----------------------------------------------------------------------
\def\verbinput#1{
\begingroup\@verbatim\frenchspacing\@vobeyspaces\input#1\endgroup
}

% ----------------------------------------------------------------------
%  \now  -- Current time in h:mm AM/PM format
%  \mdyy -- Today's date in m/d/yy format.  Forget Y2K; this is for humans!
% ----------------------------------------------------------------------
\newcount\timehh\timehh=\time
\divide\timehh by 60
\newcount\timemm\timemm=\time
\count255=\timehh
\multiply\count255 by -60
\advance\timemm by \count255
\newif\iftimePM
\ifnum\timehh>11 \timePMtrue\else\timePMfalse\fi
\ifnum\timehh<1 \advance\timehh by 12\fi
\ifnum\timehh>12 \advance\timehh by -12\fi
\def\now{\number\timehh:\ifnum\timemm<10 0\fi\number\timemm
         \iftimePM pm\else am\fi}
\newcount\mdYY\mdYY=\year
\count255=\year
\divide\count255 by 100
\multiply\count255 by 100
\advance\mdYY by -\count255
\def\mdyy{\number\month/\number\day/\ifnum\mdYY<10 0\fi\number\mdYY}

% ----------------------------------------------------------------------
%  Notes to myself
% ----------------------------------------------------------------------
\def\n@te#1{\textsf{$\langle\!\langle$#1$\rangle\!\rangle$}\leavevmode}
\def\n@tew@rn{\GenericWarning{}{AUTHOR WARNING: Unresolved \protect\note}}

\def\n@ten@te#1{\marginpar
	[\hfill\llap{\textcircled{\small#1}$\!\Longrightarrow$}]
	{\rlap{$\Longleftarrow\!$\textcircled{\small#1}}}}

\def\n@tedingb@t{\@ifundefined{textmusicalnote}
			{$\circledcirc$}	% if you don't have textcomp
			{\textmusicalnote}}	% if you do have textcomp

\def\note#1{\n@tew@rn\n@te{\n@ten@te{\n@tedingb@t}#1}}

\def\sidenote#1{\marginpar{\tiny\sf #1}}


%----------------------------------------------------------------------
%  Bibliography aliases, so I can use mnemonic citation keys and
%  geom.bib at the same time.  \bibalias{foo}{bar} makes \cite{foo}
%  act (almost) exactly like \cite{bar}.
%----------------------------------------------------------------------
\def\bibalias#1#2{%
    \global\@namedef{b@#1}{%
        {\@ifundefined{b@#2}{\textsf{?}}{}\csname b@#2\endcsname}}}

%----------------------------------------------------------------------
%  Flag bad citations and refernces in the margin.  Dangerous if you
%  have lots of undefined refs; use batchmode the first time.
%  Incompatible with some document classes.
%----------------------------------------------------------------------
\DeclareOption{flagerrors}
{
\def\badcite{\ifinner\else\n@ten@te{\textcent}\fi}

\def\badref{\ifinner\else\n@ten@te{$\Join$}\fi}

\def\bibalias#1#2{%
    \global\@namedef{b@#1}{%
        {\@ifundefined{b@#2}{\textsf{>>#1??}}{}\csname b@#2\endcsname}}}

\def\@citex[#1]#2{%
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\mbox{\reset@font\sffamily>\@citeb?}%
       \badcite%
       \G@refundefinedtrue%
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\hbox{\csname b@\@citeb\endcsname}}}}{#1}}

\def\@setref#1#2#3{
  \ifx#1\relax
   \protect\G@refundefinedtrue
   \badref\mbox{\reset@font\sffamily >#3?}
   \@latex@warning{Reference `#3' on page \thepage \space undefined}%
  \else
   \expandafter#2#1\null
  \fi}
}


% ----------------------------------------------------------------------
%  Draft notice.  Put \DRAFT on the title page, in place of \date.
% ----------------------------------------------------------------------
\def\draftnotice{Preliminary draft --- \mdyy\ --- Not for distribution}

\def\DRAFT{
\date{\fbox{\textsf{\textbf{\draftnotice}}}}
\def\@oddfoot{\footnotesize\hss\fbox{\textbf{\textsf{\draftnotice}}}\hss}
\let\@evenfoot\@oddfoot
}

% ----------------------------------------------------------------------
%  Dingbats from the TeX/METAFONT-book manual font
%  Use only with 11 or 12 pt text.
%  Doesn't work with TeXtures, which doesn't know about manfnt.
% ----------------------------------------------------------------------
\font\manual=manfnt
\def\goodcube{{\manual\char28}}	% possible cube from MF-book
\def\badcube{{\manual\char29}}	% impossible cube from MF-book
\def\starknot{{\manual\char30}}	% 2,5 torus knot from MF-book
\def\target{{\manual\char36}}	% concentric circles from MF-book
\def\xflower{{\manual\char38}}	% X flower dingbat from MF-book
\def\tflower{{\manual\char39}}	% + flower dingbat from MF-book
\def\changeto{{\manual\char121}}	% change arrow
\def\dbend{{\manual\char127}}	% dangerous bend sign

% ----------------------------------------------------------------------
%  Dangerous bend environments, stolen from TeXbook and slightly
%  massaged.
%
%  Invoke as \begin{[d]danger}...\end{[d]danger}.  The enclosed text
%  is offset just like any other list (theorem, proof, etc.)  Puts
%  sign[s] in front of first two lines of first paragraph, which are
%  (supposedly) never split by a page boundary.  Does NOT shrink or
%  otherwise modify the text.
% ----------------------------------------------------------------------
%  The dangerous bend signs are the correct size to match two lines of
%  Computer Modern 9pt type.  I really ought to scale them up to
%  fit whatever size we're using, but I won't.  Unfortunately, manfnt
%  thinks it's a 10pt font, so if we want to match 11pt Computer
%  Modern, we have to scale manfnt to 12.222222pt!  Thanks, Don.
%
%  TeX is a FuXing HaX.
% ----------------------------------------------------------------------

% Single danger
\def\danger{\begin{trivlist}\item[]\noindent%
\begingroup\hangindent=2.5pc\hangafter=-2\clubpenalty=10000%
\def\par{\endgraf\endgroup}%
\hbox to 0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces}
\def\enddanger{\end{trivlist}}

% Double danger
\def\ddanger{\begin{trivlist}\item[]\noindent%
\begingroup\hangindent=4pc\hangafter=-2\clubpenalty=10000%
\def\par{\endgraf\endgroup}%
\hbox to 0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\ignorespaces}
\def\endddanger{\end{trivlist}}

%----------------------------------------------------------------------
% 'cramped' list style, stolen from Jeff Vitter.  Doesn't always work.
%----------------------------------------------------------------------
\def\cramped
  {\parskip\@outerparskip\@topsep\parskip
  \@topsepadd2pt\itemsep0pt
%  \settowidth{\labelwidth}{\@itemlabel}
%  \advance\leftmargin-\labelsep
%  \advance\leftmargin-\labelwidth
%  \advance\@totalleftmargin-\leftmargin
%  \advance\linewidth\leftmargin
%  \parshape1\@totalleftmargin\linewidth
}

%----------------------------------------------------------------------
%  More footnote symbols, please.
%----------------------------------------------------------------------
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or \dagger\or \ddagger\or
   \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
   \or \ddagger\ddagger \or \mathsection\mathsection \or
   \mathparagraph\mathparagraph \else\@ctrerr\fi}}

%----------------------------------------------------------------------
%  TeXbook style quotations -- I should really use the right font, tho.
%----------------------------------------------------------------------
\newenvironment{rightquote}[1]
{\flushright\begin{minipage}{#1\textwidth}
\parskip0pt\footnotesize\sffamily\slshape}
{\end{minipage}\par\bigskip}
\def\quotee#1{\par\vspace{0.5ex}\flushright\unskip\textup{--- #1}}

%----------------------------------------------------------------------
%  Creative Commons license
%----------------------------------------------------------------------
\def\CCLicense{\vfill\centerline{\tiny \textcopyright Copyright \number\year\ Jeff Erickson. Released under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License (\url{http://creativecommons.org/licenses/by-nc-sa/3.0/})}}

\ProcessOptions
