diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:54:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:54:02 +0000 |
commit | e71364f18cbfb00305b86b52f2d0bb5f0d338f7e (patch) | |
tree | d69ff99944a2521985774671e78437a0b774f04a /Master | |
parent | 2b168a711c6da46a5949b441aef618aa61a4a1e0 (diff) |
trunk/Master/texmf-dist/source/latex/hyper
git-svn-id: svn://tug.org/texlive/trunk@326 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/Makefile-MSDos | 72 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/Makefile-Unix | 71 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/README | 49 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/TODO | 34 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/backcite.dtx | 401 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/contrib/README | 9 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/contrib/harvard-to.hyp | 21 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/dvi2pdf.pl | 239 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/hyper.dtx | 3732 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/hyper.ins | 90 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/scontrib/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/hyper/scontrib/harvard.hyp | 21 |
12 files changed, 4745 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/hyper/Makefile-MSDos b/Master/texmf-dist/source/latex/hyper/Makefile-MSDos new file mode 100644 index 00000000000..e45ddb604f6 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/Makefile-MSDos @@ -0,0 +1,72 @@ +# MSDos-Makefile + +### variables to configure for the local system + +#installation directories +TEXINPUTS = . +TEXDOCS_SRC = . +TEXDOCS_DVI = $(TEXDOCS_SRC) +TEXDOCS_PS = $(TEXDOCS_SRC) + +#executables +LATEX = latex +DVIPS = dvips -z -o + +THEMAKE = $(MAKE) -f Makefile-MSDos + +COPY = copy +ECHO = echo +MKDIR = mkdir +RM = del + +### do not change anything beyond this line + +PACKAGE = hyper + +default: $(PACKAGE).dvi + +$(PACKAGE).dvi: $(PACKAGE).dtx + $(LATEX) $(PACKAGE).dtx + $(LATEX) $(PACKAGE).dtx + $(LATEX) $(PACKAGE).dtx + +$(PACKAGE).ps: $(PACKAGE).dvi + $(DVIPS) $(PACKAGE).ps $(PACKAGE).dvi + +files: $(PACKAGE).ins $(PACKAGE).dtx + $(LATEX) $(PACKAGE).ins + +install: + $(THEMAKE) -s install-info + +install-info: + $(ECHO) "After configuring the Makefile call:" + $(ECHO) " $(THEMAKE) install-package to install the package (without sources)" + $(ECHO) " $(THEMAKE) install-doc to install the documentation sources" + $(ECHO) " $(THEMAKE) install-dvi to install the documentation in dvi-format" + $(ECHO) " $(THEMAKE) install-ps to install the documentation in ps-format" + $(ECHO) " $(THEMAKE) install-all to install the package and the documentation" + +install-package: files + -$(MKDIR) $(TEXINPUTS) + $(COPY) *.sty $(TEXINPUTS) + $(COPY) *.hyp $(TEXINPUTS) + $(COPY) contrib\*.hyp $(TEXINPUTS) + $(COPY) scontrib\*.hyp $(TEXINPUTS) + +install-doc: $(PACKAGE).dtx + - $(MKDIR) $(TEXDOCS_SRC) + $(COPY) $(PACKAGE).dtx $(TEXDOCS_SRC) + +install-dvi: $(PACKAGE).dvi + -$(MKDIR) $(TEXDOCS_DVI) + $(COPY) $(PACKAGE).dvi $(TEXDOCS_DVI) + +install-ps: $(PACKAGE).ps + -$(MKDIR) $(TEXDOCS_PS) + $(COPY) $(PACKAGE).ps $(TEXDOCS_PS) + +install-all: install-package install-doc install-dvi install-ps + +clean: + $(RM) *.aux *.cfg *.dvi *.hyp *.log *.ps *.sty *.toc diff --git a/Master/texmf-dist/source/latex/hyper/Makefile-Unix b/Master/texmf-dist/source/latex/hyper/Makefile-Unix new file mode 100644 index 00000000000..b972d5df860 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/Makefile-Unix @@ -0,0 +1,71 @@ +# UNIX-Makefile + +### variables to configure for the local system + +#installation directories +TEXINPUTS = . +TEXDOCS_SRC = . +TEXDOCS_DVI = $(TEXDOCS_SRC) +TEXDOCS_PS = $(TEXDOCS_SRC) + +#executables +LATEX = latex +DVIPS = dvips -z -o + +THEMAKE = $(MAKE) -f Makefile-Unix + +COPY = cp +ECHO = echo +MKDIR = mkdir +RM = /bin/rm -rf + +### do not change anything beyond this line + +PACKAGE = hyper + +default: $(PACKAGE).dvi + +$(PACKAGE).dvi: $(PACKAGE).dtx + $(LATEX) $(PACKAGE).dtx + $(LATEX) $(PACKAGE).dtx + $(LATEX) $(PACKAGE).dtx + +$(PACKAGE).ps: $(PACKAGE).dvi + $(DVIPS) $(PACKAGE).ps $(PACKAGE).dvi + +files: $(PACKAGE).ins $(PACKAGE).dtx + $(LATEX) $(PACKAGE).ins + +install: + $(THEMAKE) -s install-info + +install-info: + $(ECHO) "After configuring the Makefile call:" + $(ECHO) " $(THEMAKE) install-package to install the package (without sources)" + $(ECHO) " $(THEMAKE) install-doc to install the documentation sources" + $(ECHO) " $(THEMAKE) install-dvi to install the documentation in dvi-format" + $(ECHO) " $(THEMAKE) install-ps to install the documentation in ps-format" + $(ECHO) " $(THEMAKE) install-all to install the package and the documentation" + +install-package: files + -$(MKDIR) $(TEXINPUTS) + $(COPY) *.sty *.hyp $(TEXINPUTS)/ + $(COPY) contrib/*.hyp $(TEXINPUTS)/ + $(COPY) scontrib/*.hyp $(TEXINPUTS)/ + +install-doc: $(PACKAGE).dtx + - $(MKDIR) $(TEXDOCS_SRC) + $(COPY) $(PACKAGE).dtx $(TEXDOCS_SRC)/ + +install-dvi: $(PACKAGE).dvi + -$(MKDIR) $(TEXDOCS_DVI) + $(COPY) $(PACKAGE).dvi $(TEXDOCS_DVI)/ + +install-ps: $(PACKAGE).ps + -$(MKDIR) $(TEXDOCS_PS) + $(COPY) $(PACKAGE).ps $(TEXDOCS_PS)/ + +install-all: install-package install-doc install-dvi install-ps + +clean: + $(RM) *.aux *.cfg *.dvi *.hyp *.log *.ps *.sty *.toc diff --git a/Master/texmf-dist/source/latex/hyper/README b/Master/texmf-dist/source/latex/hyper/README new file mode 100644 index 00000000000..fac47d3ea6a --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/README @@ -0,0 +1,49 @@ +hyper-package V4.2d of 1999/03/09 + +This package is used to produce hypertext documents with LaTeX. + +Currently supported are: + * the LaTeX2e base + * the following packages: + + amslatex + + cweb + + fancyheadings + + ftnright + + longtable + + natbib + + subeqnarray + + theorem + + xr + +Current extensions are: + * backcite + +Many other packages will run with the hyper-package without modifying +anything. Just try it. + +Documentation: + Process hyper.dtx three times with latex + If the hyper-package is already installed this will produce a hypertext + document. Otherwise you will get a classical document without hypertext + marks. + +Installation on Unix-platforms: + Configure the variables of Makefile-Unix to Your needs and execute + "make -f Makefile-Unix install". Follow the instructions. + +Installation on MSDos-platforms: + Configure the variables of Makefile-MSDos to Your needs and execute + "nmake -f Makefile-MSDos install". Follow the instructions. + +Installation on other platforms: + Process hyper.ins with latex and move the files ending with .hyp or .sty + into a directory searched by TeX. + Move the files from the subdirectories contrib and scontrib into a + directory searched by TeX. + +Addons (not part of the installation directives above): + There is a perl script called dvi2pdf.pl that generates a pdf file from + a dvi file using a dvips capable of transforming hyper dvi files to + hyper ps files and ghostscripts pdfwriter capability. + This file has three variables that have to be configured. + diff --git a/Master/texmf-dist/source/latex/hyper/TODO b/Master/texmf-dist/source/latex/hyper/TODO new file mode 100644 index 00000000000..be8e2cd9a78 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/TODO @@ -0,0 +1,34 @@ +- Introduce \DefineHyperURL and \UseHyperUrl to + allow definition of external URLs in the document + preamble and usage at any position in the document + so that redefinition of URLs become easier + Add names \...ExternalURL? + +- after reference text for ref pageref noref as optional parameter surrounded by (,)? + (to be passed as 5th parameter to hyper@setref) + +- Introduce Base Reference for External Links + base_name: html:<base href = "href_string"> + +- Introduce corresponding Macro(s) for inserting + relative links + +- Introduce Other Link/Referencing mechanism + that uses "type of stuff.number of stuff" + instead of an internal code as an alternative. + +- Consider the following part from html.sty (and allow additional optional parameter): + %%% HYPERREF + % Suggested by Eric M. Carol <eric@ca.utoronto.utcc.enfm> + % Similar to \ref but accepts conditional text. + % The first argument is HTML text which will become ``hyperized'' + % (underlined). + % The second and third arguments are text which will appear only in the paper + % version (DVI file), enclosing the fourth argument which is a reference to a label. + % + %e.g. \hyperref{using the tracer}{using the tracer (see Section}{)}{trace} + % where there is a corresponding \label{trace} + % + \newcommand{\hyperref}[4]{#2\ref{#4}#3} + +- Is it worth to develop a native PDF support?
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/hyper/backcite.dtx b/Master/texmf-dist/source/latex/hyper/backcite.dtx new file mode 100644 index 00000000000..2b49be45284 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/backcite.dtx @@ -0,0 +1,401 @@ +% \iffalse +%% File: backcite.dtx Copyright (C) 1995--1999 Michael Mehlich +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +% +%<*driver> +\documentclass{ltxdoc} +\IfFileExists{hyper.sty}{% + \message{*** Generating hypertext documentation ***} + \usepackage[color,pagetop]{hyper}% +}{% + \def\hyperURL##1##2##3##4{##4} +} +%</driver> +\def\fileversion{V2.0} +\def\filedate{1997/03/01} +\def\docdate{1997/03/01} +%<*driver> +\begin{document} + \title{Backcite Extension for Hyper\LaTeXe\\\fileversion} + \author{Michael Mehlich} + \date{\docdate} + \maketitle + \tableofcontents + \DocInput{backcite.dtx} +\end{document} +%</driver> +% \fi +% \CheckSum{513} +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \MakeShortVerb{|} +% +% \title{Hyper\LaTeXe} +% \maketitle +% +% \section{Introduction} +% For developing documents it is often useful to know the places +% bibliographic entries have been used in. This subpackage of +% the |hyper|--package realizes this by remembering the pages +% or sections/theorems and so on a |\cite| command occurs in. +% The resulting informations are then added to the respectively +% bibliograhic entries for the citations. +% +% \section{Usage} +% This package is not intended to be used stand alone but only +% together with the |hyper|--package. You can invoke it by giving +% |backcitepages| respectively |backcitesections| as optional +% parameters for the |hyper|--package. +% +% \StopEventually{} +% +% \clearpage +% \section{The Realization} +% First of all, introduce the standard header. +% \begin{macrocode} +%<*backcite> +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{hxt-bc}% + [\filedate\space Backcite extension for HyperLaTeX2e] +% \end{macrocode} +% Now check whether the |\hyper|--package already has been loaded. +% Otherwise, print a warning message and load it. +% \begin{macrocode} +\@ifpackageloaded{hyper}{}{% +\PackageWarningNoLine{backcite}{% + Backcite extension of hyper package needs hyper package.\MessageBreak + Loading hyper package.% +}% +\usepackage[no]{hyper}% +} +% \end{macrocode} +% We have to recognize all the places for the citations; thus, we need a +% collector for them that introduces a new macro holding this information +% for each cite and, to check them being unchanged by a latex run, a new +% token list holding all these macros. Such a collector is defined +% in a generic way by the following macro. (First time I used +% |\expandafter| seven(!) times one after another.) +% \begin{macrocode} +\def\hyper@aux#1#2#3{% + \expandafter\ifx\csname hyper@aux@#1@#2\endcsname\relax% + \expandafter\global% + \expandafter\edef\csname hyper@aux@#1@#2\endcsname% + {(#3)}% + \else% + \expandafter\global% + \expandafter\edef\csname hyper@aux@#1@#2\endcsname% + {\csname hyper@aux@#1@#2\endcsname(#3)}% + \fi% + \expandafter\ifx\csname hyper@aux@#1\endcsname\relax% + \expandafter\global\expandafter% + \newtoks\csname hyper@aux@#1\endcsname% + \fi% + \def\hyper@tempa{\csname hyper@aux@#1\endcsname}% + \expandafter\expandafter\expandafter\expandafter% + \expandafter\expandafter\expandafter\global% + \expandafter\expandafter\expandafter\expandafter% + \expandafter\expandafter\expandafter\hyper@tempa% + \expandafter\expandafter\expandafter\expandafter% + \expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\the\expandafter\hyper@tempa% + \csname hyper@aux@#1@#2\endcsname% + }% +} +% \end{macrocode} +% To remember the citations between two runs or realize a bibliography in +% front of a document we have to write the neccessary informations about +% the occurrences of the citations to the axiliary file and get the +% informations back when reading this file during startup.\newline +% Damned, why do different packages handle this differently? +% \begin{macrocode} +\def\hyperbackcite#1#2#3#4{\hyper@aux{br}{#1}{#2,#3,#4}} +\def\hyper@back@to@aux#1{% + \@bsphack% + \protected@write% + \@auxout% + {}% + {\string\hyperbackcite% + {#1}% + {\@currenthyper}% + {\@currentlabel}% + {\thepage}% + }% + \@esphack% +} +\def\hyper@back@to@aux@list#1{% + \@for\@citeb:=#1\do% + {\edef\@citeb{\expandafter\@firstofone\@citeb}% + \@bsphack% + \protected@write% + \@auxout% + {}% + {\string\hyperbackcite% + {\@citeb}% + {\@currenthyper}% + {\@currentlabel}% + {\thepage}% + }% + \@esphack% + }% +} +\let\hyper@citex\@citex% +\def\@citex[#1]#2{% + \hyper@back@to@aux@list{#2}% + \hyper@citex[#1]{#2}% +}% +\ifx\harvarditem\@undefined\else% + \let\hyper@har@citetoaux\HAR@citetoaux% + \def\HAR@citetoaux#1{% + \hyper@back@to@aux{#1}% + \hyper@har@citetoaux{#1}% + }% +\fi +\ifx\NAT@set@cites\@undefined\else% + \let\hyper@hyper@natlinkstart\hyper@natlinkstart% + \def\hyper@natlinkstart#1#2\hyper@natlinkend{% + \hyper@back@to@aux{#1}% + \hyper@hyper@natlinkstart{#1}{#2}\hyper@natlinkend% + }% + \ifnum\NAT@sort=1\relax + \let\hyper@back@hold\relax + \def\hyper@compress@cite#1#2{% + \advance\@tempcnta\@ne% + \ifnum #1=\@tempcnta% + \ifx\@h@ld\relax% + \edef\@h@ld{% + \@citea% + \noexpand% + \hyper@natlinkstart{#2}{#1}% + \noexpand% + \hyper@natlinkend% + }% + \def\hyper@back@hold{\hyper@back@to@aux{#2}}% + \else% + \hyper@back@hold% + \def\@h@ld{% + \hbox{--}% + \hyper@natlinkstart{#2}{#1}\hyper@natlinkend% + }% + \def\hyper@back@hold{\hyper@back@to@aux{#2}}% + \fi% + \else% + \@h@ld\@citea% + \hyper@natlinkstart{#2}{#1}\hyper@natlinkend% + \let\@h@ld\relax% + \fi% + \@tempcnta#1\def\@citea{\NAT@sep\penalty\@m\NAT@space}% + } + \fi + \NAT@set@cites +\fi% +% \end{macrocode} +% However, that does not help much. So far we did not write the informations +% down into the resulting |dvi|--file. To overcome this we modify +% the |\bibitem|--command such that the respectively informations will be +% added after each entry. +% \begin{macrocode} +\let\hyper@lbibitem\@lbibitem +\def\@lbibitem[#1]#2#3\par{% + \hyper@lbibitem[#1]{#2}#3% + \expandafter\hyper@backcite\csname hyper@aux@br@#2\endcsname% + \par% +} +\let\hyper@bibitem\@bibitem +\def\hyper@bibitem#1#2\par{% + \hyper@bibitem{#1}#2% + \expandafter\hyper@backcite\csname hyper@aux@br@#1\endcsname% + \par% +} +\ifx\harvarditem\@undefined\else + \let\hyper@harvarditem\harvarditem + \def\harvarditem{% + \@ifnextchar[{\hyper@harvard@oitem}{\hyper@harvard@item}% + } + \def\hyper@harvard@item#1#2#3#4\par{% + \hyper@harvarditem{#1}{#2}{#3}#4% + \expandafter\hyper@backcite\csname hyper@aux@br@#3\endcsname% + \par% + } + \def\hyper@harvard@oitem[#1]#2#3#4#5\par{% + \hyper@harvarditem[#1]{#2}{#3}{#4}#5% + \expandafter\hyper@backcite\csname hyper@aux@br@#4\endcsname% + \par% + } +\fi +% \end{macrocode} +% As we do not want an entry several times\footnote{Note, that currently +% we do not sort the list of informations. Thus, we may get several +% identical entries for the sectioning informations if, e.g.\ we cite +% something within a theorem.} +% but want to insert a hint +% about the type of backcites, we have to count then number of informations +% for each citation. +% Afterwards we can print out this hint and loop through all informations +% to print them out. +% \begin{macrocode} +\def\hyperbackcitepage{Cited on page~} +\def\hyperbackcitepages{Cited on pages~} +\def\hyperbackcitesection{Cited in~} +\def\hyperbackcitesections{Cited in~} +\def\hyperbackcitenormalseparator{, } +\def\hyperbackcitefinalseparatorpair{ and~} +\def\hyperbackcitefinalseparatorlist{, and~} +\def\hyper@backcite#1{% + \bgroup% + \let\hyper@last@cite\relax% + \count11=0\relax% + \expandafter\hyper@back@cnt#1\relax% + \let\hyper@last@cite\relax% + \expandafter\ifnum\count11>0\relax% + \if@hyper@back@pages@% + \expandafter\ifnum\count11>1\relax% + \hyperbackcitepages% + \else% + \hyperbackcitepage% + \fi% + \else% + \expandafter\ifnum\count11>1\relax% + \hyperbackcitesection% + \else% + \hyperbackcitesections% + \fi% + \fi% + \ifnum\count11>2\relax% + \let\hyper@back@final@connection% + \hyperbackcitefinalseparatorlist% + \else% + \let\hyper@back@final@connection% + \hyperbackcitefinalseparatorpair% + \fi% + \expandafter\hyper@@backcite#1\relax.% + \fi% + \egroup% +} +\def\hyper@back@cnt{\@ifnextchar({\hyper@@back@cnt}{\@gobble}} +\def\hyper@@back@cnt(#1,#2,#3){% + \if@hyper@back@pages@% + \edef\hyper@tempa{#3}% + \ifx\hyper@last@cite\hyper@tempa\relax\else% + \advance\count11by1\relax% + \edef\hyper@last@cite{#3}% + \fi% + \else% + \edef\hyper@tempa{#2}% + \ifx\hyper@tempa\@empty% + \else\ifx\hyper@last@cite\hyper@tempa\relax\else% + \advance\count11by1\relax% + \edef\hyper@last@cite{#2}% + \fi\fi% + \fi% + \hyper@back@cnt% +} +\def\hyper@@backcite{\@ifnextchar({\hyper@@@backcite}{}} +\def\hyper@@@backcite(#1,#2,#3){% + \if@hyper@back@pages@% + \edef\hyper@tempa{#3}% + \ifx\hyper@tempa\@empty\relax% + \else\ifx\hyper@last@cite\hyper@tempa\relax\else% + \advance\count11by-1\relax% + \ifx\hyper@last@cite\relax\else% + \ifnum\count11=0\relax% + \hyper@back@final@connection% + \else% + \hyperbackcitenormalseparator% + \fi% + \fi% + \hyperpagereference{#3}{#3}% + \edef\hyper@last@cite{#3}% + \fi\fi% + \else% + \edef\hyper@tempa{#2}% + \ifx\hyper@tempa\@empty\relax% + \else\ifx\hyper@last@cite\hyper@tempa\relax\else% + \advance\count11by-1\relax% + \ifx\hyper@last@cite\relax\else% + \ifnum\count11=0\relax% + \hyper@back@final@connection% + \else% + \hyperbackcitenormalseparator% + \fi% + \fi% + \hyperreference{#1}{#2}% + \edef\hyper@last@cite{#2}% + \fi\fi% + \fi% + \hyper@@backcite% +} +% \end{macrocode} +% At the end of the latex run we want to check whether the backcites +% may have changed to warn the user about this problem. Thus, we +% reread the auxiliary file just generated and collect all the informations +% about the new citations. Afterwards we just check their equivalence +% roughly such that everything is correct at least when no warning message +% is printed. +% \begin{macrocode} +\def\hyperbackcite@check#1#2#3#4{\hyper@aux{brc}{#1}{#2,#3,#4}} +\let\hyper@back@cite@enddocument\enddocument +\def\enddocument{% + \let\hyperbackcite\hyperbackcite@check% + \let\hyper@@backcite@end\@@end% + \def\@@end{\hyper@check@backcites\hyper@@backcite@end}% + \hyper@back@cite@enddocument% +} +\def\hyper@check@backcites{% + \expandafter\ifx\csname hyper@aux@br\endcsname\relax% + \expandafter\ifx\csname hyper@aux@brc\endcsname\relax% + \else% + \PackageWarningNoLine{backcite}{% + Backcite(s) may have changed.\MessageBreak + Rerun to get back references right% + }% + \fi% + \else\expandafter\ifx\csname hyper@aux@brc\endcsname\relax% + \PackageWarningNoLine{backcite}{% + Backcite(s) may have changed.\MessageBreak + Rerun to get back references right% + }% + \else% + \edef\hyper@tempa{\the\hyper@aux@br} + \edef\hyper@tempb{\the\hyper@aux@brc} + \edef\hyper@tempa{\hyper@tempa} + \edef\hyper@tempb{\hyper@tempb} + \ifx\hyper@tempa\hyper@tempb\else% + \PackageWarningNoLine{backcite}{% + Backcite(s) may have changed.\MessageBreak + Rerun to get back references right% + }% + \fi% + \fi\fi% +} +% \end{macrocode} +% Now let's just introduce the options for this package, i.e.\ decide +% whether we want to introduce backreferences for the citations using +% the pages or the section/theorem numbers. +% \begin{macrocode} +\newif\if@hyper@back@pages@ +\@hyper@back@pages@true +\DeclareOption{pages}{\@hyper@back@pages@true} +\DeclareOption{sections}{\@hyper@back@pages@false} +\ProcessOptions +%</backcite> +% \end{macrocode} +% +% \Finale diff --git a/Master/texmf-dist/source/latex/hyper/contrib/README b/Master/texmf-dist/source/latex/hyper/contrib/README new file mode 100644 index 00000000000..5668e5d43a0 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/contrib/README @@ -0,0 +1,9 @@ +This area is for downloading stuff that authors have +written for adding hypertex capability to other packages +that are not supported by the hyper package. + +They can be included by giving the name <file> for +including <file>.hyp as an optional parameter when +including the hyper package. +If a file does not end with .hyp include it afterwards +instead. diff --git a/Master/texmf-dist/source/latex/hyper/contrib/harvard-to.hyp b/Master/texmf-dist/source/latex/hyper/contrib/harvard-to.hyp new file mode 100644 index 00000000000..c4cfce13771 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/contrib/harvard-to.hyp @@ -0,0 +1,21 @@ +%% harvard.hyp - Amendments to harvard bibliography style Version 2.0.5 +%% to be used together with the hyper package +%% Author: Renate Schmidt (schmidt@mpi-sb.mpg.de) +%% Copyright: Renate Schmidt, May 1995 +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{harvard-to.hyp}[95/05/15] + +%% An apaptation of the original \harvarditem command that inserts a +% \blindhyperanchor for each item in the biliography and \hyperreference +% links around the citation-year. +\renewcommand{\harvarditem}[4][\null]{% + \hyper@setcurrent% + \item[\blindhyperanchor{\@currenthyper}]% + \if@filesw{ \def\protect##1{\string ##1\space}% + \ifthenelse{\equal{#1}{\null}} + {\def\next{{#4}{#2}{#2}{\hyperreference{\@currenthyper}{#3}}}} + {\def\next{{#4}{#2}{#1}{\hyperreference{\@currenthyper}{#3}}}} + \immediate\write\@auxout{\string\harvardcite\next}% + }\fi% + \protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces% + } diff --git a/Master/texmf-dist/source/latex/hyper/dvi2pdf.pl b/Master/texmf-dist/source/latex/hyper/dvi2pdf.pl new file mode 100644 index 00000000000..1a953c8e561 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/dvi2pdf.pl @@ -0,0 +1,239 @@ +#!/usr/bin/perl + +## File: backcite.dtx Copyright (C) 1995--1999 Michael Mehlich +## This program can be redistributed and/or modified under the terms +## of the LaTeX Project Public License Distributed from CTAN +## archives in directory macros/latex/base/lppl.txt; either +## version 1 of the License, or any later version. + +### DESCRIPTION: +### This script transforms dvi-files to pdf-files using dvihps and ghostscripts pdfwriter +### It has been tested with emtex's dvips and ghostscript 4.01 on WindowsNT +### Usage: dvi2pdf <options> +### where <options> are the usual dvips options and/or one of the following ones +### -nopdf produce only the ps-file not the pdf-file +### (this option is automatically used if output file has suffix .ps) +### -noborder produces an outputfile where the hyper-links don't have borders +### -s<x>,<y> shifts the hyper-links by (<x>,<y>) + +#Note: This script overwrites eventually existing files named +# $$.ps, $pdffile.ps, $pdffile.pdf +# where $$ is the process id (as provided by perl) +# and $pdffile is the output file name given with the option -o or +# derived from the input file name, i.e. the input file name without suffix + +### CONFIGURATION: +#Access paths for the programs dvihps and ghostscript +$GHOSTSCRIPT = "gswin32c"; #how to call ghostscript +$DVIHPS = "dvips"; #how to call hyper postscript capable dvips +$REMOVEFILE = "del"; #command to delete file + +### Probably no changes necessary below this line + +#some local initializations +$argno = 0; +$arglist = ""; +$dvifile = ""; +$psfile = ""; +$pdffile = ""; +$xshift = 0; $yshift = 0; #shift for hyper references +$referenceborder = 1; #do we want to have a border surrounding hyper references? +$nopdf = 0; #we just patch the ps-file if ($nopdf == 1) + +#scan arguments for input and output file and preserver rest for forwarding to dvips +while ($argno <= $#ARGV) + { if ($ARGV[$argno] eq "") + { #empty argument, ignore + } + elsif ($ARGV[$argno] =~ m/^-s([\+\-0-9]+)\,([\+\-0-9]+)$/) + { $xshift = $1; + $yshift = $2; + } + elsif ($ARGV[$argno] =~ m/^-nopdf$/) + { $nopdf = 1; + } + elsif ($ARGV[$argno] =~ m/^-noborder$/) + { $referenceborder = 0; + } + elsif ($ARGV[$argno] =~ m/^-(.)(.+)$/) + { #argument follows flag directly + if ($1 eq "o") + { #argument is output file + ($pdffile ne "") && die("Sorry, multiple output files cannot be handled"); + $pdffile = $2; + } + else + { #argument is dvi-argument + if ($ARGV[$argno] =~ m/ /) + { $arglist .= ' '.'"'.$ARGV[$argno].'"'; + } + else + { $arglist .= ' '.$ARGV[$argno]; + } + } + } + elsif ($ARGV[$argno] =~ m/^-(.)$/) + { #flag without directly following argument + if ( ($1 eq "a") || ($1 eq "k") || ($1 eq "m") || ($1 eq "q") || ($1 eq "r") + || ($1 eq "s") || ($1 eq "z") || ($1 eq "A") || ($1 eq "B") || ($1 eq "E") + || ($1 eq "F") || ($1 eq "K") || ($1 eq "M") || ($1 eq "N") || ($1 eq "R") + || ($1 eq "U") || ($1 eq "V") || ($1 eq "Z") + ) + { #flag without argument + if (!($1 eq "z")) + { $arglist .= ' '.$ARGV[$argno]; + } + } + elsif ($1 eq "i") + { die("Sorry, separate file per section cannot be handled"); + } + elsif ($1 eq "f") + { die("Sorry, run in filter mode not possible"); + } + else + { #flag with argument + if ($1 eq "o") + { #argument is output file + ($pdffile ne "") && die("Sorry, multiple output files cannot be handled"); + $pdffile = $ARGV[$argno+1]; + } + else + { #argument is dvi-argument + if ($ARGV[$argno+1] =~ m/ /) + { $arglist .= ' '.$ARGV[$argno].' '.'"'.$ARGV[$argno+1].'"'; + } + else + { $arglist .= ' '.$ARGV[$argno].' '.$ARGV[$argno+1]; + } + } + $argno++; + } + } + else + { #nonflag argument + ($dvifile ne "") && die("Sorry, multiple input files cannot be handled"); + $dvifile = $ARGV[$argno]; + } + $argno++; + } +$arglist = substr($arglist,1,length($arglist)-1); + +($dvifile eq "") && die("Sorry, no input file"); +if (!($dvifile =~ m/\.[^\.\:\\\/]*$/)) + { $dvifile .= '.dvi'; + } +(!($dvifile =~ m/\.dvi$/)) && die("Sorry, input file has illegal suffix different from .dvi"); + +if ($pdffile eq "") + { ($pdffile = $dvifile) =~ s/\.[^\:\\\/\.]*$/\.pdf/; + if ($pdffile eq $dvifile) + { $pdffile = $dvifile.'.pdf'; + } + } +else + { if ($pdffile =~ m/\.ps$/) + { $nopdf = 1; + } + } + +($psfile = $pdffile) =~ s/\.[^\:\\\/\.]*$/\.ps/; + +$tmpfile = "$$.ps"; + +#output arguments +print STDERR "DVI file: $dvifile\n"; +print STDERR "PS file: $psfile\n"; +if ($nopdf == 0) + { print STDERR "PDF file: $pdffile\n"; + } +print STDERR "TMP file: $tmpfile\n"; +print STDERR "Arg list: $arglist\n"; +print STDERR "Shifting: ($xshift,$yshift)\n"; +print STDERR "HyBorder: "; if ($referenceborder) { print STDERR "preserve"; } else { print STDERR "none"; }; print STDERR "\n"; + +#call dvips +print STDERR "*** $DVIHPS -z $arglist -o $tmpfile $dvifile\n"; +system("$DVIHPS -z $arglist -o $tmpfile $dvifile"); +(!(-f "$tmpfile")) && die("Error, $DVIHPS could not generate '$tmpfile'"); + +#path postscript file because we want to use a different fitheight for references to pages +print STDERR "*** PATCH $tmpfile $psfile\n"; + +open(STDIN,"<$tmpfile") || die("Input file '$tmpfile' not found.\n"); +open(STDOUT,">$psfile") || do { close(STDIN); die("Cannot open file '$psfile' for writing.\n") }; + +while (<STDIN>) + { if (/^\s*\((.+)\)\s+\[([0-9]+)\s+\[([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\]\s+([0-9]+)\]\s+def\s*$/) + { $name = $1; # name of an anchor + $page = $2; # page the anchor is on + $xa = $3 + $xshift; # rectangular box of anchor + $ya = $4 + $yshift; + $xb = $5 + $xshift; + $yb = $6 + $yshift; + $fitheight = (($ya > $yb) ? $ya : $yb) + 10; # screen top to show when reference to this anchor is choosen + print STDOUT "($name) [$page [$xa $ya $xb $yb] $fitheight] def\n"; + } + elsif (/^(.*)\s+\((.+)\)\s+\[\[([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\]\s+\[(.+)\]\s+\[(.+)\]\] pdfm\s+(.*)$/) + { $before = $1; + $name = $2; # name of the reference + $xa = $3 + $xshift; # rectangular box of reference + $ya = $4 + $yshift; + $xb = $5 + $xshift; + $yb = $6 + $yshift; + $borderinfo = $7; #horizontal_corner_radius vertical_corner_radius box_line_width [dash_on_size] [dash_off_size] + $bordercolor = $8; #red green blue + $after = $9; + if ($borderinfo =~ m/^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)\s*\[\s*([0-9]+)\s+([0-9]+)\s*\]\s*$/) + { $horizontalcornerradius = $1; + $verticalcornerradius = $2; + $boxlinewidth = $3; + $dashonsize = $4; + $dashoffsize = $5; + if ($referenceborder == 0) + { $boxlinewidth = 0; + } + $borderinfo = "$horizontalcornerradius $verticalcornerradius $boxlinewidth [$dashonsize $dashoffsize]"; + } + print STDOUT "$before ($name) [[$xa $ya $xb $yb] [$borderinfo] [$bordercolor]] pdfm $after\n"; + } + elsif (/^(.*)\s+\[\[([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\]\s+\[(.+)\]\s+\[(.+)\]\]\s+\((.+)\)\s+pdfm\s+(.*)$/) + { $before = $1; + $xa = $2 + $xshift; # rectangular box of reference + $ya = $3 + $yshift; + $xb = $4 + $xshift; + $yb = $5 + $yshift; + $borderinfo = $6; #horizontal_corner_radius vertical_corner_radius box_line_width [dash_on_size] [dash_off_size] + $bordercolor = $7; #red green blue + $name = $8; + $after = $9; + if ($borderinfo =~ m/^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)\s*\[\s*([0-9]+)\s+([0-9]+)\s*\]\s*$/) + { $horizontalcornerradius = $1; + $verticalcornerradius = $2; + $boxlinewidth = $3; + $dashonsize = $4; + $dashoffsize = $5; + if ($referenceborder == 0) + { $boxlinewidth = 0; + } + $borderinfo = "$horizontalcornerradius $verticalcornerradius $boxlinewidth [$dashonsize $dashoffsize]"; + } + print STDOUT "$before [[$xa $ya $xb $yb] [$borderinfo] [$bordercolor]] ($name) pdfm $after\n"; + } + else + { print STDOUT $_; + } + } + +close(STDIN); +close(STDOUT); + +# delete auxiliary file +print STDERR "*** $REMOVEFILE $tmpfile\n"; +system("$REMOVEFILE $tmpfile"); + +if ($nopdf == 0) + { # create pdf-file by calling ghostscript + print STDERR "*** $GHOSTSCRIPT -q -dNOPAUSE -sDEVICE#pdfwrite -sOutputFile#$pdffile $psfile -c quit\n"; + system("$GHOSTSCRIPT -q -dNOPAUSE -sDEVICE#pdfwrite -sOutputFile#$pdffile $psfile -c quit"); + (!(-f "$pdffile")) && die("Error, $DVIHPS could not generate '$pdffile'"); + } diff --git a/Master/texmf-dist/source/latex/hyper/hyper.dtx b/Master/texmf-dist/source/latex/hyper/hyper.dtx new file mode 100644 index 00000000000..bf83272d0fb --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/hyper.dtx @@ -0,0 +1,3732 @@ +% \iffalse +%% File: hyper.dtx Copyright (C) 1995--1999 Michael Mehlich +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%<*driver> +\documentclass[letterpaper]{ltxdoc} +\usepackage{tabularx} +\makeatletter +\let\TX@vwarn\relax +\makeatother +\IfFileExists{hyper.sty}{% + \message{*** Generating hypertext documentation ***} + \usepackage[color,fixhyperbox,pagetop]{hyper}% +}{% + \def\hyperURL##1##2##3##4{##4} +} +\def\AmS{{\protect\usefont{OMS}{cmsy}{m}{n}% + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} +\def\amslatex{{\protect\AmS-\protect\LaTeXe}} +\def\CWEB{{\scshape Cweb}} +%</driver> +\def\fileversion{V4.2d} +\def\filedate{1999/03/09} +\def\docdate{1999/03/09} +%<*driver> +\begin{document} + \hbadness=10000 + \hfuzz100pt + \title{HyperText Documents with \LaTeXe\\\fileversion} + \author{Michael Mehlich} + \date{\docdate} + \maketitle + \tableofcontents + \DocInput{hyper.dtx} +\end{document} +%</driver> +% \fi +% \CheckSum{5034} +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \MakeShortVerb{|} +% +% \title{Hyper\LaTeXe} +% \maketitle +% +% \section{Introduction} +% Traditional texts only have a linear structure given by its series of +% characters. But this is not sufficient for any kind of documents one +% may think of. Thus, recently the number of documents using a more +% complex graphical structure (called ``hyper text'' documents) have +% increased. +% +% This package provides the generation of such documents based on the +% already given structure of \LaTeXe{}-documents without the document +% writer having to consider new commands. +% +% \section{Usage} +% +% Just insert |\usepackage{hyper}| in the preamble of your +% \LaTeX2e--document as the last package to be loaded.\par +% If you use the theorem package define the theorems via +% |\newtheorem| after inserting the hyper package.\medskip +% +% You may also give some options for the package, i.e.\ instead of +% the command above you may use |\usepackage[<option list>]{hyper}| +% in your preamble.\medskip +% +% \noindent Currently the following options are known: +% \begin{itemize} +% \item |yes|, |no| +% determine whether the hypertext marks are inserted +% or not (default is |yes|) +% \item |fixhyperbox| +% modifies the position of the html-marks in the |dvi|-file +% so that |dvips| creates the right bounding boxes for +% the hyper references; it is highly recommended to use +% this option (though for compatibility reasons with earlier +% versions this is not the default setting); note, that the +% text of the reference is packed into a horizontal box (|\hbox|) +% due to the need of measuring its size +% \item |black|, |gray|, |color| +% determine the colors anchors and references +% are printed in (default is |black|);\newline +% the colors can be changed by +% |\definecolor{refcolor}{rgb}{|\emph{r}|,|\emph{g}|,|\emph{b}|}| +% for references, +% |\definecolor{undefrefcolor}{rgb}{|\emph{r}|,|\emph{g}|,|\emph{b}|}| +% for unresolved references, and +% |\definecolor{anchorcolor}{rgb}{|\emph{r}|,|\emph{g}|,|\emph{b}|}| +% for anchors where \emph{r}, \emph{g}, \emph{b} stand for the +% red, green, and blue, respectively, values (between 0.0 and 1.0) +% of the color (cf.\ |graphics| package) +% \item |pagenumber|, |pagetop| +% determine whether a page number refers to the page +% number of the respectively page or to the top of +% the page +% \item |indexcmds| has to be given explicitely whenever an +% index or glossary file has been created using +% this package if the file is not regenerated using +% the commands |\makeindex| and |\makeglossary|, +% respectively. +% \item |backcitepages|, |backcitesections| introduce back references +% from the bibliography to the pages and sections, +% respectively, they have been cited in +% \item |amsart|, |amsbook|, |amsdtx|, |amsldoc|, |amsproc|, |article|, +% |book|, |cweb|, |letter|, |ltxdoc|, |ltxguide|, |ltnews|, |proc|, +% |report|, |slides| +% determine the document class for which the +% modifications are loaded +% (default is the document class given via +% |\documentclass| if it can be derived) +% \item |leqno| +% adds modifications for the document class option +% |leqno| (will be used automagically for known +% document classes) +% \item |amsmath|, |amstex|, |amsthm|, |doc|, |fancyheadings|, |ftnright|, |longtable|, +% |natbib|, |subeqnarray|, |theorem|, |upref| +% add modifications for the corresponding package +% (will be used automagically) +% \item |xr| +% add modifications for the package |xr| and +% redefine it's internal macro |\externaldocument| +% addint a new parameter determining the URL--address +% of the document for the cross references used +% (will be used automagically) +% \item |harvard| add modifications for the respectively packages that +% are part of the distribution but provided by other +% authors +% \item |<other>| +% add a modification file |<other>.hyp| that has to +% be provided by yourself +% \end{itemize} +% +% \section{Macros Provided} +% The following macros are defined by the package and may be used: +% \begin{itemize} +% \item |\hyperanchor#1#2| +% lets |#1| being the hypertext anchor for |#2| +% (|#1| may neither be a natural number nor beginning +% with |page.| or |fn.|) +% \item |\blindhyperanchor#1| +% lets |#1| being a hypertext anchor +% (|#1| may neither be a natural number nor beginning +% with |page.| or |fn.|) +% \item |\hyperreference#1#2| +% lets |#2| being a hypertext reference to the anchor |#1|, +% (|#1| may not start with a |[|) +% \item |\hyperURL#1#2#3#4| +% lets |#4| being a hypertext reference to an external URL +% with type |#1|, domain |#2|, and document |#3|, i.e.\ +% to the URL |#1://#2/#3| +% \item |\labeltext#1#2| +% lets |#1| being the hypertext capable (\LaTeXe) reference to the text |#2| +% and prints |#2| +% \item |\noref[#1]#2| +% lets |#1| being a hypertext reference to the +% anchor defined by the \LaTeXe reference |#2| without printing the reference +% (|#1| is not optional!) +% \item |\ref[#1]#2| +% is the same as \LaTeXe's original |#1~\ref{#2}| except that +% the hypertext reference is provided from the complete +% |#1~\ref{#2}| instead of |\ref{#2}| only +% \item |\pageref[#1]#2| +% is the same as |\ref| except that we get a reference to the +% page number +% \item |\refcurrent#1| +% lets |#1| being a hypertext reference to the last numerical anchor +% that has been generated +% \item |\refnext#1| +% lets |#1| being a hypertext reference to the next numerical anchor +% that will be generated +% \end{itemize} +% +% \noindent The following macros are redefined when using the +% corresponding packages: +% \begin{itemize} +% \item for |xr|: +% \begin{itemize} +% \item |\externaldocument(#1)[#2]#3|, |\externaldocument[#1](#2)#3| +% are equivalent to the original |\externaldocument| of the +% |xr|--package except for the additional parameter surrounded +% by |(||)| determining the URL--address of the external +% document (the URL--type |file:| is added automagically) +% (default is |#3.dvi|) +% \end{itemize} +% \end{itemize} +% +% \noindent The following macros are provided when using the option |backcitepages| +% or |backcitesections| (definitions show default value): +% \begin{itemize} +% \item |\def\hyperbackcitepage{Cited on page~}| is the text preceeding a +% back reference to a single page number. +% \item |\def\hyperbackcitepages{Cited on pages~}| is the text preceeding a +% back reference to multiple page numbers. +% \item |\def\hyperbackcitesection{Cited in~}| is the text preceeding a +% back reference to a single section reference. +% \item |\def\hyperbackcitesections{Cited in~}| is the text preceeding a +% back reference to multiple section references. +% \item |\def\hyperbackcitenormalseparator{, }| is the text between two +% page numbers or section references (except for the last pair). +% \item |\def\hyperbackcitefinalseparatorpair{ and~}| is the text +% between the page numbers or section references if there are +% exactly two entries. +% \item |\def\hyperbackcitefinalseparatorlist{, and~}| is the text +% between the last pair page numbers or section references if +% there are more than two entries. +% \end{itemize} +% \section{Viewing Hyper\LaTeXe--documents} +% +% There are several methods that can be used to view the dvi--documents +% with html--marks resulting from using this package. +% +% \begin{itemize} +% \item For UNIX$^{\mathrm{TM}}$--systems with the graphical user interface +% |X| there is a modification of |xdvi| called |xhdvi| available at any CTAN-site. +% \item For systems running under NeXTSTEP$^{\mathrm{TM}}$ there exists a +% Hyper\TeX-capable modification of |TeXview|, called |HyperTeXview|. +% \item There exists a variant of |dvips| (called |dvihps|) translating hyperdvi--files to +% hyperps--files containing the html--marks when using the parameter |-z|. +% (|emtex| provides this feature with |dvips|).\par +% \noindent The resulting files can be viewed using a HyperPS-capable Postscript-viewer, +% (e.g. a hacked version of |ghostview| (for UNIX$^{\mathrm{TM}}$) or the actual |gsview| +% (for Windows$^{\mathrm{TM}}$)) +% \item Another way is to use |dvihps| to get a HyperPS--file ready to be handled by +% the Acrobat$^{\mathrm{TM}}$--distiller available from Adobe +% or by ghostscript's |pdfwriter|--output--device +% which both can translate hyperps--files to |pdf|--files that can be viewed +% using an Acrobat$^{\mathrm{TM}}$--reader or any other |pdf|--reader. +% \end{itemize} +% +% \section{Bugs} +% Currently there are only a few known problems. Unfortunately they +% cannot be avoided. You have to care about this: +% \begin{itemize} +% \item If you write your bibliographies with the |thebibliograpy|-environment +% by hand (not using bibtex) you may get an error message due to a +% command not matching its definition. This can be avoided by providing +% an empty line or a |\par| command at the end of each bibliographic entry +% (with |\bibitem|) including the last entry before |\end{thebibliography}|. +% \item If you include an index or glossary file into the current +% document you may get a message from \LaTeX{} like +% |Undefined control sequence.| $\ldots$ |\hyperpage|. +% This is due to you not using |\makeindex| or |\makeglossary| +% in the preamble. In this case just add the package option +% |indexcmds| when loading the hyper--package. +% \item In indexing commands you can't use |]| without surrounding braces. +% If you do, \TeX{} will parse the command in a wrong way. +% To get the sorting of the index right you therefore should use +% |\index{A[zzzzB@A{]}B}| instead of |\index{A]B}|. +% \item Similarly, a protected $\mid$, i.e.\ |"|$\mid$ is not handled +% correctly. Use a similar method as above to circumnavigate +% this problem. +% \end{itemize} +% \vskip0.5em +% \noindent There is another problem in connection with (a html-capable) |dvips| and paper formats different +% from |letter|. Apparently the positions for the |html|-specials are not computed correctly. The package +% provides a perl-script that allows to modify the positions of these specials. +% When using e.g.\ a4paper you have to call |perl dvi2pdf.pl -z "-s0,50" -nopdf <normal parameters to dvips>| +% to create an appropriate ps-file. +% Note, that the script |dvi2pdf.pl| has to be configured +% and has only been tested on a Windows$^{\mathrm{TM}}$ system. +% \vskip0.5em +% \noindent Other problems are not known so far. But surely there are some +% (otherwise the history would not be already that long). +% Thus, if you detect one please report it with the package version and +% a small example to\medskip +% +% | Michael Mehlich|\par +% | mmehlich@semdesigns.com| +% +% \section{Related Work, Acknowledgement} +% Sebastian Rahtz has written another package for adding +% HyperText--capabilities to \LaTeX{}. His package +% |hyperref| has been developed in parallel with this one +% and uses a slightly different realization for getting +% similar results. Some of the ideas found there have been +% added to this package, too. +% Thus, I have to give a special thank to him. +% +% Thanks also to Ulrich Fuchs for further suggestions. +% +% \StopEventually{} +% +% \section{History} +% \leavevmode +% \begin{tabularx}{\textwidth}{|c|l|X|r@{.}l|} +% \hline +% When & By & What & \multicolumn{2}{|c|}{V} +% \\ \hline\hline +% 1998/10/29 & Michael Mehlich & +% fixed macro name for |amsthm| +% & 4&2d +% \\ \hline +% 1998/10/28 & Michael Mehlich & +% corrected problem with wrong references produced +% & 4&2c +% \\ \hline +% 1997/09/22 & Michael Mehlich & +% corrected problem with |\uppercase| and |\lowercase| in internally used names +% & 4&2b +% \\ \hline +% 1997/09/15 & Michael Mehlich & +% corrected problem with |\noalign| in |eqnarray| environment +% & 4&2a +% \\ \hline +% 1997/08/28 & Michael Mehlich & +% corrected definition of new hyper anchor name to appear +% only locally within |\labeltext|\newline +% redefined |\label| for |amstex.sty|\newline +% added support for package |subeqnarray| +% & 4&2 +% \\ \hline +% 1997/08/24 & Michael Mehlich & +% reduced problems when adding or removing the |hyper|-package\newline +% patched around problem in interaction of option |fixhyperbox| with +% |dvips|\newline +% problem with undefined hyper references when using cross references +% provided by the package |xr| resolved +% & 4&1 +% \\ \hline +% 1997/07/14 & Michael Mehlich & +% corrected bug when creating cross-references between documents +% (bug was introduced when introducing resolution of nested html-marks) +% & 4&0h +% \\ \hline +% 1997/05/28 & Michael Mehlich & +% ensured hyper references for footnotes being created +% even if footnote is moved to the next page +% (but not further)\newline +% corrected marks introduced by the index environment |\theindex| +% in the classes |report| and |book|\newline +% changed mechanism for change flags +% & 4&0g +% \\ \hline +% 1997/05/07 & Michael Mehlich & +% redirected output for special hyper informations to main auxiliary file +% & 4&0f +% \\ \hline +% 1997/04/25 & Michael Mehlich & +% changed catcodes for reading the parameters of |\hyperURL| +% & 4&0e +% \\ \hline +% 1997/04/17 & Michael Mehlich & +% resolved some problem with the |cweb|-package modifications +% & 4&0d +% \\ \hline +% 1997/03/25 & Michael Mehlich & +% resolved problem with wrong footnote references when using package |footnpag| +% (this also corrects the former wrong naming of anchors for footnotes) +% & 4&0c +% \\ \hline +% 1997/03/21 & Michael Mehlich & +% removed bug in interaction of package with |cweb|'s chunk naming mechanism +% & 4&0b +% \\ \hline +% \end{tabularx} +% \newpage +% \begin{tabularx}{\textwidth}{|c|l|X|r@{.}l|} +% \hline +% When & By & What & \multicolumn{2}{|c|}{V} +% \\ \hline\hline +% 1997/03/08 & Michael Mehlich & +% added color for external URL added by |\hyperURL| +% & 4&0a +% \\ \hline +% 1997/03/01 & Michael Mehlich & +% added check for anchor existing before introducing reference to it\newline +% added check whether the anchors have changed beween two \LaTeXe\ runs\newline +% added handling of nested html-marks by unnesting (shit, this conflicts with +% the option |fixhyperbox|)\newline +% added option |fixhyperbox|\newline +% changed creation of anchor names for footnotes due to illegal names and +% duplicated names in the old version\newline +% improved extension package |backcites|\newline +% added handling of sorted citations for package |natbib|\newline +% changed macros for package |natbib|\newline +% added support for common package |fancyheadings| (this was needed for handling +% page references to page numbers when creating pages with empty headers +% and footers)\newline +% modified header and footer modification for inserting appropriate +% anchors and references +% & 4&0 +% \\ \hline +% 1997/02/03 & Michael Mehlich & +% allow |\makeindex| and |\makeglossary| to appear after including the package\newline +% corrected mishandling of |pagetop|\newline +% changed colors for references and anchors\newline +% added documentation about how to change colors for colored references and anchors +% & 3&0c +% \\ \hline +% 1997/01/12 & Michael Mehlich & +% corrected problem with loop occurring on even pages +% & 3&0b +% \\ \hline +% 1996/11/01 & Michael Mehlich & +% corrected problem with empty headings causing an overful hbox\newline +% bug of having two page anchors on empty pages in case of |pagetop| removed\newline +% adapted to current version of |natbib| +% & 3&0a +% \\ \hline +% \end{tabularx} +% \newpage +% \begin{tabularx}{\textwidth}{|c|l|X|r@{.}l|} +% \hline +% When & By & What & \multicolumn{2}{|c|}{V} +% \\ \hline\hline +% 1996/10/26 & Michael Mehlich & +% added code for bibliographic references with |natbib|\newline +% added possibility of let pagelinks go to the top of the page +% & 3&0 +% \\ \hline +% 1996/10/21 & Michael Mehlich & +% corrected problem with empty page style +% & 2&8a +% \\ \hline +% 1996/01/07 & Michael Mehlich & +% adapted to current version of latex +% & 2&8 +% \\ \hline +% 1995/12/19 & Michael Mehlich & +% adapted to current version of the cweb--package +% & 2&7b +% \\ \hline +% 1995/10/22 & Michael Mehlich & +% made reference commands robust +% & 2&7a +% \\ \hline +% 1995/09/24 & Michael Mehlich & +% added support for the \CWEB\ document class +% & 2&7 +% \\ \hline +% 1995/07/13 & Michael Mehlich & +% |\hyper@next| changed to |\fragilerefnext| to avoid problems when writing +% the command into the |.toc|--file +% & 2&6a +% \\ \hline +% 1995/07/06 & Michael Mehlich & +% |\hyperbackcite| occurred mistakenly in each file\newline +% bug fix in redefinition of |theindex|-environment in |doc.hyp|\newline +% handling of footnotes corrected\newline +% modified |\@xeqncr| instead of |\@eqncr|\newline +% adapted redefinition of captions for |longtable| to current +% version of |longtable| +% & 2&6 +% \\ \hline +% 1995/07/04 & Michael Mehlich & +% correction of optional parameter of |\\| in eqnarray--environment +% mistakenly ignored +% & 2&5d +% \\ \hline +% 1995/06/14 & Michael Mehlich & +% corrected |\hyper@oddfoot| +% & 2&5c +% \\ \hline +% 1995/05/29 & Michael Mehlich & +% added support for contribution |harvard.hyp|, +% changed automatical uploading of packages to +% conditional uploading (tests if the package +% really exists) +% & 2&5b +% \\ \hline +% 1995/05/23 & Michael Mehlich & +% changed wrong page numbers for certain +% document classes +% & 2&5a +% \\ \hline +% 1995/05/10 & Michael Mehlich & +% added support for backcites +% &2&5 +% \\ \hline +% 1995/05/08 & Michael Mehlich & +% internal handling of references to pages simplified\newline +% bug in |xr.hyp| fixed\newline +% anchor on empty pages added +% & 2&4c +% \\ \hline +% 1995/05/07 & Michael Mehlich & +% let |\item| accept |]| in optional argument +% & 2&4b +% \\ \hline +% \end{tabularx} +% \newpage +% \begin{tabularx}{\textwidth}{|c|l|X|r@{.}l|} +% \hline +% When & By & What & \multicolumn{2}{|c|}{V} +% \\ \hline\hline +% 1995/04/20 & Michael Mehlich & +% added new option |indexcmds| +% & 2&4a +% \\ \hline +% 1995/04/20 & Michael Mehlich & +% added support for |amstex| +% & 2&4 +% \\ \hline +% 1995/04/18 & Michael Mehlich & +% corrected bug in index (reported by Ulrich Fuchs) +% & 2&3a +% \\ \hline +% 1995/02/12 & Michael Mehlich & +% support for package |xr| added\newline +% handling of options improved +% & 2&3 +% \\ \hline +% 1995/02/11 & Michael Mehlich & +% definition of |\label| corrected (bug introduced at 1995/01/31) +% & 2&2b +% \\ \hline +% 1995/02/02 & Michael Mehlich & +% macros for |amsthm| changed according to new definition in amslatex +% & 2&2a +% \\ \hline +% 1995/02/01 & Michael Mehlich & +% support for package |amslatex| added\newline +% support for package |longtable| added +% & 2&2 +% \\ \hline +% 1995/01/31 & Michael Mehlich & +% support for package |theorem| added\newline +% catcodes of \verb+|+, |@|, and |!| for parsing the parameters of +% |\index| and |\glossary| changed\newline +% |\@makecaption| modified\newline +% hypertext references in |eqnarray| corrected\newline +% redefinition of |\label| changed +% & 2&1 +% \\ \hline +% 1995/01/30 & Michael Mehlich & +% handling of series of page numbers for index/glossary added\newline +% |\protected@write| stopped from inserting an extra space +% & 2&0b +% \\ \hline +% 1995/01/29 & Michael Mehlich & +% references from headers to sections for bibliography, index, glossary, and +% table of contents added +% & 2&0a +% \\ \hline +% 1995/01/26 & Michael Mehlich & +% options to be handled are determined automagically now\newline +% protected the anchor and reference adding macros instead of {\tt"}\newline +% some internal algorithms changed\newline +% some macro--names changed +% & 2&0 +% \\ \hline +% 1995/01/25 & Michael Mehlich & handling of index and glossary added & 1&3 +% \\ \hline +% 1995/01/24 & Michael Mehlich & +% handling of options changed\newline +% color support for anchors and references added +% & 1&2 +% \\ \hline +% 1995/01/24 & Michael Mehlich & +% |\noref| added\newline +% bug in writing wrong page numbers to auxiliary files removed +% & 1&1 +% \\ \hline +% 1995/01/20 & Michael Mehlich & +% protected {\tt"} for compatibility with the package |german.sty| +% & 1&0g +% \\ \hline +% 1995/01/12 & Michael Mehlich & +% first official version +% & 1&0 +% \\ \hline +% \end{tabularx} +% +% \clearpage +% +% \section{The Realization} +% +% \subsection{The Package Header} +% We need a version of \LaTeX2e{} dated with June 1, 1995 or newer. +% Thus, we just demand it. +% \begin{macrocode} +%<*hyper> +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +% \end{macrocode} +% Now we have to introduce ourself. +% \begin{macrocode} +\ProvidesPackage{hyper}[\filedate\space HyperLaTeX2e extension] +% \end{macrocode} +% +% \subsection{Special Characters} +% First of all let us reserve some characters which are important and are +% not preserved by every other package. +% \begin{macrocode} +\bgroup + \catcode`\!00\relax + \catcode`\"12\relax + !catcode`!\12!relax + !gdef!hyper@quote{"} + !gdef!hyper@backslash{\} + !global!edef!hyper@hash{!string#} + !global!edef!hyper@tilde{!string~} +!egroup +% \end{macrocode} +% For compatibility with other packages this may need to be extended. +% But for now we suppose this being sufficient. +% +% \subsection{The Basic Anchor/Reference-Entries} +% Let us set the output channel for special hyper informations first. +% \begin{macrocode} +\AtBeginDocument{\let\hyper@auxout\@auxout} +% \end{macrocode} +% We have to define some macros that allow us to insert the hypertext marks +% for anchors and references into the resulting dvi-file. This can be +% done by using the |\special|--macro.\par +% \noindent But before introducing them, we need some auxiliaries that allow +% us to write the hyper anchors to the auxiliary file and reread them at +% program start. This way we can check, whether we use a reference to an +% existing anchor; thus we can avoid introducing invalid references. +% This mechanism can additionally be used to check whether the hyper anchors +% may have changed between two \LaTeXe\ runs.\par +% \noindent This is also a good place to recheck whether there have been some +% undefined or multiply defined hyper anchors or forwarded references +% used in hyper references. +% \begin{macrocode} +\newcount\hyper@changed +\global\hyper@changed=0 +\newcount\hyper@cnt%careful, this is used as a temporary counter in various places +\def\hyper@change#1{%set change value (powers of 2 only), in use: 1,2,4,8 + \hyper@cnt\hyper@changed\relax% + \divide\hyper@cnt#1\relax% + \ifodd\hyper@cnt\else% + \global\advance\hyper@changed#1\relax% + \fi% +} +\def\newhyper#1#2{% + \bgroup% + \def\uppercase{<UPPERCASE>}% + \def\lowercase{<LOWERCASE>}% + \expandafter\ifx\csname hyper@#1\endcsname\relax\else% + \hyper@change2\relax% + \PackageWarningNoLine{hyper}% + {Hyper anchor #1 multiply defined}% + \fi% + \expandafter\global\expandafter\def\csname hyper@#1\endcsname{#2}% + \egroup% +} +\def\newhyper@check#1#2{% + \def\reserved@a{#2}% + \bgroup% + \def\uppercase{<UPPERCASE>}% + \def\lowercase{<LOWERCASE>}% + \expandafter\ifx\csname hyper@#1\endcsname\reserved@a\else% + \expandafter\ifx\csname hyper@new@#1\endcsname\reserved@a\else% + \global\hyper@change4\relax% + \fi% + \fi% + \egroup% +} +\let\hyper@enddocument\enddocument +\def\hyper@check@end{% + \ifodd\hyper@changed%1 + \PackageWarningNoLine{hyper}{There were undefined hyper references}% + \fi% + \divide\hyper@changed2\relax% + \ifodd\hyper@changed%2 + \PackageWarningNoLine{hyper}% + {There were multiply defined hyper anchors}% + \fi% + \divide\hyper@changed2\relax% + \ifodd\hyper@changed%4 + \PackageWarningNoLine{hyper}% + {Hyper anchor(s) may have changed.\MessageBreak + Rerun to get hyper references right}% + \fi% + \divide\hyper@changed2\relax% + \ifodd\hyper@changed%8 + \PackageWarningNoLine{hyper}% + {Footnote hyper reference(s) may have been forwarded\MessageBreak + to next page.\MessageBreak + Check result to ensure this being correct.\MessageBreak + If not rerun to get footnote hyper references right}% + \fi% +} +\def\enddocument{% + \let\hyper@@end\@@end% + \def\@@end{\hyper@check@end\hyper@@end}% + \let\newhyper\newhyper@check% + \hyper@enddocument% +} +\def\hyper@to@aux#1{% + \bgroup% + \def\uppercase{<UPPERCASE>}% + \def\lowercase{<LOWERCASE>}% + \expandafter\ifx\csname hyper@#1\endcsname\relax% + \expandafter\ifx\csname hyper@new@#1\endcsname\relax% + \expandafter\global% + \expandafter\expandafter\expandafter\def\csname hyper@new@#1\endcsname% + {{\@currentlabel}{\thepage}}% + \fi% + \fi% + \@bsphack% + \protected@write% + \hyper@auxout% + {}% + {\string\newhyper% + {#1}% + {{\@currentlabel}{\thepage}}% + }% + \@esphack% + \egroup% +} +% \end{macrocode} +% \noindent The macros |\hyperreference| |\hyperpagereference| and insert a html-reference +% to an internal label except when the first parameter begins with |[|. Then the +% parameter must have the form |[#1][#2]| where |#1| is an external URL and +% |#2| an anchor within this URL. This is used when generating cross references +% between documents.\par +% \noindent The whole stuff is complicated by two problems: We have to avoid +% nesting of the html-markups in the dvi-file and we have to tell |dvips| about the +% right dimension of the box by modifying the positions of the specials from which +% |dvips| gets the bounding box for a hyper reference (The latter one is optionally +% done when passing the corresponding parameter to the package). +% \begin{macrocode} +\newbox\hyper@box@text +\newbox\hyper@box@ref +\newdimen\hyper@fixdim +\newif\if@hyper@is@active +\@hyper@is@activefalse +\def\hyper@html{html:} +\bgroup + \catcode`\<12\catcode`\>12\relax% + \catcode`\:12\catcode`\=12\catcode`\/12\relax% + \gdef\hyper{% + \def\hyper@unnested@special##1##2##3{% + \special{\hyper@html##1}##3\special{\hyper@html##2}% + }% + \def\hyper@unnested@special@anchor@nofix##1##2##3{% + \special{\hyper@html##1}\hyper@anchor@color{##3}\special{\hyper@html##2}% + }% + \def\hyper@unnested@special@reference@nofix##1##2##3{% + \special{\hyper@html##1}\hyper@ref@color{##3}\special{\hyper@html##2}% + }% + \def\hyper@unnested@special##1##2{% + \hyper@fixdim\ht\hyper@box@text% + \advance\hyper@fixdim\dp\hyper@box@text% + \advance\hyper@fixdim-8pt% + \setbox\hyper@box@ref=\hbox{% + \parindent0pt\leftskip0pt\rightskip0pt% + \leftmargin0pt\rightmargin\wd\hyper@box@text\advance\rightmargin0.5pt% + \linewidth\rightmargin\textwidth\rightmargin% + \noindent\vbox{% + \hrule height \hyper@fixdim width 0pt% + \special{\hyper@html##1}\hbox to\linewidth{\hfill}% + \hrule height -\hyper@fixdim width 0pt% + \hbox to\linewidth{\hfill\special{\hyper@html##2}}% + \hrule height 0pt width 0pt% + }% + }% + \ht\hyper@box@ref0pt% + \dp\hyper@box@ref0pt% + \wd\hyper@box@ref0pt% + \hyper@fixdim\ht\hyper@box@text% + \advance\hyper@fixdim-8pt% + \hbox{\raise\hyper@fixdim\copy\hyper@box@ref\copy\hyper@box@text}% + \setbox\hyper@box@ref=\hbox{}% + }% + \def\hyper@unnested@special@anchor@fix##1##2##3{% + \setbox\hyper@box@text=\hbox{\hyper@anchor@color{##3}}% + \hyper@unnested@special{##1}{##2}% + \setbox\hyper@box@text=\hbox{}% + }% + \def\hyper@unnested@special@reference@fix##1##2##3{% + \setbox\hyper@box@text=\hbox{\hyper@ref@color{##3}}% + \hyper@unnested@special{##1}{##2}% + \setbox\hyper@box@text=\hbox{}% + } + \let\hyper@unnested@special@reference\hyper@unnested@special@reference@nofix% + \let\hyper@unnested@special@anchor\hyper@unnested@special@anchor@nofix% + \def\hyper@nested@special##1##2##3##4{% + \ifx\hyper@unnested@special@reference\hyper@unnested@special@reference@nofix% + \if@hyper@is@active% + \expandafter\expandafter\expandafter% + \special\expandafter\@firstoftwo\hyper@special@last% + {\def\hyper@special@last{{{\hyper@html##4}}{{\hyper@html##2}}}% + ##1{##2}{##4}{##3}% + }% + \expandafter\expandafter\expandafter% + \special\expandafter\@secondoftwo\hyper@special@last% + \else% + \def\hyper@special@last{{{\hyper@html##4}}{{\hyper@html##2}}}% + \@hyper@is@activetrue\relax% + ##1{##2}{##4}{##3}% + \@hyper@is@activefalse\relax% + \fi% + \else% + \if@hyper@is@active% + ##1{##2}{##4}{##3}% + \else% + \@hyper@is@activetrue\relax% + ##1{##2}{##4}{##3}% + \@hyper@is@activefalse\relax% + \fi% + \fi% + }% + \def\hyper@special@anchor{\hyper@nested@special\hyper@unnested@special@anchor} + \def\hyper@special@reference{\hyper@nested@special\hyper@unnested@special@reference} + \def\f@hyper@ref@ext[##1][##2][##3]\end@hyper@ref##4{% + \ifvmode\leavevmode\fi% + \hyper@special@reference% + {<a href=\hyper@quote##1##2\hyper@hash##3\hyper@quote>}% + {##4}% + {</a>}% + }% + \def\hyper@check@fn##1.##2.##3.##4\hyper@check@fn{% + \def\hyper@tmpa{fn}%mark for link to footnote + \def\hyper@tmpb{##1}% + \ifx\hyper@tmpa\hyper@tmpb{% + \ifx?##3\relax% + \global\let\hyper@forwarded@fn\@empty% + \else% + \hyper@cnt##3\relax% fetch page + \advance\hyper@cnt1\relax% advance page by one + \global\edef\hyper@forwarded@fn{fn.##2.\the\hyper@cnt}%create new link + \fi% + }% + \else% + \global\let\hyper@forwarded@fn\@empty% + \fi% + }% + \let\hyper@thepage\thepage% + \def\f@hyper@ref@int##1\end@hyper@ref##2{% + \ifvmode\leavevmode\fi% + \expandafter\ifx\csname hyper@##1\endcsname\relax% + \expandafter\ifx\csname hyper@new@##1\endcsname\relax% + \hyper@check@fn##1...\hyper@check@fn% + \ifx\hyper@forwarded@fn\@empty% + \PackageWarning{hyper}% + {Hyper reference `##1' for `##2' on page \hyper@thepage\space undefined}% + \hyper@change1\relax% + \hyper@undef@color{##2}% + \else% + \expandafter\ifx\csname hyper@\hyper@forwarded@fn\endcsname\relax% + \expandafter\ifx\csname hyper@new@\hyper@forwarded@fn\endcsname\relax% + \PackageWarning{hyper}% + {Hyper reference `##1' for `##2' % + on page \hyper@thepage\space undefined}% + \hyper@change1\relax% + \hyper@undef@color{##2}% + \else% + \hyper@change8\relax% + \PackageWarning{hyper}% + {Hyper reference `##1' for `##2' on page \hyper@thepage\space% + forwarded to `\hyper@forwarded@fn'}% + \hyper@special@reference% + {<a href=\hyper@quote\hyper@hash\hyper@forwarded@fn\hyper@quote>}% + {##2}% + {</a>}% + \fi% + \else% + \hyper@change8\relax% + \PackageWarning{hyper}% + {Hyper reference `##1' for `##2' on page \hyper@thepage\space% + forwarded to `\hyper@forwarded@fn'}% + \hyper@special@reference% + {<a href=\hyper@quote\hyper@hash\hyper@forwarded@fn\hyper@quote>}% + {##2}% + {</a>}% + \fi% + \fi% + \else% + \hyper@special@reference% + {<a href=\hyper@quote\hyper@hash##1\hyper@quote>}% + {##2}% + {</a>}% + \fi% + \else% + \hyper@special@reference% + {<a href=\hyper@quote\hyper@hash##1\hyper@quote>}% + {##2}% + {</a>}% + \fi% + }% + \def\f@hyper@ref{% + \@ifnextchar[{\f@hyper@ref@ext[]}{\f@hyper@ref@int}% + }% + \def\fragilehyperreference##1{% + \expandafter\expandafter\expandafter\f@hyper@ref##1\end@hyper@ref% + }% + \def\f@hyper@page@ref{% + \@ifnextchar[{\f@hyper@ref@page@ext[page.]}{\f@hyper@ref@int page.}% + }% + \def\fragilehyperpagereference##1{% + \expandafter\expandafter\expandafter% + \f@hyper@page@ref##1\end@hyper@ref% + }% + \def\fragilehyperanchor##1##2{% + \ifvmode\leavevmode\fi% + \hyper@special@anchor% + {<a name=\hyper@quote##1\hyper@quote>}% + {\hyper@to@aux{##1}% + ##2% + }% + {</a>}% + }% + \def\fragileblindhyperanchor##1{% + \hyper@special@anchor% + {<a name=\hyper@quote##1\hyper@quote>}% + {\hyper@to@aux{##1}}% + {</a>}% + }% + \def\fragilehyperURL##1##2##3##4{% + \ifvmode\leavevmode\fi% + \def\hyper@tmp{##4}% + \def\hyper@tmpa{##1}% + \def\hyper@tmpb{##2}% + \def\hyper@tmpc{##3}% + \ifx\hyper@tmp\@empty% + % + \else\ifx\hyper@tmpa\@empty% + \ifx\hyper@tmpb\@empty% + \ifx\hyper@tmpc\@empty% + {##4}% + \else% + \hyper@special@reference% + {<a href=\hyper@quote##3\hyper@quote>}% + {##4}% + {</a>}% + \fi% + \else\ifx\hyper@tmpc\@empty% + \hyper@special@reference% + {<a href=\hyper@quote//##2/\hyper@quote>}% + {##4}% + {</a>}% + \else% + \hyper@special@reference% + {<a href=\hyper@quote//##2/##3\hyper@quote>}% + {##4}% + {</a>}% + \fi\fi% + \else\ifx\hyper@tmpb\@empty% + \ifx\hyper@tmpc\@empty% + {##4}% + \else% + \hyper@special@reference% + {<a href=\hyper@quote##1:##3\hyper@quote>}% + {##4}% + {</a>}% + \fi% + \else\ifx\hyper@tmpc\@empty% + \hyper@special@reference% + {<a href=\hyper@quote##1://##2/\hyper@quote>}% + {##4}% + {</a>}% + \else% + \hyper@special@reference% + {<a href=\hyper@quote##1://##2/##3\hyper@quote>}% + {##4}% + {</a>}% + \fi\fi\fi\fi% + }% + } +\egroup +\hyper +% \end{macrocode} +% Sometimes we need this package without being allowed to insert +% the hypertext marks into the dvi--file. Note, thate |\hyper@fix| is +% defined for the sole purpose of having the same \TeX-output behaviour +% regardless whether we create or do not create hypertext markups. +% \begin{macrocode} +\def\nohyper{% + \def\hyper@fix##1{% + \ifx\hyper@unnested@special@reference\hyper@unnested@special@reference@nofix% + ##1% + \else% + \hbox{##1}% + \fi% + } + \def\fragilehyperreference##1##2{% + \ifvmode\leavevmode\fi\hyper@fix{\hyper@ref@color{##2}}% + }% + \def\fragilehyperpagereference##1##2{% + \ifvmode\leavevmode\fi\hyper@fix{\hyper@ref@color{##2}}% + }% + \def\fragilehyperanchor##1##2{% + \ifvmode\leavevmode\fi\hyper@anchor@color{##2}% + }% + \def\fragileblindhyperanchor##1{}% + \def\fragilehyperURL##1##2##3##4{% + \ifvmode\leavevmode\fi\hyper@fix{\hyper@ref@color{##4}}% + }% +} +% \end{macrocode} +% Now let's protect the fragile commands. +% \begin{macrocode} +\def\hyperreference{\protect\fragilehyperreference} +\def\hyperpagereference{\protect\fragilehyperpagereference} +\def\hyperanchor{\protect\fragilehyperanchor} +\def\blindhyperanchor{\protect\fragileblindhyperanchor} +\def\fragileChyperURL{% + \bgroup% + \catcode`\<12\catcode`\>12\catcode`\"12\relax% + \catcode`\:12\catcode`\=12\catcode`\/12\relax% + \catcode`\#12\catcode`\~12\relax%\catcode`\%12\relax% + \finish@hyperURL% +} +\def\finish@hyperURL#1#2#3#4{% + \fragilehyperURL{#1}{#2}{#3}{#4}% + \egroup% +} +\def\hyperURL{\protect\fragileChyperURL} +% \end{macrocode} +% +% \subsection{Colored Anchors/References} +% Above we have used three macros |\hyper@ref@color|, |\hyper@undef@color|, and |\hyper@anchor@color| +% with which we can modify the text that is printed to the document. +% As their name indicates we want to use them to color the anchors resp.\ +% references. Hence we should define some variants of these macros.\par +% \noindent The first variant prints the text in different colors. +% \begin{macrocode} +\def\hyper@color{% + \definecolor{refcolor}{rgb}{0,0,1}% + \definecolor{undefrefcolor}{rgb}{1,0,0}% + \definecolor{anchorcolor}{rgb}{0,0.75,0.75}% + \def\hyper@ref@color##1{\textcolor{refcolor}{##1}}% + \def\hyper@undef@color##1{\textcolor{undefrefcolor}{##1}}% + \def\hyper@anchor@color##1{\textcolor{anchorcolor}{##1}}% +} +% \end{macrocode} +% If we do not have colors we may use gray text instead. +% \begin{macrocode} +\def\hyper@gray{% + \definecolor{refcolor}{gray}{0.75}% + \definecolor{undefrefcolor}{gray}{0.25}% + \definecolor{anchorcolor}{gray}{0.5}% + \def\hyper@ref@color##1{\textcolor{refcolor}{##1}}% + \def\hyper@undef@color##1{\textcolor{undefrefcolor}{##1}}% + \def\hyper@anchor@color##1{\textcolor{anchorcolor}{##1}}% +} +% \end{macrocode} +% In ready to print documents we should not use these options but print +% the text in ordinary black. This is also the default definition. +% \begin{macrocode} +\def\hyper@black{% + \def\hyper@ref@color##1{##1}% + \def\hyper@undef@color##1{##1}% + \def\hyper@anchor@color##1{##1}% +} +\hyper@black +% \end{macrocode} +% +% \subsection{Automatic Generation of Anchor Names} +% As we want to insert hypertext marks automagically we need a service that +% provides new names for anchors. The simplest solution is to let the +% name be a natural number.\par +% \noindent Thus we need an initialization for providing them. +% \begin{macrocode} +\newcount\hypercount +\hypercount=0\relax +\def\@currenthyper{} +% \end{macrocode} +% Now we can compute the next anchor from the last one generated. +% \begin{macrocode} +\def\hyper@setcurrent{% + \global\advance\hypercount1\relax% + \edef\@currenthyper{\the\hypercount}% +}% +\def\hyper@settype#1{% +\edef\@currenthypertype{#1}% +}% +% \end{macrocode} +% The automatic generation of anchor names leads to a little problem. +% We have to ensure that |\@currenthyper| is expanded at an appropriate +% time. Thus we define a macro that allow us to get an expanded +% hypertext reference that follows a not yet expanded +% token list. +% \begin{macrocode} +\def\hyper@ref@toggle#1#2#3{#3[\hyperreference{#1}{#2}]} +\def\ref@by@expanded@hyper#1\end@hyper{{#1}} +\def\callwithexpandedhyperref#1#2{% + \expandafter\expandafter\expandafter\hyper@ref@toggle% + \expandafter\ref@by@expanded@hyper\@currenthyper\end@hyper% + {#2}{#1}% +} +% \end{macrocode} +% +% \subsection{HyperText Cross--Referencing for \LaTeXe} +% For a replacement of \LaTeXe's cross--referencing features we need to +% redefine the commands |\label| and |\ref|.\par +% \noindent Let us first define a label command for writing the current +% hypertext reference to the |.aux|--file. It must print four components +% of a label: the hypertext--type, the hypertext--anchor, the \LaTeXe--anchor, +% and the \LaTeXe--page. This is due to the fact that we need to know not only +% the stuff we reference to but also the internal name of the anchor. +% \begin{macrocode} +\def\hyperlabel#1{\@bsphack + \protected@write\hyper@auxout{}% + {\string\newlabel{#1}% + {{\@currenthypertype}{\@currenthyper}{\@currentlabel}{\thepage}}}% + \@esphack} +% \end{macrocode} +% Now we need some auxiliary macros to be able to select each of the three +% parts of the second argument of |\newlabel| that has been written to the +% |.aux|--file. Note, that the third component may contain informations +% about the URL of an external document (for cross referencing between +% documents) that has to be stripped of a page +% number before printing it. +% \begin{macrocode} +\def\hyper@secondoffour#1#2#3#4{#2} +\def\hyper@thirdoffour#1#2#3#4{#3} +\def\hyper@forthoffour#1#2#3#4{#4} +\def\hyper@snd@forthoffour[#1][#2]\end@hyper{#2} +\def\hyper@this@forthoffour#1\end@hyper{#1} +\def\hyper@test@forthoffour{% + \@ifnextchar[{\hyper@snd@forthoffour}{\hyper@this@forthoffour}% +} +\def\hyper@page@forthoffour#1#2#3#4{% + \expandafter\hyper@test@forthoffour#4\end@hyper% +} +% \end{macrocode} +% When setting a reference to an anchor we also have to add the corresponding +% hypertext link into the dvi-file. +% \begin{macrocode} +\let\hyper@thepage\thepage +\def\hyper@setref#1#2#3#4{% + \ifx#1\relax% + \protect\G@refundefinedtrue% + #4\nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference `#3' on page \hyper@thepage \space undefined}% + \else% + \edef\hyper@tmp{\expandafter\hyper@secondoffour#1}% + \ifx\hyper@tmp\@empty% + \ifx#2\hyper@secondoffour% + #4\null% + \else\ifx#2\hyper@thirdoffour% + #4\expandafter#2#1\null% + \else% + #4\expandafter#2#1\null% + \fi\fi% + \else% + \ifx#2\hyper@secondoffour% + \hyperreference{\expandafter\hyper@secondoffour#1}{#4}\null% + \else\ifx#2\hyper@thirdoffour% + \hyperreference% + {\expandafter\hyper@secondoffour#1}% + {#4\expandafter#2#1\null}\null% + \else% + \hyperpagereference% + {\expandafter\hyper@forthoffour#1}% + {#4\expandafter#2#1\null}\null% + \fi\fi% + \fi% + \fi% +} +% \end{macrocode} +% Proceeding from this we can define three macros |\hypernoref|, |\hyperref|, +% and |\hyperpageref| that correspond to the same \LaTeXe--macros where the +% hyper does not occur. But we want to do a little bit more. Thus an +% additional optional argument may be given to these macros to allow +% the user to reference from a whole text and not only from the number +% to the anchor. +% \begin{macrocode} +\def\@@hypernoref[#1]#2{% + \expandafter\hyper@setref\csname r@#2\endcsname% + \hyper@secondoffour{#2}{#1}% +} +\def\@hypernoref[#1]{\@@hypernoref[#1]} +\def\hypernoref{\@ifnextchar[{\@hypernoref}{\@@hypernoref[]}} +\def\@@hyperref[#1]#2{% + \expandafter\hyper@setref\csname r@#2\endcsname% + \hyper@thirdoffour{#2}{#1}% +} +\def\@hyperref[#1]{\@@hyperref[#1~]} +\def\hyperref{\@ifnextchar[{\@hyperref}{\@@hyperref[]}} +\def\@@hyperpageref[#1]#2{% + \expandafter\hyper@setref\csname r@#2\endcsname% + \hyper@page@forthoffour{#2}{#1}% +} +\def\@hyperpageref[#1]{\@@hyperpageref[#1~]} +\def\hyperpageref{\@ifnextchar[{\@hyperpageref}{\@@hyperpageref[]}} +% \end{macrocode} +% Now let's patch \LaTeXe's ref/label-system: +% \begin{macrocode} +\let\label\hyperlabel +\def\noref{\protect\hypernoref} +\def\ref{\protect\hyperref} +\def\pageref{\protect\hyperpageref} +% \end{macrocode} +% Up to now we only can reference to anchors but haven't yet defined some. +% This will be done in many of the following subsections. +% \subsection{Other Cross--Referencing Features} +% Though \LaTeXe{} has a very good reference mechanism this is not enough +% for hypertext documents. The user should be able to add an anchor to +% a text of his own choice. +% \begin{macrocode} +\def\labeltext#1#2{% + \bgroup% + \hyper@setcurrent% + \hyper@settype{text}% + \def\@currentlabel{#2}% + \label{#1}% + \hyperanchor{\@currenthyper}{#2}% + \egroup% +} +% \end{macrocode} +% But that is not enough. Some of the macros of this package define anchors +% which cannot be caught by a |\label| command. But then it is the current or +% the next anchor generated. The following macros will allow us to reference +% to them: +% \begin{macrocode} +\def\refcurrent#1{\hyperreference{\@currenthyper}{#1}} +\def\fragilerefnext#1#2{\bgroup% + \hypercount=#1\relax\advance\hypercount1\relax% + \hyperreference{\the\hypercount}{#2}% +\egroup} +\def\refnext#1{\protect\fragilerefnext{\the\hypercount}{#1}} +% \end{macrocode} +% This is especially usefull for inserting links from the table of contents +% to an unnumbered section like e.g.\ the references of a document.\par +% \noindent But wait, there is more. \LaTeXe{} not only uses |\ref| and +% |\label| for it's referencing mechanism but also |\refstepcounter| to +% determine to what the next |\label| should reference. +% This has to be reflected for the hypertext stuff. +% \begin{macrocode} +\let\hyper@refstepcounter\refstepcounter +\def\refstepcounter{\hyper@setcurrent\hyper@settype{counter}\hyper@refstepcounter} +% \end{macrocode} +% As we will patch some latex internals below we also need +% a macro that allow us to forget the next |\refstepcounter|. +% \begin{macrocode} +\def\ignore@next@refstepcounter{% + \def\refstepcounter##1{% + \def\refstepcounter{\hyper@setcurrent\hyper@settype{counter}\hyper@refstepcounter}% + }% +} +% \end{macrocode} +% +% \subsection{Handling Page Numbers} +% We want to refer from the pages in the table of contents +% to the corresponding page. Thus we have to recall the necessary +% information when printing the table. +% \begin{macrocode} +\let\hyper@contentsline\contentsline +\def\contentsline#1#2#3{% + \hyper@contentsline{#1}{#2}{\hyperpagereference{#3}{#3}}% +} +% \end{macrocode} +% The same is valid for indices and glossaries. But they are more +% problematic. Hence we will handle them in a subsection of its own.\par +% \noindent So far the result is a couple of references from page numbers +% to pages. But we haven't defined the anchors they refer to.\par +% \noindent To resolve this we have to modify headers and footers of +% a page. This can be done for an arbitrary page style when we change +% (misuse!) |\@begindvi|.\par +% \noindent Let's provide to different styles for this purpose, one allowing +% jumps to the page number, and one allowing jumps to the top of the page. +% In the latter case we let the page numbers in the headers and footers refer +% to the top of the page. +% \begin{macrocode} +\let\hyper@thepage\thepage +\def\hyper@anchorpage{% + \fragilehyperanchor{page.\hyper@thepage}{\hyper@thepage}% +} +\def\hyper@referencepage{% + \fragilehyperreference{page.\hyper@thepage}{\hyper@thepage}% +} +\def\hyper@empty{\@empty} +\def\hyper@evenhead{\@evenhead} +\def\hyper@oddhead{\@oddhead} +\def\hyper@evenfoot{\@evenfoot} +\def\hyper@oddfoot{\@oddfoot} +\def\hyper@modifyheadfoot@pagenumber{% + \let\hyper@thehead\@thehead% + \ifx\hyper@thehead\hyper@oddhead\let\hyper@thehead\@oddhead\fi% + \ifx\hyper@thehead\hyper@evenhead\let\hyper@thehead\@evenhead\fi% + \let\hyper@thefoot\@thefoot% + \ifx\hyper@thefoot\hyper@oddfoot\let\hyper@thefoot\@oddfoot\fi% + \ifx\hyper@thefoot\hyper@evenfoot\let\hyper@thefoot\@evenfoot\fi% + \def\@thehead{% + \ifnum\ifnum\ifx\hyper@thehead\@empty1\else0\fi% + \ifx\hyper@thehead\hyper@empty1\else0\fi% + >0 0\else1\fi% + \ifnum\ifx\hyper@thefoot\@empty1\else0\fi% + \ifx\hyper@thefoot\hyper@empty1\else0\fi% + >0 0\else1\fi% + >0\relax% + \else% + \blindhyperanchor{page.\thepage}% + \fi% + \let\hyper@thepage\thepage% + \let\thepage\hyper@anchorpage% + \ifx\hyper@thehead\@empty% + \hfil% + \else\ifx\hyper@thehead\hyper@empty% + \hfil% + \else% + \hyper@thehead% + \fi\fi% + }% + \def\@thefoot{% + \let\hyper@thepage\thepage% + \let\thepage\hyper@anchorpage% + \ifx\hyper@thefoot\@empty% + \hfil% + \else\ifx\hyper@thefoot\hyper@empty% + \hfil% + \else% + \hyper@thefoot% + \fi\fi% + }% +} +\def\hyper@modifyheadfoot@pagetop{% + \let\hyper@thehead\@thehead% + \ifx\hyper@thehead\hyper@oddhead\let\hyper@thehead\@oddhead\fi% + \ifx\hyper@thehead\hyper@evenhead\let\hyper@thehead\@evenhead\fi% + \let\hyper@thefoot\@thefoot% + \ifx\hyper@thefoot\hyper@oddfoot\let\hyper@thefoot\@oddfoot\fi% + \ifx\hyper@thefoot\hyper@evenfoot\let\hyper@thefoot\@evenfoot\fi% + \def\@thehead{% + \blindhyperanchor{page.\thepage}% + \let\hyper@thepage\thepage% + \let\thepage\hyper@referencepage% + \ifx\hyper@thehead\@empty% + \hfil% + \else\ifx\hyper@thehead\hyper@empty% + \hfil% + \else% + \hyper@thehead% + \fi\fi% + }% + \def\@thefoot{% + \let\hyper@thepage\thepage% + \let\thepage\hyper@referencepage% + \ifx\hyper@thefoot\@empty% + \hfil% + \else\ifx\hyper@thefoot\hyper@empty% + \hfil% + \else% + \hyper@thefoot% + \fi\fi% + }% +} +\let\hyper@begindvi\@begindvi +\def\@begindvi{% + \hyper@begindvi% + \hyper@modifyheadfoot% + \global\let\@begindvi\hyper@modifyheadfoot% +} +% \end{macrocode} +% Hopefully we do not use a page number twice in headers or footers if we want to jump to the pagenumber.\par +% \noindent We use pagenumbers as the default position for page anchors. +% \begin{macrocode} +\let\hyper@modifyheadfoot\hyper@modifyheadfoot@pagenumber +% \end{macrocode} +% \subsection{Table of Contents} +% In the subsection ``Handling of Pages'' we already have inserted +% references from the page number to the corresponding page. +% Now we want to add further references from the title of an entry +% in the table of contents to the corresponding text within the +% document.\par +% \noindent To do that we have to modify the corresponding sectioning commands. +% \begin{macrocode} +\let\hyper@sect\@sect +\def\@sect#1#2#3#4#5#6[#7]#8{% + \ifnum #2>\c@secnumdepth% + \hyper@setcurrent% + \else% + \refstepcounter{#1}% + \ignore@next@refstepcounter% + \fi% + \hyper@settype{#1}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref% + {\hyper@sect{#1}{#2}{#3}{#4}{#5}{#6}}% + {#7}% + {\hyperanchor{\@currenthyper}{#8}}% +} +\let\hyper@ssect\@ssect +\def\@ssect#1#2#3#4#5{% + \hyper@setcurrent% + \hyper@settype{#1}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \hyper@ssect{#1}{#2}{#3}{#4}{\hyperanchor{\@currenthyper}{#5}}% +} +%</hyper> +% \end{macrocode} +% The classes |book| and |report| additionally define a |\chapter| command. +% Unfortunately they do it in a different way. But the differences are fairly +% small. Thus we will use nearly the same definition. +% \begin{macrocode} +%<*book,report> +\let\hyper@chapter\@chapter +\let\hyper@schapter\@schapter +\def\@chapter[#1]#2{% + \ifnum\c@secnumdepth>\m@ne% +%</book,report> +%<*book> + \if@mainmatter% +%</book> +%<*book,report> + \refstepcounter{chapter}% + \ignore@next@refstepcounter% +%</book,report> +%<*book> + \else% + \hyper@setcurrent% + \fi% +%</book> +%<*book,report> + \else% + \hyper@setcurrent% + \fi% + \hyper@settype{chapter}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref% + {\hyper@chapter}% + {#1}% + {\hyperanchor{\@currenthyper}{#2}}% +} +\def\@schapter#1{% + \hyper@setcurrent% + \hyper@settype{chapter}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \hyper@schapter{\hyperanchor{\@currenthyper}{#1}}% +} +% \end{macrocode} +% However, this is not sufficient. The classes |book| and |report| use a different mechanism +% for the index heading not using the macro |\chapter*|. So we have to fix this. +% \begin{macrocode} +\let\hyper@theindex\theindex +\def\theindex{% + \bgroup% + \let\hyper@makeschapterhead\@makeschapterhead% + \def\@makeschapterhead##1{% + \hyper@setcurrent% + \hyper@settype{chapter}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \hyper@makeschapterhead{\hyperanchor{\@currenthyper}{##1}}% + } + \hyper@theindex% + \egroup% + \let\item\@idxitem% +} +%</book,report> +% \end{macrocode} +% There is also a |\part|--macro defined in the classes |article|, |book|, +% |ltnews|, |ltxdoc|, |ltxguide|, |proc|, and |report|. +% Unfortunately there are two different definitions we have to modify. +% But they differ only in a constant in a conditional expression. +% Thus we can use a nearly common definition. +% \begin{macrocode} +%<*article,book,ltnews,ltxdoc,ltxguide,proc,report> +\let\hyper@part\@part +\def\@part[#1]#2{% + \ifnum\c@secnumdepth>% +%</article,book,ltnews,ltxdoc,ltxguide,proc,report> +%<*article,ltnews,ltxdoc,ltxguide,proc> +-1\relax% +%</article,ltnews,ltxdoc,ltxguide,proc> +%<*book,report> +-2\relax% +%</book,report> +%<*article,book,ltnews,ltxdoc,ltxguide,proc,report> + \refstepcounter{part}% + \ignore@next@refstepcounter% + \else% + \hyper@setcurrent% + \fi% + \hyper@settype{part}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref% + {\hyper@part}% + {#1}% + {\hyperanchor{\@currenthyper}{#2}}% +} +\let\hyper@spart\@spart +\def\@spart#1{% + \hyper@setcurrent% + \hyper@settype{part}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \hyper@spart{\hyperanchor{\@currenthyper}{#1}}% +} +%</article,book,ltnews,ltxdoc,ltxguide,proc,report> +% \end{macrocode} +% Now we do not only get references from the table of contents to the +% corresponding sections but also from the headers and footers to them. +% There is only one exception these references are not inserted: +% If we used the |*|--ed variants of the sectioning commands the marks +% are not inserted in the headers.\par +% \noindent For bibliography, glossary, index, and table of contents +% this can be changed by modifying |\@mkboth|. +% \begin{macrocode} +%<*article,book,ltnews,ltxdoc,ltxguide,proc,report> +\def\hyper@mkboth@do[#1][#2]{% + \markboth{#1}{#2}% +} +\def\hyper@mkboth#1#2{% + \callwithexpandedhyperref% + {\callwithexpandedhyperref{\hyper@mkboth@do}{#1}}% + {#2}% +} +% \end{macrocode} +% As marks are only inserted when using the pagestyle ``headings'', +% the corresponding macro has to be modified to get the desired result. +% \begin{macrocode} +\let\hyper@ps@headings\ps@headings +\def\ps@headings{% + \hyper@ps@headings% + \let\@mkboth\hyper@mkboth% +} +%</article,book,ltnews,ltxdoc,ltxguide,proc,report> +% \end{macrocode} +% Last but not least set the new page style. +% \begin{macrocode} +%<*book,report> +\pagestyle{headings} +%</book,report> +% \end{macrocode} +% Unfortunately, the package |doc.sty| modifies the |theindex| environment +% in a way that the above changes do not work correctly with it. +% Hence, we have to modify this environment to resolve this. +% \begin{macrocode} +%<*doc> +\g@addto@macro\index@prologue{% + \def\markboth#1#2{% + \@mkboth{\refcurrent{#1}}{\refcurrent{#2}}% + }% +} +%</doc> +% \end{macrocode} +% +% \subsection{Bibliography} +% We want to reference from citation points within the text, +% given by |\cite|, to the corresponding entry in the bibliography. +% To realize this we only have to modify the |\bibitem|--macro. +% \begin{macrocode} +%<*hyper> +\def\@lbibitem[#1]#2{% + \hyper@setcurrent% + \hyper@settype{citation}% + \item[\@biblabel{\hyperanchor{\@currenthyper}{#1}}\hfill]% + \if@filesw% + {\let\protect\@unexpandable@protect% + \immediate% + \write\@auxout{% + \string\bibcite{#2}{\hyperreference{\@currenthyper}{#1}}% + }% + }% + \fi% + \ignorespaces% +} +\def\@bibitem{% + \stepcounter{\@listctr}% + \hyper@settype{citation}% + \@lbibitem[\the\value{\@listctr}]% +} +% \end{macrocode} +% \subsection{Equations} +% The goal is to reference to the equation number in equations and +% arrays of equations. This is really simple to do. +% \begin{macrocode} +\def\@eqnnum{% + \hyperanchor{\@currenthyper}{\normalfont\normalcolor(\theequation)}% +} +\let\hyper@eqnarray\eqnarray +\def\eqnarray{% + \hyper@setcurrent% + \def\@currenthyper{\the\hypercount}% + \hyper@settype{equation}% + \hyper@eqnarray% +} +\let\hyper@xeqncr\@xeqncr +\def\@xeqncr[#1]{% + \hyper@xeqncr[#1]% + \noalign{\hyper@setcurrent\hyper@settype{equation}}% +} +%</hyper> +% \end{macrocode} +% There is a document class option |leqno| that has to be redefined for us. +% \begin{macrocode} +%<*leqno> +\def\@eqnnum{% + \hbox to .01\p@{}% + \rlap{\reset@font\rmfamily% + \hskip -\displaywidth% + \hyperanchor{\@currenthyper}{\reset@font\rmfamily (\theequation)}% + }% +} +%</leqno> +% \end{macrocode} +% +% \subsection{Float Captions} +% What do you think we want to do here? Simply using |\caption| to define +% an anchor that may be used to refer to the current float. +% \begin{macrocode} +%<*hyper> +\long\def\@caption#1[#2]#3{\par% + \addcontentsline% + {\csname ext@#1\endcsname}% + {#1}% + {\protect\numberline{\csname the#1\endcsname}% + {\ignorespaces \hyperreference{\@currenthyper}{#2}}% + }% + \begingroup% + \@parboxrestore% + \normalsize% + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par% + \endgroup% +} +%</hyper> +% \end{macrocode} +% Obviously we need to modify |\@makecaption| to define the anchor. +% As this macro is defined only for the classes |article|, |book|, +% |ltnews|, |ltxdoc|, |ltxguide|, |proc|, and |report| we redefine +% it only for them. +% \begin{macrocode} +%<*article,book,ltnews,ltxdoc,ltxguide,proc,report> +\let\hyper@makecaption\@makecaption +\long\def\@makecaption#1#2{% + \hyper@makecaption{\hyperanchor{\@currenthyper}{#1}}{#2}% +} +%</article,book,ltnews,ltxdoc,ltxguide,proc,report> +% \end{macrocode} +% +% \subsection{Footnotes} +% Here we want to handle references from footnotemarks to footnotes +% at the bottom of the page.\par +% \noindent At first modify the standard definition of |\@makefnmark| to +% refer to a footnote which is complicated by the fact that |\thepage| does not +% necessarily refer to the actual page when used. So we have to write the page +% to an auxiliary file and reread it afterwards. Let's not forget to check for +% changes of these entries to warn the user about possible changes. +% \begin{macrocode} +%<*hyper> +\newcount\hyper@fnmark@count +\hyper@fnmark@count0 +\def\hyper@currentfnmark{% + \global\advance\hyper@fnmark@count1\relax% + \@bsphack% + \protected@write\hyper@auxout% + {}% + {\string\hyperfnpage{\the\hyper@fnmark@count}{\thepage}}% + \@esphack% + \hb@xt@\z@{% + \ifx\hyper@minipage@label\@empty% + \global\edef\hyper@current@fnmark% + {fn.\@arabic\c@footnote.% + \expandafter% + \ifx\csname hyper@fn@\the\hyper@fnmark@count\endcsname% + \relax% + ?% + \else% + \csname hyper@fn@\the\hyper@fnmark@count\endcsname% + \fi% + }% + \else\ifnum\hyper@minipage@label=0\relax% + \global\edef\hyper@current@fnmark% + {fn.\hyper@minipage@label.\@arabic\c@footnote.% + \expandafter% + \ifx\csname hyper@fn@\the\hyper@fnmark@count\endcsname% + \relax% + ?% + \else% + \csname hyper@fn@\the\hyper@fnmark@count\endcsname% + \fi% + }% + \else% + \global\edef\hyper@current@fnmark% + {fn.\hyper@minipage@label.\@arabic\c@mpfootnote.% + \expandafter% + \ifx\csname hyper@fn@\the\hyper@fnmark@count\endcsname% + \relax% + ?% + \else% + \csname hyper@fn@\the\hyper@fnmark@count\endcsname% + \fi% + }% + \fi\fi% + }% +} +\def\hyperfnpage#1#2{% + \expandafter\global\expandafter\def\csname hyper@fn@#1\endcsname{#2}% +} +\def\hyperfnpage@check#1#2{% + \def\reserved@a{#2}% + \expandafter\ifx\csname hyper@fn@#1\endcsname\reserved@a\else% + \hyper@change4\relax% + \fi% +} +\let\hyper@fn@enddocument\enddocument +\def\enddocument{% + \let\hyperfnpage\hyperfnpage@check% + \global\hyper@fnmark@count0\relax% + \hyper@fn@enddocument% +} +\def\@makefnmark{% + \hyper@currentfnmark% + \hbox{\@textsuperscript{% + \normalfont\hyperreference% + {\hyper@current@fnmark}% + {\@thefnmark}% + }}% +} +\def\hyper@makefnmark@text{% + \hyper@currentfnmark% + \hbox{\@textsuperscript{% + \normalfont\hyperanchor% + {\hyper@current@fnmark}% + {\@thefnmark}% + }}% +} +%</hyper> +% \end{macrocode} +% Unfortunately, the definition of |\@makefntext| is dependend of the +% document class we use.\par +% \noindent For |article|, |book|, |letter|, |ltnews|, |ltxdoc|, |ltxguide|, +% |proc|, |report|, and |slides| we have to use the following +% hypertext--variant. +% \begin{macrocode} +%<*article,book,letter,ltnews,ltxdoc,ltxguide,proc,report,slides> +\let\hyper@makefntext\@makefntext% +\long\def\@makefntext#1{% + \bgroup% + \hyper@currentfnmark% + \edef\@currenthyper{\hyper@current@fnmark}% + \let\@makefnmark\hyper@makefnmark@text% + \hyper@makefntext{#1}% + \egroup% +} +%</article,book,letter,ltnews,ltxdoc,ltxguide,proc,report,slides> +% \end{macrocode} +% There are also footnotes within minipages. Therefore we should handle them. +% \begin{macrocode} +%<*hyper> +\newcount\hyper@minipage@cnt +\hyper@minipage@cnt=0 +\edef\hyper@minipage@label{} +\let\hyper@minipage\minipage +\let\hyper@endminipage\endminipage +\def\minipage{% + \bgroup% + \global\advance\hyper@minipage@cnt1\relax% + \edef\hyper@minipage@label{\the\hyper@minipage@cnt}% + \hyper@minipage% +} +\def\endminipage{% + \hyper@endminipage% + \egroup% +} +%</hyper> +% \end{macrocode} +% Note, that there exists only one level of minipages the footnotes +% are handled correctly by \LaTeXe. Thus we haven't to do more.\par +% \noindent Unfortunately there is another problem. The footnote--macros +% are redefined by the |\maketitle|--macro in some classes.\par +% \noindent Thus we need the following changes for the classes +% |article|, |book|, |ltxdoc|, |ltxguide|, and |report|. +% \begin{macrocode} +%<*article,book,ltxdoc,ltxguide,report> +\if@titlepage\else +\renewcommand\maketitle{\par + \begingroup + \renewcommand\thefootnote{\fnsymbol{footnote}}% + \def\@makefnmark{% + \hyper@currentfnmark% + \rlap{\@textsuperscript{% + \normalfont% + \hyperreference{\hyper@current@fnmark}% + {\@thefnmark}% + }}% + }% + \long\def\@makefntext##1{% + \hyper@currentfnmark% + \bgroup% + \edef\@currenthyper{\hyper@current@fnmark}% + \parindent 1em\noindent + \hb@xt@1.8em{% + \hss\@textsuperscript{% + \normalfont% + \hyperanchor{\hyper@current@fnmark}{\@thefnmark} + }% + }% + ##1% + \egroup% + }% + \if@twocolumn + \ifnum \col@number=\@ne + \@maketitle + \else + \twocolumn[\@maketitle]% + \fi + \else + \newpage + \global\@topnum\z@ + \@maketitle + \fi + \thispagestyle{plain}\@thanks + \endgroup + \setcounter{footnote}{0}% + \let\thanks\relax + \let\maketitle\relax\let\@maketitle\relax + \gdef\@thanks{}\gdef\@author{}\gdef\@title{}} +\fi +%</article,book,ltxdoc,ltxguide,report> +% \end{macrocode} +% For the class |proc| another redefinition is needed. +% \begin{macrocode} +%<*proc> +\def\maketitle{\par + \begingroup + \renewcommand\thefootnote{\fnsymbol{footnote}}% + \def\@makefnmark{% + \hyper@currentfnmark% + \hbox to\z@{% + \@textsuperscript{% + \normalfont% + \hyperreference{\hyper@current@fnmark}% + {\@thefnmark}% + }% + }}% + \twocolumn[\@maketitle]% + \@thanks + \endgroup + \setcounter{footnote}{0}% + \let\maketitle\relax + \let\@maketitle\relax + \gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax} +%</proc> +% \end{macrocode} +% The package |doc.sty| also modifies |\maketitle| that has a redefinition +% of |\@makefnmark| and |\@makefntext|. +% \begin{macrocode} +%<*doc> +\def\maketitle{\par + \begingroup \def \thefootnote {\fnsymbol {footnote}}% + \setcounter {footnote}\z@ + \def\@makefnmark{% + \hyper@currentfnmark% + \hbox to\z@{% + $\m@th^{% + \hyperreference% + {\hyper@current@fnmark}% + {\@thefnmark}% + }$\hss% + }}% + \long\def\@makefntext##1{% + \hyper@currentfnmark% + \bgroup + \edef\@currenthyper{\hyper@current@fnmark} + \parindent 1em\noindent + \hbox to1.8em{% + \hss$\m@th^{% + \hyperanchor{\hyper@current@fnmark}{\@thefnmark}% + }$% + }% + ##1% + \egroup% + }% + \if@twocolumn \twocolumn [\@maketitle ]% + \else \newpage \global \@topnum \z@ \@maketitle \fi + \thispagestyle{titlepage}\@thanks \endgroup + \setcounter {footnote}\z@ + \gdef\@date{\today}\gdef\@thanks{}% + \gdef\@author{}\gdef\@title{}} +%</doc> +% \end{macrocode} +% Shit, now we can get the same name for hyper anchors, one via maketitle and one for the following text. +% Let's pretend the titlepage being minipage 0. Note, that the definition of |\hyper@currentfnmark| given +% above tests for this. (This is necessary!) Additionally we have to modify the macro |\thanks| to get +% the correct anchors in the footnote texts. +% \begin{macrocode} +%<*hyper> +\AtBeginDocument{% + \let\hyper@maketitle\maketitle% + \def\maketitle{% + \edef\hyper@minipage@label{0}% + \hyper@maketitle% + \let\hyper@minipage@label\@empty% + }% +} +\def\hyper@thanks@footnotetext#1[#2]#3{% + \bgroup% + \edef\hyper@current@fnmark{#1}% + \let\hyper@currentfnmark\relax% + \footnotetext[#2]{#3}% + \egroup% +} +\def\thanks#1{\footnotemark% + \expandafter\protected@xdef\expandafter\@thanks\expandafter{\expandafter\@thanks% + \expandafter\protect% + \expandafter\hyper@thanks@footnotetext% + \expandafter{\hyper@current@fnmark}[\the\c@footnote]{#1}}% +} +%</hyper> +% \end{macrocode} +% \subsection{Lists} +% Some lists have enumerated items which may be referenced to by the +% label command. Hence we have to set the corresponding anchors. +% \begin{macrocode} +%<*hyper> +\let\hyper@item\@item +\def\@item[#1]{% + \if@noitemarg% + \if@nmbrlist% + \hyper@item[\hyperanchor{\@currenthyper}{#1}]% + \else% + \hyper@item[{#1}]% + \fi% + \else% + \hyper@item[{#1}]% + \fi% +} +% \end{macrocode} +% +% \subsection{Index and Glossary} +% As already has been said, we don't write the page number together with a +% reference to |.idx|-- resp.\ |.glo|--files. |makeindex| wouldn't accept +% such informations. But that means that we have to think of a way to get +% back the references after |makeindex| has generated the index resp.\ +% glossary.\par +% \noindent As this stuff needs an additional package we should include it only +% if it is necessary. Thus, let us at first save it in a macro. +% \begin{macrocode} +\def\hyper@idxglo@cmds{ +% \end{macrocode} +% \noindent For the following definition we need the |defpattern|-package. +% \begin{macrocode} +\RequirePackage{defpattern} +% \end{macrocode} +% Now we can define hypertext variants of the macros |\index| and +% |\glossary|.\par +% \noindent First of all we handle series of page numbers and ranges. +% \begin{macrocode} +\def\hyper@ref@page##1{\hyperpagereference{##1}{##1}} +\defpattern\hyper@page@range[##2]{\hyper@ref@page{##2}} +\defpattern\hyper@page@range[##2--##3]{% + \hyper@ref@page{##2}--\hyper@ref@page{##3}% +} +\defpattern\hyper@page@range[##2, ##3]{% + \hyper@page@range[##2], \hyper@page@range[##3]% +} +% \end{macrocode} +% Based on this we can define a macro |\hyperpage| with an optional executable +% macro as provided by the indexing system to surround a page number. +% \begin{macrocode} +\def\hyper@page@cmd[##1]##2{##1{\hyper@page@range[##2]}} +\def\hyper@page@nocmd##1{\hyper@page@range[##1]} +\def\hyperpage{\@ifnextchar[{\hyper@page@cmd}{\hyper@page@nocmd}} +% \end{macrocode} +% After saving the original meaning of |\index| and |\glossary| +% \begin{macrocode} +\let\hyper@index\index +\let\hyper@glossary\glossary +% \end{macrocode} +% we can insert the page number surrounding command for |makeindex| by +% \begin{macrocode} +\defpattern\hyper@ig@pat[##2|##3]{##2{##3|hyperpage}} +\defpattern\hyper@ig@pat[##2|##3|##4]{% + ##2{##3|hyperpage[\hyper@backslash##4]}% +} +\defpattern\hyper@ig@pat[##2|##3|(##4]{% + ##2{##3|(hyperpage[\hyper@backslash##4]}% +} +\defpattern\hyper@ig@pat[##2|##3|)##4]{% + ##2{##3|)hyperpage[\hyper@backslash##4]}% +} +\defpattern\hyper@ig@pat[##2|##3|(]{##2{##3|(hyperpage}} +\defpattern\hyper@ig@pat[##2|##3|)]{##2{##3|)hyperpage}} +% \end{macrocode} +% and define the new |\index|-- and |\glossary|--macros as follows. +% \begin{macrocode} +\def\hyper@ig{% + \@bsphack\begingroup% + \catcode`\@=12\catcode`\!=12\catcode`\|=12\catcode`\"=12\relax% + \@sanitize\hyper@ig@% +} +\def\hyper@ig@##1##2{% + \hyper@ig@pat[##1|##2]% + \endgroup\@esphack% +} +\def\index{\hyper@ig\hyper@index} +\def\glossary{\hyper@ig\hyper@glossary} +% \end{macrocode} +% We have reached the end of the macro. But as we do not call its contents +% twice we just let the macro being a no-op before. +% \begin{macrocode} +\let\hyper@idxglo@cmds\relax +} +% \end{macrocode} +% Now let's call the stuff whenever an index or glossary has to be generated. +% \begin{macrocode} +\ifnum% + \ifx\@indexfile\@undefined0\else1\fi% + \ifx\@glossaryfile\@undefined0\else1\fi% + >0\relax + \hyper@idxglo@cmds +\fi +\ifx\makeindex\@empty\else + \let\hyper@makeindex\makeindex + \def\makeindex{\hyper@makeindex\hyper@idxglo@cmds} +\fi +\ifx\makeglossary\@empty\else + \let\hyper@makeglossary\makeglossary + \def\makeglossary{\hyper@makeglossary\hyper@idxglo@cmds} +\fi +% \end{macrocode} +% +% \subsection{Theorems} +% Theorems, Lemmatas, Corollaries, Examples, etc.\ are often refered to. Hence +% they have to introduce an anchor for these references. +% \begin{macrocode} +\let\hyper@begintheorem\@begintheorem% +\def\@begintheorem#1#2{\trivlist% + \item[\hskip% + \labelsep{\hyperanchor{\@currenthyper}{\bfseries #1\ #2}}% + ]\itshape% +} +\def\@opargbegintheorem#1#2#3{\trivlist% + \item[\hskip% + \labelsep% + {\hyperanchor{\@currenthyper}{\bfseries #1\ #2}\ (#3)}% + ]\itshape% +} +%</hyper> +% \end{macrocode} +% These definitions are changed by the theorem--package. Hence, we have to +% give hypertext definitions for them below. +% +% \subsection{Additional Patches} +% The Hyper\TeX--previewer for NeXTSTEP can't handle multiple pages with the +% same name correctly. It supposes that each link on a page number 1 is on +% the first page with the number one. This is a problem for the title page +% often having the same number as one of the following pages. Hence we patch +% the page number of the title page from 1 to -1 (if the next page also has +% number 1). +% \begin{macrocode} +%<*article,report> +\let\hyper@titlepage\titlepage +\def\titlepage{% + \hyper@titlepage% + \if@compatibility% + \global\setcounter{page}{0}% + \else% + \global\setcounter{page}{-1}% + \fi% +} +%</article,report> +% \end{macrocode} +% We have to ignore the stuff that is written to the |.aux|--file +% by the extensional packages +% \begin{macrocode} +%<*hyper> +\def\hyperbackcite#1#2#3#4{} +%</hyper> +% \end{macrocode} +% +% \subsection{Handling Options} +% At first let us define some macros to collect and detect mutually +% excluding options. +% \begin{macrocode} +%<*hyper> +\def\hyper@set@option#1#2#3{% + \ifx#1\@undefined% + \def#1{#2}% + \else% + \PackageError{hyper}{#3}{}% + \fi} +\def\set@hyper@class#1{% + \hyper@set@option\hyper@class{#1}% + {Only one class is allowed in option list}% +} +\def\set@hyper@do#1{% + \hyper@set@option\hyper@do{#1}% + {Excluding options 'yes' and 'no' in option list found}% +} +\def\set@hyper@pageanchor#1{% + \hyper@set@option\hyper@pageanchor{#1}% + {Excluding options 'pagenumber' and 'pagetop' in option list found}% +} +\def\set@hyper@color#1{% + \hyper@set@option\hyper@this@color{#1}% + {Multiple color options in option list found}% +} +\def\set@hyper@idxglo{% + \let\hyper@idxglo\hyper@idxglo@cmds% +} +% \end{macrocode} +% We suppose each other option given being an additional package. +% They are collected without regarding multiple occurrences. +% \begin{macrocode} +\def\hyper@packages{} +\def\add@hyper@package#1{% + \edef\hyper@packages{\hyper@packages(#1)}% +} +\def\hyper@extensions{} +\def\add@hyper@extension#1{% + \edef\hyper@extensions{\hyper@extensions(#1)}% +} +% \end{macrocode} +% Now we define the options known to distribute them between the macros +% given above.\par +% \noindent The document classes known by the package are the following. +% \begin{macrocode} +\DeclareOption{article}{\set@hyper@class{article}} +\DeclareOption{book}{\set@hyper@class{book}} +\DeclareOption{letter}{\set@hyper@class{letter}} +\DeclareOption{ltxdoc}{\set@hyper@class{ltxdoc}} +\DeclareOption{ltxguide}{\set@hyper@class{ltxguide}} +\DeclareOption{ltnews}{\set@hyper@class{ltnews}} +\DeclareOption{proc}{\set@hyper@class{proc}} +\DeclareOption{report}{\set@hyper@class{report}} +\DeclareOption{slides}{\set@hyper@class{slides}} +\DeclareOption{amsart}{\set@hyper@class{amsart}} +\DeclareOption{amsproc}{\set@hyper@class{amsproc}} +\DeclareOption{amsbook}{\set@hyper@class{amsbook}} +\DeclareOption{amsdtx}{\set@hyper@class{amsdtx}} +\DeclareOption{amsldoc}{\set@hyper@class{amsldoc}} +\DeclareOption{cweb}{\set@hyper@class{cweb}} +% \end{macrocode} +% There are two options determining whether we want to insert the +% hypertext--marks into the dvi--file. +% \begin{macrocode} +\DeclareOption{yes}{\set@hyper@do{\hyper}} +\DeclareOption{no}{\set@hyper@do{\nohyper}} +% \end{macrocode} +% We should not forget that we have an optional behaviour for fixing the bounding box +% of a hyper reference. So we have to introduce and handle an option for it. +% \begin{macrocode} +\DeclareOption{fixhyperbox}{% + \AtBeginDocument{% + \let\hyper@unnested@special@reference\hyper@unnested@special@reference@fix% + \let\hyper@unnested@special@anchor\hyper@unnested@special@anchor@fix% + }% +} +% In the subsection ``Colored Anchors/References'' we have introduced +% three variants of colors the anchors resp.\ references may be printed in. +% \begin{macrocode} +\DeclareOption{color}{\set@hyper@color{\hyper@color}} +\DeclareOption{gray}{\set@hyper@color{\hyper@gray}} +\DeclareOption{black}{\set@hyper@color{\hyper@black}} +% \end{macrocode} +% We additionally have to choose whether a hyperlink to a page always +% jumps to the page number or to the top of the page. +% \begin{macrocode} +\DeclareOption{pagenumber}{\set@hyper@pageanchor{\hyper@modifyheadfoot@pagebottom}} +\DeclareOption{pagetop}{\set@hyper@pageanchor{\hyper@modifyheadfoot@pagetop}} +% \end{macrocode} +% If the user want to have the index and glossary commands, +% e.g.\ when including an index or glossary +% without using |\makeindex| respectively |\makeglossary| he may +% give the option |indexcmds|. +% \begin{macrocode} +\DeclareOption{indexcmds}{\set@hyper@idxglo} +% \end{macrocode} +% Additionally we have to pass the options for the extensional packages +% \begin{macrocode} +\DeclareOption{backcitepages}{% + \PassOptionsToPackage{pages}{hxt-bc}% + \add@hyper@extension{hxt-bc}% +} +\DeclareOption{backcitesections}{% + \PassOptionsToPackage{sections}{hxt-bc}% + \add@hyper@extension{hxt-bc}% +} +% \end{macrocode} +% All other options to be given are considered as packages. +% \begin{macrocode} +\DeclareOption*{\add@hyper@package{\CurrentOption}} +% \end{macrocode} +% Now let's collect the options given. +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% So far now we know the options the user has send to us.\par +% \noindent If no option determining a document class has been given we should +% try to determine which class the document is of. +% \begin{macrocode} +\ifx\hyper@class\@undefined + \@ifclassloaded{slides}{\def\hyper@class{slides}}{} + \@ifclassloaded{report}{\def\hyper@class{report}}{} + \@ifclassloaded{letter}{\def\hyper@class{letter}}{} + \@ifclassloaded{book}{\def\hyper@class{book}}{} + \@ifclassloaded{article}{\def\hyper@class{article}}{} + \@ifclassloaded{proc}{\def\hyper@class{proc}}{} + \@ifclassloaded{ltnews}{\def\hyper@class{ltnews}}{} + \@ifclassloaded{ltxguide}{\def\hyper@class{ltxguide}}{} + \@ifclassloaded{ltxdoc}{\def\hyper@class{ltxdoc}}{} + \@ifclassloaded{amsart}{\def\hyper@class{amsart}}{} + \@ifclassloaded{amsproc}{\def\hyper@class{amsproc}}{} + \@ifclassloaded{amsbook}{\def\hyper@class{amsbook}}{} + \@ifclassloaded{amsdtx}{\def\hyper@class{amsdtx}}{} + \@ifclassloaded{amsldoc}{\def\hyper@class{amsldoc}}{} + \@ifclassloaded{cweb}{\def\hyper@class{cweb}}{} +\fi +% \end{macrocode} +% If there is a document class load the corresponding |.hyp|--file +% otherwise give an error message. +% \begin{macrocode} +\ifx\hyper@class\@undefined + \PackageError{hyper}{Document class can't be determined.\MessageBreak + Please add one to the option list% + }{} +\else + \InputIfFileExists{\hyper@class.hyp}{}% + {\PackageError{hyper}{\hyper@class.hyp not found.\MessageBreak + Please reinstall the complete package% + }{}% + }% +\fi +% \end{macrocode} +% If we explicitely want to have the commands for index and glossary +% we have to introduce them by calling the macro holding the stuff. +% Note, that the macro is a nop when the stuff already has been added. +% \begin{macrocode} +\ifx\hyper@idxglo\@undefined\else + \hyper@idxglo@cmds +\fi +% \end{macrocode} +% If we want to print the anchors resp.\ references in colors we have to +% load the |color|-package and defined the appropriate macros. +% \begin{macrocode} +\ifx\hyper@this@color\@undefined +\else + \expandafter\ifx\hyper@this@color\hyper@gray + \RequirePackage{color} + \else\expandafter\ifx\hyper@this@color\hyper@color + \RequirePackage{color} + \else\expandafter\ifx\hyper@this@color\hyper@black + \else + \PackageError{hyper}{Implementation error:\MessageBreak + Case for reference/anchor color definition not defined}{} + \fi\fi\fi + \hyper@this@color +\fi +% \end{macrocode} +% Afterwards we have to load modifications.\par +% \noindent At first we just handle the document class option |leqno| +% if it can be found in the option list. +% \begin{macrocode} +\@ifclasswith\hyper@class{leqno}% + {\InputIfFileExists{leqno.hyp}{}% + {\PackageError{hyper}{leqno.hyp not found.\MessageBreak + Please reinstall the complete package}{}% + }% + }% + {} +% \end{macrocode} +% We may have to handle some known packages, i.e.\ we need to load +% some modifications for them.\par +% \noindent As there is a common way to do this let us first define +% a generic macro. +% \begin{macrocode} +\def\hyper@loadpackage#1{% + \@ifpackageloaded{#1}% + {\InputIfFileExists{#1.hyp}% + {\expandafter\edef\csname hyper@loaded@#1\endcsname{#1.hyp}}% + {\PackageError{hyper}{#1.hyp not found.\MessageBreak + Please reinstall the complete package}{}% + }% + }% + {} +} +% \end{macrocode} +% Now we can call this macro for each package known. +% \begin{macrocode} +\hyper@loadpackage{amsmath} +\hyper@loadpackage{amstex} +\hyper@loadpackage{amsthm} +\hyper@loadpackage{doc} +\hyper@loadpackage{fancyheadings} +\hyper@loadpackage{ftnright} +\hyper@loadpackage{harvard} +\hyper@loadpackage{longtable} +\hyper@loadpackage{natbib} +\hyper@loadpackage{subeqnarray} +\hyper@loadpackage{theorem} +\hyper@loadpackage{upref} +\hyper@loadpackage{xr} +% \end{macrocode} +% Afterwards we add each package the user has told us to do. +% \begin{macrocode} +\def\@hyper@load@pkg(#1){% + \expandafter\ifx\csname hyper@loaded@#1\endcsname\relax% + \IfFileExists{#1.hyp}% + {\IfFileExists{#1.sty}{\RequirePackage{#1}}{}% + \input{#1.hyp}% + \expandafter\edef\csname hyper@loaded@#1\endcsname{#1.hyp}% + }% + {\PackageError{hyper}{Modification file #1.hyp not found}{}}% + \fi% + \hyper@loadpackage% +} +\def\hyper@loadpackage{\@ifnextchar({\@hyper@load@pkg}{}} +\expandafter\hyper@loadpackage\hyper@packages\relax +% \end{macrocode} +% Additionally, we have to load some extensions of the hyper package. +% \begin{macrocode} +\def\@hyper@load@ext(#1){% + \expandafter\ifx\csname hyper@loaded@ext@#1\endcsname\relax% + \IfFileExists{#1.sty}% + {\RequirePackage{#1}% + \expandafter\edef\csname hyper@loaded@ext@#1\endcsname{#1.sty}% + }% + {\PackageError{hyper}{Extension file #1.sty not found}{}}% + \fi% + \hyper@loadpackage% +} +\def\hyper@load@extension{\@ifnextchar({\@hyper@load@ext}{}} +\expandafter\hyper@load@extension\hyper@extensions\relax +% \end{macrocode} +% Now we have to activate the (nondefault) decision for placing the anchors on pages (top of page or pagenumber) +% \begin{macrocode} +\ifx\hyper@pageanchor\@undefined +\else + \expandafter\let\expandafter\hyper@modifyheadfoot\hyper@pageanchor +\fi +% \end{macrocode} +% Last but not least we have to decide whether we really want the +% hypertext--marks being inserted into the dvi--file. +% \begin{macrocode} +\ifx\hyper@do\@undefined\else\hyper@do\fi +%</hyper> +% \end{macrocode} +% +% \subsection{Compatibility with Ordinary \LaTeX} +% The package redefines the notion of a label. Thus, to be able to add the +% package to an exising \LaTeX-file without having trouble with an existing +% |.aux|-file we have to be able to handle the old as well as the new definition: +% \begin{macrocode} +%<*hyper> +\def\hyper@end@newlabel{\relax} +\let\hyper@orig@newlabel\newlabel +\def\hyper@newlabel#1#2#3#4#5{% + \ifx|#4|% + \hyper@orig@newlabel{#1}{{}{}{#2}{#3}}% + \else% + \hyper@orig@newlabel{#1}{{#2}{#3}{#4}{#5}}% + \fi% +} +\def\newlabel#1#2{\hyper@newlabel{#1}#2\hyper@end@newlabel\hyper@end@newlabel} +% \end{macrocode} +% +% The package leaves traces for intermediate informations in several auxiliary files. +% To be able to remove the package without deleting these auxiliary files, certain +% definitions have to remain to exist. The following code ensures, that these definitions +% are availlable, by adding them to the subsequently generated |.aux|-files. +% \begin{macrocode} +\begingroup + \catcode`\<=\catcode`\{ + \catcode`\>=\catcode`\} + \catcode`\{=12\catcode`\}=12 + \catcode`\%=12 + \gdef\hyper@open<{> + \gdef\hyper@close<}> + \gdef\hyper@comment<%> +\endgroup +\def\hyper@nl{^^J}% +\long\def\hyper@protected@write#1{% + \begingroup% + \let\thepage\relax% + \let\protect\@unexpandable@protect% + \edef\reserved@a{\immediate\write\@auxout{#1}}% + \reserved@a% + \endgroup% + \if@nobreak\ifvmode\nobreak\fi\fi% +} +\gdef\hyper@aux@write{ + \hyper@protected@write{\hyper@comment@potential% + \string\ifx\string\newhyper\string\@undefined% + } + \hyper@protected@write{\hyper@comment@potential% + \string\gdef\string\newhyper\hyper@hash1\hyper@hash2{}\hyper@nl + \string\gdef\string\hyperfnpage\hyper@hash1\hyper@hash2{}\hyper@nl + \string\global\string\let\string\@hyper@newlabel\string\newlabel\hyper@nl + \string\gdef\string\hyper@end@newlabel{\string\relax}\hyper@nl + \string\gdef\string\hyper@newlabel\hyper@hash1\hyper@hash2\hyper@hash3\hyper@hash4\hyper@hash5% + {\hyper@comment@potential% + \string\ifx\string|\hyper@hash4\string|\string\hyper@end@newlabel\hyper@comment@potential% + \string\@hyper@newlabel{\hyper@hash1}{{\hyper@hash2}{\hyper@hash3}}% + \hyper@comment@potential% + \string\else\hyper@comment@potential% + \string\@hyper@newlabel{\hyper@hash1}{{\hyper@hash4}{\hyper@hash5}}% + \hyper@comment@potential% + \string\fi\hyper@comment@potential% + }\hyper@nl + \string\gdef\string\newlabel\hyper@hash1\hyper@hash2% + {\string\hyper@newlabel{\hyper@hash1}\hyper@hash2% + \string\hyper@end@newlabel\string\hyper@end@newlabel}\hyper@nl + \string\gdef\string\@@hyperpage[\hyper@hash1]{\hyper@hash1}\hyper@nl + \string\gdef\string\@hyperpage\hyper@hash1{\hyper@hash1}\hyper@nl + \string\gdef\string\hyperpage% + {\string\@ifnextchar[\string\@@hyperpage\string\@hyperpage}\hyper@nl + \string\global\string\let\string\fragilehyperreference\string\@gobble\hyper@nl + \string\global\string\let\string\fragilehyperpagereference\string\@gobble\hyper@nl + \string\global\string\let\string\fragilehyperanchor\string\@gobble\hyper@nl + \string\global\string\let\string\fragileblindhyperanchor\string\@gobble\hyper@nl + \string\global\string\let\string\fragilehyperURL\string\@gobble\hyper@nl + \string\gdef\string\hyperbackcite\hyper@hash1\hyper@hash2\hyper@hash3\hyper@hash4% + {}\hyper@nl + \string\global\string\let\string\hyper@setref\string\@setref\hyper@nl + \string\gdef\string\hyper@thirdoffour\hyper@hash1\hyper@hash2\hyper@hash3% + {\hyper@hash2}\hyper@nl + \string\gdef\string\hyper@forthoffour\hyper@hash1\hyper@hash2\hyper@hash3% + {\hyper@hash3}\hyper@nl + \string\gdef\string\hyper@end@forthoffour{\string\relax}\hyper@nl + \string\gdef\string\@setref\hyper@hash1{\hyper@comment@real\hyper@nl + \string\ifx\hyper@hash1\string\relax\hyper@comment@real\hyper@nl + \string\def\string\hyper@next{\string\hyper@setref{\hyper@hash1}}% + \hyper@comment@real\hyper@nl + \string\else\hyper@comment@real\hyper@nl + \string\edef\string\hyper@tmp% + {\string\expandafter\string\hyper@forthoffour\hyper@hash1% + \string\hyper@end@forthoffour}\hyper@comment@real\hyper@nl + \string\ifx\string\hyper@tmp\string\hyper@end@forthoffour% + \hyper@comment@real\hyper@nl + \string\def\string\hyper@next{\string\hyper@setref{\hyper@hash1}}% + \hyper@comment@real\hyper@nl + \string\else\hyper@comment@real\hyper@nl + \string\edef\string\hyper@tmp% + {{\string\expandafter\string\hyper@thirdoffour\hyper@hash1}% + {\string\expandafter\string\hyper@forthoffour\hyper@hash1}}% + \hyper@comment@real\hyper@nl + \string\def\string\hyper@next{\string\hyper@setref{\string\hyper@tmp}}% + \hyper@comment@real\hyper@nl + \string\fi\hyper@comment@real\hyper@nl + \string\fi\hyper@comment@real\hyper@nl + \string\hyper@next\hyper@comment@real\hyper@nl + } + } + \hyper@protected@write{\hyper@comment@potential% + \string\begingroup\hyper@nl + \string\catcode\string`\string\<\string=\string\catcode\string`\string\{\hyper@nl + \string\catcode\string`\string\>\string=\string\catcode\string`\string\}\hyper@nl + \string\catcode\string`\string\{\string=12% + \string\catcode\string`\string\}\string=12\hyper@nl + \string\catcode\string`\string\%\string=12\hyper@nl + \string\gdef\string\hyper@open<{>\hyper@nl + \string\gdef\string\hyper@close<}>\hyper@nl + \string\gdef\string\hyper@comment<\hyper@comment@real>\hyper@nl + \string\endgroup + } + \hyper@protected@write{\hyper@comment@potential% + \string\bgroup\hyper@nl + \string\global\string\edef\string\hyper@hash{\string\string\hyper@hash}\hyper@nl + \string\egroup + } + \hyper@protected@write{\hyper@comment@potential% + \string\gdef\string\hyper@nl{\string^\string^J} + } + \hyper@protected@write{\hyper@comment@potential% + \string\def\string\hyper@hash@four{\string\hyper@hash\string\hyper@hash% + \string\hyper@hash\string\hyper@hash} + } + \hyper@protected@write{\hyper@comment@potential% + \string\global\string\long\string\def\string\hyper@protected@write\hyper@hash1% + {\hyper@nl + \string\begingroup\hyper@nl + \string\let\string\thepage\string\relax\hyper@nl + \string\let\string\protect\string\@unexpandable@protect\hyper@nl + \string\edef\string\reserved@a{\string\immediate\string\write\string\@auxout% + {\hyper@hash1}}\hyper@nl + \string\reserved@a\hyper@nl + \string\endgroup\hyper@nl + \string\if@nobreak\string\ifvmode\string\nobreak\string\fi\string\fi\hyper@nl + } + } + \hyper@protected@write{\hyper@comment@potential% + \string\gdef\string\hyper@aux@write\hyper@open + }% + \hyper@second@write{\hyper@comment@potential% + \string\hyper@write\hyper@open\hyper@nl + \string\begingroup\hyper@nl + \string\let\string\@hyper@protected@write\string\hyper@protected@write\hyper@nl + \string\def\string\hyper@protected@write@do\hyper@hash\hyper@hash1% + \hyper@hash\hyper@hash2{\hyper@nl + \string\begingroup\hyper@nl + \string\let\string\hyper@string\string\string\hyper@nl + \string\def\string\string% + {\string\hyper@string\string\string\string\hyper@string}\hyper@nl + \string\def\string\hyper@open% + {\string\hyper@string\string\hyper@open}\hyper@nl + \string\def\string\hyper@close% + {\string\hyper@string\string\hyper@close}\hyper@nl + \string\def\string\hyper@nl% + {\string\hyper@string\string\hyper@nl\string^\string^J}\hyper@nl + \string\def\string\hyper@comment@real% + {\string\hyper@string\string\hyper@comment@real}\hyper@nl + \string\def\string\hyper@comment@potential% + {\string\hyper@string\string\hyper@comment@potential% + \string\hyper@comment\string^\string^J}\hyper@nl + \string\def\string\hyper@hash% + {\string\hyper@string\string\hyper@hash}\hyper@nl + \string\@hyper@protected@write% + {\string\hyper@string\hyper@hash\hyper@hash1% + {\hyper@hash\hyper@hash2\string^\string^J}}\hyper@nl + \string\endgroup\hyper@nl + }\hyper@nl + \string\def\string\hyper@protected@write% + {\string\hyper@protected@write@do\string\hyper@protected@write}% + \hyper@nl + \string\def\string\hyper@second@write\hyper@hash\hyper@hash1{\hyper@nl + \string\hyper@protected@write@do\string\hyper@second@write% + {\hyper@hash\hyper@hash1}\hyper@nl + \string\@hyper@protected@write{\hyper@hash\hyper@hash1}\hyper@nl + }\hyper@nl + \string\def\string\hyper@write{\string\@gobble}\hyper@nl + \string\hyper@aux@write\hyper@nl + \string\endgroup\hyper@nl + \hyper@close + } + \hyper@write{ + \begingroup + \let\@hyper@protected@write\hyper@protected@write + \def\hyper@protected@write@do##1##2{ + \begingroup + \let\hyper@string\string + \def\string{\hyper@string\string\hyper@string} + \def\hyper@open{\hyper@string\hyper@open} + \def\hyper@close{\hyper@string\hyper@close} + \def\hyper@nl{\hyper@string\hyper@nl^^J} + \def\hyper@comment@real{\hyper@string\hyper@comment@real} + \def\hyper@comment@potential% + {\hyper@string\hyper@comment@potential\hyper@comment^^J} + \def\hyper@hash{\hyper@string\hyper@hash} + \@hyper@protected@write{\hyper@string##1{##2^^J}} + \endgroup + } + \def\hyper@protected@write{\hyper@protected@write@do\hyper@protected@write} + \def\hyper@second@write##1{ + \hyper@protected@write@do\hyper@second@write{##1} + \@hyper@protected@write{##1} + } + \def\hyper@write{\@gobble} + \hyper@aux@write + \endgroup + } + \hyper@protected@write{\hyper@comment@potential% + \hyper@close + } + \hyper@protected@write{\hyper@comment@potential% + \string\AtBeginDocument{\hyper@comment@real\hyper@nl% + \string\let\string\hyper@write\string\relax% + \hyper@comment@real\hyper@nl% + \string\let\string\hyper@second@write\string\@gobble% + \hyper@comment@real\hyper@nl% + \string\let\string\hyper@comment@potential\string\@empty% + \hyper@comment@real\hyper@nl% + \string\let\string\hyper@comment@real\string\hyper@comment% + \hyper@comment@real\hyper@nl% + \string\hyper@aux@write\hyper@comment@real\hyper@nl% + } + } + \hyper@protected@write{\hyper@comment@potential% + \string\fi + } + \relax +} +\AtBeginDocument{% + \let\hyper@write\relax% + \let\hyper@second@write\@gobble% + \let\hyper@comment@potential\@empty% + \let\hyper@comment@real\hyper@comment% + \hyper@aux@write% +} +%</hyper> +% \end{macrocode} +% +% \clearpage +% +% \section{Supported Packages} +% +% \subsection{\amslatex} +% \subsubsection{The Classes} +% First of all let us modify the \amslatex--classes.\par +% \noindent We change |amsart.cls|, |amsproc.cls|, and |amsbook.cls| +% in the following way. +% \begin{macrocode} +%<*amsart,amsproc,amsbook> +\let\hyper@makecaption\@makecaption +\def\@makecaption#1#2{% + \hyper@makecaption{\hyperanchor{\@currenthyper}{#1}}{#2}% +} +\def\@makefnmark{% + \hyper@currentfnmark% + \hbox{% + \@textsuperscript{% + \normalfont% + \hyperreference{\hyper@current@fnmark}% + {\@thefnmark}% + }% + }% +} +\long\def\@makefntext#1{\indent% + \hyper@currentfnmark% + \bgroup% + \edef\@currenthyper{\hyper@current@fnmark}% + \parindent 1em\noindent + \hbox{% + \hss\@textsuperscript{% + \normalfont% + \hyperanchor{\hyper@current@fnmark}{\@thefnmark}% + }% + }% + #1 + \egroup% +} +\let\hyper@tocwriteb\@tocwriteb +\def\hyper@tocwriteb@def[#1]{% + \def\@tocwriteb##1##2##3{% + \hyper@tocwriteb{##1}{##2}{#1}% + \let\@tocwriteb\hyper@tocwriteb% + }% +} +\def\@sect#1#2#3#4#5#6[#7]#8{% + \ifnum#2>\c@secnumdepth% + \hyper@setcurrent% + \else% + \refstepcounter{#1}% + \ignore@next@refstepcounter% + \fi% + \hyper@settype{#1}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \ifnum#2>\@m\else% + \callwithexpandedhyperref{\hyper@tocwriteb@def}{#8}% + \fi% + \callwithexpandedhyperref% + {\hyper@sect{#1}{#2}{#3}{#4}{#5}{#6}}% + {#7}% + {\hyperanchor{\@currenthyper}{#8}}% +} +%</amsart,amsproc,amsbook> +% \end{macrocode} +% For |amsbook.cls| we need some additional modifications for parts and chapters. +% \begin{macrocode} +%<*amsbook> +\let\hyper@chapter\@chapter +\def\@chapter[#1]#2{% + \refstepcounter{chapter}% + \ignore@next@refstepcounter% + \hyper@settype{chapter}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref{\hyper@tocwriteb@def}{#2}% + \hyper@chapter[#1]{\hyperanchor{\@currenthyper}{#2}}% +} +\let\hyper@chaptermark\chaptermark +\def\hyper@chaptermark@def[#1]{% + \def\chaptermark##1{% + \hyper@chaptermark{#1}% + \let\chaptermark\hyper@chaptermark% + }% +} +\let\hyper@schapter\@schapter +\def\@schapter#1{% + \hyper@setcurrent% + \hyper@settype{chapter}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref{\hyper@tocwriteb@def}{#1}% + \callwithexpandedhyperref{\hyper@chaptermark@def}{#1}% + \hyper@schapter{\hyperanchor{\@currenthyper}{#1}}% +} +\let\hyper@part\@part +\def\@part[#1]#2{% + \ifnum\c@secnumdepth>-2\relax% + \refstepcounter{part}% + \ignore@next@refstepcounter% + \else% + \hyper@setcurrent% + \fi% + \hyper@settype{part}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref% + {\hyper@part}% + {#1}% + {\hyperanchor{\@currenthyper}{#2}}% +} +\def\hyper@add@part[#1]{% + \addcontentsline{toc}{part}{\protect\noindent#1}% +} +\def\@spart#1{% + \hyper@setcurrent% + \hyper@settype{part}% + \global\let\@currenthyper\@currenthyper% + \global\let\@currenthypertype\@currenthypertype% + \callwithexpandedhyperref{\hyper@add@part}{#1}% + \begingroup\centering + \fontsize{\@xxpt}{25}\bfseries + \hyperanchor{\@currenthyper}{#1}% + \vfil\vfil\endgroup \newpage\thispagestyle{empty}} +%</amsbook> +% \end{macrocode} +% |amsdtx.cls| has to be modified as follows. +% \begin{macrocode} +%<*amsdtx> +\input{book.hyp} +\renewcommand\maketitle{\par + \begingroup + \renewcommand\thefootnote{\fnsymbol{footnote}}% + \def\@makefnmark{% + \hyper@currentfnmark% + \hbox to\z@{% + \@textsuperscript{% + \normalfont% + \hyperreference% + {\hyper@current@fnmark}% + {\@thefnmark}% + }% + }}% + \long\def\@makefntext##1{% + \hyper@currentfnmark% + \bgroup% + \edef\@currenthyper{\hyper@current@fnmark}% + \parindent 1em% + \noindent% + \hbox to1.8em% + {\hss$\m@th^{% + \hyperanchor{\hyper@current@fnmark}{\@thefnmark}% + }$}##1% + \egroup% + }% + \if@twocolumn + \ifnum \col@number=\@ne + \@maketitle + \else + \twocolumn[\@maketitle]% + \fi + \else + \newpage + \global\@topnum\z@ + \@maketitle + \fi + \thispagestyle{plain}\@thanks + \endgroup + \setcounter{footnote}{0}% + \let\thanks\relax + \let\maketitle\relax\let\@maketitle\relax + \gdef\@thanks{}\gdef\@author{}\gdef\@title{}} +%</amsdtx> +% \end{macrocode} +% For |amsldoc.cls| we need the following changes. +% \begin{macrocode} +%<*amsldoc> +\input{book.hyp} +\let\hyper@theindex@ams\theindex%fetch modified index from book.hyp +\def\theindex{% + \hyper@theindex@ams% + \let\autoindex\@gobble% +} +%</amsldoc> +% \end{macrocode} +% \subsubsection{The Packages} +% To add the hypertext--capability to |amsmath| respectively |amstex| +% some macros of them have to be modified.\par +% \noindent As we have redefined |\@eqnnum| and we need another +% definition for |amsmath| and |amstex| let us set the macro to its +% default. +% \begin{macrocode} +%<*amsmath,amstex> +\iftagsleft@ + \def\@eqnnum{\hbox to1sp{}\rlap{\normalfont\normalcolor + \hskip -\displaywidth\tagform@\theequation}} +\else + \def\@eqnnum{{\normalfont\normalcolor \tagform@\theequation}} +\fi +%</amsmath,amstex> +% \end{macrocode} +% |amsmath| temporary redefines |\label| but needs the original definition +% that is hold in |\ltx@label|. +% \begin{macrocode} +%<*amsmath> +\let\ltx@label\label +%</amsmath> +% \end{macrocode} +% Now let us define a blind anchor for referencing a couple of equations +% bound together. +% \begin{macrocode} +%<*amsmath,amstex> +\let\hyper@subequations\subequations +\def\subequations{% + \hyper@setcurrent% + \hyper@settype{equation}% + \blindhyperanchor{\@currenthyper}% + \hyper@subequations% +} +% \end{macrocode} +% To allow the references pointing to an equation number we have to define an +% appropriate anchor. +% \begin{macrocode} +\let\hyper@tagform@\tagform@ +\def\tagform@#1{% + \maketag@@@{\hyperanchor{\@currenthyper}{(\ignorespaces#1\unskip)}}% +} +%</amsmath,amstex> +% \end{macrocode} +% For user defined tags it is necessary to generate a new hypertext number +% in |amsmath|. +% \begin{macrocode} +%<*amsmath> +\let\hyper@make@display@tag\make@display@tag +\def\make@display@tag{% + \if@eqnsw\else\iftag@% + \hyper@setcurrent% + \hyper@settype{equation}% + \fi\fi% + \hyper@make@display@tag% +} +%</amsmath> +% \end{macrocode} +% For |amstex| a similar result cannot be provided with an as simple changing. +% This is due to |\@seteqlabel| being called when introducing a new tag. +% Supposing |\@seteqlabel| defining the correct |\@currenthyper| we therefore +% have to modify |\make@df@tag| as follows. +% \begin{macrocode} +%<*amstex> +\def\make@df@tag@@@#1{% + \@seteqlabel{#1}% + \global\let\ams@currenthyper\@currenthyper% + \gdef\df@tag{\let\@currenthyper\ams@currenthyper\tagform@{#1}}% +} +% \end{macrocode} +% Now we just have to ensure |\@seteqlabel| defining the correct +% |\@currenthyper|. +% \begin{macrocode} +\def\@seteqlabel#1{% + \toks@\@xp{\p@equation{#1}}% + \hyper@setcurrent% + \hyper@settype{equation}% + \edef\@currenthyper{\@currenthyper.\the\toks@}% + \edef\@currentlabel{\the\toks@}% +} +%</amstex> +% \end{macrocode} +% We should not use an anchor when using |\eqref| +% \begin{macrocode} +%<*amsmath,amstex> +\def\eqref#1{\textup{\hyper@tagform@{\ref{#1}}}} +%</amsmath,amstex> +% \end{macrocode} +% Damned |amstex| redefines the macro |\label|. We have to ensure that the +% correct stuff is written into the |.aux|-file when this macro is called. +% \begin{macrocode} +%<*amstex> +\def\hyperlabel#1{% + \@bsphack% + \iffirstchoice@\if@filesw% + {\let\thepage\relax% + \def\protect{\noexpand\noexpand\noexpand}% + \xdef\@gtempa{% + \write\@auxout{% + \string\newlabel{#1}{{\@currenthypertype}{\@currenthyper}{\@currentlabel}{\thepage}}% + }% + }% + }% + \@gtempa% + \if@nobreak\ifvmode\nobreak\fi\fi% + \fi\fi% + \@esphack% +} +\let\label\hyperlabel +%</amstex> +% \end{macrocode} +% To get hypertext references to theorems, lemmas, etc.\ |amsthm| has to +% be modified. +% \begin{macrocode} +%<*amsthm> +\let\@begintheorem\hyper@begintheorem +\def\thmhead@plain#1#2#3{% + \hyperanchor{\@currenthyper}{\thmname{#1}\thmnumber{ #2}}% + \thmnote{ {\the\thm@notefont(#3)}}% +} +\let\thmhead\thmhead@plain +\def\swappedhead#1#2#3{% + \hyperanchor{\@currenthyper}{\thmnumber{#2}\thmname{. #1}}% + \thmnote{ {\the\thm@notefont(#3)}}% +} +%</amsthm> +% \end{macrocode} +% For |upref| working correct it is sufficient to modify |\hyper@setref|. +% \begin{macrocode} +%<*upref> +\def\hyper@setref#1#2#3#4{% + \ifx#1\relax% + \protect\G@refundefinedtrue% + #4\nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference `#3' on page \thepage \space undefined}% + \else% + \edef\hyper@tmp{\expandafter\hyper@secondoffour#1}% + \ifx\hyper@tmp\@empty% + \ifx#2\hyper@secondoffour% + #4\null% + \else\ifx#2\hyper@thirdoffour% + #4\protect\textup{\expandafter#2#1\hbox{}}\null% + \else% + #4\protect\textup{\expandafter#2#1\hbox{}}\null% + \fi\fi% + \else% + \ifx#2\hyper@secondoffour% + \hyperreference{\expandafter\hyper@secondoffour#1}{#4}\null% + \else\ifx#2\hyper@thirdoffour% + \hyperreference% + {\expandafter\hyper@secondoffour#1}% + {#4\protect\textup{\expandafter#2#1\hbox{}}}\null% + \else% + \hyperpagereference% + {\expandafter\hyper@forthoffour#1}% + {#4\protect\textup{\expandafter#2#1\hbox{}}}\null% + \fi\fi% + \fi% + \fi% +} +%</upref> +% \end{macrocode} +% +% \subsection{Cross References between Documents} +% The package |xr| adds the capability of generating cross--references +% between different \LaTeXe--documents. It is a nice feature to support +% this by hypertext links. Thus we have to modify |xr| appropriately.\par +% \noindent At first let us provide an additional parameter to |\externaldocument| +% giving the URL--address of the document we use references to. It has to +% be given with surrounding |(||)|. The default value is given by +% |documentname.dvi|. +% \begin{macrocode} +%<*xr> +\def\externaldocument{% + \@ifnextchar(% + {\hyper@externaldocument}% + {\hyper@externaldocument()}% +} +\def\hyper@externaldocument(#1){% + \@ifnextchar[% + {\hyper@@externaldocument(#1)}% + {\hyper@@externaldocument(#1)[]}% +} +\def\hyper@@externaldocument(#1)[#2]#3{% + \def\hyper@XR@docprefix{#1}% + \ifx\hyper@XR@docprefix\@empty% + \def\hyper@XR@docprefix{#3.dvi}% + \fi% + \XR@[#2]{#3}% +} +% \end{macrocode} +% Now we have to modify the anchors we refer to from their local definition +% in the documents |.aux|--file to its external URL--definitions. +% \begin{macrocode} +\def\hyper@xr@end@newlabel{\relax} +\def\hyper@xr@newlabel#1#2#3#4#5{% + \ifx#4\hyper@xr@end@newlabel% + \newlabel% + {\XR@prefix#1}% + {{}% + {}% + {#2}% + {[file:\hyper@XR@docprefix][#3]}% + }% + \else% + \newlabel% + {\XR@prefix#1}% + {{#2}% + {[file:\hyper@XR@docprefix][#3]}% + {#4}% + {[file:\hyper@XR@docprefix][#5]}% + }% + \fi +} +\long\def\XR@test#1#2#3#4\XR@{% + \ifx#1\newlabel% + \expandafter\hyper@xr@newlabel{#2}#3\hyper@xr@end@newlabel\hyper@xr@end@newlabel% + \else\ifx#1\newhyper% + \newhyper{\XR@prefix#2}{#3}% + \else\ifx#1\@input% + \edef\XR@list{\XR@list#2\relax}% + \fi\fi\fi% + \ifeof% + \@inputcheck\expandafter\XR@aux% + \else% + \expandafter\XR@read% + \fi% +} +%</xr> +% \end{macrocode} +% +% \subsection{Fancy Headings} +% The package |fancyheadings| uses a different way to express headings. This gives us trouble on +% pages with an ``empty'' page style via the (default) settings for headers and footers using +% the macro |\fancyplain|. To get the page number if all the parts for the heads and foots are empty +% demands a fairly complicated mechanism to implement if we want to refer to the page number as we +% do have to detect whether we really have a page number on the page. For sake of simplicity of +% processing we assume that any time there is a non-empty text for the head or the foot there also +% is a page number printed in either the head or the foot. +% \begin{macrocode} +%<*fancyheadings> +\def\hyper@fancy@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd} +\def\hyper@fancy@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd} +\def\hyper@fancy@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd} +\def\hyper@fancy@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd} +\def\hyper@fancy@empty{{\hyper@empty\hyper@empty}} +\def\hyper@iffancyplain@empty#1#2#3#4#5\hyper@iffancyplain@empty{% + \ifx#4\hyper@fancy@empty% + \ifx#1\fancyplain% + \if@fancyplain% + \ifx\\#2\\1\else0\fi% + \else% + \ifx\\#3\\1\else0\fi% + \fi% + \else% + 0% + \fi% + \else% + 0% + \fi% +} +\def\hyper@iffancy@empty#1{% + \ifnum\ifx#1\@empty1\else0\fi% + \ifx#1\hyper@empty1\else0\fi% + \expandafter% + \hyper@iffancyplain@empty% + #1\hyper@fancy@empty% + \hyper@fancy@empty\hyper@fancy@empty% + \hyper@fancy@empty\hyper@fancy@empty% + \hyper@iffancyplain@empty% + >0 0\else1\fi% +} +\def\hyper@modifyheadfoot@pagenumber{% + \let\hyper@thehead\@thehead% + \ifx\hyper@thehead\hyper@oddhead\let\hyper@thehead\@oddhead\fi% + \ifx\hyper@thehead\hyper@evenhead\let\hyper@thehead\@evenhead\fi% + \let\hyper@thefoot\@thefoot% + \ifx\hyper@thefoot\hyper@oddfoot\let\hyper@thefoot\@oddfoot\fi% + \ifx\hyper@thefoot\hyper@evenfoot\let\hyper@thefoot\@evenfoot\fi% + \def\@thehead{% + \ifnum\ifnum\ifx\hyper@thehead\@empty1\else0\fi% + \ifx\hyper@thehead\hyper@empty1\else0\fi% + \ifx\hyper@thehead\relax1\else0\fi% + >0 0\else1\fi% + \ifnum\ifx\hyper@thefoot\@empty1\else0\fi% + \ifx\hyper@thefoot\hyper@empty1\else0\fi% + \ifx\hyper@thefoot\relax1\else0\fi% + >0 0\else1\fi% + >0\relax% + \ifnum\ifnum\ifx\hyper@thehead\hyper@fancy@oddhead1\else0\fi% + \ifx\hyper@thehead\hyper@fancy@evenhead1\else0\fi% + >0 0\else1\fi% + \ifnum\ifx\hyper@thefoot\hyper@fancy@oddfoot1\else0\fi% + \ifx\hyper@thefoot\hyper@fancy@evenfoot1\else0\fi% + >0 0\else1\fi% + >0\relax% + \else% + \ifnum\ifnum\hyper@iffancy@empty\@olhead% + \hyper@iffancy@empty\@ochead% + \hyper@iffancy@empty\@orhead% + >0 1\else0\fi% + \ifnum\hyper@iffancy@empty\@olfoot% + \hyper@iffancy@empty\@ocfoot% + \hyper@iffancy@empty\@orfoot% + >0 1\else0\fi% + >0\relax% + \else% + \blindhyperanchor{page.\thepage}% + \fi% + \fi% + \else% + \blindhyperanchor{page.\thepage}% + \fi% + \let\hyper@thepage\thepage% + \let\thepage\hyper@anchorpage% + \ifx\hyper@thehead\@empty% + \hfil% + \else\ifx\hyper@thehead\hyper@empty% + \hfil% + \else% + \hyper@thehead% + \fi\fi% + }% + \def\@thefoot{% + \let\hyper@thepage\thepage% + \let\thepage\hyper@anchorpage% + \ifx\hyper@thefoot\@empty% + \hfil% + \else\ifx\hyper@thefoot\hyper@empty% + \hfil% + \else% + \hyper@thefoot% + \fi\fi% + }% +} +\let\hyper@modifyheadfoot\hyper@modifyheadfoot@pagenumber +%</fancyheadings> +% \end{macrocode} +% \subsection{Long Tables} +% The package |longtable| uses a definition of |\caption| for it's own. +% Thus we have to modify this to reflect the hypertext needs. +% \begin{macrocode} +%<*longtable> +\let\hyper@LT@array\LT@array +\def\LT@array{% + \refstepcounter{table}\ignore@next@refstepcounter% + \def\@currenthyper{\the\hypercount}% + \hyper@LT@array% +} +\def\LT@c@ption#1[#2]#3{% + \LT@makecaption#1\fnum@table{#3}% + \def\@tempa{#2}\ifx\@tempa\@empty\else + {\let\\\space% + \edef\@currenthyper{\the\hypercount}% + \addcontentsline% + {lot}% + {table}% + {\protect\numberline{\thetable}{\hyperreference{\@currenthyper}{#2}}}% + }% + \fi} +\def\LT@makecaption#1#2#3{% + \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{% + \hyper@setcurrent% + \hyper@settype{caption}% + \sbox\@tempboxa{\hyperanchor{\@currenthyper}{#1{#2}}: #3}% + \ifdim\wd\@tempboxa>\hsize + \hyperanchor{\@currenthyper}{#1{#2}}: #3% + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \endgraf\vskip\baselineskip}% + \hss}}% +} +%</longtable> +% \end{macrocode} +% +% \subsection{Right Column Footnotes in Double Column Documents} +% |ftnright.sty| redefines the macro |\@makefntext|. Thus we have to +% modify it's definition when needed. +% \begin{macrocode} +%<*ftnright> +\long\def\@makefntext#1{% + \hyper@currentfnmark% + \bgroup% + \edef\@currenthyper{\hyper@current@fnmark}% + \parindent 1em% + \noindent\hbox to 2em{}% + \llap{${\hyperanchor{\hyper@current@fnmark}{\@thefnmark}}.\;\;$}#1% + \egroup% +} +%</ftnright> +% \end{macrocode} +% +% \subsection{The {\tt natbib}-Package} +% Unfortunately, the bibliography stuff is changed by the |natbib|-package. So we have to provide +% a special macrocode fragment for it which is complicated by the fact, that the package scans +% parts of the |\bibitem| parameters from the |*.aux|-file.\par +% \noindent Let's start with adding an anchor to the bibliographic entries. +% \begin{macrocode} +%<*natbib> +\def\@lbibitem[#1]#2{% + \hyper@setcurrent% + \hyper@settype{citation}% + \@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}% + \item[\hfil\hyperanchor{\@currenthyper}{\@biblabel{\NAT@num}}]% + \NAT@ifcmd#1()()\@nil{#2}% +} +% \end{macrocode} +% To be able to associate the correct hyperlinks from citations to the respectively +% bibliographic entries, we have to save the hyper-addresses into the |.aux|-file +% and provide a macro to read them. Note, that we cannot use the same technique as +% in standard \LaTeXe\ as the |natbib|-package scans parts of the arguments of +% |\bibitem| and we have to ensure, that we do not introduce conflicts by surrounding +% the entries with a hyperlink. To avoid that we store the hyperlink in another macro. +% \begin{macrocode} +\renewcommand\NAT@wrout[5]{% + \if@filesw% + {\let\protect\noexpand\let~\relax% + \immediate% + \write\@auxout% + {\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}{\@currenthyper}}% + }% + \fi% + \ignorespaces% +} +\renewcommand\bibcite[3]{% + \@ifundefined{b@#1\@extra@binfo}\relax + {\NAT@citemultiple% + \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}% + }% + \global\@namedef{b@#1\@extra@binfo}{#2}% + \global\@namedef{hyper@b@#1\@extra@binfo}{#3}% +} +\AtEndDocument{\NAT@swatrue\renewcommand\bibcite[3]{\NAT@testdef{#1}{#2}}}% +% \end{macrocode} +% Now comes the crucial part. We have to invoke the hyperlinks at appropriate points in the +% citation macros. Fortunately |natbib| supports |hyperref| by adding macros at appropriate places +% that can be redefined for introducing the links. +% \begin{macrocode} +\def\hyper@natlinkstart#1#2\hyper@natlinkend{% + \hyperreference{\csname hyper@b@#1\@extra@b@citeb\endcsname}{#2}% +} +\def\hyper@natlinkend{\relax} +% \end{macrocode} +% But we do not like their solution for citations with author name and year. We can do better +% by not including the separators into the links. +% \begin{macrocode} +\def\NAT@citex% + [#1][#2]#3{\let\@citea\@empty% + \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty% + \@for\@citeb:=#3\do% + {\edef\@citeb{\expandafter\@firstofone\@citeb}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi% + \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea% + {\reset@font\bfseries ?}\NAT@citeundefined% + \PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}}% + {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year% + \NAT@parse{\@citeb}\ifNAT@full\let\NAT@nm\NAT@all@names\else% + \let\NAT@nm\NAT@name\fi% + \ifNAT@swa% + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep% + \ifx\NAT@last@yr\NAT@year% + \hyper@natlinkstart{\@citeb}{\NAT@exlab}\hyper@natlinkend% + \else% + \unskip\ % + \hyper@natlinkstart{\@citeb}{\NAT@date}\hyper@natlinkend% + \fi% + \else\@citea% + \hyper@natlinkstart{\@citeb}{{\NAT@nm}}\hyper@natlinkend% + \NAT@aysep\ % + \hyper@natlinkstart{\@citeb}{\NAT@date}\hyper@natlinkend% + \fi% + \def\@citea{\NAT@sep\ }% + \else% + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep% + \ifx\NAT@last@yr\NAT@year% + \hyper@natlinkstart{\@citeb}{\NAT@exlab}\hyper@natlinkend% + \else% + \unskip\ % + \hyper@natlinkstart{\@citeb}{\NAT@date}\hyper@natlinkend% + \fi% + \else\@citea% + \hyper@natlinkstart{\@citeb}{{\NAT@nm}}\hyper@natlinkend% + \ \NAT@open% + \hyper@natlinkstart{\@citeb}{\NAT@date}\hyper@natlinkend% + \fi% + \def\@citea{\NAT@close\NAT@sep\ }% + \fi}}\ifNAT@swa\else\NAT@close\fi}{#1}{#2}} +% \end{macrocode} +% Damned, |natbib| accesses this macros through |\@citex| using a |\let|-assignment. +% We have to recall this assignment to define it. Fortunately, the package provides +% a macro to achieve this. +% \begin{macrocode} +\NAT@set@cites +% \end{macrocode} +% Bad news, |natbib| does not provide dummies for inserting hypertext-markups into ranges. +% Thus we have to patch the sorting macros of the package. +% \begin{macrocode} +\ifnum\NAT@sort=1 +\begingroup \catcode`\_=8 +\gdef\@make@cite@list{% + \edef\@citeb{\expandafter\@firstofone\@citeb}% + \@ifundefined{b@\@citeb\@extra@b@citeb}{% + \@citea{\reset@font\bfseries?}% + \def\@citea{\NAT@sep\penalty\@m\NAT@space}% + \NAT@citeundefined\PackageWarning{natcite}% + {Citation `\@citeb' on page \thepage\space undefined}}% + {\NAT@parse{\@citeb}% + \ifcat_\ifnum\z@<0\NAT@num_\else A\fi% + \@tempcnta\NAT@num\relax% + \ifnum\@tempcnta>\@tempcntb% + \edef\@cite@list{\@cite@list \@celt{{\NAT@num}{\@citeb}}}% + \@tempcntb\@tempcnta% + \else% + \edef\@cite@list{\expandafter\@sort@celt\@cite@list\@gobble @}% + \fi% + \else% + \@citea\hyper@natlinkstart{\@citeb}{\NAT@num}\hyper@natlinkend% + \def\@citea{\NAT@sep\penalty\@m\NAT@space}% + \fi}} +\endgroup +\def\@sort@celt#1#2{% + \ifx \@celt #1% + \hyper@sort@celt#2% + \fi% +}% +\def\hyper@sort@celt#1#2{% + \ifnum #1<\@tempcnta% + \@celt{{#1}{#2}}% + \expandafter\expandafter\expandafter\@sort@celt% + \else% + \@celt{{\NAT@num}{\@citeb}}\@celt{{#1}{#2}}% + \fi% +} +\def\@compress@cite#1{\hyper@compress@cite#1} +\def\hyper@compress@cite#1#2{% + \advance\@tempcnta\@ne% + \ifnum #1=\@tempcnta% + \ifx\@h@ld\relax% + \edef\@h@ld{% + \@citea% + \noexpand\hyper@natlinkstart{#2}{#1}\noexpand\hyper@natlinkend% + }% + \else% + \def\@h@ld{% + \hbox{--}% + \hyper@natlinkstart{#2}{#1}\hyper@natlinkend% + }% + \fi% + \else% + \@h@ld\@citea% + \hyper@natlinkstart{#2}{#1}\hyper@natlinkend% + \let\@h@ld\relax% + \fi% + \@tempcnta#1\def\@citea{\NAT@sep\penalty\@m\NAT@space}% +} +\fi +%</natbib> +% \end{macrocode} +% +% \subsection{The Subequationarray Package} +% First of all we have to set some anchors in the |subeqnarray|-environment +% we can refer to. +% \begin{macrocode} +%<*subeqnarray> +\def\hyper@subeqnnum@leqno{% + \hbox to .01\p@{}% + \rlap{% + \reset@font\rmfamily% + \hskip-\displaywidth\hyperanchor{\@currenthyper}{(\thesubequation)}% + }% +} +\def\hyper@subeqnnum@reqno{% + {\reset@font\rmfamily \hyperanchor{\@currenthyper}{(\thesubequation)}}% +} +\let\@subeqnnum\hyper@subeqnnum@reqno +\@ifpackagewith{subeqnarray}{leqno} + {\let\@subeqnnum\hyper@subeqnnum@leqno} + {\let\@subeqnnum\hyper@subeqnnum@reqno} +\let\hyper@subeqnarray\subeqnarray +\def\subeqnarray{% + \hyper@setcurrent% + \hyper@settype{equation}% + \let\label@currenthyper\@currenthyper% + \let\label@currenthypertype\@currenthypertype% + \def\label##1{% + \let\@currenthyper\label@currenthyper% + \let\@currenthypertype\label@currenthypertype% + \hyperlabel{##1}% + \blindhyperanchor{\label@currenthyper}% + \def\@currenthyper{\the\hypercount}% + }% + \hyper@setcurrent% + \hyper@settype{equation}% + \def\@currenthyper{\the\hypercount}% + \hyper@subeqnarray% +} +% \end{macrocode} +% The subeqnarray package defines a new label command called |\slabel|. +% Thus, we have to redefine it in order to ensure that the hyper reference is +% added to the label when written into the |.aux|-file. +% \begin{macrocode} +\def\slabel#1{% + \@bsphack + \if@filesw + {\let\thepage\relax + \def\protect{\noexpand\noexpand\noexpand}% + \edef\@tempa{\write\@auxout{\string + \newlabel{#1}{{\@currenthypertype}{\@currenthyper}{\thesubequation}{\thepage}}}}% + \expandafter}\@tempa + \if@nobreak \ifvmode\nobreak\fi\fi + \fi\@esphack} +%</subeqnarray> +% \end{macrocode} +% \subsection{The Theorem Package} +% Analoguous to the theorem environment of \LaTeXe{} we have to modify +% the different theorem styles of the theorem package. +% \begin{macrocode} +%<*theorem> +%plain +\gdef\th@plain{\normalfont\itshape% + \def\@begintheorem##1##2{% + \item[\hskip\labelsep% + \hyperanchor{\@currenthyper}{\theorem@headerfont ##1\ ##2}% + ]% + }% + \def\@opargbegintheorem##1##2##3{% + \item[\hskip\labelsep% + \hyperanchor% + {\@currenthyper}% + {\theorem@headerfont ##1\ ##2}\ (##3)% + ]% + }% +} +%break +\gdef\th@break{\normalfont\slshape% + \def\@begintheorem##1##2{% + \item[\rlap{\vbox{\hbox{\hskip \labelsep% + \hyperanchor{\@currenthyper}{\theorem@headerfont ##1\ ##2}% + }\hbox{\strut}}}% + ]% + }% + \def\@opargbegintheorem##1##2##3{% + \item[\rlap{\vbox{\hbox{\hskip \labelsep% + \hyperanchor% + {\@currenthyper}% + {\theorem@headerfont ##1\ ##2}\ (##3)% + }\hbox{\strut}}}% + ]% + }% +} +%marginbreak +\gdef\th@marginbreak{\normalfont\slshape% + \def\@begintheorem##1##2{% + \item[\rlap{\vbox{\theorem@headerfont% + \hbox{\llap{##2}\hskip\labelsep% + \hyperanchor{\@currenthyper}{##1}% + }% + \hbox{\strut}}}% + ]% + }% + \def\@opargbegintheorem##1##2##3{% + \item[\rlap{\vbox{\theorem@headerfont% + \hbox{\llap{##2}\hskip\labelsep% + \hyperanchor{\@currenthyper}{##1}\ (##3) + }% + \hbox{\strut}}}% + ]% + }% +} +%changebreak +\gdef\th@changebreak{\normalfont\slshape% + \def\@begintheorem##1##2{% + \item[\rlap{\vbox{\hbox{\hskip\labelsep% + \hyperanchor{\@currenthyper}{\theorem@headerfont ##2\ ##1}% + }\hbox{\strut}}}% + ]% + }% + \def\@opargbegintheorem##1##2##3{% + \item[\rlap{\vbox{\hbox{\hskip\labelsep% + \hyperanchor% + {\@currenthyper}% + {\theorem@headerfont ##2\ ##1}\ (##3)% + }\hbox{\strut}}}% + ]% + }% +} +%change +\gdef\th@change{\normalfont\slshape% + \def\@begintheorem##1##2{% + \item[\hskip\labelsep% + \hyperanchor{\@currenthyper}{\theorem@headerfont ##2\ ##1}% + ]% + }% + \def\@opargbegintheorem##1##2##3{% + \item[\hskip\labelsep% + \hyperanchor% + {\@currenthyper}% + {\theorem@headerfont ##2\ ##1}\ (##3)% + ]% + }% +} +%margin +\gdef\th@margin{\normalfont\slshape% + \def\@begintheorem##1##2{% + \item[\theorem@headerfont \llap{##2}\hskip\labelsep% + \hyperanchor{\@currenthyper}{##1}% + ]% + }% + \def\@opargbegintheorem##1##2##3{% + \item[\theorem@headerfont \llap{##2}\hskip\labelsep% + \hyperanchor{\@currenthyper}{##1}\ (##3)% + ]% + }% +} +%</theorem> +% \end{macrocode} +% +% \subsection{The CWEB Document Class} +% For \CWEB\ there exists a \LaTeXe\ document class that defined a reference +% mechanism for literate programming using latex and \CWEB.\par +% \noindent +% First of all it is based on another document class. Thus we have to +% load the modifications for this class, too. +% \begin{macrocode} +%<*cweb> +\InputIfFileExists{\CwebBaseClass.hyp}{}% + {\PackageError{hyper}{\CwebBaseClass.hyp not found.\MessageBreak + Please choose another base document class for cweb\MessageBreak + or redefine \string\CwebBaseClass to point to a\MessageBreak + modification document class for the base document class + }{}% + }% +% \end{macrocode} +% As we use pattern--like definitions for some stuff following below +% an additiional package has to be loaded. +% \begin{macrocode} +\RequirePackage{defpattern} +% \end{macrocode} +% |cweb.cls| uses the underscore character as a letter for some macro names +% we have to redefine. Thus we set the category code of |_| correspondingley. +% \begin{macrocode} +\chardef\hyper@CatUsCode=\catcode`\_ +\catcode`\_=\CatLetter +% \end{macrocode} +% Why the hell must the class use a redefinition of |\refstepcounter| for +% its own? This means that we have to redefine it another time. +% \begin{macrocode} +\let\hyper@cweb@refstepcounter=\hyper@refstepcounter +\def\refstepcounter#1{% + \def\@tempa{#1}% + \ifx \@tempa\cweb@string@chunk% + \protected@edef\@currenthyper{cweb.\cweb@refchunk}% + \hyper@settype{chunk}% + \protected@edef\@currentlabel{\cweb@refchunk}% + \else% + \hyper@setcurrent% + \hyper@settype{chunk}% + \hyper@cweb@refstepcounter{#1}% + \fi% +} +% \end{macrocode} +% Naturally, we want to use the chunk numbers as links to the corresponding +% chunks. This means that we have to redefine |\CwebRefName|. +% Don't ask why it's that complicated. +% \begin{macrocode} +\let\hyper@CwebRefName\CwebRefName +\def\CwebRefName#1:#2\X{% + \ifmmode \gdef\cwbb@toggle_text{\null$\null}% + \else \let\cwbb@toggle_text\relax% + \fi% + \cwbb@toggle_text% + \expandafter\ifx\csname hyper@cweb.#1\endcsname\relax% + \expandafter\ifx\csname hyper@new@cweb.#1\endcsname\relax% + \PackageWarning{hyper}% + {Hyper reference for `cweb.#1' on page \hyper@thepage\space undefined}% + \hyper@change1\relax% + \hyper@undef@color{% + $\langle\,${\cwbb@tex \cwbb@check_dot{#2}\CwebRefNumber{#1}}$\,\rangle$% + }% + \else% + \hyperreference{cweb.#1}{% + $\langle\,${\cwbb@tex \cwbb@check_dot{#2}\CwebRefNumber{#1}}$\,\rangle$% + }% + \fi% + \else% + \hyperreference{cweb.#1}{% + $\langle\,${\cwbb@tex \cwbb@check_dot{#2}\CwebRefNumber{#1}}$\,\rangle$% + }% + \fi% + \cwbb@toggle_text% +} +% \end{macrocode} +% However, there has to exist anchors for these links to the chunks.\par +% \noindent Well, for a hierarchical structure the chunk numbers are +% written into the +% margin whereas for a flat structure they are written at the beginning of +% the chunk using the chunk begin macro |\M|. Therefore we need the following +% modifications of the original code. +% \begin{macrocode} +\ifcase \cweb@structure + %% hierarchic + \let\hyper@cwbb@marginal_chunkno\cwbb@marginal_chunkno% + \def\cwbb@marginal_chunkno{% + \let\hyper@thechunk\thechunk% + \def\thechunk{\hyperanchor{cweb.\arabic{chunk}}{\hyper@thechunk}}% + \hyper@cwbb@marginal_chunkno% + \let\thechunk\hyper@thechunk% + } + \or + %% flat + \let\hyper@M\M% + \def\M#1{% + \let\hyper@thechunk\thechunk% + \def\thechunk{\hyperanchor{cweb.\arabic{chunk}}{\hyper@thechunk}}% + \hyper@M{#1}% + \let\thechunk\hyper@thechunk% + } +\fi +% \end{macrocode} +% Unfortunately, this is not sufficient. The class uses an additional +% cross referencing mechanism.\par +% \noindent Damned, it uses seperators for a list of cross references that +% cannot be used for the pattern-like definition we need to seperate the +% different references. Thus we have to redefinie the seperators and reinvoke +% them after splitting. +% \begin{macrocode} +\let\hyper@CwebCREt\CwebCREt +\let\hyper@CwebCRsEt\CwebCRsEt +\def\CwebCREt{!} +\def\CwebCRsEt{?} +% +\defpattern\hyper@split@CwebCrossRef[#2]{\hyperreference{cweb.#2}{#2}} +\defpattern\hyper@split@CwebCrossRef[ #2]{\hyper@split@CwebCrossRef[#2]} +\defpattern\hyper@split@CwebCrossRef[#2,#3]{% + \hyper@split@CwebCrossRef[#2], % + \hyper@split@CwebCrossRef[#3]% +} +\defpattern\hyper@split@CwebCrossRef[#2!#3]{% + \hyper@split@CwebCrossRef[#2]\hyper@CwebCREt% + \hyper@split@CwebCrossRef[#3]% +} +\defpattern\hyper@split@CwebCrossRef[#2?#3]{% + \hyper@split@CwebCrossRef[#2]\hyper@CwebCRsEt% + \hyper@split@CwebCrossRef[#3]% +} +\def\hypersplit@CwebCrossRef[#1]{% + \edef\hyper@tmp{#1}% + \expandafter\hyper@split@CwebCrossRef\expandafter[\hyper@tmp]% +} +% +\let\hyper@CwebCrossRef\CwebCrossRef +\def\CwebCrossRef#1#2.{% + \hyper@CwebCrossRef{#1}{\hypersplit@CwebCrossRef[#2]}.% +} +% \end{macrocode} +% As you might have expected, this even does not resolve all problems. +% The list of references may contain multiple entries pointing to +% different chunks containing code for the same literate. +% Therefore we have to redefine the literates to allow links to different +% occurrences. +% \begin{macrocode} +\let\hyper@CwebRefList\CwebRefList +\def\hyper@CwebRefName@RefList#1:#2\X{% + \hyper@CwebRefName\hypersplit@CwebCrossRef[#1]:#2\X% +} +\def\CwebRefList{% + \let\hyper@CwebReadPPList\CwebReadPPList% + \let\CwebReadPPList\relax% + \hyper@CwebRefList% + \let\X\hyper@CwebRefName@RefList + \def\CwebCrossRef##1##2.{% + \quad {\reset@font\footnotesize ##1~\hypersplit@CwebCrossRef[##2].}% + }% + \let\CwebReadPPList\hyper@CwebReadPPList% + \CwebReadPPList% +} +% \end{macrocode} +% Last but not least we have to handle the index referencing from variables +% to the chunks they occur in. The modifications below are just a little bit +% complicated as we have to split the list of occurrences to several parts +% each of which has to be handled sepeartely without being allowed to use +% the original list that may contain the character |]| that cannot be used +% in pattern--like definitions we need here. +% \begin{macrocode} +\let\hyper@CwebIndexEntry\CwebIndexEntry +\let\hyper@CwebIndexDeclared\CwebIndexDeclared +\def\CwebIndexDeclared#1]{|#1|} +\defpattern\hyper@cwebindex[#2]{\hyperreference{cweb.#2}{#2}} +\defpattern\hyper@cwebindex[|#2|]{% + \hyperreference{cweb.#2}{\hyper@CwebIndexDeclared#2]}% +} +\defpattern\hyper@cwebindex[#2, #3]{% + \hyper@cwebindex[#2], \hyper@cwebindex[#3]% +} +\def\hyper@cweb@index#1{% + \edef\hyper@tmp{#1}% + \expandafter\hyper@cwebindex\expandafter[\hyper@tmp]% +} +\def\CwebIndexEntry#1, #2.{% + \hyper@CwebIndexEntry#1, \hyper@cweb@index{#2}.% +} +% \end{macrocode} +% Now it just remains to reset the category code for |_| to the one we had +% before the modifications started. +% \begin{macrocode} +\catcode`\_=\hyper@CatUsCode +%</cweb> +% \end{macrocode} +% +% \clearpage +% +% \section{Needed Packages (Part of this Distribution)} +% +% \subsection{Pattern--Like Definition of Macros} +% For the index and glossary definitions we have used the package |defpattern| +% that is already part of the fp--package on |CTAN:macros/latex/contrib/other/fp|. +% This is a very usefull macro allowing the definition of other macros by +% pattern matching rules.\par +% \noindent The package has been adapted from Alan Jeffrey's |\howto| that can be +% found in ``\TeX and TUG NEWS 2(2)''. +% \begin{macrocode} +%<*defpattern> +\ProvidesPackage{defpattern} +\message{% + `\string\defpattern-macro % + (adapted from \string\howto\space% + (Alan Jeffrey in TeX and TUG NEWS 2(2))% + )% + '% +} +\def\xcs#1#2{\expandafter#1\csname#2\endcsname} +\newcount\actioncount +\def\defpattern#1[#2]#3{% + \xcs\ifx{\expandafter\gobble\string#1}\relax + \def#1{\erroraction#1}\fi + \advance\actioncount by 1\relax + \expandafter\defaction\expandafter{#1}{#3}{#2}% + \def\temp##1##2##3##4##5##6##7##8##9{\def\temp{[#2]}}% + \temp\empty\empty\empty\empty\empty\empty\empty\empty\empty + \edef#1{\noexpand\doaction\xcs\noexpand + {action-\the\actioncount}\temp}} +\def\defaction#1#2#3{% + \xcs\def{action-\the\actioncount}##1[#3]{\applyto{#1}{#2}}} +\def\gobble#1{} +\def\applyto#1#2#3{#3{#1}{#2}} +\def\doaction#1[#2][#3]{#1[#3]\success[#2]\failure[#3]} +\def\success#1#2[#3]\failure[#4]{#2} +\def\failure#1#2{#1} +\def\erroraction#1[#2]{% + \PackageError{defpattern}{I don't know how to \string#1[#2]}{}} +%</defpattern> +% \end{macrocode} +% +% \clearpage +% +% \section{Extensions} +% Currently the following extensions exist for this package. +% \begin{itemize} +% \item Back references from the bibliography to the citations\newline +% (described in |backcite.dtx|) +% \end{itemize} +% +% \Finale diff --git a/Master/texmf-dist/source/latex/hyper/hyper.ins b/Master/texmf-dist/source/latex/hyper/hyper.ins new file mode 100644 index 00000000000..2d876541f12 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/hyper.ins @@ -0,0 +1,90 @@ +%% File: hyper.ins Copyright (C) 1995--1999 Michael Mehlich +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +\input docstrip + +{\ifx\generate\undefined +\Msg{***********************************************} +\Msg{*} +\Msg{* This installation requires docstrip} +\Msg{* version 2.3c or later.} +\Msg{*} +\Msg{* An older version of docstrip has been input} +\Msg{*} +\Msg{***********************************************} +\errhelp{Install newer docstrip.tex.} +\errmessage{Old docstrip in input path} +\batchmode +\csname @@end\endcsname +\fi} + +\preamble +\endpreamble + +\keepsilent +\askforoverwritefalse + +\generate{ + \file{hyper.sty}{\from{hyper.dtx}{hyper}} + \file{defpattern.sty}{\from{hyper.dtx}{defpattern}} +} + +\generate{ + \file{article.hyp}{\from{hyper.dtx}{article}} + \file{proc.hyp}{\from{hyper.dtx}{proc}} + \file{report.hyp}{\from{hyper.dtx}{report}} + \file{book.hyp}{\from{hyper.dtx}{book}} + \file{letter.hyp}{\from{hyper.dtx}{letter}} + \file{slides.hyp}{\from{hyper.dtx}{slides}} + \file{ltnews.hyp}{\from{hyper.dtx}{ltnews}} + \file{ltxdoc.hyp}{\from{hyper.dtx}{ltxdoc}} + \file{ltxguide.hyp}{\from{hyper.dtx}{ltxguide}} + \file{leqno.hyp}{\from{hyper.dtx}{leqno}} + \file{doc.hyp}{\from{hyper.dtx}{doc}} +} + +\generate{ + \file{amsart.hyp}{\from{hyper.dtx}{amsart}} + \file{amsproc.hyp}{\from{hyper.dtx}{amsproc}} + \file{amsbook.hyp}{\from{hyper.dtx}{amsbook}} + \file{amsdtx.hyp}{\from{hyper.dtx}{amsdtx}} + \file{amsldoc.hyp}{\from{hyper.dtx}{amsldoc}} + \file{amsmath.hyp}{\from{hyper.dtx}{amsmath}} + \file{amstex.hyp}{\from{hyper.dtx}{amstex}} + \file{amsthm.hyp}{\from{hyper.dtx}{amsthm}} + \file{upref.hyp}{\from{hyper.dtx}{upref}} +} + +\generate{ + \file{cweb.hyp}{\from{hyper.dtx}{cweb}} +} + +\generate{ + \file{xr.hyp}{\from{hyper.dtx}{xr}} + \file{fancyheadings.hyp}{\from{hyper.dtx}{fancyheadings}} + \file{ftnright.hyp}{\from{hyper.dtx}{ftnright}} + \file{longtable.hyp}{\from{hyper.dtx}{longtable}} + \file{natbib.hyp}{\from{hyper.dtx}{natbib}} + \file{subeqnarray.hyp}{\from{hyper.dtx}{subeqnarray}} + \file{theorem.hyp}{\from{hyper.dtx}{theorem}} +} + +\generate{ + \file{hxt-bc.sty}{\from{backcite.dtx}{backcite}} +} + +\postamble +\Msg{*********************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the files with suffixes} +\Msg{*} +\Msg{*\space\space hyp and sty} +\Msg{*} +\Msg{* into a directory searched by TeX} +\Msg{*********************************************************************} +\endpostamble + +\end + diff --git a/Master/texmf-dist/source/latex/hyper/scontrib/README b/Master/texmf-dist/source/latex/hyper/scontrib/README new file mode 100644 index 00000000000..68eb8e64eb6 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/scontrib/README @@ -0,0 +1,6 @@ +This area contains some stuff that authors have written for +adding hypertex capability to other packages that are not +supported by the hyper package. +Some files from the contrib directory may be moved into this +directory when the hyper package has been prepared for +automatically loading them. diff --git a/Master/texmf-dist/source/latex/hyper/scontrib/harvard.hyp b/Master/texmf-dist/source/latex/hyper/scontrib/harvard.hyp new file mode 100644 index 00000000000..53fd4fc98c3 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyper/scontrib/harvard.hyp @@ -0,0 +1,21 @@ +%% harvardfull.hyp - Amendments to harvard bibliography style Version 2.0.5 +%% to be used together with the hyper package +%% Author: Renate Schmidt (schmidt@mpi-sb.mpg.de) +%% Copyright: Renate Schmidt, May 1995 +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{harvard.hyp}[95/05/15] + +%% The following defines anchors not just for the year but also for the +%% abbr-citation, the full-citation and the name. +\renewcommand{\harvarditem}[4][\null]{% + \hyper@setcurrent% + \item[\blindhyperanchor{\@currenthyper}]% + \if@filesw{ \def\protect##1{\string ##1\space}% + \ifthenelse{\equal{#1}{\null}} + {\def\next{{#4}{\hyperreference{\@currenthyper}{#2}}{\hyperreference{\@currenthyper}{#2}}{\hyperreference{\@currenthyper}{#3}}}} + {\def\next{{#4}{\hyperreference{\@currenthyper}{#2}}{\hyperreference{\@currenthyper}{#1}}{\hyperreference{\@currenthyper}{#3}}}} + \immediate\write\@auxout{\string\harvardcite\next}% + }\fi% + \protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces% + } + |