% \iffalse
%% File: hyperref.dtx Copyright (C) 1995, 1996, 1997, 1998 Sebastian Rahtz  
% RCS: $Id: hyperref.dtx 6.47 1999/02/01 11:34:59 srahtz Exp srahtz $
%
% Permission is hereby granted, free of charge, to any person obtaining
% a copy of this software and associated documentation files (the
% ``Software''), to deal in the Software without restriction, including
% without limitation the rights to use, copy, modify, merge, publish,
% distribute, sublicense, and/or sell copies of the Software, and to
% permit persons to whom the Software is furnished to do so, subject to
% the following conditions:
% 
% The above copyright notice and this permission notice shall be included
% in all copies or substantial portions of the Software.
% 
% THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
% IN NO EVENT SHALL SEBASTIAN RAHTZ BE LIABLE FOR ANY CLAIM, DAMAGES OR
% OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
% ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
% OTHER DEALINGS IN THE SOFTWARE.
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{hyperref}
%<package>                [1998/02/01 6.47 Hypertext links for LaTeX]
%<*driver>
\documentclass{ltxdoc}
\usepackage{array,times}
\usepackage[hyperindex]{hyperref}
\EnableCrossrefs
\CodelineIndex
\begin{document}
 \GetFileInfo{hyperref.sty}
 \title{Hypertext marks in \LaTeX}
 \author{Sebastian Rahtz\\
     Email: \texttt{s.rahtz@elsevier.co.uk}}
 \date{processed \today}
 \maketitle
 \tableofcontents
 \let\Email\texttt
 \DocInput{hyperref.dtx}
\end{document}
%</driver>
% \fi
% \CheckSum{7177}
%
% \MakeShortVerb{|}
% \StopEventually{}
%
% \section{The main macros}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \subsection{Package options and setup}\label{options}
% It needs the December 95 release of \LaTeX, because it uses
% |\protected@write|, and it defines commands in options; and the page
% setup internal code changed at that point. It'll probably break
% with the later releases!
%    \begin{macrocode}
\RequirePackage{keyval}[1997/11/10]
\RequirePackage{nameref}
\def\hyper@warn#1{\PackageWarningNoLine{hyperref}{#1}}
\def\hyper@info#1{\PackageInfo{hyperref}{#1}}
\def\pdf@bbox{pdf@llx pdf@lly pdf@urx pdf@ury}
\newdimen\@linkdim
\newif\ifPDFbookmark
\PDFbookmarkfalse
\newif\ifhy@backref
\newif\ifhy@acrofour\hy@acrofourfalse
\newif\ifhy@bookmarksnumbered\hy@bookmarksnumberedfalse
\newif\ifhy@bookmarks
\newif\ifhy@bookmarksopen
\newif\ifhy@psize
\newif\ifhy@colorlinks
\newif\ifhy@frenchlinks
\newif\ifhy@figures
\newif\ifhy@nesting
\newif\ifhy@hyperindex
\newif\ifhy@plainpages
\newif\ifhy@activeanchor
\newif\ifhy@raiselinks
\newif\ifhy@breaklinks
\newif\ifhy@pageanchor
\newif\ifhy@linktocpage \hy@linktocpagefalse
\newif\ifhy@debug     \hy@debugfalse
\newif\ifhy@implicit  \hy@implicittrue
\newif\ifhy@toolbar   \hy@toolbartrue
\newif\ifhy@menubar   \hy@menubartrue
\newif\ifhy@windowui  \hy@windowuitrue
\newif\ifhy@fitwindow \hy@fitwindowfalse
\newif\ifhy@centerwindow \hy@centerwindowfalse
\newif\ifhy@newwindow \hy@newwindowfalse
\newif\ifhy@exactdef  \hy@exactdeffalse
\hy@bookmarkstrue
\hy@bookmarksopenfalse
\hy@raiselinksfalse
\hy@breaklinksfalse
\hy@figuresfalse
\hy@nestingfalse
\hy@backreffalse
\hy@plainpagestrue
\hy@hyperindextrue
\hy@pageanchortrue
\hy@psizefalse
\let\hy@driver\@empty
\let\MaybeStopEarly\relax
%    \end{macrocode}
% The PD1 encoding stuff done by Heiko Oberdiek.
%
% Encoding PD1 can be specified as option of package 'fontenc' or
% loaded here. It does not matter what font family is selected, as
% \TeX{} does not process it anyway. So use CM.
%    \begin{macrocode}
\@ifundefined{T@PD1}{\input{pd1enc.def}}{}
\DeclareFontFamily{PD1}{pdf}{}
\DeclareFontShape{PD1}{pdf}{m}{n}{ <-> cmr10 }{}
\DeclareFontSubstitution{PD1}{pdf}{m}{n}
\def\Hy@PDFDef#1#2{%
  \begingroup
    \fontencoding{PD1}\enc@update
    \escapechar=`\\%
%    \end{macrocode}
% For octal numbers
%    \begin{macrocode}
    \edef\0{\string\0}%
    \edef\1{\string\1}%
    \edef\2{\string\2}%
    \edef\3{\string\3}%
    \edef\4{\string\4}%
    \edef\5{\string\5}%
    \edef\6{\string\6}%
    \edef\7{\string\7}%
%    \end{macrocode}
% \TeX\ commands
%    \begin{macrocode}
    \let\{\textbraceleft
    \let\}\textbraceright
    \let\\\textbackslash
    \let\#\textnumbersign
    \let\$\textdollar
    \let\%\textpercent
    \let\&\textampersand
    \let\~\textasciitilde
    \let\_\textunderscore
    \let\P\textparagraph
    \edef\space{\string\040}%
    \let\ \space
    \let~\space
    \let\ldots\textellipsis
    \let\dots\textellipsis
    \let\glqq\textglqq  
    \let\grqq\textgrqq
    \let\glq\textglq    
    \let\grq\textgrq
    \let\flqq\textflqq  
    \let\flqq\textflqq
    \let\flq\textflq    
    \let\frq\textfrq
%    \end{macrocode}
% Here is a good place to redefine common commands
% if they should be supported at all, e. g.:
%    \begin{macrocode}
    \def\LaTeX{LaTeX}%
    \def\eTeX{e-TeX}%
    \def\TeX{TeX}%
    \let\label\@gobble
    \let\index\@gobble
    \let\glossary\@gobble
    \let\emph\@firstofone
    \let\textbf\@firstofone
    \let\textit\@firstofone
    \let\textmd\@firstofone
    \let\textnormal\@firstofone
    \let\textrm\@firstofone
    \let\textsc\@firstofone
    \let\textsf\@firstofone
    \let\textsl\@firstofone
    \let\texttt\@firstofone
    \let\textup\@firstofone
    \let\Huge\@empty
    \let\LARGE\@empty
    \let\Large\@empty
    \let\footnotesize\@empty
    \let\huge\@empty
    \let\large\@empty
    \let\normalsize\@empty
    \let\scriptsize\@empty
    \let\small\@empty
    \let\tiny\@empty
%    \end{macrocode}
% a) rigid definition of \#1,
% in which unexpandable commands are detected by an error
% in |\csname...\endcsname|
%    \begin{macrocode}
    \ifhy@exactdef
      \edef\Hy@temp{\expandafter\string\csname#2\endcsname}%
      \edef\Hy@temp{\noexpand\gdef\noexpand#1{%
        \expandafter\ifnum\expandafter\escapechar\expandafter
          =\expandafter`\Hy@temp\fi}%
      }%
%    \end{macrocode}
% b) conservative definition of \#1,
% in which unexpandable commands are written to bookmarks
%    \begin{macrocode}
    \else
%      \protected@edef\Hy@temp{\noexpand\gdef\noexpand#1{#2}}%
      \edef\Hy@temp{\noexpand\gdef\noexpand#1{#2}}%
    \fi
  \Hy@temp
  \endgroup
}
\@ifpackageloaded{xr}{%
%    \end{macrocode}
% If reading external aux files check whether they have a non zero
% fourth field in |\newlabel| and if so, add the URL as the fifth field.
%    \begin{macrocode}
\def\XR@addURL#1{\XR@@dURL#1{}{}{}{}\\}
\def\XR@@dURL#1#2#3#4#5\\{{#1}{#2}%
  \if!#4!\else
    {#3}{#4}{\XR@URL}%
\fi}
}{}
\def\hy@true{true}
\let\literalps@out\@gobble
\let\pdfbookmark\@gobbletwo
\let\Acrobatmenu\@gobble
\def\@writetorep#1#2#3#4{}%
\def\Hyp@boolkey#1#2{%
  \hyper@info{option #2 set #1}%
  \csname hy@#2\ifx\relax#1\relax true\else#1\fi\endcsname}
\define@key{Hyp}{implicit}[true]{%
   \lowercase{\Hyp@boolkey{#1}}{implicit}%
}
\define@key{Hyp}{draft}[true]{\AtBeginDocument{%
    \let\hyper@@anchor\@gobble
    \gdef\hyper@link##1##2##3{##3}%
    \let\hyper@anchorstart\@gobble
    \let\hyper@anchorend\@empty
    \let\hyper@linkstart\@gobbletwo
    \let\hyper@linkend\@empty
    \def\hyper@linkurl##1##2{##1}%
    \def\hyper@linkfile##1##2##3{##1}%
    \def\Acrobatmenu##1##2{##2}%
    \let\PDF@SetupDoc\@empty
    \let\@fifthoffive\@secondoftwo
    \let\@secondoffive\@secondoftwo
    \hyper@warn{ draft mode on}%
   }%
}
\let\KV@Hyp@nolinks\KV@Hyp@draft
\define@key{Hyp}{a4paper}[true]{\def\special@paper{210mm,297mm}%
  \def\hy@pageheight{842}}
\define@key{Hyp}{a5paper}[true]{\def\special@paper{148mm,210mm}%
  \def\hy@pageheight{595}}
\define@key{Hyp}{b5paper}[true]{\def\special@paper{176mm,250mm}%
  \def\hy@pageheight{709}}
\define@key{Hyp}{letterpaper}[true]{\def\special@paper{8.5in,11in}%
  \def\hy@pageheight{792}}
\define@key{Hyp}{legalpaper}[true]{\def\special@paper{8.5in,14in}%
  \def\hy@pageheight{1008}}
\define@key{Hyp}{executivepaper}[true]{\def\special@paper{7.25in,10.5in}%
  \def\hy@pageheight{720}}
\define@key{Hyp}{debug}[true]{%
   \lowercase{\Hyp@boolkey{#1}}{debug}}
\define@key{Hyp}{4}[true]{%
   \lowercase{\Hyp@boolkey{#1}}{acrofour}}
\define@key{Hyp}{linktocpage}[true]{%
   \lowercase{\Hyp@boolkey{#1}}{linktocpage}}
\define@key{Hyp}{exactdef}[true]{%
   \lowercase{\Hyp@boolkey{#1}}{exactdef}}
\define@key{Hyp}{extension}{\def\XR@ext{#1}}
\def\XR@ext{dvi}
%    \end{macrocode}
% If we are going to PDF via HyperTeX |\special| commands, 
% the dvips (-Z option)  processor does not know
% the \emph{height} of a link, as it works solely on the
% position of the closing |\special|. If we use this option,
% the |\special| is raised up by the right amount, to fool
% the dvi processor.
%    \begin{macrocode}
\define@key{Hyp}{raiselinks}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{raiselinks}}
%    \end{macrocode}
% Most PDF-creating drivers do not allow links to be broken
%    \begin{macrocode}
\define@key{Hyp}{breaklinks}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{breaklinks}}
%    \end{macrocode}
% Determines whether an automatic anchor is put on each page
%    \begin{macrocode}
\define@key{Hyp}{pageanchor}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{pageanchor}}
%    \end{macrocode}
% Are the page links done as plain arabic numbers, or do
% they follow the formatting of the package? The latter loses
% if you put in typesetting like |\textbf| or the like.
%    \begin{macrocode}
\define@key{Hyp}{plainpages}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{plainpages}}
%    \end{macrocode}
% Currently, |dvips| doesn't allow anchors nested within targets,
% so this option tries to stop that happening. Other processors
% may be able to cope.
%    \begin{macrocode}
\define@key{Hyp}{nesting}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{nesting}}
%    \end{macrocode}
% \subsection{Options for different drivers}\label{drivers}
%    \begin{macrocode}
\define@key{Hyp}{hyperref}[true]{}
\define@key{Hyp}{tex4ht}[true]{%
   \def\XR@ext{html}%
   \def\hy@driver{htex4ht}%
}
\define@key{Hyp}{pdftex}[true]{%
   \def\hy@driver{hpdftex}%
   \def\XR@ext{pdf}%
   \PassOptionsToPackage{pdftex}{color}%
   \hy@breaklinkstrue
}
\define@key{Hyp}{dvipdf}[true]{%
}
\define@key{Hyp}{nativepdf}[true]{%
   \def\hy@driver{hdvips}%
   \def\XR@ext{pdf}%
}
\define@key{Hyp}{dvipdfm}[true]{%
   \def\hy@driver{hdvipdfm}%
   \def\XR@ext{pdf}%
}
\define@key{Hyp}{pdfmark}[true]{%
   \def\hy@driver{hdvips}%
   \def\XR@ext{pdf}%
   }
\define@key{Hyp}{dvips}[true]{%
   \def\hy@driver{hdvips}%
   \def\XR@ext{pdf}%
   }
\define@key{Hyp}{hypertex}[true]{%
   \def\hy@driver{hypertex}%
   }
\define@key{Hyp}{vtex}[true]{%
 \@ifundefined{OpMode}{\@latex@error{Non-VTeX processor}{}\endinput}{}
 \ifnum\OpMode=1\relax
   \def\XR@ext{pdf}%
   \def\hy@driver{hvtex}%
 \else
  \ifnum\OpMode=10\relax
    \def\XR@ext{htm}%
    \def\hy@driver{hvtexhtm}%
    \def\MaybeStopEarly{\typeout{Hyperref stopped early}\endinput}
  \else
    \latex@error{Mode (\the\OpMode) has no hyperref driver}{}\endinput
  \fi
 \fi
}
\define@key{Hyp}{dviwindo}[true]{%
    \def\hy@driver{hdviwind}%
    \setkeys{Hyp}{colorlinks}%
    \PassOptionsToPackage{dviwindo}{color}%
}
\define@key{Hyp}{dvipsone}[true]{%
   \def\XR@ext{pdf}%
   \def\hy@driver{hdvipson}%
}
\define@key{Hyp}{textures}[true]{%
   \def\XR@ext{pdf}%
   \def\hy@driver{htexture}%
}
\define@key{Hyp}{latex2html}[true]{%
   \AtBeginDocument{\@@latextohtmlX}%
 }
%    \end{macrocode}
% No more special treatment for ps2pdf. Let it sink or swim.
%    \begin{macrocode}
\define@key{Hyp}{ps2pdf}[true]{%
   \def\hy@driver{hdvips}%
}
%    \end{macrocode}
% \subsection{Options to add extra features}\label{features}
% Make included figures (assuming they use the standard graphics
% package) be hypertext links. Off by default. Needs more work.
%    \begin{macrocode}
\define@key{Hyp}{hyperfigures}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{figures}}
%    \end{macrocode}
% Set up back-referencing to be hyper links, by page or section number,
%    \begin{macrocode}
\def\back@none{none}
\def\back@section{section}
\def\back@page{page}
\define@key{Hyp}{backref}[section]{%
 \ifx\\#1\\\def\@tempa{section}\else\def\@tempa{section}\fi
 \ifx\@tempa\back@section
  \PassOptionsToPackage{hyperref}{backref}
  \hy@backreftrue
 \else
   \ifx\back@opt\back@page
     \PassOptionsToPackage{hyperpageref}{backref}
     \hy@backreftrue
   \fi
 \fi
}
\define@key{Hyp}{pagebackref}[true]{%
  \PassOptionsToPackage{hyperpageref}{backref}
  \hy@backreftrue
}
%    \end{macrocode}
% Make index entries be links back to the relevant pages. By default
% this is turned on, but may be stopped.
%    \begin{macrocode}
\define@key{Hyp}{hyperindex}[true]{%
  \lowercase{\Hyp@boolkey{#1}}{hyperindex}}
%    \end{macrocode}
% \subsection{Options to change appearance of links}\label{appearance}
% Colouring links at the \LaTeX\ level is useful for debugging, perhaps.
%    \begin{macrocode}
\define@key{Hyp}{colorlinks}[true]{\lowercase{\Hyp@boolkey{#1}}{colorlinks}}
\define@key{Hyp}{frenchlinks}[true]{\lowercase{\Hyp@boolkey{#1}}{frenchlinks}}
\define@key{Hyp}{bookmarks}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{bookmarks}}
\define@key{Hyp}{bookmarksopen}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{bookmarksopen}}
%    \end{macrocode}
% Richard Curnow <richard@curnow.demon.co.uk> suggested this
% functionality. It adds section numbers etc to bookmarks.
%    \begin{macrocode}
\define@key{Hyp}{bookmarksnumbered}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{bookmarksnumbered}}
\define@key{Hyp}{linkcolor}{\def\@linkcolor{#1}}
\define@key{Hyp}{anchorcolor}{\def\@anchorcolor{#1}}
\define@key{Hyp}{citecolor}{\def\@citecolor{#1}}
\define@key{Hyp}{urlcolor}{\def\@urlcolor{#1}}
\define@key{Hyp}{menucolor}{\def\@menucolor{#1}}
\define@key{Hyp}{filecolor}{\def\@filecolor{#1}}
\define@key{Hyp}{pagecolor}{\def\@pagecolor{#1}}
%    \end{macrocode}
% Default values:
%    \begin{macrocode}
\def\@linkcolor{red}
\def\@anchorcolor{black}
\def\@citecolor{green}
\def\@filecolor{cyan}
\def\@urlcolor{magenta}
\def\@menucolor{red}
\def\@pagecolor{red}
\define@key{Hyp}{baseurl}{\def\@baseurl{#1}}
\def\hyperbaseurl#1{\def\@baseurl{#1}}
\def\@pdfpagetransition{}
\let\@baseurl\@empty
%    \end{macrocode}
% \subsection{PDF-specific options}\label{pdfopt}
%    \begin{macrocode}
\define@key{Hyp}{linkbordercolor}{\def\@linkbordercolor{#1}}
\define@key{Hyp}{urlbordercolor}{\def\@urlbordercolor{#1}}
\define@key{Hyp}{menubordercolor}{\def\@menubordercolor{#1}}
\define@key{Hyp}{filebordercolor}{\def\@filebordercolor{#1}}
\define@key{Hyp}{citebordercolor}{\def\@citebordercolor{#1}}
\define@key{Hyp}{pagebordercolor}{\def\@pagebordercolor{#1}}
\define@key{Hyp}{pdfhighlight}{\def\@pdfhighlight{#1}}
\define@key{Hyp}{pdfborder}{\def\@pdfborder{#1}}
\define@key{Hyp}{pdfpagemode}{\def\@pdfpagemode{/#1 }}
\define@key{Hyp}{pdfpagetransition}{\def\@pdfpagetransition{#1}}
\define@key{Hyp}{pdftitle}{\Hy@PDFDef\@pdftitle{#1}}
\define@key{Hyp}{pdfauthor}{\Hy@PDFDef\@pdfauthor{#1}}
\define@key{Hyp}{pdfproducer}{\Hy@PDFDef\@pdfproducer{#1}}
\define@key{Hyp}{pdfcreator}{\Hy@PDFDef\@pdfcreator{#1}}
\define@key{Hyp}{pdfsubject}{\Hy@PDFDef\@pdfsubject{#1}}
\define@key{Hyp}{pdfkeywords}{\Hy@PDFDef\@pdfkeywords{#1}}
\define@key{Hyp}{pdfview}{\calculate@pdfview#1 \\}
\def\calculate@pdfview#1 #2\\{%
 \def\@pdfview{#1}%
 \ifx\\#2\\%
   \def\@pdfviewparams{ -32768}%
 \else
   \def\@pdfviewparams{ #2}%
 \fi
}
\define@key{Hyp}{pdfstartpage}{\def\@pdfstartpage{#1}}
\define@key{Hyp}{pdfstartview}{%
\ifx\\#1\\
  \def\@pdfstartview{}%
\else
  \def\@pdfstartview{ /#1 }%
\fi
}
\define@key{Hyp}{pdfpagescrop}{\edef\@pdfpagescrop{#1}}
\define@key{Hyp}{pdftoolbar}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{toolbar}}
\define@key{Hyp}{pdfmenubar}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{menubar}}
\define@key{Hyp}{pdfwindowui}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{windowui}}
\define@key{Hyp}{pdffitwindow}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{fitwindow}}
\define@key{Hyp}{pdfcenterwindow}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{centerwindow}}
\define@key{Hyp}{pdfnewwindow}[true]{%
    \lowercase{\Hyp@boolkey{#1}}{newwindow}}
\define@key{Hyp}{pdfpagelayout}{\def\pdf@pagelayout{#1}}
\def\pdf@pagelayout{}
%    \end{macrocode}
% Default values:
%    \begin{macrocode}
\def\@linkbordercolor{1 0 0}
\def\@urlbordercolor{0 1 1}
\def\@menubordercolor{1 0 0}
\def\@filebordercolor{0 .5 .5}
\def\@citebordercolor{0 1 0}
\def\@pagebordercolor{1 1 0}
\def\@pdfhighlight{/I}
\def\@pdfpagemode{}
\def\@pdftitle{}
\def\@pdfauthor{}
\def\@pdfproducer{}
\def\@pdfcreator{LaTeX with hyperref package}
\def\@pdfsubject{}
\def\@pdfkeywords{}
\def\@pdfpagecrop{}
\def\@pdfpagescrop{}
\def\@pdfstartview{ /Fit }
\def\@pdfstartpage{1}
\let\PDF@SetupDoc\@empty
\def\special@paper{210mm,297mm}
\def\hy@pageheight{842}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hypersetup{\setkeys{Hyp}}
%    \end{macrocode}
%
% Allow the user to use |\ExecuteOptions| in the cfg file even though
% this package does not use the normal option mechanism.
% Use |\hyper@normalise| as a scratch macro, since it is going to
% be defined in a couple of lines anyway.
%    \begin{macrocode}
\let\hyper@normalise\ExecuteOptions
\let\ExecuteOptions\hypersetup
\InputIfFileExists{hyperref.cfg}{}{}
\let\ExecuteOptions\hyper@normalise
%    \end{macrocode}
% To add flexibility, we will not use the ordinary processing of
% package options, but put them through the \emph{keyval} package.
% This section was written by David Carlisle.
%    \begin{macrocode}
\def\ProcessOptionsWithKV#1{%
  \let\@tempc\relax 
  \let\@tempa\@empty
%    \end{macrocode}
% Add any global options that are known to KV to the start of the list
% being built in |\@tempa|.
%    \begin{macrocode}
  \@for\CurrentOption:=\@classoptionslist\do{%
     \@ifundefined{KV@#1@\CurrentOption}%
       {}%
       {\edef\@tempa{\@tempa,\CurrentOption,}}}%
%    \end{macrocode}
%
% Now stick the package options at the end of the list and wrap in a call
% to |\setkeys|. Can simply use |\edef|, normally KV takes care to avoid
% expansion, but the package system has already fully expanded the package
% option list before passing it to the package, so no more harm can occur
% here.
%    \begin{macrocode}
     \edef\@tempa{%
        \noexpand\setkeys{#1}{\@tempa\@ptionlist{\@currname.\@currext}}}%
%    \end{macrocode}
%
% Do it.
%    \begin{macrocode}
    \@tempa
}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\ReadBookmarks\relax
\ProcessOptionsWithKV{Hyp}
\def\WriteBookmarks{0}
\ifhy@bookmarks
 \hyper@info{Bookmarks ON}
  \ifx\@pdfpagemode\@empty\def\@pdfpagemode{/UseOutlines }\fi
  \ifhy@bookmarksopen
    \hyper@info{Bookmarks open}%
    \def\@bookmarkopenstatus{}%
  \else
    \def\@bookmarkopenstatus{-}%
  \fi
\else
 \hyper@info{Bookmarks OFF}
 \AtEndOfPackage{\global\let\ReadBookmarks\relax
                 \global\let\WriteBookmarks\relax}%
 \ifx\@pdfpagemode\@empty\def\@pdfpagemode{/None}\fi
\fi
\ifhy@figures
 \hyper@info{Hyper figures ON}
\else
 \hyper@info{Hyper figures OFF}
\fi
\ifhy@nesting
 \hyper@info{Link nesting ON}
\else
 \hyper@info{Link nesting OFF}
\fi
\ifhy@hyperindex
 \hyper@info{Hyper index ON}
\else
 \hyper@info{Hyper index OFF}
\fi
\ifhy@plainpages
 \hyper@info{Plain pages ON}
\else
 \hyper@info{Plain pages OFF}
\fi
\ifhy@backref
 \hyper@info{Backreferencing ON}
\else
 \hyper@info{Backreferencing OFF}
\fi
%    \end{macrocode}
% We might need to revert to this:
% \begin{verbatim}
%\ifhy@colorlinks
%   \AtEndOfPackage{\RequirePackage{color}}%
%   \def\hy@colorlink#1{\let\hyper@color\current@color\color{#1}}%
%   \def\hy@endcolorlink{\let\current@color\hyper@color\set@color}%
%\else
%   \let\hy@colorlink\@gobble
%   \let\hy@endcolorlink\@empty
%   \hyper@info{Link coloring OFF}
%\fi
% \end{verbatim}
%    \begin{macrocode}
\ifhy@implicit
    \typeout{Implicit mode ON; LaTeX internals redefined}%
\else
    \typeout{Implicit mode OFF; no redefinition of LaTeX internals}%
    \def\MaybeStopEarly{\typeout{Hyperref stopped early}\endinput}%
    \AtBeginDocument{%
     \let\autoref\ref
     \ifx\@pdfpagemode\@empty\global\def\@pdfpagemode{/None}\fi
     \global\hy@backreffalse
  }%
  \AtEndOfPackage{%
     \global\let\ReadBookmarks\relax
     \global\let\WriteBookmarks\relax
    }
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
\AtEndOfPackage{%
 \ifx\hy@driver\@empty
   \@ifundefined{pdfoutput}%
      {\let\pdfoutput\@undefined
       \typeout{*hyperref using default driver hypertex*}%
       \input{hypertex.def}}
      {\ifcase\pdfoutput
         \let\pdfoutput\@undefined
         \typeout{*hyperref using default driver hypertex*}%
         \input{hypertex.def}
       \else
         \typeout{*hyperref using default driver pdftex*}%
         \input{hpdftex.def}%
         \def\XR@ext{pdf}%
         \PassOptionsToPackage{pdftex}{color}%
         \hy@breaklinkstrue
       \fi}
 \else
   \typeout{*hyperref using driver \hy@driver*}%
   \input{\hy@driver.def}%
 \fi
\let\@unprocessedoptions\relax
}
\AtBeginDocument{%
 \ifhy@colorlinks
  \RequirePackage{color}%
  \def\hy@colorlink#1{\begingroup\color{#1}}%
  \def\hy@endcolorlink{\endgroup}%
  \hyper@info{Link coloring ON}%
 \else
  \ifhy@frenchlinks
   \def\hy@colorlink#1{\begingroup\fontshape{sc}\selectfont}% 
   \def\hy@endcolorlink{\endgroup}%
   \hyper@info{French linking ON}%
  \else
   \def\hy@colorlink#1{\begingroup} % for grouping consistency 
   \def\hy@endcolorlink{\endgroup}%
   \hyper@info{Link coloring OFF}%
  \fi
 \fi
 \ReadBookmarks
}
\ifhy@backref
 \RequirePackage{backref}
\else
 \let\hy@backout\@gobble
\fi
\hy@activeanchorfalse
%    \end{macrocode}
%
% \subsection{User hypertext macros}\label{usermacros}
% We need to normalise all user commands taking a URL argument;
% Within the argument the following special definitions apply:
% |\#|, |\%|, |~| produce |#|, |%|, |~| respectively.
% for consistency |\~| produces |~| as well.
% At the \emph{top level only} ie not within the argument of another
% command, you can use |#| and |%| unescaped, to produce themselves.
% even if, say, |#| is entered as |#| it will be converted to |\#|
% so it does not die if written to an aux file etc. |\#| will write
% as |#| locally while making |\special|s.
%    \begin{macrocode}
\begingroup
  \catcode`\!\active
  \catcode`\&\active
  \catcode`\_\active
  \uccode`\!=`\%
  \uccode`\&=`\#%
\uppercase{\endgroup%
\def\hyper@normalise#1{%
  \begingroup%
  \catcode`\%\active\def!{\%}%
  \catcode`\#\active\def&{\#}%
  \catcode`\_\active\def_{\string_}%
  \let~\hyper@tilde%
  \let\~\hyper@tilde%
  \hyper@n@rmalise#1}}
\def\hyper@n@rmalise#1#2{%
  \edef\@tempa{\endgroup\noexpand#1{#2}}%
  \@tempa}
\providecommand\hyper@chars{%
  \let\#\hyper@hash
  \let\%\@percentchar}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hyperlink#1#2{%
  \hyper@@link{}{#1}{#2}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\href{\hyper@normalise\href@}
\def\href@#1{\expandafter\href@split#1\#\#\\}
\def\href@split#1\##2\##3\\{%
 \hyper@@link{#1}{#2}%
}
\RequirePackage{url}
\def\Hurl{\begingroup \Url}
\def\url{\hyper@normalise\url@}
\def\url@#1{\hyper@linkurl{\Hurl{#1}}{#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hyperimage{\hyper@normalise\hyper@image}
\providecommand\hyper@image[2]{#2}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hypertarget#1#2{%
  \ifhy@nesting
    \hyper@@anchor{#1}{#2}%
  \else
    \hyper@@anchor{#1}{\relax}#2%
  \fi}
%    \end{macrocode}
% |\hyperref| is more complicated, as it includes the concept of a
% category of link, used to make the name. This is not really used in this
% package.  |\hyperdef| sets up an anchor in the same way. They each have
% three  parameters of category, linkname, and marked text, and |\hyperrref| 
% also has a first parameter of URL.
% If there is an optional first parameter to |\hyperdef|,
% it is the name of a \LaTeX\ label which can be used in 
% a short form of |\hyperref| later, to avoid
% remembering the name and category.
%    \begin{macrocode}
\def\hyperref{\@ifnextchar[\label@hyperref\@hyperref}
\def\@hyperref{\hyper@normalise\@@hyperref}
\def\@@hyperref#1#2#3{%
  \edef\ref@one{\ifx\\#2\\\else#2.\fi#3}%
  \expandafter\tryhyper@link\ref@one\\{#1}%
}
\def\tryhyper@link#1\\#2{%
 \hyper@@link{#2}{#1}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hyperdef{\@ifnextchar[{\label@hyperdef}{\@hyperdef}}
\def\@hyperdef#1#2#3{%, category, name, text
  \ifhy@nesting
    \hyper@@anchor{#1.#2}{#3}%
  \else
    \hyper@@anchor{#1.#2}{\relax}#3%
  \fi}
%    \end{macrocode}
% We also have a need to give a \LaTeX\ \emph{label} to a
% hyper reference, to ease the pain of referring to it later.
%    \begin{macrocode}
\def\label@hyperref[#1]{%
  \expandafter\label@@hyperref\csname r@#1\endcsname{#1}}%
\def\label@@hyperref#1#2#3{%
  \ifx#1\relax
   \protect\G@refundefinedtrue
    \@latex@warning{Hyper reference `#2' on page \thepage \space
             undefined}%
   \hyper@@link{}{??}{#3}%
  \else
   \hyper@@link{\expandafter\@fifthoffive#1}%
   {\expandafter\@fourthoffive#1\@empty\@empty}{#3}%
  \fi
}
\def\label@hyperdef[#1]#2#3#4{% label name, category, name,
                                % anchor text
  \@bsphack
  \protected@write\@auxout{}%
         {\string\newlabel{#1}{{}{}{}\##2.#3}}%
  \@esphack
  \ifhy@nesting
   \hyper@@anchor{#2.#3}{#4}%
  \else
   \hyper@@anchor{#2.#3}{\relax}#4%
  \fi
}
%    \end{macrocode}
% \subsection{Underlying basic hypertext macros}\label{coremacros}
% Links have an optional type, a filename (possibly a URL),
% an internal name, and some marked text.
% If the second parameter is empty, its an internal link,
% otherwise we need to open another file or a URL.
% A link start has a type, and a URL.
%    \begin{macrocode}
\def\hyper@@link{\let\reserved@a\relax
  \@ifnextchar[{\hyper@link@}{\hyper@link@[link]}}
\def\hyper@link@[#1]#2#3#4{%
  \edef\@tempa{#2}%
  \ifx\@tempa\@empty
      \hyper@link{#1}{#3}{#4}%
  \else
      \expandafter\hyper@readexternallink#2\\{#1}{#3}{#4}%
  \fi
}
%    \end{macrocode}
% The problem here is that the first (URL) parameter may be a
% local \texttt{file:} reference 
% (in which case some browsers treat it differently)
% or a genuine URL, in which case we'll have to activate
% a real Web browser. 
% Note that a simple name is also a URL, as that is interpreted
% as a relative file name. We have to worry about |#| signs in a local
% file as well.
%
%    \begin{macrocode}
\def\hyper@readexternallink#1\\#2#3#4{%
%    \end{macrocode}
% Parameters are:
% \begin{enumerate}
% \item The URL or file name
% \item The type
% \item The internal name
% \item The link string
% \end{enumerate}
% We need to get the 1st parameter properly expanded,
% so we delimit the arguments rather than passing it inside a group.
%    \begin{macrocode}
 \expandafter\@hyper@readexternallink{#2}{#3}{#4}#1::\\{#1}%
}
%    \end{macrocode}
% Now (potentially), we are passed:
% 1) The link type
% 2) The internal name, 
% 3) the link string,
% 4) the URL type (http, mailto, file etc),
% 5) the URL details
% 6) anything after a real : in the URL 
% 7) the whole URL again
%    \begin{macrocode}
\def\@pdftempwordfile{file}%
\def\@hyper@readexternallink#1#2#3#4:#5:#6\\#7{%
%    \end{macrocode}
% If there are no colons at all (|#6| is blank), its a local
% file; if the URL type (|#4|) is blank, its probably a Mac filename,
% so treat it like a \texttt{file:} URL. The only flaw is if
% its a relative Mac path, with several colon-separated elements ---
% then we lose. Such names must be prefixed with an explicit |dvi:|
%    \begin{macrocode}
\ifx\\#6\\%
  \expandafter\@hyper@linkfile file:#7\\{#3}{#2}%
\else
  \ifx\\#4\\% 
   \expandafter\@hyper@linkfile file:#7\\{#3}{#2}%
  \else
%    \end{macrocode}
% If the URL type is `file', pass it for local opening
%    \begin{macrocode}
  \def\@pdftempa{#4}%
  \ifx\@pdftempa\@pdftempwordfile
     \expandafter\@hyper@linkfile#7\\{#3}{#2}%
  \else
%    \end{macrocode}
% otherwise its a URL
%    \begin{macrocode}
      \hyper@linkurl{#3}{#7\ifx\\#2\\\else\##2\fi}%
  \fi
 \fi
\fi
}
%    \end{macrocode}
% D P Story <story@uakron.edu> pointed out that relative paths
% starting .. fell over. Switched to using |\filename@parse| to
% solve this.
%    \begin{macrocode}
\def \@hyper@linkfile file:#1\\#2#3{%
     %file url,link string, name
 \filename@parse{#1}%
 \ifx\filename@ext\relax
    \edef\filename@ext{\XR@ext}%
 \fi
 \def\use@file{\filename@area\filename@base.\filename@ext}%
 \ifx\filename@ext\XR@ext
    \hyper@linkfile{#2}{\use@file}{#3}%
 \else
    \ifx\@baseurl\@empty
      \hyper@linkurl{#2}{file:\use@file\ifx\\#3\\\else\##3\fi}%
    \else
      \hyper@linkurl{#2}{\use@file\ifx\\#3\\\else\##3\fi}%
    \fi
 \fi%
}
%    \end{macrocode}
% Anchors have a name, and marked text.
% We have to be careful with the marked text, as if we break
% off part of something to put a |\special| around it, all hell breaks
% loose. Therefore, we check the category code of the first token,
% and only proceed if its safe. Tanmoy sorted this out.
%
% A curious case arises if the original parameter
% was in braces. That means that |#2| comes here a multiple
% letters, and the |noexpand| just looks at the first one,
% putting the rest in the output. Yuck.
%    \begin{macrocode}
\long\def\hyper@@anchor#1#2{\@hyper@@anchor#1\relax#2\relax}
\long\def\@hyper@@anchor#1\relax#2#3\relax{%
\ifx\\#1\\#2\hyper@warn{empty link? #1: #2#3}%
\else
 \def\anchor@spot{#2#3}%
 \let\put@me@back\@empty
 \ifx\relax#2\relax
 \else
    \ifhy@nesting
    \else
       \ifcat a\noexpand#2\relax
       \else
         \ifcat 0\noexpand#2 \relax
         \else
%\typeout{Anchor start is not alphanumeric on input line\the\inputlineno}%
           \let\anchor@spot\@empty
           \def\put@me@back{#2#3}%
         \fi
      \fi
    \fi
 \fi
 \ifhy@activeanchor
      \anchor@spot
 \else
      \hyper@anchor{#1}%
 \fi
 \expandafter\put@me@back
\fi
\let\anchor@spot\@empty
}
%    \end{macrocode}
% \subsection{Compatibility with the \emph{\LaTeX{}2html} package}\label{latex2html}
% Map our macro names on to Nikos', so that documents prepared
% for that system will work without change.
%
% Note, however, that the whole complicated structure for
% segmenting documents is not supported; it is assumed that the user
% will load |html.sty| first, and then |hyperref.sty|, so that the
% definitions in |html.sty| take effect, and are then overridden
% in a few circumstances by this package.
%    \begin{macrocode}
\let\htmladdimg\hyperimage
%    \end{macrocode}
%
%    \begin{macrocode}
\def\htmladdnormallink#1#2{\href{#2}{#1}}
\def\htmladdnormallinkfoot#1#2{\href{#2}{#1}\footnote{#2}}
\def\htmlref#1#2{% anchor text, label
  \label@hyperref[#2]{#1}%
}
%    \end{macrocode}
% This is really too much. The \LaTeX2html package defines its own
% |\hyperref| command, with a different syntax. Was this always here?
% Its weird, anyway. We interpret it in the `printed' way, since
% we are about fidelity to the page.
%    \begin{macrocode}
\def\@@latextohtmlX{%
 \let\hhyperref\hyperref
 \def\hyperref##1##2##3##4{% anchor text for HTML
                     % text to print before label in print
                     % label
                     % post-label text in print
  ##2\ref{##4}##3}%
}
%    \end{macrocode}
% \subsection{Forms creation}
% Allow for creation of PDF or HTML forms. The effects here are
% limited somewhat by the need to support both output formats,
% so it may not be as clever as something which only wants 
% to make PDF forms.
%
% I could not have started this without the encouragement of T V Raman.
%    \begin{macrocode}
\newif\ifFld@checked
\newif\ifFld@hidden
\newif\ifFld@multiline
\newif\ifFld@readonly
\newif\ifFld@disabled
\newif\ifFld@password
\newif\ifFld@radio
\newif\ifFld@combo
\newif\ifFld@popdown
\Fld@multilinefalse
\Fld@checkedfalse
\Fld@hiddenfalse
\Fld@readonlyfalse
\Fld@disabledfalse
\Fld@radiofalse
\Fld@combofalse
\Fld@popdownfalse
\Fld@passwordfalse
\newcount\Fld@menulength
\newdimen\Field@Width
\newdimen\Fld@charsize
\Fld@charsize=10\p@
\def\Fld@maxlen{0}
\def\Fld@align{0}
\def\Fld@color{0 0 0}
\def\Fld@bcolor{1 1 1}
\def\Fld@bordercolor{1 0 0}
\def\Fld@bordersep{1\p@}
\def\Fld@borderwidth{1}
\def\Fld@borderstyle{S}
\newtoks\Choice@toks
\def\Form{\@ifnextchar[{\@Form}{\@Form[]}}
\def\endForm{\@endForm}
\newif\ifForm@html
\Form@htmlfalse
\def\Form@boolkey#1#2{%
  \csname Form@#2\ifx\relax#1\relax true\else#1\fi\endcsname}
\define@key{Form}{action}{%
 \def\Form@action{#1}%
}
\def\enc@@html{html}
\define@key{Form}{encoding}{%
 \def\@tempa{#1}%
 \ifx\@tempa\enc@@html
   \Form@htmltrue
 \else
   \typeout{hyperref: form `encoding' key set to #1 -- unknown type}%
   \Form@htmlfalse
 \fi
}
\define@key{Form}{method}{%
 \def\Form@method{#1}%
}
\def\Form@method{}
\def\Field@boolkey#1#2{%
  \csname Fld@#2\ifx\relax#1\relax true\else#1\fi\endcsname}
\newtoks\Field@toks
\Field@toks={ }%
\def\Field@addtoks#1#2{%
   \edef\@processme{\Field@toks{\the\Field@toks\space #1="#2"}}%
   \@processme
}
\def\Fld@checkequals#1=#2=#3\\{%
 \def\@currDisplay{#1}%
 \ifx\\#2\\%
   \def\@currValue{#1}%
 \else
   \def\@currValue{#2}%
 \fi
}
\define@key{Field}{loc}{%
 \def\Fld@loc{#1}%
}
\define@key{Field}{multiline}[true]{%
   \lowercase{\Field@boolkey{#1}}{multiline}}
\define@key{Field}{checked}[true]{%
   \lowercase{\Field@boolkey{#1}}{checked}}
\define@key{Field}{hidden}[true]{%
   \lowercase{\Field@boolkey{#1}}{hidden}}
\define@key{Field}{readonly}[true]{%
   \lowercase{\Field@boolkey{#1}}{readonly}}
\define@key{Field}{disabled}[true]{%
   \lowercase{\Field@boolkey{#1}}{disabled}}
\define@key{Field}{password}[true]{%
   \lowercase{\Field@boolkey{#1}}{password}}
\define@key{Field}{radio}[true]{%
   \lowercase{\Field@boolkey{#1}}{radio}}
\define@key{Field}{combo}[true]{%
   \lowercase{\Field@boolkey{#1}}{combo}}
\define@key{Field}{popdown}[true]{%
   \lowercase{\Field@boolkey{#1}}{popdown}}
\define@key{Field}{accesskey}{%
   \Field@addtoks{accesskey}{#1}%
}
\define@key{Field}{tabkey}{%
   \Field@addtoks{tabkey}{#1}%
}
\define@key{Field}{name}{%
 \def\Fld@name{#1}}
\define@key{Field}{width}{%
 \def\Fld@width{#1}%
 \Field@Width#1\setbox0=\hbox{m}%
}
\define@key{Field}{maxlen}{%
 \Fld@maxlen=#1}
\define@key{Field}{menulength}{%
 \Fld@menulength=#1}
\define@key{Field}{height}{%
 \def\Fld@height{#1}}
\define@key{Field}{charsize}{%
 \Fld@charsize#1}
\define@key{Field}{fillcolor}{%
 \def\Fld@fillcolor{#1}}
\define@key{Field}{bordercolor}{%
 \def\Fld@bordercolor{#1}}
\define@key{Field}{color}{%
 \def\Fld@color{#1}}
\define@key{Field}{borderwidth}{%
 \def\Fld@borderwidth{#1}}
\define@key{Field}{borderstyle}{%
 \def\Fld@borderstyle{#1}}
\define@key{Field}{bordersep}{%
 \def\Fld@bordersep{#1}}
\define@key{Field}{default}{%
 \def\Fld@default{#1}}
\define@key{Field}{align}{%
 \def\Fld@align{#1}}
\define@key{Field}{value}{%
 \def\Fld@value{#1}}
\define@key{Field}{backgroundcolor}{%
 \def\Fld@bcolor{#1}}
\def\Fld@format@code{}
\def\Fld@validate@code{}
\def\Fld@calculate@code{}
\def\Fld@keystroke@code{}
\define@key{Field}{keystroke}{%
  \def\Fld@keystroke@code{#1}%
}
\define@key{Field}{format}{%
  \def\Fld@format@code{#1}%
}
\define@key{Field}{validate}{%
  \def\Fld@validate@code{#1}%
}
\define@key{Field}{calculate}{%
  \def\Fld@calculate@code{#1}%
}
\define@key{Field}{onfocus}{%
  \Field@addtoks{onfocus}{#1}%
}
\define@key{Field}{onblur}{%
  \Field@addtoks{onblur}{#1}%
}
\define@key{Field}{onselect}{%
  \Field@addtoks{onselect}{#1}%
}
\define@key{Field}{onchange}{%
  \Field@addtoks{onchange}{#1}%
}
\define@key{Field}{onclick}{%
  \def\Fld@onclick{#1}%
  \Field@addtoks{onclick}{#1}%
}
\define@key{Field}{ondblclick}{%
  \Field@addtoks{ondblclick}{#1}%
}
\define@key{Field}{onmousedown}{%
  \Field@addtoks{onmousedown}{#1}%
}
\define@key{Field}{onmouseup}{%
  \Field@addtoks{onmouseup}{#1}%
}
\define@key{Field}{onmouseover}{%
  \Field@addtoks{onmouseover}{#1}%
}
\define@key{Field}{onmousemove}{%
  \Field@addtoks{onmousemove}{#1}%
}
\define@key{Field}{onmouseout}{%
  \Field@addtoks{onmouseout}{#1}%
}
\define@key{Field}{onkeypress}{%
  \Field@addtoks{onkeypress}{#1}%
}
\define@key{Field}{onkeydown}{%
  \Field@addtoks{onkeydown}{#1}%
}
\define@key{Field}{onkeyup}{%
  \Field@addtoks{onkeyup}{#1}%
}
%
\DeclareRobustCommand\TextField{\@ifnextchar[{\@TextField}{\@TextField[]}}
\DeclareRobustCommand\ChoiceMenu{\@ifnextchar[{\@ChoiceMenu}{\@ChoiceMenu[]}}
\DeclareRobustCommand\CheckBox{\@ifnextchar[{\@CheckBox}{\@CheckBox[]}}
\DeclareRobustCommand\PushButton{\@ifnextchar[{\@PushButton}{\@PushButton[]}}
\DeclareRobustCommand\Gauge{\@ifnextchar[{\@Gauge}{\@Gauge[]}}
\DeclareRobustCommand\Submit{\@ifnextchar[{\@Submit}{\@Submit[]}}
\DeclareRobustCommand\Reset{\@ifnextchar[{\@Reset}{\@Reset[]}}
\def\LayoutTextField#1#2{% label, field
 #1 #2}
\def\LayoutChoiceField#1#2{% label, field
 #1 #2}
\def\LayoutCheckField#1#2{% label, field
 #1 #2}
\def\LayoutPushButtonField#1{% button
 #1}
\def\MakeRadioField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}}
\def\MakeCheckField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}}
\def\MakeTextField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}}
\def\MakeChoiceField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}}
\def\MakeButtonField#1{%
 \setbox0=\hbox{\hskip\Fld@borderwidth bp#1\hskip\Fld@borderwidth bp}%
 \@tempdima\ht0
    \advance\@tempdima by \Fld@borderwidth bp
    \advance\@tempdima by \Fld@borderwidth bp
    \ht0\@tempdima
 \@tempdima\dp0
    \advance\@tempdima by \Fld@borderwidth bp
    \advance\@tempdima by \Fld@borderwidth bp
    \dp0\@tempdima
 \box0}
\def\DefaultHeightofSubmit{14pt}
\def\DefaultWidthofSubmit{2cm}
\def\DefaultHeightofReset{14pt}
\def\DefaultWidthofReset{2cm}
\def\DefaultHeightofCheckBox{\baselineskip}
\def\DefaultWidthofCheckBox{\baselineskip}
\def\DefaultHeightofChoiceMenu{\baselineskip}
\def\DefaultWidthofChoiceMenu{\baselineskip}
\def\DefaultHeightofText{\baselineskip}
\def\DefaultWidthofText{3cm}
%    \end{macrocode}
%
% \subsection{Setup}
%    \begin{macrocode}
\ifhy@figures
 \hyper@info{Hyper figures ON}
\else
 \hyper@info{Hyper figures OFF}
\fi
\ifhy@nesting
 \hyper@info{Link nesting ON}
\else
 \hyper@info{Link nesting OFF}
\fi
\ifhy@hyperindex
 \hyper@info{Hyper index ON}
\else
 \hyper@info{Hyper index OFF}
\fi
\ifhy@backref
 \hyper@info{backreferencing ON}
\else
 \hyper@info{backreferencing OFF}
\fi
\ifhy@colorlinks
    \hyper@info{Link coloring ON}
\else
    \hyper@info{Link coloring OFF}
\fi
%    \end{macrocode}
% \subsection{Low-level utility macros}
% We need unrestricted access to the |#|, |~| and |"| characters, so make
% them nice macros.
%    \begin{macrocode}
\edef\hyper@hash{\string#}
\edef\hyper@tilde{\string~}
\edef\hyper@quote{\string"}
\let\@currentHref\@empty
%    \end{macrocode}
% We give the start of document a special label; this is used
% in backreferencing-by-section, to allow for cites before
% any sectioning commands. Set up PDF info.
%    \begin{macrocode}
\AtBeginDocument{{\PDFbookmarktrue\PDF@SetupDoc}%
   \hyper@anchorstart{Doc-Start}\hyper@anchorend}
\MaybeStopEarly
%    \end{macrocode}
% \subsection{Automated \LaTeX\ hypertext cross-references}\label{latexxref}
% Anything which can be referenced advances some counter; we overload
% this to put in a hypertext starting point (with no visible anchor),
% and make a note of that for later use in |\label|.
% This will fail badly if |\theH<name>|
% does not expand to a sensible reference. This means that classes
% or package which introduce new elements need to define
% an equivalent  |\theH<name>|  for every  |\the<name>|. We do make
% a trap to make |\theH<name>| be the same as |\arabic{<name>}|,
% if |\theH<name>| is not defined, but this is not necessarily a good idea.
%
% All the shenanigans is to make sure section numbers etc
% are always arabic, separated by dots. Who knows how people
% will set up |\@currentlabel|? If they put spaces in, or brackets
% (quite legal) then the hypertext processors will get upset.
%
% But this is flaky, and open to abuse. Styles like
% |subeqn| will mess it up, for starters. Appendices are an issue, too.
% We just hope to cover most situations. We can at least cope
% with the standard sectioning structure, allowing for |\part|
% and |\chapter|.
%
% Start with a fallback for equations
%    \begin{macrocode}
\newcommand\theHequation {\theHsection.\arabic{equation}}
\@ifundefined{thepart}{}{\newcommand\theHpart{\arabic{part}}}
\@ifundefined{thechapter}{%
     \newcommand\theHsection        {\arabic{section}}
     \newcommand\theHfigure         {\arabic{figure}}
     \newcommand\theHtable         {\arabic{table}}
  }{%
  \newcommand\theHchapter       {\arabic{chapter}}
  \newcommand\theHfigure        {\theHchapter.\arabic{figure}}
  \newcommand\theHtable        {\theHchapter.\arabic{table}}
  \newcommand\theHsection       {\theHchapter.\arabic{section}}
  }
\newcommand\theHsubsection    {\theHsection.\arabic{subsection}}
\newcommand\theHsubsubsection {\theHsubsection.\arabic{subsubsection}}
\newcommand\theHparagraph     {\theHsubsubsection.\arabic{paragraph}}
\newcommand\theHsubparagraph  {\theHparagraph.\arabic{subparagraph}}
\newcommand\theHtheorem       {\theHsection.\arabic{theorem}}
\newcommand\theHthm       {\theHsection.\arabic{thm}}
%    \end{macrocode}
% Thanks to Greta Meyer (gbd@pop.cwru.edu) for making me realize
% that enumeration starts at 0 for every list! But |\item|
% occurs inside |\trivlist|, so check if its a real |\item| before
% incrementing counters.
%    \begin{macrocode}
\let\H@item\item
\newcounter{Item}
\def\theHItem{\arabic{Item}}
\def\item{%
 \@hyper@itemfalse
 \if@nmbrlist\@hyper@itemtrue\fi
 \H@item
}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\theHenumi  {\theHItem}
\newcommand\theHenumii  {\theHItem}
\newcommand\theHenumiii  {\theHItem}
\newcommand\theHenumiv  {\theHItem}
\newcommand\theHHfootnote  {\arabic{Hfootnote}}
\newcommand\theHmpfootnote  {\arabic{mpfootnote}}
\let\theHHmpfootnote\theHHfootnote
\newcommand\theHslide  {\arabic{slide}}
\let\orig@appendix\appendix
\def\appendix{\orig@appendix
  \@ifundefined{thechapter}%
   {\renewcommand\theHsection{\Alph{section}}}%
   {\renewcommand\theHchapter{\Alph{chapter}}}%
}
%    \end{macrocode}
% Tanmoy asked for this default handling of undefined |\theH<name>|
% situations. It really isn't clear what would be ideal, whether to
% turn off hyperizing of unknown elements, to pick up the textual
% definition of the counter, or to default it to something like
% |\arabic{name}|. We take the latter course, slightly worriedly.
%    \begin{macrocode}
\let\H@refstepcounter\refstepcounter
%    \end{macrocode}
%
%    \begin{macrocode}
\edef\name@of@eq{equation}%
%    \end{macrocode}
% We do not want the handler for |\refstepcounter| to cut in
% during the processing of |\item| (we handle that separately),
% so we provide a bypass conditional.
%    \begin{macrocode}
\newif\if@hyper@item
\newif\if@skiphyperref
\@hyper@itemfalse
\@skiphyperreffalse
\def\refstepcounter#1{%
 \H@refstepcounter{#1}%
 \if@skiphyperref
 \else
  \if@hyper@item
    \stepcounter{Item}%
    \hyper@refstepcounter{Item}%
  \else
    \hyper@refstepcounter{#1}%
  \fi
 \fi
}
%    \end{macrocode}
% AMS\LaTeX\ processes all equations twice; we want to make sure
% that the hyper stuff is not executed twice, so we use the AMS
% |\ifmeasuring@|, initialized if AMS math is not used.
%    \begin{macrocode}
\@ifpackageloaded{amsmath}{}{\newif\ifmeasuring@\measuring@false}
\def\hyper@refstepcounter#1{%
  \edef\This@name{#1}%
  \ifx\This@name\name@of@eq
     \make@stripped@name{\theequation}%
     \let\theHequation\newname
  \fi
  \@ifundefined{theH#1}{%
  \expandafter\def\csname theH#1\endcsname{\arabic{#1}}%
     }{}%
  \hyper@makecurrent{#1}%
  \ifmeasuring@\else
   \hyper@anchorstart{\@currentHref}\hyper@anchorend
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hyper@makecurrent#1{%
 \edef\@currentHlabel{\csname theH#1\endcsname}%
 \global\edef\@currentHref{#1.\expandafter
    \strip@prefix\meaning\@currentHlabel}%
}
\@ifpackageloaded{fancyvrb}{%
 \def\FV@StepLineNo{%
   \FV@SetLineNo
   \def\FV@StepLineNo{\H@refstepcounter{FancyVerbLine}}%
   \FV@StepLineNo}%
}{}
\@ifpackageloaded{lastpage}{%
\def\lastpage@putlabel{\addtocounter{page}{-1}%
   \immediate\write\@auxout{\string
   \newlabel{LastPage}{{}{\thepage}{}{}{}}}%
   \addtocounter{page}{1}}}{}

%    \end{macrocode}
% \subsubsection{Equations}\label{equations}
% We want to  make the whole equation a target anchor.
% Overload equation, temporarily reverting to original
% |\refstepcounter|. If, however, it is in AMS math, we do not
% do anything, as the tag mechanism is used there (see section \ref{ams}).
%    \begin{macrocode}
\let\new@refstepcounter\refstepcounter
\let\H@equation\equation
\let\H@endequation\endequation
%    \end{macrocode}
%
%    \begin{macrocode}
\@ifpackageloaded{amsmath}{}{%
 \def\equation{%
 \let\refstepcounter\H@refstepcounter
 \H@equation
 \make@stripped@name{\theequation}%
 \let\theHequation\newname
 \hyper@makecurrent{equation}%
 \hyper@anchorstart{\@currentHref}%
 \let\refstepcounter\new@refstepcounter
 }\def\endequation{\hyper@anchorend\H@endequation}%
}
%    \end{macrocode}
% My goodness, why can't \LaTeX{} be consistent? Why is |\eqnarray|
% set up differently from other objects?
%    \begin{macrocode}
\newif\if@eqnstar
\@eqnstarfalse
\let\H@eqnarray\eqnarray
\let\H@endeqnarray\endeqnarray
\def\eqnarray{%
 \let\reserved@a\relax
 \H@eqnarray
 \if@eqnstar\else
 \make@stripped@name{\theequation}%
 \let\theHequation\newname
 \hyper@makecurrent{equation}%
 \hyper@anchorstart{\@currentHref}{}\hyper@anchorend
 \fi
}
\def\endeqnarray{%
 \H@endeqnarray
}
%    \end{macrocode}
% This is quite heavy-handed, but it works for now. If its an |eqnarray*|
% we need to disable the hyperref actions. There may well be a cleaner
% way to trap this. Bill Moss found this.
%    \begin{macrocode}
\@namedef{eqnarray*}{\def\@eqncr{\nonumber\@seqncr}\@eqnstartrue\eqnarray}
\@namedef{endeqnarray*}{\nonumber\endeqnarray\@eqnstarfalse}
%    \end{macrocode}
% Then again, we have the \emph{subeqnarray}
% package. Tanmoy provided some code for this:
%    \begin{macrocode}
\@ifundefined{subeqnarray}{}%
{\let\H@subeqnarray\subeqnarray
 \let\H@endsubeqnarray\endsubeqnarray
 \def\subeqnarray{%
  \let\reserved@a\relax
  \H@subeqnarray
  \make@stripped@name{\theequation}%
  \let\theHequation\newname
  \hyper@makecurrent{equation}%
  \hyper@anchorstart{\@currentHref}{}\hyper@anchorend
  }%
  \def\endsubeqnarray{%
   \H@endsubeqnarray
  }%
\newcommand\theHsubequation {\theHequation\alph{subequation}}%
}
%    \end{macrocode}
% The aim of this macro is to produce a sanitized version of
% its argument, to make it a safe label.
%    \begin{macrocode}
\def\make@stripped@name#1{{%
 \escapechar\m@ne
 \global\let\newname\@empty
 \protected@edef\@tempa{#1}%
 \edef\@tempb{%
  \noexpand\@tfor\noexpand\@tempa:=\expandafter\strip@prefix\meaning\@tempa}%
 \@tempb\do{%
  \if{\@tempa\else
    \if}\@tempa\else
      \xdef\newname{\newname\@tempa}%
    \fi
  \fi}}}
%    \end{macrocode}
% \subsubsection{Footnotes}\label{footnotes}
% The footnote mark is a hypertext link, and the text is a target.
% We separately number the footnotes sequentially through the
% text, separately from whatever labels the text assigns. Too hard
% to keep track of markers otherwise. If the raw forms |\footnotemark|
% and |\footnotetext| are used, force them to use un-hyper original.
%    \begin{macrocode}
\newcounter{Hfootnote}
\let\H@@footnotetext\@footnotetext
\let\H@@footnotemark\@footnotemark
\def\@xfootnotenext[#1]{%
  \begingroup
     \csname c@\@mpfn\endcsname #1\relax
     \unrestored@protected@xdef\@thefnmark{\thempfn}%
  \endgroup
  \H@@footnotetext}
\def\@xfootnotemark[#1]{%
   \begingroup
      \c@footnote #1\relax
      \unrestored@protected@xdef\@thefnmark{\thefootnote}%
   \endgroup
   \H@@footnotemark}
\let\H@@mpfootnotetext\@mpfootnotetext
\long\def\@mpfootnotetext#1{%
  \H@@mpfootnotetext{%
 \ifhy@nesting
  \hyper@@anchor{\@currentHref}{#1}%
 \else
  \hyper@@anchor{\@currentHref}{\relax}#1%
 \fi
  }%
}
\long\def\@footnotetext#1{%
  \H@@footnotetext{%
 \ifhy@nesting
  \hyper@@anchor{\@currentHref}{#1}%
 \else
  \hyper@@anchor{\@currentHref}{\relax}#1%
 \fi
 }%
}
%    \end{macrocode}
% Redefine \verb+\@footnotemark+, borrowing its code (at the 
% cost of getting out of sync with latex.ltx), to take
% advantage of its white space and hyphenation fudges. If we just overload
% it, we can get variant documents (the word before the footnote
% is treated differently). Thanks to David Carlisle and Brian Ripley
% for confusing and helping me on this.
%    \begin{macrocode}
\def\@footnotemark{%
  \leavevmode
  \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
  \H@refstepcounter{Hfootnote}%
  \hyper@makecurrent{Hfootnote}%
  \hyper@linkstart{link}{\@currentHref}%
  \@makefnmark
  \hyper@linkend
  \ifhmode\spacefactor\@x@sf\fi
  \relax
}
\def\realfootnote{\@ifnextchar[\@xfootnote{\stepcounter{\@mpfn}%
     \protected@xdef\@thefnmark{\thempfn}%
     \H@@footnotemark\H@@footnotetext}}
%    \end{macrocode}
% But the special footnotes
% in |\maketitle| are much too hard to deal with
% properly. Let them revert to plain behaviour.
%    \begin{macrocode}
\let\orig@maketitle\maketitle
\def\maketitle{%
 \let\H@@origfootnotemark\@footnotemark
 \let\H@@origfootnotetext\@footnotetext
 \let\@footnotemark\H@@footnotemark
 \let\@footnotetext\H@@footnotetext
 \orig@maketitle
 \ifx\@footnotemark\H@@footnotemark
  \let\@footnotemark\H@@origfootnotemark
 \fi
 \ifx\@footnotetext\H@@footnotetext
  \let\@footnotetext\H@@origfootnotetext
 \fi
}
%    \end{macrocode}
% \subsubsection{Float captions}\label{captions}
% Make the float caption the hypertext anchor; curiously enough,
% we can't just copy the definition of |\@caption|. Its all to do
% with expansion. It screws up. Sigh.
%    \begin{macrocode}
\def\caption{\H@refstepcounter\@captype \@dblarg{\@caption\@captype}}
\long\def\@caption#1[#2]#3{%
  \hyper@makecurrent{\@captype}%
  \par\addcontentsline{\csname
  ext@#1\endcsname}{#1}{\protect\numberline{\csname
  the#1\endcsname}{\ignorespaces #2}}\begingroup
    \@parboxrestore
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces
%    \end{macrocode}
% If we cannot have nesting, the anchor is empty.
%    \begin{macrocode}
\ifhy@nesting
 \hyper@@anchor{\@currentHref}{#3}%
\else
 \hyper@@anchor{\@currentHref}{\relax}#3%
\fi
}\par
  \endgroup}
%    \end{macrocode}
% \subsubsection{Bibliographic references}\label{bib}
% This is not very robust, since many styles redefine these things.
% The package used to redefine |\@citex| and the like; then we tried
% adding the hyperref call explicitly into the .aux file.
% Now we redefine |\bibcite|; this still breaks some citation packages
% so we have to work around them. But this remains extremely dangerous.
% Any or all of \emph{achemso}, \emph{chapterbib}, 
% and \emph{drftcite} may break. 
%
% However, lets make an attempt to get \emph{natbib} right, because
% thats a powerful, important package. 
% Patrick Daly (\Email{daly@linmpi.mpg.de})  has
% provided hooks for us, so all we need to do is activate them.
%    \begin{macrocode}
\def\hyper@natlinkstart#1{%
  \hy@backout{#1}%
  \hyper@linkstart{cite}{cite.#1}%
  \def\hyper@nat@current{#1}%
}
\def\hyper@natlinkend{%
  \hyper@linkend
}
\def\hyper@natlinkbreak#1#2{\hyper@linkend#1\hyper@linkstart{cite}{cite.#2}}
\def\hyper@natanchorstart#1{%
     \hyper@anchorstart{cite.#1}%
}
\def\hyper@natanchorend{\hyper@anchorend}
%    \end{macrocode}
% Do not play games if we have natbib support.
%    \begin{macrocode}
\@ifundefined{NAT@parse}{%
\def\bibcite#1#2{%
 \@newl@bel{b}{#1}{\hyper@@link[cite]{}{cite.#1}{#2}}}%
%    \end{macrocode}
% |\@BIBLABEL| is working around a `feature' of Rev\TeX.
%    \begin{macrocode}
\providecommand{\@BIBLABEL}{\@biblabel}%
\def\@lbibitem[#1]#2{%
 \@skiphyperreftrue
 \H@item[\hyper@anchorstart{cite.#2}%
   \@BIBLABEL{#1}\hyper@anchorend\hfill]%
 \@skiphyperreffalse
 \if@filesw{\let\protect\noexpand
   \immediate\write\@auxout{%
     \string\bibcite{#2}{#1}}}%
  \fi
  \ignorespaces
}%
%    \end{macrocode}
% Since |\bibitem| is doing its own labelling, call the raw
% version of |\item|, to avoid extra spurious labels
%    \begin{macrocode}
\def\@bibitem#1{%
 \@skiphyperreftrue\H@item\@skiphyperreffalse
 \hyper@anchorstart{cite.#1}\relax\hyper@anchorend
 \if@filesw {\let\protect\noexpand
 \immediate\write\@auxout{%
   \string\bibcite{#1}{\the\value{\@listctr}}}}%
 \fi
 \ignorespaces
}%
}{}
%    \end{macrocode}
% Revtex (bless its little heart) takes over |\bibcite| and looks
% at the result to measure something. Make this a hypertext link
% and it goes ape. Therefore, make an anodyne result first, call
% its business, then go back to the real thing.
%    \begin{macrocode}
\@ifclassloaded{revtex}{%
 \hyper@info{*** compatibility with revtex **** }%
 \def\revtex@checking#1#2{%
   \expandafter\let\expandafter\T@temp\csname b@#1\endcsname
   \expandafter\def\csname b@#1\endcsname{#2}%
   \@SetMaxRnhefLabel{#1}%
   \expandafter\let\csname b@#1\endcsname\T@temp
  }%
%    \end{macrocode}
% Tanmoy provided this replacement for CITEX. Lord knows what it does.
%    \begin{macrocode}
\@ifundefined{@CITE}{\def\@CITE{\@cite}}{}
\def\@CITEX[#1]#2{%
  \let\@citea\@empty
  \leavevmode\unskip$^{\scriptstyle
  \@CITE{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@firstofone\@citeb}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {{\csname b@\@citeb\endcsname}}}}{#1}}$}
%    \end{macrocode}
% No, life is too short. I am not going to understand the
% Revtex |\@collapse| macro, I shall
% just restore the original behaviour of |\@citex|;
% sigh. This is SO vile.
%    \begin{macrocode}
\def\@citex[#1]#2{%
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@firstofone\@citeb}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\hbox{\csname b@\@citeb\endcsname}}}}{#1}}
}{}
%    \end{macrocode}
% Override Peter Williams' Harvard package; we have to
% a) make each of the citation types into a link; b) make
% each citation write a backref entry, and c) kick off a backreference
% section for each bibliography entry.
%    \begin{macrocode}
\@ifpackageloaded{harvard}{%
 \hyper@info{*** compatibility with harvard **** }%
 \hy@raiselinksfalse
 \def\harvardcite#1#2#3#4{%
  \global\@namedef{HAR@fn@#1}{\hyper@@link[cite]{}{cite.#1}{#2}}%
  \global\@namedef{HAR@an@#1}{\hyper@@link[cite]{}{cite.#1}{#3}}%
  \global\@namedef{HAR@yr@#1}{\hyper@@link[cite]{}{cite.#1}{#4}}%
  \global\@namedef{HAR@df@#1}{\csname HAR@fn@#1\endcsname}%
 }%
 \def\HAR@citetoaux#1{%
   \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi%
   \ifhy@backref
    \ifx\@empty\@currentlabel\else
     \@bsphack
     \protected@write\@auxout{}%
     {\string\@writefile{brf}%
       {\string\backcite{#1}{{\@currentlabel}{\thepage}{\@currentHref}}}}%
     \@esphack
    \fi
  \fi
 }
 \def\harvarditem{\@ifnextchar[{\@harvarditem}{\@harvarditem[\null]}}
 \def\@harvarditem[#1]#2#3#4#5\par{%
 \item[]%
 \hyper@anchorstart{cite.#4}\relax\hyper@anchorend%
 \if@filesw{ \def\protect##1{\string ##1\space}%
 \ifthenelse{\equal{#1}{\null}}
  {\def\next{{#4}{#2}{#2}{#3}}}
  {\def\next{{#4}{#2}{#1}{#3}}}
 \immediate\write\@auxout{\string\harvardcite\codeof\next}%
 }\fi%
 \protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces%
 #5
 \ifhy@backref
  \newblock
  \backref{\csname br@#4\endcsname}%
 \fi
 \par
}%
}{}
%    \end{macrocode}
% \subsubsection{Page numbers}\label{pagenum}
% Give every page an automatic number anchor. This involves, sigh,
% overloading \LaTeX's output bits and pieces, which must be dangerous.
% This used to be |\@shipoutsetup|, now |\@begindvi|. We cannot even
% overload this, as it sets itself to null. SIGH.
%    \begin{macrocode}
\def\@begindvi{%
  \unvbox \@begindvibox
 \ifhy@pageanchor
  \@hyperfixhead
  \global\let \@begindvi \@hyperfixhead
 \else
  \global\let \@begindvi \@empty
 \fi
}
\def\hyperpageanchor{%
   \ifhy@plainpages
     \hyper@anchorstart{page.\arabic{page}}\hyper@anchorend
   \else
     \hyper@anchorstart{page.\thepage}\hyper@anchorend
   \fi
 }
\def\pagenumbering#1{%
  \global\c@page \@ne \gdef\thepage{\csname @#1\endcsname
   \c@page}}
%    \end{macrocode}
% This is needed for some unremembered reason\ldots
%    \begin{macrocode}
\let\HYPERPAGEANCHOR\hyperpageanchor
%    \end{macrocode}
% This where we supply a destination for each page. Test to see 
% if there is some sort of header. The test used to be
% |\expandafter\ifx\expandafter\@empty\H@old@thehead|.
%    \begin{macrocode}
\providecommand\hyper@pagetransition{}
\def\@hyperfixhead{%
 \ifhy@plainpages
     \gdef\@foo{\hyper@@anchor{page.\arabic{page}}}%
 \else
     \gdef\@foo{\hyper@@anchor{page.\thepage}}%
 \fi
 \let\H@old@thehead\@thehead
 \if^\@thehead^\def\H@old@thehead{\hfil}\fi
 \def\@thehead{\@foo\relax\hyper@pagetransition\H@old@thehead}%
}
%    \end{macrocode}
%
%\subsubsection{Table of contents}\label{toc}
% TV Raman noticed that people who add arbitrary material into the TOC
% generate a bad or null link. We used to
% avoid that by checking if the current 
% destination was empty; instead,  generate
% an arbitrary anchor at this point, and link to it. A separate
% macro is used for the automatic uses of |\addcontentsline| in
% section headings. THIS DOES NOT WORK YET!!!!!
%    \begin{macrocode}
\def\toclevel@part{-1}
\def\toclevel@chapter{0}
\def\toclevel@section{1}
\def\toclevel@subsection{2}
\def\toclevel@subsubsection{3}
\def\toclevel@paragraph{4}
\def\toclevel@subparagraph{5}
\def\@nameoftoc{toc}
\newcount\OddToc
\def\addhyperlinkline#1#2{%
  \global\advance\OddToc by 1
  % If we're in vmode we want to revert to vmode
  \edef\@tempa{\ifvmode\vskip0pt\fi}%
  \hyper@@anchor{toc\the\OddToc}{\relax}\@tempa%
  \@writetorep{}{#2}{toc\the\OddToc}{\csname toclevel@#1\endcsname}%
}
\def\manual@addcontentsline#1#2#3{%
  \addhyperlinkline{#2}{#3}
  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}{toc\the\OddToc}}%
}
\def\addcontentsline#1#2#3{%
  \ifx\@currentHref\@empty
  \hyper@warn{contentsline with no destination
     at line \the\inputlineno}\fi
  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}{\@currentHref}}%
}
\def\contentsline#1#2#3#4{%
 \ifx\\#4\\%
  \csname l@#1\endcsname{#2}{#3}%
\else
 \ifhy@linktocpage
    \csname l@#1\endcsname{%
    {#2}}{\hyper@linkstart{link}{#4}{#3}\hyper@linkend}%
 \else
    \csname l@#1\endcsname{%
    \hyper@linkstart{link}{#4}{#2}\hyper@linkend}{#3}%
 \fi
\fi
}
%    \end{macrocode}
% \subsubsection{New counters}\label{counters}
% The whole theorem business makes up new counters on the fly;
% we are going to intercept this. Sigh. Do it at the level where
% new counters are defined.
%    \begin{macrocode}
\let\H@definecounter\@definecounter
\def\@definecounter#1{%
   \H@definecounter{#1}%
   \expandafter\def\csname theH#1\endcsname       {\arabic{#1}}%
}
%    \end{macrocode}
% But what if they have used the optional argument to e.g. |\newtheorem|
% to determine when the numbering is reset? OK, we'll trap that too.
%    \begin{macrocode}
\let\H@newctr\@newctr
\def\@newctr#1[#2]{%
  \H@newctr#1[#2]%
  \expandafter\def\csname theH#1\endcsname
    {\csname the#2\endcsname.\arabic{#1}}%
}
%    \end{macrocode}
% \subsubsection{AMS\LaTeX\ compatibility}\label{ams}
% Oh, no, they don't use anything as simple as |\refstepcounter|
% in the AMS! We need to intercept some low-level operations
% of theirs. Damned if we are going to try and work out what the hell
% they get up to. Just stick a label of `AMS' on the front, and use the
% label \emph{they} worked out. If that produces something invalid, I give
% up. They'll change all the code again anyway, I expect.
%    \begin{macrocode}
\let\Hmake@df@tag@@\make@df@tag@@
\def\make@df@tag@@#1{%
 \Hmake@df@tag@@{#1}%
 \global\edef\@currentHref{AMS.\theequation}%
}
\let\H@seteqlabel\@seteqlabel
\def\@seteqlabel#1{%
 \H@seteqlabel{#1}%
 \global\edef\@currentHref{AMS.\theequation}%
}
%    \end{macrocode}
% This code I simply cannot remember what I was trying to achieve.
% The final result seems to do nothing anyway.
%\begin{verbatim}
%\let\H@tagform@\tagform@
%\def\tagform@#1{%
%  \maketag@@@{\hyper@@anchor{\@currentHref}%
%  {(\ignorespaces#1\unskip)}}%
%}
%\def\eqref#1{\textup{\H@tagform@{\ref{#1}}}}
%\end{verbatim}
% \subsubsection{Included figures}
% Simply intercept the low level graphics package macro.
%    \begin{macrocode}
\ifhy@figures
 \let\hy@Gin@setfile\Gin@setfile
 \def\Gin@setfile#1#2#3{%
 \hyperimage{#3}{\hy@Gin@setfile{#1}{#2}{#3}}%
 }
\fi
%    \end{macrocode}
%
% \subsection{hyperindex entries}\label{hyperindex}
% Hyper-indexing works crudely, by forcing code onto the end of the index
% entry with the \verb+|+ feature; this puts a hyperlink around
% the printed page numbers. It will not proceed if the author has already
% used the \verb+|+ specifier for something like emboldening entries.
% That would make Makeindex fail (cannot have two \verb+|+ specifiers).
% The solution is for the author to use generic coding, and put in
% the requisite |\hyperpage| in his/her own macros along with the boldness.
%
% This section is poor stuff; it's open to all sorts of abuse. Sensible
% large projects will design their own indexing macros any bypass this.
%    \begin{macrocode}
\ifhy@hyperindex
 \def\@wrindex#1{\@@wrindex#1||\\}
 \def\@@wrindex#1|#2|#3\\{%
 \ifx\\#2\\%
   \protected@write\@indexfile{}%
      {\string\indexentry{#1|hyperpage}{\thepage}}%
 \else
   \protected@write\@indexfile{}%
      {\string\indexentry{#1|#2}{\thepage}}%
 \fi
 \endgroup
 \@esphack
}
\fi
%    \end{macrocode}
% This again is quite flaky, but allow for the common situation of a
% page range separated by en-rule. We split this into two different
% hyperlinked pages.
%    \begin{macrocode}
\def\hyperpage#1{\@hyperpage#1----\\}
\def\@hyperpage#1--#2--#3\\{%
 \ifx\\#2\\%
    \@commahyperpage{#1}%
 \else
  \hyperlink{page.#1}{#1}--\hyperlink{page.#2}{#2}%
 \fi
}
\def\@commahyperpage#1{\@@commahyperpage#1, ,\\}
\def\@@commahyperpage#1, #2,#3\\{%
 \ifx\\#2\\%
   \hyperlink{page.#1}{#1}%
 \else
   \hyperlink{page.#1}{#1}, \hyperlink{page.#2}{#2}%
 \fi
}
%    \end{macrocode}
%
%\subsection{Compatibility with seminar slide package}\label{seminar}
%    \begin{macrocode}
\let\oldslide@heading\slide@heading
\def\slide@heading[#1]#2{%
 \@writetorep{\theslide}{#1}{slide.\theslide}{0}%
 \oldslide@heading[#1]{#2}%
}
\@ifundefined{listofslides}{}{%
 \def\l@slide#1#2#3{%
    \slide@undottedcline{\slidenumberline{#3}{\hyperlink{slide.#2}{#2}}}{}}%
}
%    \end{macrocode}
% \subsection{Localized nullifying of package}
% Sometimes we just don't want the wretched package interfering
% with us. Define an environment we can put in manually, or include
% in a style file, which stops the hypertext functions doing anything.
% This is used, for instance, in the Elsevier classes, to stop
% |hyperref| playing havoc in the front matter.
%    \begin{macrocode}
\def\NoHyper{%
    \def\hyper@link@[##1]##2##3##4{##4}%
    \def\hyper@@anchor##1{}%
    \global\let\hyper@livelink\hyper@link
    \gdef\hyper@link##1##2##3{##3}%
    \def\hyper@anchorstart##1{}%
    \let\hyper@anchorend\@empty
    \def\hyper@linkstart##1##2{}%
    \let\hyper@linkend\@empty
    \def\hyper@linkurl##1##2{##1}%
    \def\hyper@linkfile##1##2##3{##1}%
    \let\hy@backout\@gobble
}
\def\stop@hyper{%
    \def\hyper@link@[##1]##2##3##4{##4}%
    \let\hy@backout\@gobble
    \def\hyper@@anchor##1{}%
    \def\hyper@link##1##2##3{##3}%
    \def\hyper@anchorstart##1{}%
    \let\hyper@anchorend\@empty
    \def\hyper@linkstart##1##2{}%
    \let\hyper@linkend\@empty
    \def\hyper@linkurl##1##2{##1}%
    \def\hyper@linkfile##1##2##3{##1}%
}
\def\endNoHyper{%
    \global\let\hyper@link\hyper@livelink
}
%    \end{macrocode}
% \subsection{The Mangling Of Aux and Toc Files}
% Some extra tests so that the hyperref package may be removed or added
% to a document without having to remove .aux and .toc files
% (this section is by David Carlisle)
% All the code is delayed to |\begin{document}|
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
% First the code to deal with removing the hyperref package from
% a document.
%
% Write some stuff into the aux file so if the next run is done
% without hyperref, then |\contentsline| and |\newlabel| are defined
% to cope with the extra arguments.
%    \begin{macrocode}
  \immediate\write\@auxout{%
%    \end{macrocode}
%
%    \begin{macrocode}
    \string\ifx\string\hyper@anchor\string\@undefined^^J%
%    \end{macrocode}
%
%    \begin{macrocode}
       \global\let\string\oldcontentsline\string\contentsline^^J%
       \gdef\string\contentsline\string#1\string#2\string#3\string#4{%
           \string\oldcontentsline{\string#1}{\string#2}{\string#3}}^^J%
       \global\let\string\oldnewlabel\string\newlabel^^J%
       \gdef\string\newlabel\string#1\string#2{%
           \string\newlabelxx{\string#1}\string#2}^^J%
       \gdef\string\newlabelxx%
           \string#1\string#2\string#3\string#4\string#5\string#6{%
             \string\oldnewlabel{\string#1}{{\string#2}{\string#3}}}^^J%
%    \end{macrocode} 
%
% But the new aux file will be read again at the end, with the normal
% definitions expected, so better put things back as they were.
%    \begin{macrocode}
       \string\AtEndDocument{%
          \let\string\contentsline\string\oldcontentsline^^J%
          \let\string\newlabel\string\oldnewlabel}^^J%
%    \end{macrocode}
%
% If the document is being run with hyperref put this definition
% into the aux file, so we can spot it on the next run.
%    \begin{macrocode}
    \string\else^^J%
       \global\let\string\hyper@last\relax^^J%
    \string\fi^^J%
    }%
%    \end{macrocode}
%
% Now the code to deal with adding the hyperref package to a document
% with aux and toc written the standard way.
%
% If hyperref was used last time, do nothing. If it was not used,
% or an old version of hyperref was used, don't use that TOC at all
% but generate a warning. Not ideal, but better than failing
% with pre-5.0 hyperref TOCs.
%    \begin{macrocode}
  \ifx\hyper@last\@undefined
    \def\@starttoc#1{%
      \begingroup
        \makeatletter
        \IfFileExists{\jobname.#1}%
           {\hyper@warn{old #1 file detected, not used; run LaTeX again}}{}%
        \if@filesw
          \expandafter\newwrite\csname tf@#1\endcsname
b          \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
        \fi
        \@nobreakfalse
      \endgroup}%
    \def\newlabel#1#2{\@newl@bel r{#1}{#2{}{}{}{}}}
  \fi}
%    \end{macrocode}
% This breaks TeX4ht, so leave it to last.
% Emend |\@setref| to put out a hypertext link as well as its
% normal text (which is used as an anchor).
%    \begin{macrocode}
\@ifpackageloaded{tex4ht}{\endinput}{}
\let\real@setref\@setref
\let\real@ref\ref
\DeclareRobustCommand\ref{\@ifnextchar*{\@refstar}{\real@ref}}
\DeclareRobustCommand\pageref{\@ifnextchar*{\@pagerefstar}{\real@pageref}}
\def\@setref#1#2#3{% csname, extract group, refname
  \ifx#1\relax
   \protect\G@refundefinedtrue
   \nfss@text{\reset@font\bfseries ??}%
   \@latex@warning{Reference `#3' on page \thepage \space
             undefined}%
  \else
   \hyper@@link
       {\expandafter\@fifthoffive#1}%
       {\expandafter\@fourthoffive#1\@empty\@empty}%
       {\expandafter#2#1\@empty\@empty\null}%
  \fi}
%    \end{macrocode}
% Set |\pageref| to be a link.
% |\realpageref| is available for people who know about these things,
% which uses a copy of |\@setref|.
%    \begin{macrocode}
\def\real@pageref#1{\expandafter\@pagesetref\csname r@#1\endcsname
                                   \@secondoftwo{#1}}
\def\@pagesetref#1#2#3{% csname, extract macro, ref
  \ifx#1\relax
   \protect\G@refundefinedtrue
   \nfss@text{\reset@font\bfseries ??}%
   \@latex@warning{Reference `#3' on page \thepage \space
             undefined}%
  \else
   \protect\hyper@@link{\expandafter\@fifthoffive#1}%
      {page.\expandafter\@secondoffive#1}%
      {\expandafter\@secondoffive#1}%
  \fi}
\def\realpageref#1{\expandafter\real@setref
  \csname r@#1\endcsname\@secondoffive{#1}}
%    \end{macrocode}
% Now some extended referencing. |\ref*| is not linked,
% and |\autoref| prefixes with a tag based on the type.
%    \begin{macrocode}
\def\@refstar*#1{\expandafter\real@setref
       \csname r@#1\endcsname\@firstoffive{#1}}
\def\@pagerefstar*#1{\expandafter\real@setref
       \csname r@#1\endcsname\@secondoffive{#1}}
\DeclareRobustCommand\autoref[1]{%
    \expandafter\auto@setref\csname r@#1\endcsname\@firstoffive{#1}}
\def\auto@setref#1#2#3{% csname, extract group, refname
  \ifx#1\relax
   \protect\G@refundefinedtrue
   \nfss@text{\reset@font\bfseries ??}%
   \@latex@warning{Reference `#3' on page \thepage \space
             undefined}%
  \else
   \edef\@thisref{\expandafter\@fourthoffive#1\@empty\@empty}%
   \expandafter\test@reftype\@thisref\\%
   \hyper@@link
       {\expandafter\@fifthoffive#1}%
       {\expandafter\@fourthoffive#1\@empty\@empty}%
       {\@currentHtag\expandafter#2#1\@empty\@empty\null}%
  \fi}
\def\test@reftype#1.#2\\{%
  \@ifundefined{#1name}%
     {\def\@currentHtag{}%
        \@latex@warning{no tag name for #1 at \the\inputlineno}}%
     {\def\@currentHtag{\csname#1name\endcsname~}}%
}
\def\@currentHtag{}
\providecommand\figurename{Figure}
\providecommand\tablename{Table}
\providecommand\partname{Part}
\providecommand\appendixname{Appendix}
\providecommand\equationname{Equation}
\providecommand\Itemname{item}
\providecommand\chaptername{chapter}
\providecommand\sectionname{section}
\providecommand\subsectionname{subsection}
\providecommand\subsubsectionname{subsubsection}
\providecommand\paragraphname{paragraph}
\providecommand\FancyVerbLinename{line}
\providecommand\Hfootnotename{footnote}
\providecommand\AMSname{Equation}
\providecommand\theoremname{Theorem}
%</package>
%<*pdftex>
%    \end{macrocode}
% \section{Configuration files}
% \subsection{pdftex}
%
%    \begin{macrocode}
%    \end{macrocode}

% This driver is for Han The Thanh's \TeX{} variant
% which produces PDF directly. This has new primitives
% to do PDF things, which usually translate almost directly to
% PDF code, so there is a lot of flexibility which we do not at
% present harness.
%
% First set up the default linking
%    \begin{macrocode}
\providecommand\@pdfview{XYZ}
%    \end{macrocode}
% First define the anchors:
%    \begin{macrocode}
\def\new@pdflink#1{%
%<pdftexold> \pdfdest name {#1!}\@pdfview\ifvmode\nobreak\fi}
%<!pdftexold> \pdfdest name {#1}\@pdfview\ifvmode\nobreak\fi}
\let\pdf@endanchor\@empty
%
%    \end{macrocode}
% Now the links; the interesting part here is the set of attributes
% which define how the link looks. We probably want to add a border
% and color it, but there are other choices. This directly translates
% to PDF code, so consult the manual for how to change this. We will
% add an interface at some point.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\pdfBorderAttrs{/Border [0 0 0]}%
  \fi
}
\def\@pdfborder{0 0 1}%
\def\pdfBorderAttrs{/Border [\@pdfborder]}
\def\find@pdflink#1#2{%
  \leavevmode\pdfannotlink
  attr{\pdfBorderAttrs /H \@pdfhighlight /C [\CurrentBorderColor]}
%<pdftexold>  goto name {#2!}%
%<!pdftexold>  goto name {#2}%
  \hy@colorlink{\csname @#1color\endcsname}%
}
\def\close@pdflink{\hy@endcolorlink\pdfendlink}
\def\hyper@anchor#1{\new@pdflink{#1}\anchor@spot\pdf@endanchor}
\def\hyper@anchorstart#1{\new@pdflink{#1}\hy@activeanchortrue}
\def\hyper@anchorend{\pdf@endanchor\hy@activeanchorfalse}
\def\hyper@linkstart#1#2{%
  \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}%
  \find@pdflink{#1}{#2}}
\def\hyper@linkend{\close@pdflink}
\def\hyper@link#1#2#3{%
    \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}%
    \find@pdflink{#1}{#2}#3\close@pdflink
}
\def\CurrentBorderColor{\@linkbordercolor}
\def\hyper@linkurl#1#2{% 
   \bgroup
   \hyper@chars
   \leavevmode\pdfannotlink
   attr{\pdfBorderAttrs /H \@pdfhighlight /C [\@urlbordercolor]}
%<*!pdftexold>
   user{/Subtype /Link
    /A << 
        /Type /Action 
        /S /URI 
        /URI (#2) 
    >>}\hy@colorlink{\@urlcolor}#1%
%</!pdftexold>
%<*pdftexold>
   user{/S /URI /URI (#2)}\hy@colorlink{\@urlcolor}#1%
%</pdftexold>
   \close@pdflink
   \egroup
}
\def\hyper@linkfile#1#2#3{% anchor text, filename, linkname
   \bgroup
   \leavevmode\pdfannotlink
   attr{\pdfBorderAttrs\space /H \@pdfhighlight\space /C [\@filebordercolor]}
   user {/Subtype /Link 
         /A <<   /F (#2) /S /GoToR
         \ifhy@newwindow /NewWindow true \fi
         \ifx\\#3\\/D [0 \@pdfstartview] \else /D (#3)\fi
         \space>>}\hy@colorlink{\@filecolor}#1\close@pdflink
   \egroup
}
\ifx\pdftexversion\@undefined
  \def\@pdfproducer{pdfTeX}
\else
  \def\@pdfproducer{pdfTeX\the\pdftexversion.\pdftexrevision}
\fi
%<*!pdftexold>
\def\PDF@SetupDoc{%
  \pdfcatalog {            % Catalog dictionary of PDF output. 
    /PageMode \@pdfpagemode
    /URI << /Base (\@baseurl) >>
\ifhy@acrofour
   /PageLabels << /Nums [ 0 << /S /D /St \c@page\space >> ] >>
\fi
    }
\ifx\@pdfstartview\@empty
\else
  openaction goto page \@pdfstartpage {\@pdfstartview}%
\fi
 \pdfinfo {
  /Author (\@pdfauthor)
  /Title (\@pdftitle)
  /Subject (\@pdfsubject)
  /Creator (\@pdfcreator)
  /Producer (\@pdfproducer)
  /Keywords (\@pdfkeywords)
  \ifx\@pdfpagescrop\@empty\else
    /CropBox [\@pdfpagescrop]
  \fi
  }%
\pdfcatalog{
/ViewerPreferences << 
 \ifhy@toolbar\else /HideToolbar true \fi
 \ifhy@menubar\else /HideMenubar true \fi
 \ifhy@windowui\else /HideWindowUI true \fi
 \ifhy@fitwindow /FitWindow true \fi
 \ifhy@centerwindow /CenterWindow true \fi
   >>
 \ifx\pdf@pagelayout\@empty\else/PageLayout /\pdf@pagelayout\space\fi
}%
}
%</!pdftexold>
%<*pdftexold>
\def\PDF@SetupDoc{%
\edef\x@pdfcatalog{%
  pagemode {\@pdfpagemode}
  \ifx\@baseurl\@empty\else uri {\@baseurl} \fi}%
\edef\x@pdfinfo{%
  author {\@pdfauthor}
  title {\@pdftitle}
  subject {\@pdfsubject}
  keywords {\@pdfkeywords}
 \ifx\@pdfpagescrop\@empty\else
  \pdfpagesattr={/CropBox [\@pdfpagescrop]}
 \fi
}%
 \expandafter\pdfcatalog \x@pdfcatalog
 \expandafter\pdfinfo \x@pdfinfo
}
%</pdftexold>
\def\hyper@pagetransition{%
 \ifx\@pdfpagetransition\@empty
 \else
   \edef\@processme{%
\global\pdfpageattr{/Trans << /S /\@pdfpagetransition\space >>}}%
   \@processme
 \fi
}
%    \end{macrocode}
% Let us explicitly turn on PDF generation; they can reverse 
% this decision in the document, but since we are emitting PDF
% links anyway, we \emph{must} be in PDF mode.
%    \begin{macrocode}
\pdfoutput=1
\pdfcompresslevel=9
\AtBeginDocument{%
 \pdfpagewidth\paperwidth
 \pdfpageheight\paperheight
}
%<*!pdftexold>
\def\Acrobatmenu#1#2{%
   \leavevmode\pdfannotlink
   attr{\pdfBorderAttrs /H \@pdfhighlight /C [\@menubordercolor]}
   user{
    /Subtype /Link
    /A << 
       /S /Named /N /#1
    >>
    /H \@pdfhighlight
    }\hy@colorlink{\@menucolor}#2\close@pdflink
}
%</!pdftexold>
%<*pdftexold>
\def\Acrobatmenu#1#2{%
   \leavevmode\pdfannotlink
   attr{\pdfBorderAttrs /H \@pdfhighlight /C [\@menubordercolor]}
   user{/S /Named /N /#1}\hy@colorlink{\@menucolor}#2\close@pdflink
}
%</pdftexold>
%</pdftex>
%<*hypertex>
%    \end{macrocode}
% \subsection{hypertex}
% The Hyper\TeX\ specification (this is
% borrowed from an article by Arthur Smith)
% says that conformant viewers/translators
% must recognize the following set of |\special| commands:
% \begin{description}
% \item[href:] |html:<a href = "href_string">|
% \item[name:] |html:<a name = "name_string">|
% \item[end:] |html:</a>|
% \item[image:] |html:<img src = "href_string">|
% \item[base\_name:] |html:<base href = "href_string">|
% \end{description}
%
% The \emph{href}, \emph{name} and \emph{end} commands are used to do
% the basic hypertext operations of establishing links between sections
% of documents. The \emph{image} command is intended (as with current
% html viewers) to place an image of arbitrary graphical
% format on the page in the current location.  The \emph{base\_name}
% command is be used to communicate to the \emph{dvi} viewer the full (URL)
% location of the current document so that
% files specified by relative URL's may be retrieved correctly.
%
% The \emph{href} and \emph{name} commands must be paired with an
% \emph{end} command later in
% the \TeX{} file --- the \TeX{} commands between the two ends of a pair
% form an \emph{anchor} in the document. In the case of an \emph{href}
% command, the \emph{anchor} is to be highlighted in the
% \emph{dvi} viewer, and
% when clicked on will cause the scene to shift to the destination
% specified by \emph{href\_string}. The \emph{anchor} associated with a
% name command represents a possible location to which other hypertext
% links may refer, either as local references (of the form
% \texttt{href="\#name\_string"} with the \emph{name\_string}
% identical to the one in the name command) or as part of a URL (of the
% form \emph{URL\#name\_string}). Here \emph{href\_string} is a valid
% URL or local identifier, while name\_string could be any string at
% all: the only caveat is that `|"|' characters should be escaped with a
% backslash (|\|), and if it looks like a URL name it may cause
% problems.
%
%    \begin{macrocode}
\def\PDF@SetupDoc{%
 \ifx\@baseurl\@empty\else
  \special{html:<base href="\@baseurl">}%
 \fi
}
\def\hyper@anchor#1{%
   {\let\protect=\string\special{html:<A name=\hyper@quote #1\hyper@quote>}}%
   \hy@activeanchortrue
   \hy@colorlink{\@anchorcolor}\anchor@spot\hy@endcolorlink
   \special{html:</A>}%
   \hy@activeanchorfalse
}
\def\hyper@anchorstart#1{%
 {\hyper@chars\special{html:<A name=\hyper@quote#1\hyper@quote>}}%
  \hy@activeanchortrue
}
\def\hyper@anchorend{%
  \special{html:</A>}%
  \hy@activeanchorfalse
}
\def\@urltype{url}
\def\hyper@linkstart#1#2{%
  \hy@colorlink{\csname @#1color\endcsname}%
  \def\@tempa{#1}\ifx\@tempa\@urltype
    \special{html:<A href=\hyper@quote#2\hyper@quote>}%
  \else
   {\hyper@chars\special{html:<A href=\hyper@quote\##2\hyper@quote>}}%
  \fi
}
\def\hyper@linkend{%
  \special{html:</A>}%
  \hy@endcolorlink
}
\def\hyper@linkfile#1#2#3{%
 \hyper@linkurl{#1}{file:#2\ifx\\#3\\\else\##3\fi}%
}
\def\hyper@linkurl#1#2{%
%    \end{macrocode}
% If we want to raise up the final link |\special|, we need to
% get its height; ask me why \LaTeX\ constructs make this totally
% foul up, and make us revert to basic \TeX. I do not know.
%    \begin{macrocode}
 \ifhy@raiselinks
  \setbox\@tempboxa=\hbox{#1}%
  \@linkdim\dp\@tempboxa
  \leavevmode\lower\@linkdim\hbox{%
      {\hyper@chars\special{html:<A href=\hyper@quote#2\hyper@quote>}}%
   }%
  \hy@colorlink{\@urlcolor}#1%
  \@linkdim\ht\@tempboxa
%    \end{macrocode}
% Because of the interaction with the dvihps processor, we have to subtract a
% little from the height. This is not clean, or checked. Check with Mark
% Doyle about what gives here. It may not be needed with 
% the new dvips (Jan 1997).
%    \begin{macrocode}
  \advance\@linkdim by -6.5\p@
  \raise\@linkdim\hbox{\special{html:</A>}}%
  \hy@endcolorlink
 \else
  {\hyper@chars
   \special{html:<A href=\hyper@quote#2\hyper@quote>}%
   \hy@colorlink{\@urlcolor}#1\special{html:</A>}%
   \hy@endcolorlink}%
 \fi
}
\def\hyper@link#1#2#3{%
  \hyper@linkurl{#3}{\##2}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hyper@image#1#2{%
  {\hyper@chars
   \special{html:<img src=\hyper@quote#1\hyper@quote>}}}
%</hypertex>
%<*dviwindo>
%    \end{macrocode}
% \subsection{dviwindo}
% [This was developed by David Carlisle].
% Within a file dviwindo hyperlinking is used, for external
% URL's a call to |\wwwbrowser| is made. (You can define
% this command before or after loading the hyperref package
% if the default |c:/netscape/netscape| is not suitable)
% Dviwindo could in fact handle external links to dvi files on
% the same machine without calling a web browser, but that would
% mean parsing the URL to recognise such, and this is currently
% not done.
%
% This was more or less blindly copied from the hypertex cfg.
% For dviwindo,  \LaTeX{} must specify the size of the active area
% for links. For some hooks this information is available
% but for some, the start and end of the link are
% specified separately in which case a fixed size area
% of 10000000sp wide by |\baselineskip| high is used.
%    \begin{macrocode}

\providecommand\wwwbrowser{c:\string\netscape\string\netscape}
\def\hyper@anchor#1{%
   {\let\protect=\string\special{mark:  #1}}%
   \hy@activeanchortrue
   \hy@colorlink{\@anchorcolor}\anchor@spot\hy@endcolorlink
   \hy@activeanchorfalse
}
\def\hyper@anchorstart#1{%
  \special{mark: #1}%
  \hy@activeanchortrue
}
\def\hyper@anchorend{%
  \hy@activeanchorfalse
}
\def\hyper@linkstart#1#2{%
  \hy@colorlink{\csname @#1color\endcsname}%
  \special{button:  10000000 \number\baselineskip \space
      #2}%
}
\def\hyper@linkend{%
  \hy@endcolorlink
}
\def\hyper@link#1#2#3{%
 \ifhy@raiselinks
  \setbox\@tempboxa=\hbox{#3}%
  \@linkdim\dp\@tempboxa
  \leavevmode\lower\@linkdim\hbox{%
  \special{button:  \number\wd\@tempboxa\space \number\ht\@tempboxa\space
      #2}%
  \hy@colorlink{\csname @#1color\endcsname}#3\hy@endcolorlink}%
  \@linkdim\ht\@tempboxa
  \advance\@linkdim by -6.5\p@
  \raise\@linkdim\hbox{}%
 \else
  \setbox\@tempboxa=\hbox{#3}%
  \special{button:  \number\wd\@tempboxa\space \number\ht\@tempboxa\space
      #2}%
  \hy@colorlink{\csname @#1color\endcsname}#3\hy@endcolorlink
 \fi
}
\def\hyper@linkurl#1#2{%
\bgroup\hyper@chars
 \ifhy@raiselinks
  \setbox\@tempboxa=\hbox{#1}%
  \@linkdim\dp\@tempboxa
  \leavevmode\lower\@linkdim\hbox{%
  \special{button:  \number\wd\@tempboxa\space \number\ht\@tempboxa\space
        launch: \wwwbrowser\space 
       #2}%
  \hy@colorlink{\@urlcolor}#1\hy@endcolorlink}%
  \@linkdim\ht\@tempboxa
  \advance\@linkdim by -6.5\p@
  \raise\@linkdim\hbox{}%
 \else
  \setbox\@tempboxa=\hbox{#1}%
  \special{button:  \number\wd\@tempboxa\space \number\ht\@tempboxa\space
        launch: \wwwbrowser\space 
      #2}%
  \hy@colorlink{\@urlcolor}#1\hy@endcolorlink
 \fi
\egroup
}
\def\hyper@linkfile#1#2#3{%
\bgroup\hyper@chars
 \ifhy@raiselinks
  \setbox\@tempboxa=\hbox{#1}%
  \@linkdim\dp\@tempboxa
  \leavevmode\lower\@linkdim\hbox{%
  \special{button:  \number\wd\@tempboxa\space \number\ht\@tempboxa\space
      #3,\space file: #2}%
  \hy@colorlink{\@filecolor}#1\hy@endcolorlink}%
  \@linkdim\ht\@tempboxa
  \advance\@linkdim by -6.5\p@
  \raise\@linkdim\hbox{}%
 \else
  \setbox\@tempboxa=\hbox{#1}%
  \special{button:  \number\wd\@tempboxa\space \number\ht\@tempboxa\space
      #3,\space file: #2}%
  \hy@colorlink{\@filecolor}#1\hy@endcolorlink
 \fi
\egroup
}
\def\@pdfproducer{dviwindo + Distiller}
\def\PDF@SetupDoc{
 \special{PDF: Keywords \@pdfkeywords}%
 \special{PDF: Title \@pdftitle}%
 \special{PDF: Creator \@pdfcreator}%
 \special{PDF: Author \@pdfauthor}%
 \special{PDF: Producer \@pdfproducer}%
 \special{PDF: Subject \@pdfsubject}%
 \ifx\@baseurl\@empty\else
  \special{PDF: Base \@baseurl}%
 \fi
 \ifx\@pdfpagescrop\@empty\else
  \special{PDF: BBox \@pdfpagescrop}%
 \fi
 \pdfmark{pdfmark=/DOCVIEW,
   Page=\@pdfstartpage,
   View=\@pdfstartview,
   PageMode=\@pdfpagemode
   }
 \ifx\@pdfpagescrop\@empty\else
   \pdfmark{pdfmark=/PAGES,CropBox=\@pdfpagescrop}%
 \fi
 \pdfmark{pdfmark=/PUT,Raw={
 \string{Catalog\string} <<
   /ViewerPreferences << 
  \ifhy@toolbar\else /HideToolbar true \fi
  \ifhy@menubar\else /HideMenubar true \fi
  \ifhy@windowui\else /HideWindowUI true \fi
  \ifhy@fitwindow /FitWindow true \fi
  \ifhy@centerwindow /CenterWindow true \fi
   >>
  \ifx\pdf@pagelayout\@empty\else/PageLayout /\pdf@pagelayout\space\fi
  >>}}%
}
%</dviwindo>
%<*dvipdfm>
%    \end{macrocode}
% Hyperref driver for dvipdfm dvi to PDF converter.
% Provided by Mark Wicks (mwicks@kettering.edu)
%    \begin{macrocode}
\newsavebox{\pdfm@box}
\def\@pdfm@mark#1{\special{pdf:#1}}
\def\@pdfm@dest#1{\@pdfm@mark{ dest (#1) [ @thispage /\@pdfview\space @xpos @ypos ]}}
\providecommand\@pdfview{XYZ}
\providecommand\@pdfborder{0 0 1}
\def\hyper@anchor#1{%
  \@pdfm@dest{#1}%
}
\def\pdfm@rect{width \the\wd\pdfm@box\space
   height \the\ht\pdfm@box\space
   depth \the\dp\pdfm@box}%
\def\hyper@anchorstart#1{%
  \hy@activeanchortrue
  \@pdfm@dest{#1}%
}
\def\hyper@anchorend{%
  \hy@activeanchorfalse
}
\def\hyper@linkstart#1#2{%
  \global\edef\hyper@currentanchor{#2}%
  \gdef\hyper@currentlinktype{#1}%
  \begin{lrbox}{\pdfm@box}%
  \hy@colorlink{\csname @#1color\endcsname}%
}
\def\hyper@linkend{%
  \hy@endcolorlink
  \end{lrbox}%
  \edef\@foo{\csname @\hyper@currentlinktype bordercolor\endcsname}%
  \mbox{\@pdfm@mark{ ann \pdfm@rect
  << /Type /Annot /Subtype
     /Link
     /Border [ \@pdfborder ]
     /C [ \@foo ]
     /A << /S /GoTo 
           /D (\hyper@currentanchor)
	>>
  >>}\usebox{\pdfm@box}}%
}
\def\hyper@link#1#2#3{%
 \sbox{\pdfm@box}{\hy@colorlink{\csname @#1color\endcsname}#3\hy@endcolorlink}%
  \edef\@foo{\csname @#1bordercolor\endcsname}%
  \mbox{\@pdfm@mark{ ann \pdfm@rect
  << /Type /Annot /Subtype /Link
     /Border [ \@pdfborder ]
     /C [ \@foo ]
     /A << /S /GoTo
           /D (#2)
	>>
  >>}\usebox{\pdfm@box}}%
}
\def\hyper@linkfile#1#2#3{%
  \sbox{\pdfm@box}{\hy@colorlink{\@filecolor}#1\hy@endcolorlink}%
  \edef\@foo{\csname @#1bordercolor\endcsname}%
  \mbox{\@pdfm@mark{ ann \pdfm@rect
  << /Type /Annot /Subtype /Link
     /Border [ \@pdfborder ]
     /C [ \@filebordercolor ]
     /A << /S /GoToR
           /F (#2)
           /D \ifx\\#3\\[ 0 \@pdfstartview]\else(#3)\fi\space
	   /NewWindow true
	>>
  >>}\usebox{\pdfm@box}}%
}
\def\hyper@linkurl#1#2{%
  \sbox{\pdfm@box}{\hy@colorlink{\@urlcolor}#1\hy@endcolorlink}%
  \mbox{\@pdfm@mark{ ann \pdfm@rect
  << /Type /Annot /Subtype /Link
     /Border [ \@pdfborder ]
     /C [ \@urlbordercolor ]
     /A << /S /URI
           /URI (#2)
>>
  >>}\usebox{\pdfm@box}}%
}
\def\Acrobatmenu#1#2{%
  \sbox{\pdfm@box}{\hy@colorlink{\@menucolor}#2\hy@endcolorlink}%
  \mbox{\@pdfm@mark{ ann \pdfm@rect
  << /Type /Annot /Subtype /Link
     /A << /S /Named /N /#1 >>
     /Border [ \@pdfborder ]
     /C [ \@menubordercolor ]
  >>}\usebox{\pdfm@box}}%
}
\def\@pdfproducer{dvipdfm}
\def\PDF@SetupDoc{%
\special{pdf: docinfo <<
  /Title (\@pdftitle)
  /Subject(\@pdfsubject)
  /Creator (\@pdfcreator)
  /Author (\@pdfauthor)
  /Producer (\@pdfproducer)
  /Keywords (\@pdfkeywords) >>}%
\special{pdf: docview <<
   /Page \@pdfstartpage\space
   /View \@pdfstartview\space
   /URI << /Base (\@baseurl) >>
   /PageMode \@pdfpagemode
   /ViewerPreferences << 
  \ifhy@toolbar\else /HideToolbar true \fi
  \ifhy@menubar\else /HideMenubar true \fi
  \ifhy@windowui\else /HideWindowUI true \fi
  \ifhy@fitwindow /FitWindow true \fi
  \ifhy@centerwindow /CenterWindow true \fi
   >>
  \ifx\pdf@pagelayout\@empty\else/PageLayout /\pdf@pagelayout\space\fi
  >>}%
}
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\@pdfborder{0 0 0}%
  \fi
}
%    \end{macrocode}
%</dvipdfm>
% Hyperref drivers for VTeX typesetting system,
% provided by MicroPress, May 1998. 
% They require VTeX version 6.02 or newer;
% see \texttt{http://www.micropress-inc.com/} for details.
%    \begin{macrocode}
%<*hvtexhtml>
\RequirePackage{vtexhtml}
\newif\if@Localurl
\def\PDF@SetupDoc{%
 \ifx\@baseurl\@empty\else
  \special{!direct <base href="\@baseurl">}%
 \fi
}
\def\@urltype{url}
\def\hyper@link#1#2#3{%
 \leavevmode\special{!direct <a
    href=\hyper@quote\hyper@hash#2\hyper@quote>}#3\special{!direct </a>}%
}
\def\hyper@linkurl#1#2{%
  {\hyper@chars
   \leavevmode\MathBSuppress=1\relax
   \special{!direct <a href=\hyper@quote#2\hyper@quote>}%
   #1\MathBSuppress=0\relax\special{!direct </a>}}%
}
\def\hyper@linkfile#1#2#3{%
 \hyper@linkurl{#1}{file:#2\ifx\\#3\\\else\##3\fi}%
}
\def\hyper@linkstart#1#2{%
  \def\@tempa{#1}\ifx\@tempa\@urltype
    \@Localurltrue
    \special{!direct <A href=\hyper@quote#2\hyper@quote>}%
  \else
    \@Localurlfalse
    {\hyper@chars\special{!aref #2}}%
  \fi
}
\def\hyper@linkend{
 \if@Localurl
   \special{!endaref}%
 \else
   \special{!direct </a>}%
 \fi
}
\def\hyper@anchorstart#1{%
 {\hyper@chars\special{!aname #1}%
  \special{!direct <a name=\hyper@quote#1\hyper@quote>}}%
  \hy@activeanchortrue
}
\def\hyper@anchorend{\special{!direct </a>}\hy@activeanchorfalse}
\def\hyper@anchor#1{%
   {\let\protect=\string
   \leavevmode\special{!aname #1}%
   \special{!direct <a name=\hyper@quote #1\hyper@quote>}}%
   \hy@activeanchortrue
   \bgroup\anchor@spot\egroup
   \special{!direct </a>}%
   \hy@activeanchorfalse
}
\def\@Form[#1]{\typeout{Sorry, TeXpider does not yet support FORMs}}
\def\@endForm{}
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, TeXpider does not yet support FORM gauges}%
}
\def\@TextField[#1]#2{% parameters, label
  \typeout{Sorry, TeXpider does not yet support FORM text fields}%
  }
\def\@CheckBox[#1]#2{% parameters, label
  \typeout{Sorry, TeXpider does not yet support FORM checkboxes}%
  }
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
  \typeout{Sorry, TeXpider does not yet support FORM choice menus}%
}
\def\@PushButton[#1]#2{% parameters, label
  \typeout{Sorry, TeXpider does not yet support FORM pushbuttons}%
}
\def\@Reset[#1]#2{\typeout{Sorry, TeXpider does not yet support FORMs}}
\def\@Submit[#1]#2{\typeout{Sorry, TeXpider does not yet support FORMs}}
%</hvtexhtml>
%<*hvtex>
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\pdfBorderAttrs{/Border [0 0 0]}%
  \fi
}
\def\@pdfborder{0 0 1}%
\def\pdfBorderAttrs{/Border [\@pdfborder]}%
\def\CurrentBorderColor{\@linkbordercolor}
\def\hyper@anchor#1{%
   {\let\protect=\string\special{!aname #1;\@pdfview}}%
   \hy@activeanchortrue
   \hy@colorlink{\@anchorcolor}\anchor@spot\hy@endcolorlink
   \hy@activeanchorfalse
}
\def\hyper@anchorstart#1{%
 {\hyper@chars\special{!aname #1;\@pdfview}}%
  \hy@activeanchortrue
}
\def\hyper@anchorend{%
  \hy@activeanchorfalse
}
\def\@urltype{url}
\def\hyper@linkstart#1#2{%
  \hy@colorlink{\csname @#1color\endcsname}%
  \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}%
  \def\@tempa{#1}\ifx\@tempa\@urltype
  \special{!aref <u=/Type /Action /S /URI /URI (#2)>;a=<\pdfBorderAttrs \space /C [\CurrentBorderColor]>}%
  \else
  \special{!aref #2;a=<\pdfBorderAttrs\space /C [\CurrentBorderColor]>}%
  \fi
}
\def\hyper@linkend{%
  \special{!endaref}%
  \hy@endcolorlink
}
\def\hyper@linkfile#1#2#3{%
 \leavevmode
 \special{!aref <f=#2>#3;a=<\pdfBorderAttrs\space /C [\@filebordercolor]>}%
 \hy@colorlink{\@filecolor}#1\hy@endcolorlink
 \special{!endaref}%
}
\def\hyper@linkurl#1#2{%
  \bgroup
  \hyper@chars
  \leavevmode
  \special{!aref <u=/Type /Action /S /URI /URI (#2)>;a=<\pdfBorderAttrs\space /C [\@urlbordercolor]>}%
  \hy@colorlink{\@urlcolor}#1\hy@endcolorlink
  \special{!endaref}%
  \egroup
}
\def\hyper@link#1#2#3{%
   \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}%
   \leavevmode
   \special{!aref #2;a=<\pdfBorderAttrs\space /C [\CurrentBorderColor]>}%
   \hy@colorlink{\csname @#1color\endcsname}#3\hy@endcolorlink
   \special{!endaref}%
}
\def\hyper@image#1#2{%
  \hyper@linkurl{#2}{#1}}

\def\Acrobatmenu#1#2{%
   \def\CurrentBorderColor{\@menubordercolor\endcsname}%
   \leavevmode
   \special{!aref <u=/S /Named /N /#1>;a=<\pdfBorderAttrs \space /C [\CurrentBorderColor]>}%
   \hy@colorlink{\@menucolor}#2\hy@endcolorlink\special{!endaref}%
}
%
\def\@pdfproducer{VTeX}
\def\PDF@SetupDoc{%
	\special{!pdfinfo p=<\@pdfpagemode>}%
	\special{!pdfinfo u=<\@baseurl>}%
	\special{!pdfinfo a=<\@pdfauthor>}%
	\special{!pdfinfo t=<\@pdftitle>}%
	\special{!pdfinfo s=<\@pdfsubject>}%
	\special{!pdfinfo c=<\@pdfcreator>}%
	\special{!pdfinfo r=<\@pdfproducer>}%
	\special{!pdfinfo k=<\@pdfkeywords>}%
	\ifx\@pdfpagescrop\@empty\else
	\special{!pdfinfo b=<\@pdfpagescrop>}%
	\fi
	\special{!onopen Page\@pdfstartpage}%
	}%
%</hvtex>
%<*pdfmark|dvipdf>
%    \end{macrocode}
%
% \subsection{Direct pdfmark support (dvipdf and pdfmark)}
%    \begin{macrocode}
\def\hyper@anchor#1{%
   {\pdfmark[\anchor@spot]{pdfmark=/DEST,linktype=anchor,View=/\@pdfview \@pdfviewparams,DestAnchor=#1}}%
}
%<*dvipdf>
\def\hyper@anchorstart#1{\hy@activeanchortrue}
\def\hyper@anchorend{\hy@activeanchorfalse}
\def\hyper@linkstart#1#2{%
   \hy@colorlink{\csname @#1color\endcsname}%
   \global\edef\hyper@currentanchor{#2}%
}
\def\hyper@linkend{%
\hy@endcolorlink
}
%</dvipdf>
%<*pdfmark>
\@ifundefined{hyper@anchorstart}{}{\endinput}
\def\hyper@anchorstart#1{%
  \PSHyperAnchorStart
  \global\edef\hyper@currentanchor{#1}%
  \hy@activeanchortrue
}
\def\hyper@anchorend{%
   \PSHyperAnchorEnd
   \pdfmark{pdfmark=/DEST,linktype=anchor,View=/\@pdfview  \@pdfviewparams,
       DestAnchor=\hyper@currentanchor,
       Rect=\pdf@bbox}%
  \hy@activeanchorfalse
}
\def\hyper@linkstart#1#2{%
   \ifhy@breaklinks\else
    \leavevmode\hbox\bgroup
   \fi
   \hy@colorlink{\csname @#1color\endcsname}%
   \PSHyperLinkStart
   \global\edef\hyper@currentanchor{#2}%
   \gdef\hyper@currentlinktype{#1}%
}
\def\hyper@linkend{%
    \PSHyperLinkEnd
    \edef\@foo{\csname @\hyper@currentlinktype bordercolor\endcsname}%
       \pdfmark{pdfmark=/ANN,linktype=link,Subtype=/Link,
           Dest=\hyper@currentanchor,
           AcroHighlight=\@pdfhighlight,
           Border=\@pdfborder,Color=\@foo,Rect=\pdf@bbox}%
   \hy@endcolorlink
   \ifhy@breaklinks\else\egroup\fi
}
\def\hyper@pagetransition{%
 \ifx\@pdfpagetransition\@empty
 \else
   \pdfmark{pdfmark=/PUT,Raw={{ThisPage} 
       << /Trans << /S /\@pdfpagetransition\space >> >>}}%
 \fi
}
%</pdfmark>
\def\hyper@image#1#2{%
  \hyper@linkurl{#2}{#1}}
%    \end{macrocode}
%
%    \begin{macrocode}Wha
\def\hyper@link#1#2#3{%
    \edef\@foo{\csname @#1bordercolor\endcsname}%
    \bgroup
%<dvipdf> \pdfmark[#3]{pdfmark=/LNK,{},linktype=#1,AcroHighlight=\@pdfhighlight,Border=\@pdfborder,Color=\@foo,Dest=#2}%
%<pdfmarkbase> \pdfmark[#3]{Color=\@foo,linktype=#1,AcroHighlight=\@pdfhighlight,Border=\@pdfborder,pdfmark=/ANN,Subtype=/Link,Dest=#2}%    
    \egroup
}
\newtoks\pdf@docset
\def\@pdfproducer{dvips + Distiller}
\def\PDF@SetupDoc{%
 \pdfmark{pdfmark=/DOCINFO,
  Title=\@pdftitle,
  Subject=\@pdfsubject,
  Creator= \@pdfcreator,
  Author=\@pdfauthor,
  Producer= \@pdfproducer,
  Keywords=\@pdfkeywords
  }%
 \ifx\@baseurl\@empty\def\@dobaseurl{}\else
     \def\@dobaseurl{}%
 \fi
 \pdfmark{pdfmark=/DOCVIEW,
   Page=\@pdfstartpage,
   View=\@pdfstartview,
   URI={<< /Base (\@baseurl) >>},
   PageMode=\@pdfpagemode
   }
 \ifx\@pdfpagescrop\@empty\else
   \pdfmark{pdfmark=/PAGES,CropBox=\@pdfpagescrop}%
 \fi
 \pdfmark{pdfmark=/PUT,Raw={
 \string{Catalog\string} <<
   /ViewerPreferences << 
  \ifhy@toolbar\else /HideToolbar true \fi
  \ifhy@menubar\else /HideMenubar true \fi
  \ifhy@windowui\else /HideWindowUI true \fi
  \ifhy@fitwindow /FitWindow true \fi
  \ifhy@centerwindow /CenterWindow true \fi
   >>
  \ifx\pdf@pagelayout\@empty\else/PageLayout /\pdf@pagelayout\space\fi
  >>}}%
}
%</pdfmark|dvipdf>
%<*pdfmarkbase|dvipdf>
%    \end{macrocode}
% We define a single macro, pdfmark, which uses the `keyval' system
% to define the various allowable keys; these are \emph{exactly}
% as listed in the pdfmark reference for Acrobat 3.0. The only addition
% is \texttt{pdfmark} which specifies the type of pdfmark to create
% (like ANN, LINK etc). The
% surrounding round and square brackets in the pdfmark commands
% are supplied, but you have to put in / characters as needed for the
% values.
%
%    \begin{macrocode}
\def\pdfmark{\@ifnextchar[{\pdfmark@}{\pdfmark@[]}}
\def\pdfmark@[#1]#2{%
    \edef\@processme{\noexpand\pdf@toks={ \the\pdf@defaulttoks}}%
    \@processme
    \let\pdf@type\relax
    \setkeys{PDF}{#2}%
    \ifx\pdf@type\relax
       \hyper@warn{no pdfmark type specified in #2!!}%
       \ifx\\#1\\\relax\else\pdf@rect{#1}\fi
    \else
       \ifx\\#1\\\relax
%<pdfmarkbase>  \literalps@out{[\the\pdf@toks\space \pdf@type\space pdfmark}%
%<dvipdf>  \literalps@out{/ANN >>}%
       \else
         \hy@colorlink{\@ifundefined{@\pdf@linktype color}%
                      {\@linkcolor}%
                      {\csname @\pdf@linktype color\endcsname}}%
         \pdf@rect{#1}%
%<pdfmarkbase>  \literalps@out{[\the\pdf@toks\space \pdf@type\space pdfmark}%
%<dvipdf>  \literalps@out{/ANN >>}%
         \hy@endcolorlink
       \fi
    \fi
}
%    \end{macrocode}
% The complicated bit is working out the right enclosing rectangle of
% some piece of \TeX\ text, needed by the /Rect key. This solution originates
% with  Toby Thain (\texttt{tobyt@netspace.net.au}).
%    \begin{macrocode}
\newsavebox{\pdf@box}
\def\pdf@rect#1{%
%<dvipdf>   \literalps@out{/ANN \pdf@type \the\pdf@toks\space <<}#1
   \leavevmode
   \sbox\pdf@box{#1}%
   \dimen@\ht\pdf@box
   \leavevmode\lower\dp\pdf@box\hbox{\PSHyperRectStart}%
%    \end{macrocode}
% If the text has to be horizontal mode stuff then just unbox
% the saved box like this, which saves executing it twice, which can
% mess up counters etc (thanks DPC\ldots).
%    \begin{macrocode}
   \ifhy@breaklinks\unhbox\else\box\fi\pdf@box
%    \end{macrocode}
% but if it can have multiple paragraphs you'd need one of these,
% but in that case the measured box size would be wrong anyway.
%   |\ifhy@breaklinks#1\else\box\pdf@box\fi|
%   |\ifhy@breaklinks{#1}\else\box\pdf@box\fi|
%    \begin{macrocode}
   \raise\dimen@\hbox{\PSHyperRectEnd}%
   \pdf@addtoks{[\pdf@bbox]}{Rect}%
}
%    \end{macrocode}
% All the supplied material is stored in a token list; since I do not
% feel sure I quite understand these, things may not work as expected
% with expansion. We'll have to experiment.
%    \begin{macrocode}
\newtoks\pdf@toks
\newtoks\pdf@defaulttoks
\pdf@defaulttoks={ }%
\def\pdf@addtoks#1#2{%
   \edef\@processme{\pdf@toks{\the\pdf@toks\space /#2 #1}}%
   \@processme
}
\def\pdf@addtoksx#1{%
   \edef\@processme{\pdf@toks{\the\pdf@toks\space #1}}%
   \@processme
}
\def\PDFdefaults#1{%
 \pdf@defaulttoks={#1}%
}
%    \end{macrocode}
% This is the list of allowed keys. See the Acrobat manual for an
% explanation.
%    \begin{macrocode}
% what is the type of pdfmark?
\define@key{PDF}{pdfmark}{\def\pdf@type{#1}}
% what is the link type?
\define@key{PDF}{linktype}{\def\pdf@linktype{#1}}
\def\pdf@linktype{link}
% parameter is a stream of PDF
\define@key{PDF}{Raw}{\pdf@addtoksx{#1}}
% parameter is a name
\define@key{PDF}{Action}{\pdf@addtoks{#1}{Action}}
% parameter is a array
\define@key{PDF}{Border}{\pdf@addtoks{[#1]}{Border}}
% parameter is a array
\define@key{PDF}{Color}{\pdf@addtoks{[#1]}{Color}}
% parameter is a string
\define@key{PDF}{Contents}{\pdf@addtoks{(#1)}{Contents}}
% parameter is a integer
\define@key{PDF}{Count}{\pdf@addtoks{#1}{Count}}
% parameter is a array
\define@key{PDF}{CropBox}{\pdf@addtoks{[#1]}{CropBox}}
% parameter is a string
\define@key{PDF}{DOSFile}{\pdf@addtoks{(#1)}{DOSFile}}
% parameter is a string or file
\define@key{PDF}{DataSource}{\pdf@addtoks{(#1)}{DataSource}}
% parameter is a destination
\define@key{PDF}{Dest}{\ifx\\#1\\\else\pdf@addtoks{/#1}{Dest}\fi}
\define@key{PDF}{DestAnchor}{\ifx\\#1\\\else
      \pdf@addtoks{/#1 }{Dest}\fi}
% parameter is a string
\define@key{PDF}{Dir}{\pdf@addtoks{(#1)}{Dir}}
% parameter is a string
\define@key{PDF}{File}{\pdf@addtoks{(#1)}{File}}
% parameter is a int
\define@key{PDF}{Flags}{\pdf@addtoks{#1}{Flags}}
% parameter is a name
\define@key{PDF}{AcroHighlight}{\pdf@addtoks{#1}{H}}
% parameter is a string
\define@key{PDF}{ID}{\pdf@addtoks{[#1]}{ID}}
% parameter is a string
\define@key{PDF}{MacFile}{\pdf@addtoks{(#1)}{MacFile}}
% parameter is a string
\define@key{PDF}{ModDate}{\pdf@addtoks{(#1)}{ModDate}}
% parameter is a string
\define@key{PDF}{Op}{\pdf@addtoks{(#1)}{Op}}
% parameter is a Boolean
\define@key{PDF}{Open}{\pdf@addtoks{#1}{Open}}
% parameter is a integer or name
\define@key{PDF}{Page}{\pdf@addtoks{#1}{Page}}
% parameter is a name
\define@key{PDF}{PageMode}{\pdf@addtoks{#1}{PageMode}}
% parameter is a string
\define@key{PDF}{Params}{\pdf@addtoks{(#1)}{Params}}
% parameter is a array
\define@key{PDF}{Rect}{\pdf@addtoks{[#1]}{Rect}}
% parameter is a integer
\define@key{PDF}{SrcPg}{\pdf@addtoks{#1}{SrcPg}}
% parameter is a name
%<pdfmarkbase>\define@key{PDF}{Subtype}{\pdf@addtoks{#1}{Subtype}}
%<dvipdf>\define@key{PDF}{Subtype}{\pdf@addtoks{#1}{}}
% parameter is a string
\define@key{PDF}{Title}{\pdf@addtoks{(#1)}{Title}}
% parameter is a string
\define@key{PDF}{Unix}{\pdf@addtoks{(#1)}{Unix}}
% parameter is a string
\define@key{PDF}{UnixFile}{\pdf@addtoks{(#1)}{UnixFile}}
% parameter is an array
\define@key{PDF}{View}{\pdf@addtoks{[#1]}{View}}
% parameter is a string
\define@key{PDF}{WinFile}{\pdf@addtoks{(#1)}{WinFile}}
%    \end{macrocode}
% These are the keys used in the DOCINFO section.
%    \begin{macrocode}
\define@key{PDF}{Author}{\pdf@addtoks{(#1)}{Author}}
\define@key{PDF}{CreationDate}{\pdf@addtoks{(#1)}{CreationDate}}
\define@key{PDF}{Creator}{\pdf@addtoks{(#1)}{Creator}}
\define@key{PDF}{Producer}{\pdf@addtoks{(#1)}{Producer}}
\define@key{PDF}{Subject}{\pdf@addtoks{(#1)}{Subject}}
\define@key{PDF}{Keywords}{\pdf@addtoks{(#1)}{Keywords}}
\define@key{PDF}{ModDate}{\pdf@addtoks{(#1)}{ModDate}}
\define@key{PDF}{Base}{\pdf@addtoks{(#1)}{Base}}
\define@key{PDF}{URI}{\pdf@addtoks{#1}{URI}}
%</pdfmarkbase|dvipdf>
%<*pdfmark|dvipdf>
\def\Acrobatmenu#1#2{%
 \pdfmark[#2]{linktype=menu,pdfmark=/ANN,AcroHighlight=\@pdfhighlight,
    Border=\@pdfborder,Action=<< /Subtype /Named /N /#1 >>,Subtype=/Link}}
%    \end{macrocode}
% And now for some useful examples:
%    \begin{macrocode}
\def\PDFNextPage{\@ifnextchar[{\PDFNextPage@}{\PDFNextPage@[]}}
\def\PDFNextPage@[#1]#2{%
 \pdfmark[#2]{#1,Border=\@pdfborder,Color=.2 .1 .5,
  pdfmark=/ANN,Subtype=/Link,Page=/Next}}
\def\PDFPreviousPage{\@ifnextchar[{\PDFPreviousPage@}{\PDFPreviousPage@[]}}
\def\PDFPreviousPage@[#1]#2{%
 \pdfmark[#2]{#1,Border=\@pdfborder,Color=.4 .4 .1,
  pdfmark=/ANN,Subtype=/Link,Page=/Prev}}
\def\PDFOpen#1{%
  \pdfmark{#1,pdfmark=/DOCVIEW}%
}
%    \end{macrocode}
% This is not as simple as it looks; if we make the argument of
% this macro eg |\pageref{foo}| and expect it to expand to `3',
% we need a special version of |\pageref|
% which does \emph{not} produce
% `3 \hbox{}'\ldots. David Carlisle looked at this bit and provided
% the solution, as ever!
%    \begin{macrocode}
\def\PDFPage{\@ifnextchar[{\PDFPage@}{\PDFPage@[]}}
\def\PDFPage@[#1]#2#3{%
 \let\pageref\simple@pageref
 \pdfmark[#3]{#1,Page=#2,AcroHighlight=\@pdfhighlight,Border=\@pdfborder,
   Color=\@pagebordercolor,pdfmark=/ANN,Subtype=/Link}}
\def\simple@pageref#1{%
  \expandafter\ifx\csname r@#1\endcsname\relax
   0%
  \else
    \expandafter\expandafter\expandafter
          \@secondoffive\csname r@#1\endcsname
  \fi}
%    \end{macrocode}
% This will only work if you use Distiller 2.1 or higher.
%    \begin{macrocode}
\def\hyper@linkurl#1#2{%
 \bgroup\hyper@chars
%<pdfmarkbase> \pdfmark[#1]{pdfmark=/ANN,linktype=url,AcroHighlight=\@pdfhighlight,Border=\@pdfborder,Color=\@urlbordercolor,
%<dvipdf> \pdfmark[#1]{pdfmark=/LNK,linktype=url,AcroHighlight=\@pdfhighlight,Border=\@pdfborder,Color=\@urlbordercolor,
%<pdfmarkbase> Action={<< /Subtype /URI /URI (#2) >>},Subtype=/Link}%
%<dvipdf> Action=URI /URI (#2)}%
 \egroup
}
\def\hyper@linkfile#1#2#3{%
 \bgroup
%<*pdfmark>
\pdfmark[#1]{pdfmark=/ANN,Subtype=/Link,
  AcroHighlight=\@pdfhighlight,Border=\@pdfborder,
  linktype=file,Color=\@filebordercolor,
  Action=<< 
    /S /GoToR
\ifhy@newwindow
    /NewWindow true
\fi
    /F (#2) 
    /D \ifx\\#3\\[0 \@pdfstartview]\else(#3)\fi 
         >>}%
%</pdfmark>
%<*dvipdf>
\pdfmark[#1]{pdfmark=/LNK,linktype=file,
  AcroHighlight=\@pdfhighlight,Border=\@pdfborder, 
  Color=\@filebordercolor,
  Action=<< 
     /S /GoToR
\ifhy@newwindow
    /NewWindow true
\fi
     /F (#2) 
     /D \ifx\\#3\\[0 \@pdfstartview]\else(#3)\fi 
         >>}%
%</dvipdf>  
 \egroup
}
%</pdfmark|dvipdf>
%    \end{macrocode}
% \subsection{Driver-specific form support}
% \subsubsection{pdfmarks}
%    \begin{macrocode}
%<*pdfmark>
\long\def\@Form[#1]{%
\AtBeginDvi{\special{!
[ /_objdef {pdfDocEncoding}
  /type /dict
/OBJ pdfmark
[ {pdfDocEncoding}
 <<	/Type /Encoding	
	/Differences [ 24 /breve /caron /circumflex /dotaccent
/hungarumlaut /ogonek /ring /tilde 39 /quotesingle 96 /grave 128
/bullet /dagger /daggerdbl /ellipsis /emdash /endash /florin /fraction
/guilsinglleft /guilsinglright /minus /perthousand /quotedblbase
/quotedblleft /quotedblright /quoteleft /quoteright /quotesinglbase
/trademark /fi /fl /Lslash /OE /Scaron /Ydieresis /Zcaron /dotlessi
/lslash /oe /scaron /zcaron 164 /currency 166 /brokenbar 168 /dieresis
/copyright /ordfeminine 172 /logicalnot /.notdef /registered /macron
/degree /plusminus /twosuperior /threesuperior /acute /mu 183
/periodcentered /cedilla /onesuperior /ordmasculine 188 /onequarter
/onehalf /threequarters 192 /Agrave /Aacute /Acircumflex /Atilde
/Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex
/Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde
/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash
/Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
/idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde
/odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis
/yacute /thorn /ydieresis ]
>>
/PUT pdfmark
[ /_objdef {ZaDb}
  /type /dict
/OBJ pdfmark
[ {ZaDb}
  <<
   /Type /Font	
   /Subtype /Type1
   /Name /ZaDb
   /BaseFont /ZapfDingbats
  >>
/PUT pdfmark
[ /_objdef {Helv}
  /type /dict
/OBJ pdfmark
[ {Helv}
  <<
  /Type /Font
  /Subtype /Type1
  /Name /Helv
  /BaseFont /Helvetica
  /Encoding {pdfDocEncoding}
  >>
/PUT pdfmark
[ /_objdef {aform}
  /type /dict
/OBJ pdfmark
[ /_objdef {afields}
  /type /array
/OBJ pdfmark
[/BBox [0 0 100 100] /_objdef {Check} /BP pdfmark
1 0 0 setrgbcolor /ZapfDingbats 80 selectfont 20 20 moveto (4) show
[/EP pdfmark
[/BBox [0 0 100 100] /_objdef {Cross} /BP pdfmark
1 0 0 setrgbcolor /ZapfDingbats 80 selectfont 20 20 moveto (8) show
[/EP pdfmark
[/BBox [0 0 250 100] /_objdef {Submit} /BP pdfmark 0.6 setgray 0 0 250
100 rectfill 1 setgray 2 2 moveto 2 98 lineto 248 98 lineto 246 96
lineto 4 96 lineto 4 4 lineto fill 0.34 setgray 248 98 moveto 248 2
lineto 2 2 lineto 4 4 lineto 246 4 lineto 246 96 lineto fill
/Helvetica 76 selectfont 0 setgray 8 22.5 moveto (Submit) show 
[/EP pdfmark
[/BBox [0 0 250 100] /_objdef {SubmitP} /BP pdfmark 0.6 setgray 0 0
250 100 rectfill 0.34 setgray 2 2 moveto 2 98 lineto 248 98 lineto 246
96 lineto 4 96 lineto 4 4 lineto fill 1 setgray 248 98 moveto 248 2
lineto 2 2 lineto 4 4 lineto 246 4 lineto 246 96 lineto fill
/Helvetica 76 selectfont 0 setgray 10 20.5 moveto (Submit) show
[/EP pdfmark 
[ {aform}
  <<
    /Fields {afields}
    /DR << /Font << /ZaDb {ZaDb} /Helv {Helv} >> >>
    /DA (/Helv 10 Tf 0 g )
    /NeedAppearances true
  >>
/PUT pdfmark
[ \string{Catalog\string}
  <<
    /AcroForm {aform}
  >>
/PUT pdfmark
}}%
 \setkeys{Form}{#1}%
}
\def\@endForm{}
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, pdfmark drivers do not support FORM gauges}%
}
\def\@TextField[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \def\Fld@default{}%
 \let\Fld@value\@empty
 \def\Fld@width{\DefaultWidthofText}%
 \def\Fld@height{\DefaultHeightofText}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi
 \ifFld@multiline
  \def\Fld@height{4\DefaultHeightofText}%
 \fi
 \LayoutTextField{#2}{%
 \pdfmark[\MakeTextField{\Fld@width}{\Fld@height}]{%
 pdfmark=/ANN,Raw={\PDFForm@Text}}}%
 \egroup
}
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
 \def\Fld@name{#2}%
 \def\Fld@default{}%
 \def\Fld@width{\DefaultWidthofChoiceMenu}%
 \def\Fld@height{\DefaultHeightofChoiceMenu}%
 \bgroup
 \Fld@menulength=0
 \@tempdima\z@
 \@for\@curropt:=#3\do{
    \expandafter\Fld@checkequals\@curropt==\\%
    \advance\Fld@menulength by 1
    \settowidth{\@tempdimb}{\@currDisplay}%
    \ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi
  }%
 \advance\@tempdima by 15\p@
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \LayoutChoiceField{#2}{%
 \ifFld@radio
   \@@Radio{#3}%
 \else
   {%
   \ifdim\Fld@width<\@tempdima
      \ifdim\@tempdima<1cm\@tempdima1cm\fi
      \edef\Fld@width{\the\@tempdima}%
   \fi
   \def\Fld@flags{}%
   \ifFld@combo\def\Fld@flags{/Ff 917504}\fi
   \ifFld@popdown\def\Fld@flags{/Ff 131072}\fi
   \ifx\Fld@flags\@empty
        \@tempdima=\the\Fld@menulength\Fld@charsize
        \advance\@tempdima by 2\Fld@borderwidth bp
        \edef\Fld@height{\the\@tempdima}%
   \fi
   \@@Listbox{#3}%
   }}%
 \fi
 \egroup
}
\def\@@Radio#1{%
 \Fld@listcount=0
 \@for\@curropt:=#1\do{%
 \expandafter\Fld@checkequals\@curropt==\\%
 \advance\Fld@listcount by 1
 \@currDisplay\space\pdfmark[\MakeRadioField{\Fld@width}{\Fld@height}]{
   pdfmark=/ANN,Raw={\PDFForm@Radio
      /AP <<
                /N <<
                 /\@currValue\space {Check}
                >>
        >>
   }} }% deliberate space between radio buttons
}
\newcount\Fld@listcount
\def\@@Listbox#1{%
 \Choice@toks={ }%
 \Fld@listcount=0
 \@for\@curropt:=#1\do{%
   \expandafter\Fld@checkequals\@curropt==\\%
   \advance\Fld@listcount by 1
   \edef\@processme{%
        \Choice@toks{\the\Choice@toks [(\@currValue) (\@currDisplay)]}%
   }\@processme
  }%
 \pdfmark[\MakeChoiceField{\Fld@width}{\Fld@height}]{
   pdfmark=/ANN,Raw={\PDFForm@List}}%
}
\def\@PushButton[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \LayoutPushButtonField{%
 \pdfmark[\MakeButtonField{#2}]{
   pdfmark=/ANN,Raw={
    \PDFForm@Push
}}}%
 \egroup
}
\def\@Submit[#1]#2{%
 \Field@toks={ }%
 \def\Fld@width{\DefaultWidthofSubmit}%
 \def\Fld@height{\DefaultHeightofSubmit}%
 \bgroup
 \def\Fld@name{Submit}%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \pdfmark[\MakeButtonField{#2}]{
   pdfmark=/ANN,Raw={\PDFForm@Submit
    /AP << /N {Submit} /D {SubmitP} >>
}}%
\egroup
}
\def\@Reset[#1]#2{%
 \Field@toks={ }%
 \def\Fld@width{\DefaultWidthofReset}%
 \def\Fld@height{\DefaultHeightofReset}%
 \bgroup
 \def\Fld@name{Reset}%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \pdfmark[\MakeButtonField{#2}]{%
  pdfmark=/ANN,Raw={\PDFForm@Reset}}%
 \egroup
}
\def\@CheckBox[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \def\Fld@default{0}%
 \bgroup
 \def\Fld@width{\DefaultWidthofCheckBox}%
 \def\Fld@height{\DefaultHeightofCheckBox}%
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \LayoutCheckField{#2}{%
 \pdfmark[\MakeCheckField{\Fld@width}{\Fld@height}]{%
  pdfmark=/ANN,Raw={\PDFForm@Check}}}%
\egroup
}
%</pdfmark>
%    \end{macrocode}
% \subsubsection{dvipdf}
%    \begin{macrocode}
%<*dvipdf>
\def\@Form[#1]{\typeout{Sorry, I do not support FORMs}}
\def\@endForm{}
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, dvipdf does not support FORM gauges}%
}
\def\@TextField[#1]#2{% parameters, label
  \typeout{Sorry, dvipdf does not support FORM text fields}%
  }
\def\@CheckBox[#1]#2{% parameters, label
  \typeout{Sorry, dvipdf does not support FORM checkboxes}%
  }
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
  \typeout{Sorry, dvipdf does not support FORM choice menus}%
}
\def\@PushButton[#1]#2{% parameters, label
  \typeout{Sorry, dvipdf does not support FORM pushbuttons}%
}
\def\@Reset[#1]#2{\typeout{Sorry, dvipdf does not support FORMs}}
\def\@Submit[#1]#2{\typeout{Sorry, dvipdf does not support FORMs}}
%</dvipdf>
%    \end{macrocode}
% \subsubsection{HyperTeX}
%    \begin{macrocode}
%<*hypertex>
\def\@Form[#1]{\typeout{Sorry, HyperTeX does not support FORMs}}
\def\@endForm{}
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, HyperTeX does not support FORM gauges}%
}
\def\@TextField[#1]#2{% parameters, label
  \typeout{Sorry, HyperTeX does not support FORM text fields}%
  }
\def\@CheckBox[#1]#2{% parameters, label
  \typeout{Sorry, HyperTeX does not support FORM checkboxes}%
  }
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
  \typeout{Sorry, HyperTeX does not support FORM choice menus}%
}
\def\@PushButton[#1]#2{% parameters, label
  \typeout{Sorry, HyperTeX does not support FORM pushbuttons}%
}
\def\@Reset[#1]#2{\typeout{Sorry, HyperTeX does not support FORMs}}
\def\@Submit[#1]#2{\typeout{Sorry, HyperTeX does not support FORMs}}
%</hypertex>
%    \end{macrocode}
% \subsubsection{TeX4ht}
%    \begin{macrocode}
%<*tex4ht>
\def\@Form[#1]{%
 \setkeys{Form}{#1}%
 \HCode{<form action="\Form@action" method="\Form@method">}%
}
\def\@endForm{\HCode{</form>}}
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, TeX4ht does not support gauges}%
}
\def\@TextField[#1]#2{% parameters, label
 \let\reserved@a\@empty
 \def\Fld@name{#2}%
 \def\Fld@default{}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \HCode{<label for="\Fld@name">#2</label>}%
 \ifFld@password
   \@@PasswordField
 \else
   \@@TextField
 \fi
 \egroup
}
\def\@@PasswordField{%
  \HCode{<input type="password" 
   id="\Fld@name"
   name="\Fld@name" 
  \ifFld@hidden type="hidden"\fi
   value="\Fld@default" \the\Field@toks>}%
}

\def\@@TextField{%
 \ifFld@multiline
  \HCode{<textarea 
  \ifFld@readonly readonly \fi
   id="\Fld@name"
   name="\Fld@name" 
  \ifFld@hidden type="hidden"\fi
   \the\Field@toks>}%
   \Fld@default
   \HCode{</textarea>}%
 \else
  \HCode{<input type="textbox" 
  \ifFld@readonly readonly \fi
   id="\Fld@name"
   name="\Fld@name" 
  \ifFld@hidden type="hidden"\fi
   value="\Fld@default" \the\Field@toks>
  }%
 \fi
}
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
 \def\Fld@name{#2}%
 \def\Fld@default{}%
 \let\reserved@a\relax
 \bgroup
 \expandafter\Fld@findlength#3\\
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 #2%
 \ifFld@radio
   \expandafter\@@Radio#3\\%
 \else
   \expandafter\@@Menu#3\\%
 \fi
 \egroup
}
\def\Fld@findlength#1\\{%
  \Fld@menulength=0%
  \@for\@curropt:=#1\do{\advance\Fld@menulength by 1}
}
\def\@@Menu#1\\{%
 \HCode{<select size="\the\Fld@menulength" 
 name="\Fld@name"  \the\Field@toks>}%
 \@for\@curropt:=#1\do{
  \expandafter\Fld@checkequals\@curropt==\\%
  \HCode{<option 
  \ifx\@curropt\Fld@default selected \fi
    value="\@currValue">\@currDisplay</option>}%
 }%
 \HCode{</select>}%
}
\def\@@Radio#1\\{%
 \@for\@curropt:=#1\do{%
  \expandafter\Fld@checkequals\@curropt==\\%
 \HCode{<input type="radio" 
  \ifx\@curropt\Fld@default checked \fi
  name="\Fld@name" 
  value="\@currValue" \the\Field@toks>}\@currDisplay}%
}
\def\@PushButton[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \HCode{<input type="button" 
   name="\Fld@name" 
   value="#2"  \the\Field@toks>}%
  \HCode{</button>}% 
 \egroup
}
\def\@Submit[#1]#2{%
 \HCode{<button type="submit">#2</button>}%
}
\def\@Reset[#1]#2{%
 \HCode{<button type="reset">#2</button>}%
}
\def\@CheckBox[#1]#2{% parameters, label
 \let\reserved@a\@empty
 \def\Fld@name{#2}%
 \def\Fld@default{0}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \HCode{<input type="checkbox" 
   \ifFld@checked checked \fi
   \ifFld@disabled disabled \fi
   \ifFld@readonly readonly \fi
   name="\Fld@name" 
  \ifFld@hidden type="hidden"\fi
   value="\Fld@default" \the\Field@toks>#2}%
 \egroup
}
%</tex4ht>
%    \end{macrocode}
% \subsubsection{pdfTeX}
%    \begin{macrocode}
%<*pdftex>
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, pdftex does not support FORM gauges}%
}
\RequirePackage{pifont}%
\def\MakeFieldObject#1#2{\setbox0=\hbox{#1}%
 \pdfform0%
 \expandafter\edef\csname #2Object\endcsname{\the\pdflastform\space 0 R}%
 \hbox to 0pt{\hskip-\maxdimen{\pdfrefform \the\pdflastform}}%
}%
\def\@Form[#1]{%
 \@ifundefined{textcolor}{\let\textcolor\@gobble}{}
 \setkeys{Form}{#1}%
 \pdfcatalog{/AcroForm \OBJ@acroform\space 0 R}%
 \MakeFieldObject{\ding{123}}{Ding}%
 \MakeFieldObject{\fbox{\textcolor{yellow}{\textsf{Submit}}}}{Submit}%
 \MakeFieldObject{\fbox{\textcolor{yellow}{\textsf{SubmitP}}}}{SubmitP}%
}
\def\@endForm{}
\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
  \typeout{Sorry, pdfmark drivers do not support FORM gauges}%
}
\def\@TextField[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \def\Fld@default{}%
 \let\Fld@value\@empty
 \def\Fld@width{\DefaultWidthofText}%
 \def\Fld@height{\DefaultHeightofText}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi
 \ifFld@multiline
  \def\Fld@height{4\DefaultHeightofText}%
 \fi
 \LayoutTextField{#2}{%
 \pdfannotlink user {\PDFForm@Text}%
 \MakeTextField{\Fld@width}{\Fld@height}\pdfendlink}%
\egroup
}
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
 \def\Fld@name{#2}%
 \def\Fld@default{}%
 \def\Fld@width{\DefaultWidthofChoiceMenu}%
 \def\Fld@height{\DefaultHeightofChoiceMenu}%
 \bgroup
 \Fld@menulength=0
 \@tempdima\z@
 \@for\@curropt:=#3\do{
    \expandafter\Fld@checkequals\@curropt==\\%
    \advance\Fld@menulength by 1
    \settowidth{\@tempdimb}{\@currDisplay}%
    \ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi
  }%
 \advance\@tempdima by 15\p@
 \Field@toks={ }%
 \setkeys{Field}{#1}% 
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \LayoutChoiceField{#2}{%
 \ifFld@radio
   \@@Radio{#3}%
 \else
   {%
   \ifdim\Fld@width<\@tempdima
      \ifdim\@tempdima<1cm\@tempdima1cm\fi
      \edef\Fld@width{\the\@tempdima}%
   \fi
   \def\Fld@flags{}%
   \ifFld@combo\def\Fld@flags{/Ff 917504}\fi
   \ifFld@popdown\def\Fld@flags{/Ff 131072}\fi
   \ifx\Fld@flags\@empty
        \@tempdima=\the\Fld@menulength\Fld@charsize
        \advance\@tempdima by 2\Fld@borderwidth bp
        \edef\Fld@height{\the\@tempdima}%
   \fi
   \@@Listbox{#3}%
   }}%
 \fi
 \egroup
}
\def\@@Radio#1{%
 \Fld@listcount=0
 \@for\@curropt:=#1\do{%
 \expandafter\Fld@checkequals\@curropt==\\%
 \advance\Fld@listcount by 1
 \@currDisplay\space
 \leavevmode\pdfannotlink user {\PDFForm@Radio
    /AP <<
           /N <<
%    \end{macrocode}
% Laurent.Guillope@math.univ-nantes.fr (Laurent Guillope)
% persuades me that this was wrong:
% |/\Fld@name\the\Fld@listcount|. But I leave it here to remind
% me that it is untested.
%    \begin{macrocode}
/\@currValue\space \DingObject
              >>
        >>
    }%
   \MakeRadioField{\Fld@width}{\Fld@height}\pdfendlink
   \space}% deliberate space between radio buttons
}
\newcount\Fld@listcount
\def\@@Listbox#1{%
 \Choice@toks={ }%
 \Fld@listcount=0
 \@for\@curropt:=#1\do{%
   \expandafter\Fld@checkequals\@curropt==\\%
   \advance\Fld@listcount by 1
   \edef\@processme{%
        \Choice@toks{\the\Choice@toks [(\@currValue) (\@currDisplay)]}%
   }\@processme
  }%
 \leavevmode\pdfannotlink user {\PDFForm@List}%
 \MakeChoiceField{\Fld@width}{\Fld@height}\pdfendlink
}
\def\@PushButton[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \bgroup
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \LayoutPushButtonField{\leavevmode\pdfannotlink user {\PDFForm@Push}%
 \MakeButtonField{#2}\pdfendlink}%
 \egroup
}
\def\@Submit[#1]#2{%
 \Field@toks={ }%
 \def\Fld@width{\DefaultWidthofSubmit}%
 \def\Fld@height{\DefaultHeightofSubmit}%
 \bgroup
 \def\Fld@name{Submit}%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
  \leavevmode\pdfannotlink user {\PDFForm@Submit
    /AP << /N \SubmitObject\space /D \SubmitPObject >>
}\MakeButtonField{#2}\pdfendlink
\egroup
}
\def\@Reset[#1]#2{%
 \Field@toks={ }%
 \def\Fld@width{\DefaultWidthofReset}%
 \def\Fld@height{\DefaultHeightofReset}%
 \bgroup
 \def\Fld@name{Reset}%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \leavevmode\pdfannotlink user {\PDFForm@Reset}%
 \MakeButtonField{#2}\pdfendlink
 \egroup
}
\def\@CheckBox[#1]#2{% parameters, label
 \def\Fld@name{#2}%
 \def\Fld@default{0}%
 \bgroup
 \def\Fld@width{\DefaultWidthofCheckBox}%
 \def\Fld@height{\DefaultHeightofCheckBox}%
 \Field@toks={ }%
 \setkeys{Field}{#1}%
 \ifFld@hidden\def\Fld@width{1sp}\fi
 \LayoutCheckField{#2}{%
 \pdfannotlink user {\PDFForm@Check}%
 \MakeCheckField{\Fld@width}{\Fld@height}\pdfendlink}\egroup
}
\pdfobj { <<	/Type /Encoding	
	/Differences [ 24 /breve /caron /circumflex /dotaccent /hungarumlaut
/ogonek /ring /tilde 39 /quotesingle 96 /grave 128 /bullet /dagger /daggerdbl                 /ellipsis /emdash /endash /florin /fraction /guilsinglleft
/guilsinglright /minus /perthousand /quotedblbase /quotedblleft
/quotedblright /quoteleft  /quoteright /quotesinglbase /trademark /fi /fl /Lslash /OE
/Scaron /Ydieresis /Zcaron /dotlessi /lslash /oe /scaron /zcaron
164 /currency 166 /brokenbar 168 /dieresis /copyright /ordfeminine 172
/logicalnot /.notdef /registered /macron /degree /plusminus
/twosuperior /threesuperior /acute /mu 183 /periodcentered /cedilla /onesuperior
/ordmasculine 188 /onequarter /onehalf /threequarters 192 /Agrave /Aacute
/Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute
/Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde                 /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn
/germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae
/ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute
/icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex
/otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ]
>> }
\edef\OBJ@pdfdocencoding{\the\pdflastobj} 

\pdfobj {
  <<
   /Type /Font	
   /Subtype /Type1
   /Name /ZaDb
   /BaseFont /ZapfDingbats
>>
}
\edef\OBJ@ZaDb{\the\pdflastobj}

\pdfobj {  <<
  /Type /Font
  /Subtype /Type1
  /Name /Helv
  /BaseFont /Helvetica
  /Encoding \OBJ@pdfdocencoding\space 0 R
  >>
}
\edef\OBJ@Helv{\the\pdflastobj}

\pdfobj {
  <<
    /Fields []
    /DR << /Font << /ZaDb \OBJ@ZaDb\space 0 R /Helv \OBJ@Helv\space0 R >> >>
    /DA (/Helv 10 Tf 0 g )
    /NeedAppearances true
  >>
}
\edef\OBJ@acroform{\the\pdflastobj}
%</pdftex>
%<*pdfform>
\def\PDFForm@Check{
         /Subtype /Widget
\ifFld@hidden /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /Q \Fld@align\space
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /MK <<
             /BC [ \Fld@bordercolor\space]
\ifx\Fld@bcolor\@empty
 \else
             /BG [ \Fld@bcolor\space]
\fi
             /CA (H)
            >>
        /DA (/ZaDb \strip@pt\Fld@charsize\space Tf \Fld@color\space rg)
        /FT /Btn
        /H /P
   \ifFld@checked /V /Yes \else /V /Off \fi
}
\def\PDFForm@Push{
        /Subtype /Widget 
\ifFld@hidden    /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /FT /Btn
        /Ff 65540
        /H /P
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /MK << 
             /BC [ \Fld@bordercolor\space] 
            >>
        /A << /S /JavaScript /JS (\Fld@onclick;) >> 
}
\def\PDFForm@List{        /Subtype /Widget
\ifFld@hidden    /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /FT /Ch
        /Q \Fld@align\space
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /MK <<
             /BC [ \Fld@bordercolor\space]
\ifx\Fld@bcolor\@empty
 \else
             /BG [ \Fld@bcolor\space]
\fi
            >>
        /DA (/Helv \strip@pt\Fld@charsize\space Tf \Fld@color\space rg )
        /Opt [ \the\Choice@toks ]
        /DV (\Fld@default)
        \Fld@flags
}
\def\PDFForm@Radio{
        /Subtype /Widget 
\ifFld@hidden    /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /FT /Btn
        /Ff 49152
        /H /P
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /MK << 
             /BC [ \Fld@bordercolor\space] 
\ifx\Fld@bcolor\@empty
 \else
             /BG [ \Fld@bcolor\space] 
\fi
	     /CA (H)
            >>
        /DA (/ZaDb \strip@pt\Fld@charsize\space Tf \Fld@color\space rg)
  \ifx\@currValue\Fld@default 
        /V /\Fld@default\space
  \else
        /V /Off
  \fi
}
\def\PDFForm@Text{
        /Subtype /Widget
\ifFld@hidden    /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /Q \Fld@align\space
        /FT /Tx
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /MK <<
             /BC [ \Fld@bordercolor\space]
\ifx\Fld@bcolor\@empty
 \else
             /BG [ \Fld@bcolor\space]
\fi
            >>
        /DA (/Helv \strip@pt\Fld@charsize\space Tf \Fld@color\space rg )
        /DV (\Fld@default)
/AA <<
%  K input (keystroke) format
\ifx\Fld@keystroke@code\@empty\else
 /K << /S /JavaScript /JS (\Fld@keystroke@code) >>
\fi
\ifx\Fld@format@code\@empty\else
% F display format
 /F << /S /JavaScript /JS (\Fld@format@code) >>
\fi
% V validation
\ifx\Fld@validate@code\@empty\else
 /V << /S /JavaScript /JS (\Fld@validate@code) >>
\fi
% C calculation
\ifx\Fld@calculate@code\@empty\else
 /C << /S /JavaScript /JS (\Fld@calculate@code) >>
\fi
>>
        /V (\Fld@value)
 \ifFld@multiline
     \ifFld@readonly\Ff 4097 \else /Ff 4096 \fi
 \else
   \ifFld@password  
     \ifFld@readonly\Ff 8193 \else /Ff 8192 \fi
    \fi
 \fi
 \ifnum\Fld@maxlen>0/MaxLen \Fld@maxlen \fi
}
\def\PDFForm@Submit{
        /Subtype /Widget 
\ifFld@hidden    /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /FT /Btn
        /Ff 65540
        /H /P
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /MK <<
             /BC [ \Fld@bordercolor\space]
          >>
        /A <<
                /S /SubmitForm
                /F << 
                        /FS /URL 
                        /F (\Form@action)
                >>
		\ifForm@html /Flags 4 \fi
        >>
}
\def\PDFForm@Reset{
        /Subtype /Widget
\ifFld@hidden    /F 6 \else /F 4 \fi
        /T (\Fld@name)
        /FT /Btn
        /H /P
        /DA (/Helv \strip@pt\Fld@charsize\space Tf 0 0 1 rg)
        /Ff 65540
        /MK <<
             /BC [ \Fld@bordercolor\space]
%             /CA (Clear)
%             /AC (Done)
          >>
        /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >>
        /A << /S /ResetForm >>
}
%</pdfform>
%<*outlines>
%    \end{macrocode}
% \section{Bookmarks in the PDF file}
% This was originally developed by Yannis Haralambous 
% (it was the separate |repere.sty|); it needed
% the |repere| or |makebook.pl| post-processor to work properly. Now
% redundant, as it is done entirely in \LaTeX{} macros.
%
% To write out the current section title, and its rationalized number,
% we have to intercept the |\@sect| command, which is rather
% dangerous. But how else to see the information we need?
%    \begin{macrocode}
\let\H@old@sect\@sect
\def\@sect#1#2#3#4#5#6[#7]#8{%
 \H@old@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}%
%<dvipdf>  \literalps@out{/BOOK <<}%%
%    \end{macrocode}
% If the sectioning internal commands are abused and beaten, what
% are we to do? Answer, nothing if the first parameter is empty.
%    \begin{macrocode}
 \ifx\\#1\\\else
  \ifnum#2>\c@secnumdepth\else
     \edef\@thishlabel{\csname theH#1\endcsname}%
%<dvipdf>\literalps@out{/BOOK /title (#7) \space /level #1.\@thishlabel\space >> }%%
%<!dvipdf>\@writetorep{\csname the#1\endcsname}{#7}{#1.\@thishlabel}{#2}\fi
 \fi
}
%    \end{macrocode}
% Unfortunately, that only works if the section headings use the
% standard |\@startsection| macros. Chapters and parts typically
% don't. This makes it almost impossible to get 100\% right, so we
% just intercept the code in the standard styles.
%    \begin{macrocode}
\let\H@old@part\@part
\def\@part[#1]#2{%
 \H@old@part[{#1}]{#2}%
%<dvipdf>\literalps@out{/BOOK << }%%
%<dvipdf> \literalps@out{/BOOK /title (#1) /level part.\theHpart\space >> } %%
%<!dvipdf> \@writetorep{\thepart}{#1}{part.\theHpart}{-1}%
}
\let\H@old@chapter\@chapter
\def\@chapter[#1]#2{%
%<dvipdf>\literalps@out{/BOOK << }%
 \H@old@chapter[{#1}]{#2}%
%<dvipdf> \literalps@out{/BOOK /title (#1) \space /level chapter.\theHchapter \space >>}
%<!dvipdf>  \@writetorep{\thechapter}{#1}{chapter.\theHchapter}{0}%
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\expandafter\def\csname Parent-4\endcsname{}
\expandafter\def\csname Parent-3\endcsname{}
\expandafter\def\csname Parent-2\endcsname{}
\expandafter\def\csname Parent-1\endcsname{}
\expandafter\def\csname Parent0\endcsname{}
\expandafter\def\csname Parent1\endcsname{}
\expandafter\def\csname Parent2\endcsname{}
\expandafter\def\csname Parent3\endcsname{}
\expandafter\def\csname Parent4\endcsname{}
%    \end{macrocode}
% \subsection{Dealing with PDFDocEncoding}
% This section was written by Heiko Oberdiek; the code replaces
% an earlier version by David Carlisle.
%
% Bookmarks and the document  information strings  use PDFDocEncoding, 
% in which:
% 
% \begin{itemize}
%    \item Chars can be specified directly or by an octal notation: 
%      Umlaut a |(\"a)|= |\344|
%    \item Unmatched brackets (|(| or |)|) must not be used, instead
%          they can be specified with the glyph name commands
%          |\textparenleft| and |\textparenright|.
%    \item With AcrobatReader 3.01 (Win 3.11) I could not verify the special
%      meaning of |\b| (backspace to generate special accented letters that are
%      not part of the PDFDocEncoding) or |\n| (two line entries) for example.
% \end{itemize}
% 
% The \LaTeX\ solution to handle different encodings is the fontencoding 
% mechanism. So I have written a ``PDFDocEncoding-fontencoding-definition'' 
% file ``pd1enc.def''. Here all 8bit and special 7bit characters are
% mapped to their octal sequence. These glyphs are now accessible by the
% standard naming scheme ``|\text|<glyphname>'' (e. g. |\textcopyright|) or
% by the normal \TeX\ commands to produce accents (|\c C\"asar|).
% The same \TeX\ string can now be written in the document's encoding to
% write chapters, sections, headlines, or the table of contents. Before
% the same string is written as bookmark (the \texttt{.out} file), 
% only the encoding has
% to be changed to the PDFDocEncoding (PD1) to get a correct ``encoded''
% output.
% This method is sufficient for the document information.
% 
% The bookmark case is more complicate. Simple strings with umlauts or
% accented characters are handled by the normal method. But if the user
% is writing a section title, he can use the whole \TeX\ language with
% math formulas, logos, several fonts, --- in the bookmarks only one
% font and one encoding can be used. So what can be done?
% \begin{enumerate} 
% \item One method is to use a ''second optional``
% argument of the
% sectioning commands to specify the bookmark entry. 
% (I haven't implemented this method, because I think that there
% are too many packages that overload the sectioning commands and
% I don't want to go into incompatiblity trouble. But if wanted,
%  this can easily be done.)
% \item Use of a macro to define the next string for a bookmark entry:
%\begin{verbatim}
% \pdfbookmarkstring{Hello World, this is a bookmark}
% \section{Hello World, this isn't part of the bookmarks}
% \section{This string is in the bookmarks, too}
%\end{verbatim}
% creates the bookmarks:
%\begin{verbatim}
%      1 Hello World, this is a bookmark
%      2 This string is in the bookmarks, too
%\end{verbatim}
%and the table of contents:
%\begin{verbatim}
%      1 Hello World, this isn't part of the bookmarks
%      2 This string is in the bookmarks, too
%\end{verbatim}
% \item While writing a bookmark a switch can be set and a macro can
%    ask if it be set or not and produce the right output:
%\begin{verbatim}
%      \section{This is \ifbookmark{a bookmark}{a heading}}
%      \section{The role of \ifbookmark{water}{H$_2$O}}
%\end{verbatim}
% \item Common commands can be redefined while writing a bookmark.
% But this solution can not be complete because there are a nearly
% infinite number of commands to be redefined.
% \end{enumerate}
% 
% Therefore, we  defined |\Hy@PDFDef| to do the work; 
% ie changing the encoding, 
% and redefining some commands:
% \begin{enumerate}
% \item required for encoding: |\0|, |\1|, ...
% \item (La)\TeX commands that produce character output: |\$|, |\#|, |\| , |~|,
%     |\dots|, |\ldots|, \ldots
% \item Commands of language packages (german, ...): |\grlqq|, |\flq|, \ldots
% \item Optional: Other commands like font switching: |\textbf|, \ldots
% \end{enumerate}
% For defining the command that holds the string there two
% possibilities:
% \begin{enumerate}
%  \item weak form: use |\edef| to get the fontencoding mechanism work.
%      Advantage: more compatible with old code than the strong form.
%      Disadvantage: stomach commands (|\relax|, ...) are not 
%      expanded further, they become part of the output string.
%      The users have to scan the result to detect wrong
%      artefacts.
%  \item strong form: converting to output string via 
%      |\expandafter\string\csname <string>\endcsname|.
%      The string is expanded like edef, but stomach commands that
%      make the PDF output string dirty cause an error at run-time.
%      So the user is forced to give the correct
%      code for the bookmark, info, author, ... entries.
% \end{enumerate}
% The default is the weak form.
%    \begin{macrocode}
\newwrite\@outlinefile
\def\@writetorep#1#2#3#4{\ifx\WriteBookmarks\relax{}%
    \else\@@writetorep{#1}{#2}{#3}{#4}\fi}
\def\@@writetorep#1#2#3#4{%
    \PDFbookmarktrue
    \@tempcnta#4
    \expandafter\xdef\csname Parent#4\endcsname{#3}%
    \advance\@tempcnta by -1
    \ifx\Hy@bookmarkstring\relax
        \Hy@PDFDef\Hy@bookmarkstring{#2}%
    \fi
    \Hy@PDFDef\@tempa{#1 }%
    \protected@write\@outlinefile%
    {%
       \expandafter\let\csname T1-cmd\endcsname\@gobble
       \let\@tabacckludge\@empty
       \let\IeC\@firstofone
    }{%
    \ifhy@bookmarksnumbered
      \protect\BOOKMARK[#4]{#3}%
       {\@tempa\Hy@bookmarkstring}{\csname Parent\the\@tempcnta\endcsname}%
    \else
      \protect\BOOKMARK[#4]{#3}%
       {\Hy@bookmarkstring}{\csname Parent\the\@tempcnta\endcsname}%
    \fi
    }%
    \PDFbookmarkfalse
    \global\let\Hy@bookmarkstring\relax
}
\let\Hy@bookmarkstring\relax
\newcommand*{\ifbookmark}{%
   \ifPDFbookmark
    \expandafter\@firstoftwo
   \else
     \expandafter\@secondoftwo
   \fi
}
%    \end{macrocode}
% Tobias Oetiker rightly points out that we need a way to
% force a bookmark entry. So we introduce |\pdfbookmark|, 
% with two parameters, the title, and a symbolic name.
% By default this is at level 1, but we can reset that with the
% optional first argument.
%    \begin{macrocode}
\def\pdfbookmark{\@ifnextchar[{\pdf@bookmark}{\pdf@bookmark[0]}}
\def\pdf@bookmark[#1]#2#3{%
 \@writetorep{}{#2}{#3.#1}{#1}%
 \hyper@anchorstart{#3.#1}\hyper@anchorend
}
\def\BOOKMARK{\@ifnextchar[{\@BOOKMARK}{\@BOOKMARK[1]}}
%    \end{macrocode}
% The macros for calculating structure of outlines 
% are derived from those by  Petr Olsak used in the texinfopdf macros.
%
% The VTEX section comes straight from them, as is.
%    \begin{macrocode}
%<*hvtex>
\newcount\@serial@counter\@serial@counter=1\relax
\def\@openstatus{c}% Closed - default
\def\@BOOKMARK #1#2#3{%
  \toks@={#2}%
  \expandafter\edef\csname @count@#1\endcsname{\the\@serial@counter}%
  \edef\@mycount{\the\@serial@counter}%
  \advance\@serial@counter by 1\relax
  \edef\@parcount{\expandafter\ifx\csname @count@#3\endcsname\relax 0\else\csname @count@#3\endcsname\fi}%
  \special{!outline #1;p=\@parcount,i=\@mycount,s=\@openstatus,t=\the\toks@}%
  }%
\def\ReadBookmarks{%
  \ifhy@bookmarksopen\def\@openstatus{o}\fi
  \InputIfFileExists{\jobname.out}{}{}%
  \ifx\WriteBookmarks\relax\else
    \immediate\openout\@outlinefile=\jobname.out
  \fi
}
%</hvtex>
%<*!hvtex>
\def\ReadBookmarks{%
  \begingroup
  \escapechar=`\\%
  \let\escapechar\@gobble % 
  \def\@BOOKMARK [##1]##2##3##4{\calc@bm@number{##4}}%
  \InputIfFileExists{\jobname.out}{}{}%
  \ifx\WriteBookmarks\relax\global\let\WriteBookmarks\relax\fi
  \def\@BOOKMARK[##1]##2##3##4{%
   \def\@tempx{##3}%
%<*pdftex>
   \pdfoutline goto
%<pdftexold> name{##2!}%
%<!pdftexold> name{##2}%
    count\@bookmarkopenstatus\check@bm@number{##2}{%
   \expandafter\strip@prefix\meaning\@tempx}%
%</pdftex>
%<*pdfmark>
 \pdfmark{pdfmark=/OUT,Count=\@bookmarkopenstatus\check@bm@number{##2},
    Dest=##2,Title=\expandafter\strip@prefix\meaning\@tempx}%
%</pdfmark>
%<*dvipdfm>
  \special{pdf: outline ##1
       << /Title (\expandafter\strip@prefix\meaning\@tempx) 
          /A << /S /GoTo 
           /D (##2)
	     >> 
       >>
      }%
%</dvipdfm>
   }%
   {%
    \def\WriteBookmarks{0}%
    \InputIfFileExists{\jobname.out}{}{}%
   }%
   %{\escapechar\m@ne\InputIfFileExists{\jobname.out}{}{}}%
   \ifx\WriteBookmarks\relax\else
     \immediate\openout\@outlinefile=\jobname.out
   \fi
   \endgroup
}
\def\check@bm@number#1{\expandafter \ifx\csname#1\endcsname \relax 0%
    \else \csname#1\endcsname \fi}
\def\calc@bm@number#1{\@tempcnta=\check@bm@number{#1}\relax
    \advance\@tempcnta by1
    \expandafter\xdef\csname#1\endcsname{\the\@tempcnta}}
%</!hvtex>
%</outlines>
%<*repere>
\newwrite\@reperefile
\immediate\openout\@reperefile=\jobname.rep
\def\@writetorep#1#2#3#4{%
    \protected@write\@reperefile
       {\def\TeX{TeX}%
        \def\LaTeX{LaTeX}%
        \let\label\@gobble
        \let\index\@gobble
        \let\glossary\@gobble}%
       {(#1) <#2>}%
}
%</repere>
%<*pdfmark>
%    \end{macrocode}
% We have to allow for |\baselineskip| having an optional
% stretch and shrink (you meet this in slide packages, for instance),
% so we need to strip off the junk. David Carlisle, of course,
% wrote this bit of code.
%    \begin{macrocode}
\begingroup
  \catcode`P=12
  \catcode`T=12
  \lowercase{\endgroup
\gdef\rem@ptetc#1.#2PT#3!{#1\ifnum#2>\z@.#2\fi}}
\def\strip@pt@and@otherjunk#1{\expandafter\rem@ptetc\the#1!}
%</pdfmark>
%    \end{macrocode}
% \subsection{Device dependent setup}
% Unfortunately, some parts of the |pdfmark|
% PostScript code depend on vagaries
% of the dvi driver. We isolate here all the problems.
% \subsubsection{Rokicki's dvips}
% dvips thinks in 10ths of a big point, its
% coordinate space is resolution dependent,
% and its $y$ axis starts at the top of the
% page. Other drivers can and will be different!
%
% The work is done in |SDict|, because we add in some header
% definitions in a moment.
%    \begin{macrocode}
%<*dvips>
\input{pdfmark.def}%
\def\@pdfborder{0 0 12}
\providecommand\@pdfview{XYZ}
\providecommand\@pdfviewparams{ pdf@hoff pdf@voff null}
\def\literalps@out#1{\special{ps:SDict begin #1 end}}%
%    \end{macrocode}
% 
% The calculation of upper left $y$ is done without
% raising the point in \TeX,
% by simply adding on the current |\baselineskip| to the current $y$.
% This is usually too much, so we remove a notional 2 points.
%
% We have to see what the current baselineskip is, and convert it
% to the dvips coordinate system.
%    \begin{macrocode}
\def\pdf@setheight{\literalps@out{%
  \strip@pt@and@otherjunk\baselineskip
  \space 2 sub dup
  /HyperBasePt exch def
  PDFToDvips /HyperBaseDvips exch def
  }%
}
\def\PSHyperAnchorStart{\literalps@out{HyperStart }}
\def\PSHyperAnchorEnd{%
  \pdf@setheight
  \literalps@out{HyperAutoEnd HyperAutoVoff }%
}
\def\PSHyperLinkStart{\literalps@out{HyperStart }}
\def\PSHyperLinkEnd{%
  \pdf@setheight
  \literalps@out{HyperAutoEnd}%
}
\def\PSHyperRectStart{\literalps@out{HyperStart }}
\def\PSHyperRectEnd{\literalps@out{HyperEnd HyperVoff }}
%    \end{macrocode}
% Do not ask what this rubbish is. Trying to make |pdfmark|
% get the right destination for views.
%    \begin{macrocode}
\AtBeginDvi{\special{!
%    \end{macrocode}
% Unless I am going mad, this \emph{appears} to be the relationship
% between the default coordinate system (PDF), and dvips;
% \begin{verbatim}
% /DvipsToPDF { .01383701 div Resolution div } def
% /PDFToDvips { .01383701 mul Resolution mul } def
% \end{verbatim}
% the latter's coordinates are resolution dependent, but what that
% .01383701 is, who knows? well, almost everyone except me, I expect\ldots
% And yes, Maarten Gelderman \texttt{<mgelderman@econ.vu.nl>}
% points out that its 1/72.27 (the number of points to an inch, big points 
% to inch is 1/72). This also suggests that the code would be more 
% understandable (and exact) if 0.013 div would be replaced by 72.27 mul,
% so here we go. If this isn't right, I'll revert it.
%    \begin{macrocode}
/DvipsToPDF { 72.27 mul Resolution div } def
/PDFToDvips { 72.27 div Resolution mul } def
%    \end{macrocode}
% The rectangle around the links starts off
% \emph{exactly} the size of the box;
% we will to make it slightly bigger, 1 point on all sides.
%    \begin{macrocode}
/HyperBorder  { 1 PDFToDvips } def
% the distance from the top of the page to the current point, in
% PDF coordinates
/HyperVoff {
   currentpoint exch pop vsize 72 sub 
   exch DvipsToPDF sub /pdf@voff exch def
 } def
%    \end{macrocode}
% the distance from the top of the page to a point
% |\baselineskip| above the current point in PDF coordinates
%    \begin{macrocode}
/HyperAutoVoff {
   currentpoint exch pop
    vsize 72 sub exch DvipsToPDF
    HyperBasePt sub % baseline skip
    sub /pdf@voff exch def
 } def
%    \end{macrocode}
% the $x$ and $y$ coordinates of the current point, in PDF coordinates
%    \begin{macrocode}
/HyperStart {
   currentpoint
    HyperBorder add /pdf@lly exch def
    dup DvipsToPDF  /pdf@hoff exch def
    HyperBorder sub /pdf@llx exch def
} def
%    \end{macrocode}
% the $x$ and $y$ coordinates of the current point, minus the baselineskip
%    \begin{macrocode}
/HyperAutoEnd  {
   currentpoint
    HyperBaseDvips sub /pdf@ury exch def
    /pdf@urx exch def
} def
 /HyperEnd  {
   currentpoint
    HyperBorder sub /pdf@ury exch def
    HyperBorder add /pdf@urx exch def
 } def
 systemdict
 /pdfmark known not
 {userdict /pdfmark systemdict /cleartomark get put} if
}}
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\@pdfborder{0 0 0}%
  \fi
  \special{papersize=\special@paper}%
}
%</dvips>
%    \end{macrocode}
% \subsubsection{Textures}
% At the suggestion of Jacques Distler (distler@golem.ph.utexas.edu), try
% to derive a suitable driver for Textures. This is a copy of dvips,
% with some guesses about Textures behaviour.
%    \begin{macrocode}
%<*textures>
\def\literalps@out#1{\special{rawpostscript #1}}%
\def\pdf@setheight{\literalps@out{%
  \strip@pt@and@otherjunk\baselineskip
  \space 2 sub 
  PDFToDvips /HyperBase exch def
  }%
}
\providecommand\@pdfview{XYZ pdf@hoff pdf@voff null}
\providecommand\@pdfviewparams{ pdf@hoff pdf@voff null}
%
%    \end{macrocode}
% These are called at the start and end of unboxed links;
% their job is to leave available PS variables called
% |pdf@llx pdf@lly pdf@urx pdf@ury|, which are the coordinates
% of the bounding rectangle of the link, and |pdf@hoff pdf@voff|
% which are the PDF page offsets. 
% The Rect pair are called at the LL and UR corners of a box
% known to \TeX. 
%    \begin{macrocode}
\def\PSHyperAnchorStart{\literalps@out{HyperStart }}
\def\PSHyperAnchorEnd{%
  \pdf@setheight
  \literalps@out{HyperAutoEnd HyperAutoVoff }%
}
\def\PSHyperLinkStart{\literalps@out{HyperStart }}
\def\PSHyperLinkEnd{%
  \pdf@setheight
  \literalps@out{HyperAutoEnd}%
}
\def\PSHyperRectStart{\literalps@out{HyperStart }}
\def\PSHyperRectEnd{\literalps@out{HyperEnd HyperVoff }}
\special{prepostscript
%    \end{macrocode}
% Textures lives in normal points, I think. So conversion from one
% coordinate system to another involves doing nothing.
%
%    \begin{macrocode}
/vsize { \hy@pageheight } def
/DvipsToPDF { } def
/PDFToDvips { } def
/HyperBorder  { 1 PDFToDvips } def
/HyperVoff {
   currentpoint exch pop vsize 72 sub 
   exch DvipsToPDF sub /pdf@voff exch def
 } def
/HyperAutoVoff {
   currentpoint exch pop
    vsize 72 sub exch DvipsToPDF
    HyperBase sub % baseline skip
    sub /pdf@voff exch def
 } def
/HyperStart {
   currentpoint
    HyperBorder add /pdf@lly exch def
    dup DvipsToPDF  /pdf@hoff exch def
    HyperBorder sub /pdf@llx exch def
} def
/HyperAutoEnd  {
   currentpoint
    HyperBase sub /pdf@ury exch def
    /pdf@urx exch def
} def
 /HyperEnd  {
   currentpoint
    HyperBorder sub /pdf@ury exch def
    HyperBorder add /pdf@urx exch def
 } def
 systemdict
 /pdfmark known not
 {userdict /pdfmark systemdict /cleartomark get put} if
}
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\@pdfborder{0 0 0}%
  \fi
}
\def\@pdfborder{0 0 1}
\AtBeginDocument{%
\def\@pdfproducer{Textures + Distiller}}
%</textures>
%    \end{macrocode}
% \subsubsection{dvipsone}
%    \begin{macrocode}
% Over-ride the default setup macro in pdfmark driver to use Y\&Y 
% |\special| commands.
%<*dvipsone>
\def\@pdfborder{0 0 65781}
\input{pdfmark.def}%
\def\@pdfproducer{dvipsone + Distiller}
\def\PDF@SetupDoc{
 \special{PDF: Keywords \@pdfkeywords}%
 \special{PDF: Title \@pdftitle}%
 \special{PDF: Creator \@pdfcreator}%
 \special{PDF: Author \@pdfauthor}%
 \special{PDF: Producer \@pdfproducer}%
 \special{PDF: Subject \@pdfsubject}%
 \pdfmark{pdfmark=/DOCVIEW,
   Page=\@pdfstartpage,
   View=\@pdfstartview,
   URI={<< /Base (\@baseurl) >>},
   PageMode=\@pdfpagemode
   }%
 \ifx\@pdfpagescrop\@empty\else
   \pdfmark{pdfmark=/PAGES,CropBox=\@pdfpagescrop}%
 \fi
 \pdfmark{pdfmark=/PUT,Raw={
  \string{Catalog\string} <<
   /ViewerPreferences << 
  \ifhy@toolbar\else /HideToolbar true \fi
  \ifhy@menubar\else /HideMenubar true \fi
  \ifhy@windowui\else /HideWindowUI true \fi
  \ifhy@fitwindow /FitWindow true \fi
  \ifhy@centerwindow /CenterWindow true \fi
   >>
  \ifx\pdf@pagelayout\@empty\else/PageLayout /\pdf@pagelayout\space\fi
  >>}}%
}
\def\literalps@out#1{\special{ps:#1}}%
\def\pdf@setheight{\literalps@out{%
  \strip@pt@and@otherjunk\baselineskip
  \space 2 sub 
  PDFToDvips /HyperBase exch def
  }%
}
\providecommand\@pdfview{XYZ}
\providecommand\@pdfviewparams{ gsave revscl currentpoint grestore 72 add
   exch pop null exch null}
%
%    \end{macrocode}
% These are called at the start and end of unboxed links;
% their job is to leave available PS variables called
% |pdf@llx pdf@lly pdf@urx pdf@ury|, which are the coordinates
% of the bounding rectangle of the link, and |pdf@hoff pdf@voff|
% which are the PDF page offsets. These latter are currently not
% used in the dvipsone setup.
% The Rect pair are called at the LL and UR corners of a box
% known to \TeX. 
%    \begin{macrocode}
\def\PSHyperAnchorStart{\literalps@out{HyperStart }}
\def\PSHyperAnchorEnd{%
  \pdf@setheight
  \literalps@out{HyperAutoEnd HyperAutoVoff }%
}
\def\PSHyperLinkStart{\literalps@out{HyperStart }}
\def\PSHyperLinkEnd{%
  \pdf@setheight
  \literalps@out{HyperAutoEnd}%
}
\def\PSHyperRectStart{\literalps@out{HyperStart }}
\def\PSHyperRectEnd{\literalps@out{HyperEnd HyperVoff }}
\special{headertext=
%    \end{macrocode}
% dvipsone lives in scaled points; does this mean 65536 or 65781?
%    \begin{macrocode}
/DvipsToPDF { 65781 div  } def
/PDFToDvips { 65781 mul } def
/HyperBorder  { 1 PDFToDvips } def
%    \end{macrocode}
%
%    \begin{macrocode}
/HyperVoff {
   currentpoint exch pop DvipsToPDF /pdf@voff exch def
 } def
/HyperAutoVoff {
   currentpoint exch pop
    HyperBase sub % baseline skip
    DvipsToPDF /pdf@voff exch def
 } def
/HyperStart {
   currentpoint
    HyperBorder add /pdf@lly exch def
    dup   DvipsToPDF /pdf@hoff exch def
    HyperBorder sub /pdf@llx exch def
} def
/HyperAutoEnd  {
   currentpoint
    HyperBase sub /pdf@ury exch def
    /pdf@urx exch def
} def
/HyperEnd  {
   currentpoint
    HyperBorder sub /pdf@ury exch def
    HyperBorder add /pdf@urx exch def
 } def
 systemdict
 /pdfmark known not
 {userdict /pdfmark systemdict /cleartomark get put} if
}
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\@pdfborder{0 0 0}%
  \fi
}
%</dvipsone>
%<*dvipdf>
\def\literalps@out#1{\special{pdf: #1}}%
\AtBeginDocument{%
  \ifhy@colorlinks
   \def\@pdfborder{0 0 0}%
  \fi
}
\def\@pdfborder{0 0 1}
%</dvipdf>
%<*tex4ht>
\RequirePackage[htex4ht]{tex4ht}
\def\PDF@SetupDoc{%
 \ifx\@baseurl\@empty\else
  \special{t4ht=<base href="\@baseurl">}%
 \fi
}
\def\hyper@anchor#1{%
   {\let\protect=\string\special{t4ht=<A name=\hyper@quote #1\hyper@quote>}}%
   \hy@activeanchortrue
   \hy@colorlink{\@anchorcolor}\anchor@spot\hy@endcolorlink
   \special{t4ht=</A>}%
   \hy@activeanchorfalse
}
\def\hyper@anchorstart#1{%
 {\hyper@chars\special{t4ht=<A name=\hyper@quote#1\hyper@quote>}}%
  \hy@activeanchortrue
}
\def\hyper@anchorend{%
  \special{t4ht=</A>}%
  \hy@activeanchorfalse
}
\def\@urltype{url}
\def\hyper@linkstart#1#2{%
  \hy@colorlink{\csname @#1color\endcsname}%
  \def\@tempa{#1}\ifx\@tempa\@urltype
    \special{t4ht=<A href=\hyper@quote#2\hyper@quote>}%
  \else
   {\hyper@chars\special{t4ht=<A href=\hyper@quote\##2\hyper@quote>}}%
  \fi
}
\def\hyper@linkend{%
  \special{t4ht=</A>}%
  \hy@endcolorlink
}
\def\hyper@linkfile#1#2#3{%
 \hyper@linkurl{#1}{file:#2\ifx\\#3\\\else\##3\fi}%
}
\def\hyper@linkurl#1#2{%
 \ifhy@raiselinks
  \setbox\@tempboxa=\hbox{#1}%
  \@linkdim\dp\@tempboxa
  \leavevmode\lower\@linkdim\hbox{%
      {\hyper@chars\special{t4ht=<A href=\hyper@quote#2\hyper@quote>}}%
   }%
  \hy@colorlink{\@urlcolor}#1\hy@endcolorlink
  \@linkdim\ht\@tempboxa
  \advance\@linkdim by -6.5\p@
  \raise\@linkdim\hbox{\special{t4ht=</A>}}%
 \else
  {\hyper@chars
   \special{t4ht=<A href=\hyper@quote#2\hyper@quote>}%
   \hy@colorlink{\@urlcolor}#1\hy@endcolorlink
   \special{t4ht=</A>}}%
 \fi
}
\def\hyper@link#1#2#3{%
  \hyper@linkurl{#3}{\##2}%
}
\def\hyper@image#1#2{%
  {\hyper@chars
   \special{t4ht=<img src=\hyper@quote#1\hyper@quote>}}}
%</tex4ht>
%<*tex4htcfg>
\Preamble{html}
   \begin{document}
\EndPreamble
\def\TeX{TeX}
\def\OMEGA{Omega}
\def\LaTeX{LaTeX}
\def\LaTeXe{LaTeX2e}
\def\eTeX{e-\TeX}
\def\MF{Metafont}
%</tex4htcfg>
%    \end{macrocode}
% This was contributed by
% Heiko Oberdiek \Email{oberdiek@ruf.uni-freiburg.de}
%    \begin{macrocode}
%<*pd1enc>
\ProvidesFile{pd1enc.def}
 [1998/10/28 v0.1 PDFDocEncoding (Heiko Oberdiek)]
% accents
\DeclareFontEncoding{PD1}{}{}
\DeclareTextAccent{\`}{PD1}{96} % grave
\DeclareTextAccent{\'}{PD1}{180} % acute
\DeclareTextAccent{\^}{PD1}{26} % circumflex
\DeclareTextAccent{\~}{PD1}{31} % tilde
\DeclareTextAccent{\"}{PD1}{168} % dieresis
\DeclareTextAccent{\r}{PD1}{30} % ring
\DeclareTextAccent{\v}{PD1}{25} % caron
\DeclareTextAccent{\.}{PD1}{27} % dotaccent
\DeclareTextAccent{\c}{PD1}{184} % cedilla
%
\DeclareTextCommand{\textbreve}{PD1}{\030} % breve
\DeclareTextCommand{\textcaron}{PD1}{\031} % caron
\DeclareTextCommand{\textcircumflex}{PD1}{\032} % circumflex
\DeclareTextCommand{\textdotaccent}{PD1}{\033} % dotaccent
\DeclareTextCommand{\texthungarumlaut}{PD1}{\034} % hungarumlaut
\DeclareTextCommand{\textogonek}{PD1}{\035} % ogonek
\DeclareTextCommand{\textring}{PD1}{\036} % ring
\DeclareTextCommand{\textasciitilde}{PD1}{\037} % tilde
% \040 space
% \041 exclam
\DeclareTextCommand{\textquotedbl}{PD1}{\string"} % quotedbl \042
\DeclareTextCommand{\textnumbersign}{PD1}{\043} % numbersign
\DeclareTextCommand{\textdollar}{PD1}{\044} % dollar
\DeclareTextCommand{\textpercent}{PD1}{\045} % percent
\DeclareTextCommand{\textampersand}{PD1}{\046} % ampersand
% \047 quotesingle
\DeclareTextCommand{\textparenleft}{PD1}{\string\(} % parenleft \050
\DeclareTextCommand{\textparenright}{PD1}{\string\)} % parenright \051
% \052 asterisk
% \053 plus
% \054 comma
% \055 hyphen
% \056 period
% \057 slash
% \060..\071 0..9
% \072 colon
% \073 semicolon
\DeclareTextCommand{\textless}{PD1}{<} % less \074
% \075 equal
\DeclareTextCommand{\textgreater}{PD1}{>} % greater \076
% \077 question
% \080 at
% \081..\132 A..Z
% \133 bracketleft
\DeclareTextCommand{\textbackslash}{PD1}{\string\\} % backslash \134
% \135 bracketright
\DeclareTextCommand{\textasciicircum}{PD1}{\136} % asciicircum
\DeclareTextCommand{\textunderscore}{PD1}{\137} % underscore
% \140 grave
% \141..\172 a..z
\DeclareTextCompositeCommand{\.}{PD1}{i}{i} % i
\DeclareTextCommand{\textbraceleft}{PD1}{\173} % braceleft
\DeclareTextCommand{\textbar}{PD1}{|} % bar
\DeclareTextCommand{\textbraceright}{PD1}{\175} % braceright
\DeclareTextCommand{\textasciitilde}{PD1}{\176} % asciitilde
% No glyph \177 in PDFDocEncoding
\DeclareTextCommand{\textbullet}{PD1}{\200} % bullet
\DeclareTextCommand{\textdagger}{PD1}{\201} % dagger
\DeclareTextCommand{\textdaggerdbl}{PD1}{\202} % daggerdbl
\DeclareTextCommand{\textellipsis}{PD1}{\203} % ellipsis
\DeclareTextCommand{\textemdash}{PD1}{\204} % emdash
\DeclareTextCommand{\textendash}{PD1}{\205} % endash
\DeclareTextCommand{\textflorin}{PD1}{\206} % florin
\DeclareTextCommand{\textfractionmark}{PD1}{\207} % fraction
\DeclareTextCommand{\guilsinglleft}{PD1}{\210} % guilsinglleft
\DeclareTextCommand{\guilsinglright}{PD1}{\211} % guilsinglright
\DeclareTextCommand{\textminus}{PD1}{\212} % minus
\DeclareTextCommand{\textperthousand}{PD1}{\213} % perthousand
\DeclareTextCommand{\quotedblbase}{PD1}{\214} % quotedblbase
\DeclareTextCommand{\textquotedblleft}{PD1}{\215} % quotedblleft
\DeclareTextCommand{\textquotedblright}{PD1}{\216} % quotedblright
\DeclareTextCommand{\textquoteleft}{PD1}{\217} % quoteleft
\DeclareTextCommand{\textquoteright}{PD1}{\220} % quoteright
\DeclareTextCommand{\quotesinglbase}{PD1}{\221} % quotesinglbase
\DeclareTextCommand{\texttrademark}{PD1}{\222} % trademark
\DeclareTextCommand{\textfi}{PD1}{\223} % fi ??
\DeclareTextCommand{\textfl}{PD1}{\224} % fl ??
\DeclareTextCommand{\L}{PD1}{\225} % Lslash
\DeclareTextCommand{\OE}{PD1}{\226} % OE
\DeclareTextCompositeCommand{\v}{PD1}{S}{\227} % Scaron
\DeclareTextCompositeCommand{\"}{PD1}{Y}{\230} % Ydieresis
\DeclareTextCompositeCommand{\v}{PD1}{Z}{\231} % Zcaron
\DeclareTextCommand{\i}{PD1}{\232} % dotlessi
\DeclareTextCommand{\l}{PD1}{\233} % lslash
\DeclareTextCommand{\oe}{PD1}{\234} % oe
\DeclareTextCompositeCommand{\v}{PD1}{s}{\235} % scaron
\DeclareTextCompositeCommand{\v}{PD1}{z}{\236} % zcaron
% No glyph \237 in PDFDocEncoding
% No glyph \240 in PDFDocEncoding
\DeclareTextCommand{\textexclamdown}{PD1}{\241} % exclamdown
\DeclareTextCommand{\textcent}{PD1}{\242} % cent
\DeclareTextCommand{\textsterling}{PD1}{\243} % sterling
\DeclareTextCommand{\textcurrency}{PD1}{\244} % currency
\DeclareTextCommand{\textyen}{PD1}{\245} % yen
\DeclareTextCommand{\textbrokenbar}{PD1}{\246} % brokenbar
\DeclareTextCommand{\textsection}{PD1}{\247} % section
\DeclareTextCommand{\textdieresis}{PD1}{\250} % dieresis
\DeclareTextCommand{\textcopyright}{PD1}{\251} % copyright
\DeclareTextCommand{\textordfeminine}{PD1}{\252} % ordfeminine
\DeclareTextCommand{\guillemotleft}{PD1}{\253} % guillemotleft
\DeclareTextCommand{\textlogicalnot}{PD1}{\254} % logicalnot
% No glyph \255 in PDFDocEncoding
\DeclareTextCommand{\textregistered}{PD1}{\256} % registered
\DeclareTextCommand{\textmacron}{PD1}{\257} % macron
\DeclareTextCommand{\textdegree}{PD1}{\260} % degree
\DeclareTextCommand{\textplusminus}{PD1}{\261} % plusminus
\DeclareTextCommand{\texttwosuperior}{PD1}{\262} % twosuperior
\DeclareTextCommand{\textthreesuperior}{PD1}{\263} % threesuperior
\DeclareTextCommand{\textacute}{PD1}{\264} % acute
\DeclareTextCommand{\textmu}{PD1}{\265} % mu
\DeclareTextCommand{\textparagraph}{PD1}{\266} % paragraph
\DeclareTextCommand{\textperiodcentered}{PD1}{\267} % periodcentered
\DeclareTextCommand{\textcedilla}{PD1}{\270} % cedilla
\DeclareTextCommand{\textonesuperior}{PD1}{\271} % onesuperior
\DeclareTextCommand{\textordmasculine}{PD1}{\272} % ordmasculine
\DeclareTextCommand{\guillemotright}{PD1}{\273} % guillemotright
\DeclareTextCommand{\textonequarter}{PD1}{\274} % onequarter
\DeclareTextCommand{\textonehalf}{PD1}{\275} % onehalf
\DeclareTextCommand{\textthreequarters}{PD1}{\276} % threequarters
\DeclareTextCommand{\textquestiondown}{PD1}{\277} % questiondown
\DeclareTextCompositeCommand{\`}{PD1}{A}{\300} % Agrave
\DeclareTextCompositeCommand{\'}{PD1}{A}{\301} % Aacute
\DeclareTextCompositeCommand{\^}{PD1}{A}{\302} % Acircumflex
\DeclareTextCompositeCommand{\~}{PD1}{A}{\303} % Atilde
\DeclareTextCompositeCommand{\"}{PD1}{A}{\304} % Adieresis
\DeclareTextCompositeCommand{\r}{PD1}{A}{\305} % Aring
\DeclareTextCommand{\AE}{PD1}{\306} % AE
\DeclareTextCompositeCommand{\c}{PD1}{C}{\307} % Ccedilla
\DeclareTextCompositeCommand{\`}{PD1}{E}{\310} % Egrave
\DeclareTextCompositeCommand{\'}{PD1}{E}{\311} % Eacute
\DeclareTextCompositeCommand{\^}{PD1}{E}{\312} % Ecircumflex
\DeclareTextCompositeCommand{\"}{PD1}{E}{\313} % Edieresis
\DeclareTextCompositeCommand{\`}{PD1}{I}{\314} % Igrave
\DeclareTextCompositeCommand{\'}{PD1}{I}{\315} % Iacute
\DeclareTextCompositeCommand{\^}{PD1}{I}{\316} % Icircumflex
\DeclareTextCompositeCommand{\"}{PD1}{I}{\317} % Idieresis
\DeclareTextCommand{\DH}{PD1}{\320} % Eth
\DeclareTextCommand{\DJ}{PD1}{\320} % Eth
\DeclareTextCompositeCommand{\~}{PD1}{N}{\321} % Ntilde
\DeclareTextCompositeCommand{\`}{PD1}{O}{\322} % Ograve
\DeclareTextCompositeCommand{\'}{PD1}{O}{\323} % Oacute
\DeclareTextCompositeCommand{\^}{PD1}{O}{\324} % Ocircumflex
\DeclareTextCompositeCommand{\~}{PD1}{O}{\325} % Otilde
\DeclareTextCompositeCommand{\"}{PD1}{O}{\326} % Odieresis
\DeclareTextCommand{\textmultiply}{PD1}{\327} % multiply
\DeclareTextCommand{\O}{PD1}{\330} % Oslash
\DeclareTextCompositeCommand{\`}{PD1}{U}{\331} % Ugrave
\DeclareTextCompositeCommand{\'}{PD1}{U}{\332} % Uacute
\DeclareTextCompositeCommand{\^}{PD1}{U}{\333} % Ucircumflex
\DeclareTextCompositeCommand{\"}{PD1}{U}{\334} % Udieresis
\DeclareTextCompositeCommand{\'}{PD1}{Y}{\335} % Yacute
\DeclareTextCommand{\TH}{PD1}{\336} % Thorn
\DeclareTextCommand{\ss}{PD1}{\337} % germandbls
\DeclareTextCompositeCommand{\`}{PD1}{a}{\340} % agrave
\DeclareTextCompositeCommand{\'}{PD1}{a}{\341} % aacute
\DeclareTextCompositeCommand{\^}{PD1}{a}{\342} % acircumflex
\DeclareTextCompositeCommand{\~}{PD1}{a}{\343} % atilde
\DeclareTextCompositeCommand{\"}{PD1}{a}{\344} % adieresis
\DeclareTextCompositeCommand{\r}{PD1}{a}{\345} % aring
\DeclareTextCommand{\ae}{PD1}{\346} % ae
\DeclareTextCompositeCommand{\c}{PD1}{c}{\347} % ccedilla
\DeclareTextCompositeCommand{\`}{PD1}{e}{\350} % egrave
\DeclareTextCompositeCommand{\'}{PD1}{e}{\351} % eacute
\DeclareTextCompositeCommand{\^}{PD1}{e}{\352} % ecircumflex
\DeclareTextCompositeCommand{\"}{PD1}{e}{\353} % edieresis
\DeclareTextCompositeCommand{\`}{PD1}{i}{\354} % igrave
\DeclareTextCompositeCommand{\`}{PD1}{\i}{\354} % igrave
\DeclareTextCompositeCommand{\'}{PD1}{i}{\355} % iacute
\DeclareTextCompositeCommand{\'}{PD1}{\i}{\355} % iacute
\DeclareTextCompositeCommand{\^}{PD1}{i}{\356} % icircumflex
\DeclareTextCompositeCommand{\^}{PD1}{\i}{\356} % icircumflex
\DeclareTextCompositeCommand{\"}{PD1}{i}{\357} % idieresis
\DeclareTextCompositeCommand{\"}{PD1}{\i}{\357} % idieresis
\DeclareTextCommand{\dh}{PD1}{\360} % eth
\DeclareTextCompositeCommand{\~}{PD1}{n}{\361} % ntilde
\DeclareTextCompositeCommand{\`}{PD1}{o}{\362} % ograve
\DeclareTextCompositeCommand{\'}{PD1}{o}{\363} % oacute
\DeclareTextCompositeCommand{\^}{PD1}{o}{\364} % ocircumflex
\DeclareTextCompositeCommand{\~}{PD1}{o}{\365} % otilde
\DeclareTextCompositeCommand{\"}{PD1}{o}{\366} % odieresis
\DeclareTextCommand{\textdivide}{PD1}{\367} % divide
\DeclareTextCommand{\o}{PD1}{\370} % oslash
\DeclareTextCompositeCommand{\`}{PD1}{u}{\371} % ugrave
\DeclareTextCompositeCommand{\'}{PD1}{u}{\372} % uacute
\DeclareTextCompositeCommand{\^}{PD1}{u}{\373} % ucircumflex
\DeclareTextCompositeCommand{\"}{PD1}{u}{\374} % udieresis
\DeclareTextCompositeCommand{\'}{PD1}{y}{\375} % yacute
\DeclareTextCommand{\th}{PD1}{\376} % thorn
\DeclareTextCompositeCommand{\"}{PD1}{y}{\377} % ydieresis
%
\DeclareTextCommand{\SS}{PD1}{SS}
\DeclareTextCommand{\textcelsius}{PD1}{\textdegree C}
%
% Aliases (german.sty)
\DeclareTextCommand{\textglqq}{PD1}{\quotedblbase}
\DeclareTextCommand{\textgrqq}{PD1}{\textquotedblleft}
\DeclareTextCommand{\textglq}{PD1}{\quotesinglbase}
\DeclareTextCommand{\textgrq}{PD1}{\textquoteleft}
\DeclareTextCommand{\textflqq}{PD1}{\guillemotleft}
\DeclareTextCommand{\textfrqq}{PD1}{\guillemotright}
\DeclareTextCommand{\textflq}{PD1}{\guilsinglleft}
\DeclareTextCommand{\textfrq}{PD1}{\guilsinglright}
%
% Aliases (math names)
\DeclareTextCommand{\textneg}{PD1}{\textlogicalnot}
\DeclareTextCommand{\texttimes}{PD1}{\textmultiply}
\DeclareTextCommand{\textdiv}{PD1}{\textdivide}
\DeclareTextCommand{\textpm}{PD1}{\textplusminus}
\DeclareTextCommand{\textcdot}{PD1}{\textperiodcentered}
\DeclareTextCommand{\textbeta}{PD1}{\ss}
%</pd1enc>
%    \end{macrocode}
%
% \Finale
%
\endinput

