From 6dc1c9960a84a72228cacdea73160739d0d7243a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Jan 2006 23:54:03 +0000 Subject: trunk/Master/texmf-dist/source/latex/hyperref git-svn-id: svn://tug.org/texlive/trunk@327 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/hyperref/Makefile | 48 + .../texmf-dist/source/latex/hyperref/backref.dtx | 595 + .../texmf-dist/source/latex/hyperref/hyperref.drv | 50 + .../texmf-dist/source/latex/hyperref/hyperref.dtx | 13330 +++++++++++++++++++ .../texmf-dist/source/latex/hyperref/hyperref.ins | 88 + Master/texmf-dist/source/latex/hyperref/manual.css | 108 + .../texmf-dist/source/latex/hyperref/nameref.dtx | 426 + 7 files changed, 14645 insertions(+) create mode 100644 Master/texmf-dist/source/latex/hyperref/Makefile create mode 100644 Master/texmf-dist/source/latex/hyperref/backref.dtx create mode 100644 Master/texmf-dist/source/latex/hyperref/hyperref.drv create mode 100644 Master/texmf-dist/source/latex/hyperref/hyperref.dtx create mode 100644 Master/texmf-dist/source/latex/hyperref/hyperref.ins create mode 100644 Master/texmf-dist/source/latex/hyperref/manual.css create mode 100644 Master/texmf-dist/source/latex/hyperref/nameref.dtx (limited to 'Master/texmf-dist/source/latex') diff --git a/Master/texmf-dist/source/latex/hyperref/Makefile b/Master/texmf-dist/source/latex/hyperref/Makefile new file mode 100644 index 00000000000..b98f0011362 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/Makefile @@ -0,0 +1,48 @@ +MKDIR=mkdir +COPY=cp +CHDIR=cd +RM=rm -f +INSTALLDIRVAR=TEXMFMAIN +SHELL=sh +all: hyperref test + +hyperref: unpack documentation + +unpack: + latex hyperref.ins + +hyperref.drv: unpack + +documentation: hyperref.drv + latex hyperref.dtx + makeindex -s gind hyperref + latex hyperref.dtx + makeindex -s gind hyperref + latex hyperref.dtx + +test: test.nodir +test.nodir: + $(CHDIR) test; latex test0 + $(CHDIR) test; makeindex test0 + $(CHDIR) test; latex test0 + +install: unpack + ( \ + TEXMF=`kpsewhich -expand-var '$$$(INSTALLDIRVAR)'`; \ + echo installing to $${TEXMF}/tex/latex/hyperref; \ + $(MKDIR) $${TEXMF}/tex/latex/hyperref; \ + $(COPY) *.sty *.def htex4ht.cfg $${TEXMF}/tex/latex/hyperref \ + ) + +clean: + -$(RM) *.aux *.toc *.idx *.drv *.dvi *.log *.rep *.lof *.brf *.tmp *.ist *.ilg *.ind *.out *.css *.html + -$(CHDIR) test; $(RM) *.dvi *.aux *.log *.toc *.lot *.lof *.idx *.ilg *.ind *.out *.brf + -$(RM) nameref.sty backref.sty hyperref.sty hycheck.tex nohyperref.sty + -$(RM) *.def htex4ht.cfg *.otc *.idv *.lg *.xref test.ps test.pdf + -$(RM) hyperref.pdf + +checks: + cd test; for what in test*tex ;\ + do \ + pdflatex $$what; pdflatex $$what; latex $$what; latex $$what ;\ + done diff --git a/Master/texmf-dist/source/latex/hyperref/backref.dtx b/Master/texmf-dist/source/latex/hyperref/backref.dtx new file mode 100644 index 00000000000..5a25459c36e --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/backref.dtx @@ -0,0 +1,595 @@ +\def\fileversion{1.23} +\def\filedate{2003/03/20} +% +% \iffalse +%% File: backref.dtx Copyright (C) 1995-2003 David Carlisle, Sebastian Rahtz, Heiko Oberdiek +% +%% This file is part of the `Hyperref Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% The list of all files belonging to the `Hyperref Bundle' is +%% given in the file `manifest.txt'. +%<*driver> +\documentclass{ltxdoc} +\begin{document} + \title{% + Back referencing from bibliographical citations% + \thanks{% + This file has version number \fileversion, + last revised \filedate.% + }% + } + \author{David Carlisle and Sebastian Rahtz} + \date{\filedate} + \maketitle + \tableofcontents + \DocInput{backref.dtx} +\end{document} +% +% \fi +% \CheckSum{505} +% \MakeShortVerb{|} +% \section{Introduction} +% +% \section{Usage} +% +% \subsection{Options} +% +% \subsubsection{Options for type of back references} +% +% In short the following options set the type of back +% references. Default is option |pageref|. +% \begin{quote} +% \begin{tabular}{@{}ll@{}} +% |ref| & section number\\ +% |pageref| & page number\\ +% |hyperref| & section number as hyper link\\ +% |hyperpageref| & page number as hyper link +% \end{tabular} +% \end{quote} +% The options that start with |hyper| are intended for +% the use with package |hyperref|. In this case package +% |backref| will be loaded automatically if the |hyperref| +% options |backref| or |pagebackref| are given. Package +% |hyperref| then loads package |backref| with the appropriate +% option: +% \begin{quote} +% \begin{tabular}{@{}ll@{}} +% |hyperref| option & |backref| option set by |hyperref|\\ +% \hline +% |backref| & |hyperref|\\ +% |backref=section| & |hyperref|\\ +% |backref=slide| & |hyperref|\\ +% |backref=page| & |hyperpageref|\\ +% |pagebackref| & |hyperpageref| +% \end{tabular} +% \end{quote} +% +% \subsubsection{Language options} +% +% Currently supported are options |english| (default), |UKenglish|, +% |USenglish|, |british|, |german|, |ngerman|, |austrian|, |naustrian|, +% |french|, |francais|, and |spanish|. +% +% \subsection{Formatting of the back references list} +% +% Package |backref| has to be able to detect the end of an entry +% in the bibliography, therefore each \cmd{\bibitem} entry must +% be ended by an empty line (or a |\par| token). +% +% Example: +%\begin{quote} +%\begin{verbatim} +%\begin{thebibliography}{9} +%\bibitem[bib:abc] First entry. +% +%\bibitem[bib:foo] Second entry. +% +%\end{thebibliography} +%\end{verbatim} +%\end{quote} +% +% Then package |backref| can add hooks for the back references list. +% at the end of the entry. The list is separated by \cmd{\newblock}, +% if the used bibliography package supports this. The package options +% control the kind of back references (page numbers, sections numbers), +% whereas the hooks control the formatting. +% +% There are two hooks \cmd{\backref} and a new hook \cmd{\backrefalt}, +% available since version 1.21 of package |backref|. The former one +% is enabled by default. +% +% \subsubsection{Formatting hook \cmd{\backref}} +% +% Macro \cmd{\backref} has a a comma separated +% list of backref references as first and only argument. +% With hyperref options only this list will be printed. Without +% hyperref there is an introductionary text, controlled by +% macros \cmd{\backrefpagesname} or \cmd{\backrefsectionsname}. +% +% \subsubsection{Formatting hook \cmd{\backrefalt}} +% +% \cmd{\backrefalt} is a new interface since version 1.21 of package +% |backref|. It takes four arguments: +% \begin{enumerate} +% \item Number of citations without dupes. +% \item Back references list without dupes. +% \item Number of all citations (with dupes). +% \item Back reference list with all entries (with dupes). +% \end{enumerate} +% The latter options consider equal entries as one entry. +% Now \cmd{\backrefalt} can easily be defined with text that +% depends on the number of citations, for example: +%\begin{quote} +%\begin{verbatim} +%\usepackage[backref]{backref} +%\renewcommand*{\backref}[1]{} +%\renewcommand*{\backrefalt}[4]{% +% \ifcase #1 % +% No citations.% +% \or +% One citation in section #2.% +% \else +% #1 citations in sections #2.% +% \fi +%} +%\end{verbatim} +%\end{quote} +% The separation between the list entries are controlled by +% the following macros: +% \begin{itemize} +% \item \cmd{\backrefsep}: inserted between entries except for the +% next cases, default is ``\verb*|, |''. +% \item \cmd{\backreftwosep}: inserted between entries in +% a list of two entries, default is ``\verb*| and~|''. +% \item \cmd{\backreflastsep}: inserted between the last two +% entries of a list with more than two entries, default is +% ``\verb*|, and~|''. +% \end{itemize} +% Examples: +% \begin{quote} +% \meta{entry1}\\ +% \meta{entry1} \cmd{\backreftwosep} \meta{entry2}\\ +% \meta{entry1} \cmd{\backrefsep} \meta{entry2} +% \cmd{\backreflastsep} \meta{entry3} +% \end{quote} +% +% \StopEventually{} +% +% \section{The macros} +% Internal command names of this package start with |\BR@|, +% commands, that store the original meaning of commands, which +% will be redefined, are prefixed with |\BRorg@|. +% +% \subsection{Package identification} +% \begin{macrocode} +%<*package> +\ProvidesPackage{backref}% + [\filedate\space v\fileversion\space Bibliographical back referencing] +% \end{macrocode} +% +% \subsection{Options} +% +% \subsubsection{Option verbose} +% If package hyperref is loaded, then its setting is used as +% default for the verbose switch. +% \begin{macrocode} +\newif\ifBR@verbose +\@ifundefined{ifHy@verbose}{% + \BR@verbosefalse +}{% + \let\ifBR@verbose\ifHy@verbose +} +\DeclareOption{verbose}{\BR@verbosetrue} +% \end{macrocode} +% +% \subsubsection{Options for way of working} +% +% What is printed depends on how the 3 available items of +% information are used (page number, section number, label). +% \begin{macrocode} +\long\def\page@backref#1#2#3{#1} +\long\def\section@backref#1#2#3{#2} +\long\def\hyper@section@backref#1#2#3{\hyperlink{#3}{#2}} +\long\def\hyper@page@backref#1#2#3{\hyperlink{page.#1}{#1}} +% \end{macrocode} +% Now the options follows, that can be used without +% package hyperref. +% \begin{macrocode} +\DeclareOption{pageref}{% + \def\backref{\backrefpagesname\ }% + \let\backrefxxx\page@backref +} +\DeclareOption{ref}{% + \def\backref{\backrefsectionsname\ }% + \let\backrefxxx\section@backref +} +% \end{macrocode} +% Set up back-referencing to be hyper links, by page or section. +% \begin{macrocode} +\DeclareOption{hyperref}{% + \def\backref{}\let\backrefxxx\hyper@section@backref +} +\DeclareOption{hyperpageref}{% + \def\backref{}\let\backrefxxx\hyper@page@backref +} +% \end{macrocode} +% +% \subsubsection{Language options} +% +% \begin{macrocode} +\def\backrefenglish{% + \def\backrefpagesname{pages}% + \def\backrefsectionsname{sections}% + \def\backrefsep{, }% + \def\backreftwosep{ and~}% + \def\backreflastsep{, and~}% +} +\def\backrefgerman{% + \def\backrefpagesname{Seiten}% + \def\backrefsectionsname{Abschnitte}% + \def\backrefsep{, }% + \def\backreftwosep{ und~}% + \def\backreflastsep{ und~}% +} +\def\backreffrench{% + \def\backrefpagesname{pages}% + \def\backrefsectionsname{sections}% + \def\backrefsep{, }% + \def\backreftwosep{ et~}% + \def\backreflastsep{ et~}% +} +\def\backrefspanish{% + \def\backrefpagesname{p\'aginas} + \def\backrefsectionsname{secciones} + \def\backrefsep{, }% + \def\backreftwosep{ y~}% + \def\backreflastsep{ y~}% +} +\def\backrefafrikaans{% + \def\backrefpagesname{bladsye}% + \def\backrefsectionsname{afdelings}% + \def\backrefsep{, }% + \def\backreftwosep{ en~}% + \def\backreflastsep{ en~}% +}% +% \end{macrocode} +% Instead of package babel's definition of \cmd{\addto} the +% implementation of package varioref is used. Additionally +% argument |#1| is checked for \cmd{\relax}. +% \begin{macrocode} +\def\BR@addto#1#2{% + #2% + \@temptokena{#2}% + \ifx#1\relax + \let#1\@empty + \fi + \ifx#1\undefined + \edef#1{\the\@temptokena}% + \else + \toks@\expandafter{#1}% + \edef#1{\the\toks@\the\@temptokena}% + \fi + \@temptokena{}\toks@\@temptokena +} +% \end{macrocode} +% \begin{macrocode} +\def\BR@DeclareLang#1#2{% + \begingroup + \edef\x##1##2{% + \noexpand\ifx##2\relax + \errmessage{No definitions for language `#2' found!}% + \noexpand\fi + \endgroup + \noexpand\DeclareOption{#1}{% + \noexpand\BR@addto{\noexpand##1}{\noexpand##2}% + }% + }% + \expandafter\x\csname extras#1\expandafter\endcsname + \csname backref#2\expandafter\endcsname +} +\BR@DeclareLang{english}{english} +\BR@DeclareLang{UKenglish}{english} +\BR@DeclareLang{USenglish}{english} +\BR@DeclareLang{british}{english} +\BR@DeclareLang{german}{german} +\BR@DeclareLang{ngerman}{german} +\BR@DeclareLang{austrian}{german} +\BR@DeclareLang{naustrian}{german} +\BR@DeclareLang{french}{french} +\BR@DeclareLang{frenchb}{french} +\BR@DeclareLang{francais}{french} +\BR@DeclareLang{spanish}{spanish} +\BR@DeclareLang{afrikaans}{afrikaans} +% \end{macrocode} +% Default is the english version: +% \begin{macrocode} +\backrefenglish +% \end{macrocode} +% +% \subsubsection{Process options} +% +% \begin{macrocode} +\ExecuteOptions{pageref} +\ProcessOptions*\relax +% \end{macrocode} +% +% \subsection{The bibliography} +% +% \begin{macro}{\BR@bibitem} +% \begin{macrocode} +\def\BR@bibitem{\@ifnextchar[\BR@@lbibitem\BR@@bibitem} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\BR@@lbibitem[#1]#2#3\par{% + \BRorg@bibitem[#1]{#2}#3% + \BR@backref{#2}% +}% +\def\BR@@bibitem#1#2\par{% + \BRorg@bibitem{#1}#2% + \BR@backref{#1}% +} +\def\BR@backref#1{% + \newblock + \begingroup + \csname @safe@activestrue\endcsname + \expandafter\providecommand\csname brc@#1\endcsname{0}% + \expandafter\providecommand\csname brcd@#1\endcsname{0}% + \csname @safe@activesfalse\expandafter\endcsname + \expandafter\backref\csname br@#1\expandafter\endcsname + \expandafter\backrefalt\csname brc@#1\expandafter\endcsname + \csname brl@#1\expandafter\endcsname + \csname brcd@#1\expandafter\endcsname + \csname brld@#1\endcsname + \endgroup + \par +} +\@ifundefined{newblock}{\def\newblock{\par}}{} +\providecommand*{\backrefalt}[4]{} +% \end{macrocode} +% +% \subsection{Reading .brf file} +% +% \begin{macro}{\backcite} +% The file |\jobname.brf| collects the back cite informations +% as calls of \cmd{\backcite} with the informations +% in the arguments. +% +% The first argument of macro \cmd{\backcite} is the citation +% label, the second parameter contains the page number +% (\cmd{\thepage}), the current label of the citation +% (\cmd{\@currentlabel}), and the current anchor name +% (\cmd{\@currentHref}). Example for a citation at the +% first page in second section: +%\begin{verbatim} +%\backcite {bib:abc}{{1}{2}{section.2}} +%\end{verbatim} +% +% While the file |\jobname.brf| is read, the informations are +% collected and stored in macros whose names are build by the +% citation label \meta{label}: +% \begin{quote} +% \begin{tabular}{@{}ll@{}} +% |\br@|\meta{label} & list, entries separated by comma without dupes\\ +% |\brc@|\meta{label} & number of citations without dupes\\ +% |\brl@|\meta{label} & backref list without dupes\\ +% |\brcd@|\meta{label} & number of all citations (with dupes)\\ +% |\brld@|\meta{label} & backref list with all entries (with dupes) +% \end{tabular} +% \end{quote} +% What are ``dupes''? An instance: you have three references to +% an entry in the bibliography on the first page: +%\begin{verbatim} +%\backcite {bib:abc}{{1}{1}{section.1}} +%\backcite {bib:abc}{{1}{1}{section.1}} +%\backcite {bib:abc}{{1}{2}{section.2}} +%\end{verbatim} +% Then the whole backref list with option |pageref| would print, e.g.: +% \begin{quote} +% Entry for |bib:abc|. Cited on pages 1, 1, 1. +% \end{quote} +% Without dupes the entries with the same page number would be removed, +% e.g.: +% \begin{quote} +% Entry for |bib:abc|. Cited on page 1. +% \end{quote} +% Also the third entry is removed, because it has the same page number. +% For the comparison only these pieces of information are considered +% that will be used later by \cmd{\backrefxxx}. With option +% |pageref| macro \cmd{\backrefxxx} becomes \cmd{\page@backref} that +% throws away the second and third argument and only uses the first +% argument with the page number. To be more precise, the first +% expansion of \cmd{\backrefxxx} is used in comparison. If some +% arguments are used here, but later omitted, then this will not +% be detected. +% +% \begin{macro}{\backrefxxxdupe} +% With option |hyperref| you will get two entries +% in the following example because the second entry differs in the +% link information, so the result will be the same section number, +% but as different links. +%\begin{verbatim} +%\backref {bib:abc}{{1}{1}{section.1}} +%\backref {bib:abc}{{1}{1}{equation.1}} +%\end{verbatim} +% Macro \cmd{\backrefxxxdupe} will be used +% in the comparison test if it is defined. Thus you can provide a +% definition in this case as follows: +%\begin{verbatim} +%\newcommand*{\backrefxxxdupe}[3]{#2} +%\end{verbatim} +% Then only the section number is interpreted, but not the anchor name. +% \end{macro} +% +% To avoid same entries, it is checked before, whether the entry +% already exists. Only the information needed by \cmd{\backrefxxx} +% is compared. +% \begin{macrocode} +\def\backcite#1#2{% + \@for\x:=#1\do{% + \begingroup + \csname @safe@activestrue\endcsname + \edef\x{\endgroup + \def\noexpand\x{\expandafter\@firstofone\x\@empty}% + }% + \x +% \end{macrocode} +% Now macro \cmd{\x} contains the citation label name. +% \begin{macrocode} + \expandafter\ifx\csname br@\x\endcsname\relax +% \end{macrocode} +% Initialization, fill in the first entry. +% \begin{macrocode} + \expandafter\protected@xdef\csname br@\x\endcsname{% + \protect\backrefxxx#2% + }% + \global\expandafter\let\csname brl@\x\expandafter\endcsname + \csname br@\x\endcsname + \global\expandafter\let\csname brld@\x\expandafter\endcsname + \csname br@\x\endcsname + \expandafter\gdef\csname brc@\x\endcsname{1}% + \expandafter\gdef\csname brcd@\x\endcsname{1}% + \else +% \end{macrocode} +% Fill in further entry. But check for dupe first. +% \begin{macrocode} + \begingroup + \@ifundefined{backrefxxxdupe}{}{\let\backrefxxx\backrefxxxdupe}% + \expandafter\def\expandafter\reserved@a\expandafter{% + \backrefxxx#2% + }% + \let\BRorg@backrefxxx\backrefxxx + \global\let\BR@found=N% + \long\def\backrefxxx##1##2##3{% + \expandafter\def\expandafter\reserved@b\expandafter{% + \BRorg@backrefxxx{##1}{##2}{##3}% + }% + \ifx\reserved@a\reserved@b + \global\let\BR@found=Y% + \fi + }% + \setbox\@tempboxa\hbox{\csname br@\x\endcsname}% + \endgroup + \let\backrefsep\relax + \def\backreftwosep{\backrefsep}% + \def\backreflastsep{\backrefsep}% + \if N\BR@found + \expandafter\protected@xdef\csname br@\x\endcsname{% + \csname br@\x\endcsname, % + \protect\backrefxxx#2% + }% + \expandafter\protected@xdef\csname brl@\x\endcsname{% + \csname brl@\x\endcsname + \ifnum\@nameuse{brc@\x}=1 % + \noexpand\backreftwosep + \else + \noexpand\backreflastsep + \fi + \protect\backrefxxx#2% + }% + \count@=\@nameuse{brc@\x}\relax + \advance\count@ by 1 % + \expandafter\xdef\csname brc@\x\endcsname{\the\count@}% + \fi + \expandafter\protected@xdef\csname brld@\x\endcsname{% + \csname brld@\x\endcsname + \ifnum\@nameuse{brcd@\x}=1 % + \noexpand\backreftwosep + \else + \noexpand\backreflastsep + \fi + \protect\backrefxxx#2% + }% + \count@=\@nameuse{brcd@\x}\relax + \advance\count@ by 1 % + \expandafter\xdef\csname brcd@\x\endcsname{\the\count@}% + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Initialization} +% +% \begin{macrocode} +\def\@currentHref{} +\AtBeginDocument{% + \let\BRorg@bibitem\bibitem + \let\bibitem\BR@bibitem + \let\BRorg@thebibliography\thebibliography + \def\thebibliography{% + \@starttoc{brf}{}% + \BRorg@thebibliography + }% + \@ifundefined{NAT@parse}{% + \global\let\BRorg@citex\@citex + \global\let\@citex\BR@citex + }{% + \@ifpackageloaded{hyperref}{}{% + \def\hyper@natlinkstart#1{\Hy@backout{#1}}% + }% + \PackageInfo{backref}{** backref set up for natbib **}% + }% +} +% \end{macrocode} +% +% \subsection{Collecting back cite informations} +% +% \begin{macro}{\BR@citex} +% \begin{macrocode} +\def\BR@citex[#1]#2{% + \BRorg@citex[#1]{#2}% + \ifBR@verbose + \PackageInfo{backref}{back cite \string`#2\string'}% + \fi + \Hy@backout{#2}% +} +% \end{macrocode} +% \end{macro} +% +% Grr. for chicago.sty +% \begin{macrocode} +\@ifpackageloaded{chicago}{% + \let\BRorg@citedatax\@citedatax + \def\@citedatax[#1]#2{% + \BRorg@citedatax[#1]{#2}% + \Hy@backout{#2}% + }% +}{} +% \end{macrocode} +% \begin{macro}{\Hy@backout} +% \begin{macrocode} +\def\Hy@backout#1{% + \@bsphack + \ifx\@empty\@currentlabel + \protected@write\@auxout{}{% + \string\@writefile{brf}{% + \string\backcite{#1}{{\thepage}{(document)}{Doc-Start}}% + }% + }% + \else + \protected@write\@auxout{}{% + \string\@writefile{brf}{% + \string\backcite{#1}{{\thepage}{\@currentlabel}{\@currentHref}}% + }% + }% + \fi + \@esphack +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +% \end{macrocode} +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/hyperref/hyperref.drv b/Master/texmf-dist/source/latex/hyperref/hyperref.drv new file mode 100644 index 00000000000..a3ec258fe43 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/hyperref.drv @@ -0,0 +1,50 @@ +%% +%% This is file `hyperref.drv', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% hyperref.dtx (with options: `driver') +%% +%% File: hyperref.dtx Copyright 1995-2001 Sebastian Rahtz, +%% RCS: $Id: hyperref.dtx 6.71 2000/10/04 rahtz Exp rahtz $ +%% +%% This file is part of the `Hyperref Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% The list of all files belonging to the `Hyperref Bundle' is +%% given in the file `manifest.txt'. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{hyperref.drv} + [2003/11/30 v6.74m + Hyperref documentation driver file] +\documentclass{ltxdoc} +\usepackage{array,times} +\def\ttdefault{cmtt} +\usepackage[colorlinks,hyperindex]{hyperref} +\pdfstringdefDisableCommands{\let\\\textbackslash}% +\EnableCrossrefs +\CodelineIndex +\begin{document} + \GetFileInfo{hyperref.sty} + \title{Hypertext marks in \LaTeX} + \author{Sebastian Rahtz\\ + Email: \texttt{sebastian.rahtz@oucs.ox.ac.uk}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{hyperref.dtx} + \PrintIndex +\end{document} +\endinput +%% +%% End of file `hyperref.drv'. diff --git a/Master/texmf-dist/source/latex/hyperref/hyperref.dtx b/Master/texmf-dist/source/latex/hyperref/hyperref.dtx new file mode 100644 index 00000000000..a26fd8ae8e1 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/hyperref.dtx @@ -0,0 +1,13330 @@ +% \iffalse +%% File: hyperref.dtx Copyright 1995-2001 Sebastian Rahtz, +% with portions written by David Carlisle and Heiko Oberdiek. +%% RCS: $Id: hyperref.dtx 6.71 2000/10/04 rahtz Exp rahtz $ +%% +%% This file is part of the `Hyperref Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% The list of all files belonging to the `Hyperref Bundle' is +%% given in the file `manifest.txt'. +%% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{hyperref} +%\ProvidesPackage{nohyperref} +%\ProvidesFile{hyperref.drv} +%\ProvidesFile{hycheck.tex} +%\ProvidesFile{hypertex.def} +%\ProvidesFile{hpdftex.def} +%\ProvidesFile{pdfmark.def} +%\ProvidesFile{hvtexmrk.def} +%\ProvidesFile{hdvips.def} +%\ProvidesFile{hdvipson.def} +%\ProvidesFile{htexture.def} +%\ProvidesFile{hdviwind.def} +%\ProvidesFile{hdvipdfm.def} +%\ProvidesFile{hdvipdf.def} +%\ProvidesFile{hvtex.def} +%\ProvidesFile{hvtexhtml.def} +%\ProvidesFile{htex4ht.def} +%\ProvidesFile{htex4ht.cfg} +%\ProvidesFile{pd1enc.def} +%\ProvidesFile{puenc.def} +% [2003/11/30 v6.74m +% Hypertext links for LaTeX] +% Dummy hyperref (SR)] +% Hyperref documentation driver file] +% Hyperref test file] +% Hyperref driver for HyperTeX specials] +% Hyperref driver for pdfTeX] +% Hyperref definitions for pdfmark specials] +% Hyperref driver for VTeX in PDF/PS mode (pdfmark specials)] +% Hyperref driver for dvips] +% Hyperref driver for dvipsone] +% Hyperref driver for Textures] +% Hyperref driver for dviwindo] +% Hyperref driver for dvipdfm] +% Hyperref driver for dvipdf] +% Hyperref driver for VTeX in PDF/PS mode] +% Hyperref driver for VTeX in HTML mode] +% Hyperref driver for TeX4ht] +% Hyperref configuration file for TeX4ht] +% Hyperref: PDFDocEncoding definition (HO)] +% Hyperref: PDF Unicode definition (HO)] +%<*driver> +\documentclass{ltxdoc} +\usepackage{array,times} +\def\ttdefault{cmtt} +\usepackage[colorlinks,hyperindex]{hyperref} +\pdfstringdefDisableCommands{\let\\\textbackslash}% +\EnableCrossrefs +\CodelineIndex +\begin{document} + \GetFileInfo{hyperref.sty} + \title{Hypertext marks in \LaTeX} + \author{Sebastian Rahtz\\ + Email: \texttt{sebastian.rahtz@oucs.ox.ac.uk}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{hyperref.dtx} + \PrintIndex +\end{document} +% +% \fi +% \CheckSum{17219} +% +% \MakeShortVerb{|} +% \StopEventually{} +% +% \DoNotIndex{\def,\edef,\gdef,\xdef,\global,\long,\let} +% \DoNotIndex{\expandafter,\string,\the,\ifx,\else,\fi} +% \DoNotIndex{\csname,\endcsname,\relax,\begingroup,\endgroup} +% \DoNotIndex{\DeclareTextCommand,\DeclareTextCompositeCommand} +% \DoNotIndex{\space,\@empty,\special} +% +% \section{File hycheck.tex} +% +% Many commands of \LaTeX\ or other packages cannot be +% overloaded, but have to be redefined by hyperref directly. +% If these commands change in newer versions, these +% changes are not noticed by hyperref. +% With this test file this situation can be checked. +% It defines the command \cmd{\checkcommand} that +% is more powerful than \LaTeX's \cmd{\CheckCommand}, +% because it takes \cmd{\DeclareRobustCommand} and +% optional parameters better into account. +% +% \begin{macrocode} +%<*check> +\documentclass{article} +\makeatletter +% \end{macrocode} +% +% \begin{macro}{\checklatex} +% Optional argument: release date of \LaTeX. +% \begin{macrocode} +\newcommand*{\checklatex}[1][]{% + \typeout{}% + \typeout{* Format: `LaTeX2e' #1}% + \typeout{\space\space Loaded: `\fmtname' \fmtversion}% +}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\checkpackage} +% The argument of \cmd{\checkpackage} is the package name +% without extension optionally followed by a release date. +% \begin{macrocode} +\newcommand*{\checkpackage}[1]{% + \def\HyC@package{#1}% + \let\HyC@date\@empty + \@ifnextchar[\HyC@getDate\HyC@checkPackage +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@getDate} +% The release date is scanned. +% \begin{macrocode} +\def\HyC@getDate[#1]{% + \def\HyC@date{#1}% + \HyC@checkPackage +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@checkPackage} +% \begin{macrocode} +\def\HyC@checkPackage{% + \typeout{} + \begingroup + \edef\x{\endgroup + \noexpand\RequirePackage{\HyC@package}% + \ifx\HyC@date\@empty\relax\else[\HyC@date]\fi% + }% + \x + \typeout{}% + \typeout{% + * Package `\HyC@package'% + \ifx\HyC@date\@empty + \else + \space\HyC@date + \fi + }% + \@ifundefined{ver@\HyC@package.sty}{% + }{% + \typeout{% + \space\space Loaded: `\HyC@package' % + \csname ver@\HyC@package.sty\endcsname + }% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\checkcommand} +% The macro \cmd{\checkcommand} parses the next +% tokens as a \LaTeX\ definition and compares +% this definition with the current meaning of +% that command. +% \begin{macrocode} +\newcommand*{\checkcommand}[1]{% + \begingroup + \ifx\long#1\relax + \expandafter\HyC@checklong + \else + \def\HyC@defcmd{#1}% + \expandafter\let\expandafter\HyC@next + \csname HyC@\expandafter\@gobble\string#1\endcsname + \expandafter\HyC@checkcommand + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@checklong} +% The definition command \cmd{\def} or \cmd{\edef} +% is read. +% \begin{macrocode} +\def\HyC@checklong#1{% + \def\HyC@defcmd{\long#1}% + \expandafter\let\expandafter\HyC@next + \csname HyC@\expandafter\@gobble\string#1\endcsname + \HyC@checkcommand +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@checkcommand} +% The optional star of \LaTeX's definitions is parsed. +% \begin{macrocode} +\def\HyC@checkcommand{% + \ifx\HyC@next\relax + \PackageError{hycheck}{% + Unknown command `\expandafter\strip@prefix\meaning\HyC@cmd'% + }\@ehd + \expandafter\endinput + \fi + \@ifstar{% + \def\HyC@star{*}% + \HyC@check + }{% + \let\HyC@star\@empty + \HyC@check + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@check} +% The macro \cmd{\HyC@check} reads the +% definition command. +% \begin{macrocode} +\def\HyC@check#1{% + \def\HyC@cmd{#1}% + \let\HyC@org@cmd#1% + \let#1\relax + \let\HyC@param\@empty + \HyC@Toks{}% + \let\HyC@org@optcmd\HyC@noValue + \let\HyC@org@robustcmd\HyC@noValue + \let\HyC@org@robustoptcmd\HyC@noValue + \HyC@next +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@noValue} +% \begin{macrocode} +\def\HyC@noValue{NoValue} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@newcommand} +% The code for \cmd{\newcommand}. +% \begin{macrocode} +\def\HyC@newcommand{% + \let\HyC@@cmd\HyC@cmd + \@ifnextchar[\HyC@nc@opt\HyC@nc@noopt +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@Toks} +% A register for storing the default value of an +% optional argument. +% \begin{macrocode} +\newtoks\HyC@Toks +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@nc@noopt} +% This macro \cmd{\HyC@nc@noopt} is called, if the +% parser has reached the definition text. +% \begin{macrocode} +\long\def\HyC@nc@noopt#1{% + \edef\x{% + \expandafter\noexpand\HyC@defcmd + \HyC@star + \expandafter\noexpand\HyC@cmd + \HyC@param\the\HyC@Toks + }% + \x{#1}% + \HyC@doCheck +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@nc@opt} +% This macro scans the first optional argument +% of a \LaTeX\ definition (number of arguments). +% \begin{macrocode} +\def\HyC@nc@opt[#1]{% + \def\HyC@param{[#1]}% + \@ifnextchar[\HyC@nc@default\HyC@nc@noopt +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@nc@default} +% Macro \cmd{\HyC@nc@default} scans the +% default for an optional argument. +% \begin{macrocode} +\def\HyC@nc@default[#1]{% + \HyC@Toks={[{#1}]}% + \edef\HyC@optcmd{% + \expandafter\noexpand + \csname\expandafter\string\HyC@@cmd\endcsname + }% + \expandafter\let\expandafter\HyC@org@optcmd\HyC@optcmd + \HyC@nc@noopt +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyC@DeclareRobustCommand} +% \cmd{\DeclareRobustCommand}|{\cmd}| makes the command +% \cmd{\cmd} robust, that then calls |\cmd|\verb*| | +% with an space at the end of the command name, defined by +% \cmd{\newcommand}. Therefore the further parsing +% is done by \cmd{\HyC@nc@opt} or \cmd{\Hy@nc@noopt} +% of the \cmd{\HyC@newcommand} chain. +% \begin{macrocode} +\def\HyC@DeclareRobustCommand{% + \edef\HyC@robustcmd{% + \expandafter\noexpand + \csname\expandafter\expandafter\expandafter\@gobble + \expandafter\string\HyC@cmd\space\endcsname + }% + \expandafter\let\expandafter\HyC@org@robustcmd\HyC@robustcmd + \expandafter\let\HyC@robustcmd\relax + \let\HyC@@cmd\HyC@robustcmd + \@ifnextchar[\HyC@nc@opt\HyC@nc@noopt +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyC@def} +% \begin{macro}{\HyC@edef} +% The parameter text of \cmd{\def} or \cmd{\edef} is +% stored in the token register \cmd{\HyC@Toks}. +% \begin{macrocode} +\def\HyC@def#1#{% + \HyC@Toks={#1}% + \HyC@nc@noopt +} +\let\HyC@edef\HyC@def +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\HyC@doCheck} +% This command performs the checks and prints the result. +% \begin{macrocode} +\def\HyC@doCheck{% + \typeout{* Checking `\HyC@string\HyC@cmd':}% + \HyC@checkItem{cmd}% + \HyC@checkItem{robustcmd}% + \HyC@checkItem{optcmd}% + \HyC@checkItem{robustoptcmd}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@checkItem} +% A single check. +% \begin{macrocode} +\def\HyC@checkItem#1{% + \expandafter\ifx\csname HyC@org@#1\endcsname\HyC@noValue + \else + \expandafter\expandafter\expandafter\ifx + \csname HyC@#1\expandafter\endcsname + \csname HyC@org@#1\endcsname + \expandafter\HyC@checkOk\csname HyC@#1\endcsname + \else + \expandafter\HyC@checkFailed + \csname HyC@#1\expandafter\endcsname + \csname HyC@org@#1\endcsname + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@string} +% \begin{macro}{\HyC@meaning} +% Some shorthands. +% \begin{macrocode} +\def\HyC@string#1{\expandafter\string#1} +\def\HyC@meaning#1{\expandafter\meaning#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\HyC@checkOk} +% The result, if the check succeeds. +% \begin{macrocode} +\def\HyC@checkOk#1{% + \typeout{\space\space`\HyC@string#1' ok.}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyC@checkFailed} +% The result, if the check fails. +% \begin{macrocode} +\def\HyC@checkFailed#1#2{% + \typeout{\space\space`\HyC@string#1' failed.}% + \typeout{\space\space* original: \meaning#2}% + \typeout{\space\space* expected: \HyC@meaning#1}% +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% ************************************************** +% +% \end{macrocode} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \section{Package options and setup}\label{options} +% +% \subsection{Save catcodes} +% There are many packages that change the standard catcodes. +% +% First we save the original meaning of |`| and |=| +% in the token register |\toks@|, because we need the two +% characters in the macros \cmd{\Hy@SetCatcodes} and +% \cmd{\Hy@RestoreCatcodes}. +% \begin{macrocode} +\begingroup + \@makeother\`% + \@makeother\=% + \edef\x{% + \edef\noexpand\x{% + \endgroup + \noexpand\toks@{% + \catcode 96=\noexpand\the\catcode`\noexpand\`\relax + \catcode 61=\noexpand\the\catcode`\noexpand\=\relax + }% + }% + \noexpand\x + }% +\x +\@makeother\` +\@makeother\= +% \end{macrocode} +% \begin{macro}{\Hy@SetCatcodes} +% \begin{macrocode} +\def\Hy@SetCatcodes{% + \@makeother\`% + \@makeother\=% + \catcode`\$=3 + \catcode`\&=4 + \catcode`\^=7 + \catcode`\_=8 + \@makeother\|% + \@makeother\:% + \@makeother\(% + \@makeother\)% + \@makeother\[% + \@makeother\]% + \@makeother\/% + \@makeother\!% + \@makeother\<% + \@makeother\>% + \@makeother\.% + \@makeother\;% + \@makeother\+% + \@makeother\-% + \@makeother\"% + \@makeother\'% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@RestoreCatcodes} +% \begin{macrocode} +\begingroup + \def\x#1{\catcode`\noexpand#1=\the\catcode`#1\relax}% + \xdef\Hy@RestoreCatcodes{% + \the\toks@ + \x\$% + \x\&% + \x\^% + \x\_% + \x\|% + \x\:% + \x\(% + \x\)% + \x\[% + \x\]% + \x\/% + \x\!% + \x\<% + \x\>% + \x\.% + \x\;% + \x\+% + \x\-% + \x\"% + \x\'% + }% +\endgroup +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\Hy@SetCatcodes +% \end{macrocode} +% +% It needs the December 95 release of \LaTeX, because it uses +% |\protected@write|, and it defines commands in options; and the page +% setup internal code changed at that point. It'll probably break +% with the later releases! +% \begin{macrocode} +\RequirePackage{keyval}[1997/11/10] +\def\Hy@Warning#1{\PackageWarning{hyperref}{#1}} +\def\Hy@WarningNoLine#1{\PackageWarningNoLine{hyperref}{#1}} +\def\Hy@Info#1{\PackageInfo{hyperref}{#1}} +% \end{macrocode} +% +% \subsection{Compatibility with format dumps} +% +% \begin{macro}{\AfterBeginDocument} +% For use with pre-compiled formats, created using the +% |ldump| package, there needs to be 2 hooks for adding +% material delayed until |\begin{document}|. +% These are called \cmd{\AfterBeginDocument} and +% \cmd{\AtBeginDocument}. +% If |ldump| is not loaded, then a single hook suffices +% for normal \LaTeX{} processing. +% +% The default definition of |\AfterBeginDocument| cannot +% be done by |\let| because of problems with |xypic|. +% \begin{macrocode} +\@ifundefined{AfterBeginDocument}{% + \def\AfterBeginDocument{\AtBeginDocument}% +}{}% +% \end{macrocode} +% \end{macro} +% +% \subsection{Switches} +% \begin{macrocode} +\newif\ifHy@typexml +\newif\ifHy@activeanchor +\newif\ifHy@backref +\newif\ifHy@bookmarks +\newif\ifHy@bookmarksnumbered +\newif\ifHy@bookmarksopen +\newif\ifHy@breaklinks +\newif\ifHy@centerwindow +\newif\ifHy@CJKbookmarks +\newif\ifHy@colorlinks +\newif\ifHy@draft +\newif\ifHy@figures +\newif\ifHy@fitwindow +\newif\ifHy@frenchlinks +\newif\ifHy@hyperfootnotes +\newif\ifHy@hyperindex +\newif\ifHy@hypertexnames +\newif\ifHy@implicit +\newif\ifHy@linktocpage +\newif\ifHy@menubar +\newif\ifHy@naturalnames +\newif\ifHy@nesting +\newif\ifHy@newwindow +\newif\ifHy@pageanchor +\newif\ifHy@pagelabels +\newif\ifHy@pdfpagehidden +\newif\ifHy@pdfstring +\newif\ifHy@plainpages +\newif\ifHy@psize +\newif\ifHy@raiselinks +\newif\ifHy@seminarslides +\newif\ifHy@setpagesize +\newif\ifHy@texht +\newif\ifHy@toolbar +\newif\ifHy@unicode +\newif\ifHy@usetitle +\newif\ifHy@verbose +\newif\ifHy@windowui +\newif\ifHy@displaydoctitle +% \end{macrocode} +% Defaults for the switches are now set. +% \begin{macrocode} +\Hy@backreffalse +\Hy@bookmarksnumberedfalse +\Hy@bookmarksopenfalse +\Hy@bookmarkstrue +\Hy@breaklinksfalse +\Hy@centerwindowfalse +\Hy@CJKbookmarksfalse +\Hy@figuresfalse +\Hy@fitwindowfalse +\Hy@hyperfootnotestrue +\Hy@hyperindextrue +\Hy@hypertexnamestrue +\Hy@implicittrue +\Hy@linktocpagefalse +\Hy@menubartrue +\Hy@naturalnamesfalse +\Hy@nestingfalse +\Hy@newwindowfalse +\Hy@pageanchortrue +\Hy@pagelabelsfalse +\Hy@pdfpagehiddenfalse +\Hy@pdfstringfalse +\Hy@plainpagestrue +\Hy@raiselinksfalse +\Hy@setpagesizetrue +\Hy@texhtfalse +\Hy@toolbartrue +\Hy@typexmlfalse +\Hy@unicodefalse +\Hy@usetitlefalse +\Hy@verbosefalse +\Hy@windowuitrue +\Hy@displaydoctitlefalse +% \end{macrocode} +% +% \section{Common help macros} +% +% \begin{macro}{\Hy@StepCount} +% \begin{macrocode} +\def\Hy@StepCount#1{\advance#1 by 1 }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@GlobalStepCount} +% \begin{macrocode} +\def\Hy@GlobalStepCount#1{\global\advance#1 by 1 }% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\newdimen\@linkdim +\let\Hy@driver\@empty +\let\MaybeStopEarly\relax +\newcount\Hy@linkcounter +\newcount\Hy@pagecounter +\Hy@linkcounter0 +\Hy@pagecounter0 +% \end{macrocode} +% +% \subsection{Macros for recursions} +% +% \begin{macro}{\Hy@ReturnAfterElseFi} +% \begin{macro}{\Hy@ReturnAfterFi} +% The commands \cs{Hy@ReturnAfterElseFi} and \cs{Hy@ReturnAfterFi} +% avoid a too deep \cs{if}-nesting especially for recursive macros. +% \begin{macrocode} +\long\def\Hy@ReturnAfterElseFi#1\else#2\fi{\fi#1} +\long\def\Hy@ReturnAfterFi#1\fi{\fi#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Coordinate transformations} +% +% At some places numbers in pdf units are +% expected (eg: FitBH, ...). The following macros +% perform the transformation from TeX units (pt) +% to PDF units (bp). +% +% \begin{macro}{\hypercalcbp} +% The user macro \cmd{\hypercalcbp} can be used, for example, +% inside option values: +%\begin{verbatim} +%pdfstartview={FitBH \hypercalcbp{\paperheight-\topmargin-1in}} +%\end{verbatim} +% \begin{itemize} +% \item +% It cannot be used inside \cmd{\usepackage}, because +% LaTeX expands the options before package hyperref +% is loaded and \cmd{\hypercalcbp} is defined. +% \item +% With e-TeX extensions an expandable implementation +% is very easy; \cmd{\hypercalcbp} can be used +% everywhere and is expanded at use. +% \item +% Without e-TeX's features \cmd{\hypercalcbp} cannot be +% implemented expandable (practically) and have to +% be supported by \cmd{\hypercalcbpdef}. +% Limitations: +% \begin{itemize} +% \item Works only in options that use \cmd{\hypercalcbpdef} +% (currently only |pdfstartview|). +% \item For calculations package |calc| have to be loaded. +% \item The expansion of the argument is done at definition time. +% \end{itemize} +% \end{itemize} +% Example (\TeX): +%\begin{verbatim} +%\usepackage{calc} +%\usepackage[...]{hyperref} +%\hypersetup{ +% pdfstartview={FitBH \hypercalcbp{\paperheight-\topmargin-1in +% -\headheight-\headsep} +%} +%\end{verbatim} +% \begin{macro}{\hypercalcbp} +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname dimexpr\endcsname\relax + \def\hypercalcbpdef#1#2{% + \begingroup + \toks@{}% + \HyCal@scan#2\hypercalcbp\@nil + \expandafter\endgroup + \expandafter\def\expandafter#1\expandafter{\the\toks@}% + } + \def\HyCal@scan#1\hypercalcbp#2\@nil{% + \toks@\expandafter{\the\toks@ #1}% + \ifx\\#2\\% + \else + \Hy@ReturnAfterFi{% + \HyCal@do#2\@nil + }% + \fi + } + \def\HyCal@do#1#2\@nil{% + \@ifpackageloaded{calc}{}{% + \Hy@Warning{% + For calculations \string\hypercalcbp\space needs\MessageBreak + package calc or e-TeX% + }% + }% + \setlength{\dimen@}{#1}% + \setlength{\dimen@}{0.99626401\dimen@}% + \edef\x{% + \toks@{% + \the\toks@ + \strip@pt\dimen@ + }% + }\x + \HyCal@scan#2\@nil + } +\else + \def\hypercalcbp#1{% + \strip@pt\dimexpr 0.99626401\dimexpr #1\relax\relax + } + \def\hypercalcbpdef{\def} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \section{Dealing with PDF strings}\label{sec:pdfstring} +% The PDF string stuff done by Heiko Oberdiek.\\ +% Email: \Email{oberdiek@ruf.uni-freiburg.de}. +% +% Naming convention: All internal commands that are only +% needed by \cs{pdfstringdef} are prefixed with \cs{HyPsd@}. +% +% \subsection{Description of PDF strings} +% The PDF specification defines several places to hold +% text strings (bookmark names, document information, +% text annotations, etc.). +% The PDF strings have following properties: +% \begin{itemize} +% \item They are surrounded by parentheses. The hexadecimal form +% is not supported. +% \item Like PostScript language strings they use the same +% escaping mechanism:\\ +% \begin{tabular}{ll} +% |\\|& the backslash itself\\ +% \cs{)}, \cs{(}& unbalanced parentheses\\ +% \cs{n}, \cs{r}, \cs{t}, \cs{b}, \cs{f}& special white space +% escape sequences\\ +% |\|\textit{|ddd|}& octal character code \textit{|ddd|} +% \end{tabular} +% \item Strings are stored either in PDFDocEncoding, which is a superset of +% ISOLatin1 and is compatible with Unicode with character codes +% below 256, or in Unicode. +% \end{itemize} +% +% \subsection{Definition of +% \texorpdfstring{\cs{pdfstringdef}}{\\pdfstringdef}} +% The central macro for dealing with PDF strings is \cs{pdfstringdef}. +% It defines a command |#1| to be the result of the conversion +% from the string in |#2| to a legal PDFDocEncoded string. +% Currently the definition is global, but this can be changed in +% the future. +% +% Important: In \TeX's view PDF strings are written to a file and +% are expanded only in its mouth. Stomach commands that cannot +% be expanded further aren't executed, they are written verbatim. +% But the PDF reader that reads such a string isn't a \TeX{} +% interpreter! +% +% The macro \cs{pdfstringdef} consists of three main parts: +% \begin{enumerate} +% \item Preprocessing. Here the expansion is prepared. The encoding +% is set and many commands are redefined, so that they work +% appropriate. +% \item Expansion. The \TeX{} string is expanded the first time +% to get a PDF string. +% \item Postprocessing. The result of the expansion is checked and +% converted to the final form. +% \end{enumerate} +% +% \begin{macro}{\pdfstringdef} +% \cs{pdfstringdef} works on the tokens in |#2| and converts them to +% a PDF string as far as possible: +% \begin{itemize} +% \item The result should obey the rules of the PDF specification +% for strings. +% \item The string can safely processed by \TeX, because the +% tokens have only catcodes 10 until 12. +% \end{itemize} +% The result is stored in the command token given in |#1|. +% \begin{macrocode} +\def\pdfstringdef#1#2{% +% \end{macrocode} +% Many redefinitions are needed, so all the work is done in a group. +% \begin{macrocode} + \begingroup +% \end{macrocode} +% +% \subsubsection{Preprocessing} +% \paragraph{Octal escape sequences.} +% To avoid problems with eight bit or non printable characters, the octal +% escape notation is supported. So most glyphs in the encoding definitions +% for PD1 and PU produce these octal escape sequences. +% All three octal digits have to be used: +% \begin{itemize} +% \item Wrong results are avoided, if digits follow that are not part of the +% octal sequence. +% \item Macros rely on the fact that the octal sequences always consist of +% three digits (vtex driver, Unicode support). +% \end{itemize} +% The escape sequences start with a backslash. By \cs{string} it will be +% printed. Therefore it is ensured that the \TeX{} escape character indeed +% prints as a normal backslash. +% Eventually this line can be removed, because this is standard +% \LaTeX{} behaviour. +% \begin{macrocode} + \escapechar`\\% +% \end{macrocode} +% From the view of \TeX{} a octal sequence consists of the command tokens +% \cs{0} until \cs{3} and two digits. +% For saving tokens \cs{0}, \cs{1}, \cs{2}, and \cs{3} are directly +% used without a preceding \cs{string} in the glyph definitions. +% This is done here locally +% by defining the \cs{0} until \cs{3} commands. So the user +% can use octal escape sequences directly, the disadvantage is +% that a previous definition of this short commands does not apply. +% \begin{macrocode} + \edef\0{\string\0}% + \edef\1{\string\1}% + \edef\2{\string\2}% + \edef\3{\string\3}% +% \end{macrocode} +% \paragraph{Setting font encoding.} +% The unicode encoding +% uses \cs{8} and \cs{9} as marker for the higher byte. +% \cs{8} is an abbreviation for the higher bytes 0 until 7 +% that can be expressed by one digit. \cs{8} will be +% converted to \cs{00}. However \cs{9} only marks the next +% three digits as higher byte and will be removed later. +% +% The encoding is set by \cs{enc@update} for optimizing reasons. +% \begin{macrocode} + \ifHy@unicode + \edef\8{\string\8}% + \edef\9{\string\9}% + \fontencoding{PU}% + \else + \fontencoding{PD1}% + \fi + \enc@update +% \end{macrocode} +% +% \paragraph{Internal encoding commands.} +% \cs{pdfstringdef} interpretes text strings which are not allowed +% to contain mathematical stuff. The text glyph commands will produce +% a warning, if called in math mode. But this warning disturbs while +% expanding. Therefore we check for math mode here, before +% \cs{@inmathwarn} will be disabled (see below). +% \begin{macrocode} + \@inmathwarn\pdfstringdef +% \end{macrocode} +% If a glyph is used, that isn't in the PD1/PU encoding there will +% be an infinite error loop, because the NFSS encoding stuff +% have to be expanded unprotected (\cs{edef}), so that the +% assigments of \cs{@changed@cmd} don't take place. +% To patch this behaviour I only found \cs{@inmathwarn} +% as a usable hook. While an \cs{edef} a warning message by +% \cs{@inmathwarn} or \cs{TextSymbolUnavailable} cannot be give out, +% so \cs{@inmathwarn} should be disabled. And with the help of it +% the assignments in \cs{@changed@cmd} can easily be catched +% (see below). +% \begin{macrocode} + \let\@inmathwarn\HyPsd@inmathwarn +% \end{macrocode} +% +% Unknown composite characters are built with \cs{add@accent}, +% so it is redefined to provide a warning. +% \begin{macrocode} + \let\add@accent\HyPsd@add@accent +% \end{macrocode} +% +% \paragraph{Commands that don't use NFSS directly.} +% There are several commands that prints characters in the +% printable ASCII area that don't obey the NFSS, so they have +% to be redefined here. +% \begin{macrocode} + \let\{\textbraceleft + \let\}\textbraceright + \let\\\textbackslash + \let\#\textnumbersign + \let\$\textdollar + \let\%\textpercent + \let\&\textampersand +% \let\~\textasciitilde + \let\_\textunderscore + \let\P\textparagraph + \let\ldots\textellipsis + \let\dots\textellipsis +% \end{macrocode} +% +% \paragraph{Newline} +% \cmd{\newline} or \cmd{\\} do not work in bookmarks, in text +% annotations they should expand to \cmd{\r}. In pdf strings +% \cmd{\\} stands for a backslash. Therefore the commands +% are disabled now. The user can redefine them for a result +% what he want: +% \begin{description} +% \item[backslash:] +% |\pdfstringdefDisableCommands{\let\\\textbackslash}| +% \item[new line:] +% |\pdfstringdefDisableCommands{\let\\\textCR}| +% \item[disabled:] +% |\pdfstringdefDisableCommands{\let\\\empty}| +% \end{description} +% At any case, however, the optional argument or the star +% cannot be scanned in a 100\% sure manner. +% \begin{macrocode} + \def\\{\pdfstringdefWarn\\}% + \def\newline{\pdfstringdefWarn\newline}% +% \end{macrocode} +% +% \paragraph{Logos.} +% Because the box shifting +% used in the \TeX{} logo does not work while writing to a file, +% the standard \TeX{} logos are redefined. +% \begin{macrocode} + \def\TeX{TeX}% + \def\LaTeX{La\TeX}% + \def\LaTeXe{\LaTeX2e}% + \def\eTeX{e-\TeX}% + \def\MF{Metafont}% + \def\MP{Metapost}% +% \end{macrocode} +% +% \paragraph{Standard font commands.} +% Because font changes do not work, the standard font +% switching commands are disabled. +% \begin{macrocode} + \let\emph\@firstofone + \let\textbf\@firstofone + \let\textit\@firstofone + \let\textmd\@firstofone + \let\textnormal\@firstofone + \let\textrm\@firstofone + \let\textsc\@firstofone + \let\textsf\@firstofone + \let\textsl\@firstofone + \let\texttt\@firstofone + \let\textup\@firstofone + \let\ttfamily\@empty + \let\sffamily\@empty + \let\itshape\@empty + \let\upshape\@empty + \let\bfseries\@empty + \let\rm\@empty + \let\Huge\@empty + \let\LARGE\@empty + \let\Large\@empty + \let\footnotesize\@empty + \let\huge\@empty + \let\large\@empty + \let\normalsize\@empty + \let\scriptsize\@empty + \let\small\@empty + \let\tiny\@empty +% \end{macrocode} +% +% \paragraph{Package color.} +% \begin{macrocode} + \def\textcolor##1##{\@secondoftwo}% +% \end{macrocode} +% +% \paragraph{Package babel.} +% Whereever ``naturalnames'' is used, disable \cs{textlatin} +% (from Babel 3.6k). Thanks to Felix Neubauer +% (Email: \Email{Felix.Neubauer@gmx.net}). +% \begin{macrocode} + \let\textlatin\@firstofone + \@ifundefined{language@group}{}{% + \csname HyPsd@babel@\language@group\endcsname + }% +% \end{macrocode} +% +% \begin{macrocode} + \let\@safe@activestrue\relax + \let\@safe@activesfalse\relax +% \end{macrocode} +% +% Disable \cs{cyr}, used in russianb.ldf. +% \begin{macrocode} + \let\cyr\relax +% \end{macrocode} +% +% \paragraph{Package german.} +% \begin{macrocode} + \let\glqq\textglqq + \let\grqq\textgrqq + \let\glq\textglq + \let\grq\textgrq + \let\flqq\textflqq + \let\frqq\textfrqq + \let\flq\textflq + \let\frq\textfrq +% \end{macrocode} +% +% \paragraph{Package french.} The support is deferred, because +% it needs |\GenericError| to be disabled (see below). +% +% \paragraph{AMS classes.} +% \begin{macrocode} + \HyPSD@AMSclassfix +% \end{macrocode} +% +% \paragraph{Redefintion of \cs{hspace}} +% \cs{hspace} don't work in bookmarks, the following fix +% tries to set a space if the argument is a positive length. +% \begin{macrocode} + \let\hspace\HyPsd@hspace +% \end{macrocode} +% +% \paragraph{Commands of referencing and indexing systems.} +% Some \LaTeX{} commands that are legal in \cs{section} commands +% have to be disabled here. +% \begin{macrocode} + \let\label\@gobble + \let\index\@gobble + \let\glossary\@gobble + \let\href\@secondoftwo +% \end{macrocode} +% +% The \cs{ref} and \cs{pageref} is much more complicate because of their +% star form. +% \begin{macrocode} + \let\ref\HyPsd@ref + \let\pageref\HyPsd@pageref +% \end{macrocode} +% +% Also we need an expandable form of \cs{autoref}. Babel's shorthands +% are not supported inside the reference label. +% \begin{macrocode} + \def\HyPsd@ar@get##1.##2\@nil{##1}% + \def\HyPsd@ar@tmp##1{% + \expandafter\expandafter\expandafter\HyPsd@ar@get + \expandafter\@fourthoffive##1\@empt\@empty.\@nil + }% + \def\auto@setref##1##2##3{% + \ifx##1\relax + \else + \csname\HyPsd@ar@tmp{##1}% + \expandafter\ifx\csname\HyPsd@ar@tmp{##1}autorefname\endcsname + \relax + \else + autoref% + \fi + name% + \endcsname + \space + \expandafter##2##1\@empty\@empty + \fi + }% +% \end{macrocode} +% +% \paragraph{Miscellaneous commands.} +% \begin{macrocode} + \let\leavevmode\@empty +% \end{macrocode} +% \cs{halign} causes error messages because of the template +% character |#|. +% \begin{macrocode} + \def\halign{\pdfstringdefWarn\halign\@gobble}% +% \end{macrocode} +% +% \paragraph{Patch for cjk bookmarks.} +% \begin{macrocode} + \ifHy@CJKbookmarks + \HyPsd@CJKhook + \fi +% \end{macrocode} +% +% \paragraph{User hook.} +% The switch \cs{Hy@pdfstring} is turned on. So user commands +% can detect that they are processed not to be typesetted within +% \TeX's stomach, +% but to be expanded by the mouth to give a PDF string. +% At this place before interpreting the string in |#2| additional +% redefinitions can by added by the hook \cs{pdfstringdefPreHook}. +% +% The position in the middle of the redefinitions is a compromise: +% The user should be able to provide his own (perhaps better) +% redefinitions, but some commands should have their original +% meaning, because they can be used in the hook (\cs{bgroup}, +% or \cs{@protected@testopt}, and \cs{@ifnextchar} +% for \cs{renewcommand}). +% \begin{macrocode} + \Hy@pdfstringtrue + \pdfstringdefPreHook +% \end{macrocode} +% +% \paragraph{Spaces.} +% For checking the token of the string, spaces must be masked, because +% they cannot by catched by undelimited arguments. +% \begin{macrocode} + \HyPsd@LetUnexpandableSpace\space + \HyPsd@LetUnexpandableSpace\ % + \HyPsd@LetUnexpandableSpace~% + \HyPsd@LetUnexpandableSpace\nobreakspace +% \end{macrocode} +% +% \paragraph{Package xspace.} +% \begin{macrocode} + \@ifundefined{@xspace}{% + \let\xspace\HyPsd@ITALCORR + }{% + \let\xspace\HyPsd@XSPACE + }% + \let\/\HyPsd@ITALCORR + \let\bgroup\/% + \let\egroup\/% +% \end{macrocode} +% +% \paragraph{Redefinitions of miscellaneous commands.} +% Hyphenation does not make sense. +% \begin{macrocode} + \let\discretionary\@gobbletwo +% \end{macrocode} +% +% \cs{@ifstar} is defined in \LaTeX\ as follows: +%\begin{verbatim} +%\def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} +%\end{verbatim} +% \cs{@ifnextchar} doesn't work, because it uses stomach +% commands like \cs{let} and \cs{futurelet}. But it +% doesn't break. Whereas |\@firstoftwo{#1}}| gives an +% error message because \cs{@firstoftwo} misses its second +% argument. +% +% A mimicry of \cs{@ifnextchar} only with expandible commands +% would be very extensive and the result would be only an +% approximation. So here a cheaper solution follows +% in order to get rid of the error message at least: +% \begin{macrocode} + \let\@ifnextchar\HyPsd@ifnextchar + \let\@protected@testopt\HyPsd@protected@testopt +% \end{macrocode} +% +% \subsubsection{Expansion} +% There are several possibilities to +% expand tokens within \LaTeX: +% \begin{description} +% \item[\cs{protected@edef}:] +% The weakest form isn't usable, because +% it does not expand the font encoding commands. They are +% made roboust and protect themselves. +% \item[\cs{csname}:] First the string is +% expanded whithin a \cs{csname} and \cs{endcsname}. +% Then the command name is converted to characters +% with catcode 12 by \cs{string} and the first +% escape character removed by \cs{@gobble}. +% This method has the great \emph{advantage} that +% stomach tokens that aren't allowed in PDF strings are detected +% by \TeX{} and reported as errors in order to force the user +% to write correct things. So he get no wrong results by +% forgetting the proofreading of his text. +% But the \emph{disadvantage} is that old wrong code cannot +% processed without errors. Mainly the error message is very cryptic +% and for the normal user hard to understand. \TeX{} provides +% no way to catch the error caused by \cs{csname} or allows to +% support the user with a descriptive error message. Therefore +% the experienced user had to enable this behaviour by an +% option |exactdef| in previous versions less or equal 6.50. +% \item[\cs{edef}] This version uses this standard form for expansion. +% It is stronger than \LaTeX's \cs{protected@edef}. +% So the font encoding mechanism works and the glyph commands +% are converted to the correct tokens for PDF strings whith the +% definitions of the PD1 encoding. +% Because the protecting mechanism of \LaTeX{} doesn't work +% within an \cs{edef}, there are situations thinkable where +% code can break. For example, assignments and definitions aren't +% performed and so undefined command errors or argument +% parsing errors can occur. But this is only a compatibility problem +% with old texts. Now there are possibilities to write +% code that gives correct PDF strings (see \cs{texorpdfstring}). +% In the most cases unexpandable commands and tokens +% (math shift, grouping characters) remains. They +% don't cause an error like with \cs{csname}. However a PDF reader +% isn't \TeX{}, so these tokens are viewed verbatim. So +% this version detects them now, and removes them with an +% descriptive warning for the user. As additional features +% xspace support is possible and grouping characters can be +% used without problems, because they are removed silently. +% \end{description} +% +% \paragraph{Generic messages.} +% While expanding via \cs{xdef} the |\Generic...| messages +% don't work and causes problems (error messages, invalid |.out| +% file). So they are disabled while expanding and removed silently, +% because a user warning would be too expensive (memory and runtime, +% |\pdfstringdef| is slow enough). +% \begin{macrocode} + \begingroup + \let\GenericError\@gobblefour + \let\GenericWarning\@gobbletwo + \let\GenericInfo\@gobbletwo +% \end{macrocode} +% +% \paragraph{Package french.} +% This fix only works, if \cs{GenericError} is disabled. +% \begin{macrocode} + \ifx\nofrenchguillemets\@undefined + \else + \nofrenchguillemets + \fi +% \end{macrocode} +% +% \paragraph{Definition commands and expansion.} +% Redefining the defining commands (see sec. \ref{defcmd}). +% The original meaning of \cs{xdef} is saved in \cs{Hy@temp}. +% \begin{macrocode} + \let\Hy@temp\xdef + \let\def\HyPsd@DefCommand + \let\gdef\HyPsd@DefCommand + \let\edef\HyPsd@DefCommand + \let\xdef\HyPsd@DefCommand + \let\futurelet\HyPsd@LetCommand + \let\let\HyPsd@LetCommand + \Hy@temp#1{#2}% + \endgroup +% \end{macrocode} +% +% \subsubsection{Postprocessing} +% If the string is empty time can be saved by omitting the +% postprocessing process. +% \begin{macrocode} + \ifx#1\@empty + \else +% \end{macrocode} +% +% \paragraph{Protecting spaces and removing grouping characters.} +% In order to check the tokens we must separate them. This will be +% done with \TeX's argument parsing. With this method +% we must the following item takes into account, that makes +% makes things a litte more complicate: +% \begin{itemize} +% \item \TeX{} does not accept a space as an undelimited argument, +% it cancels space tokens while looking for an undelimited +% argument. Therefore we must protect the spaces now. +% \item An argument can be a single token or a group of many tokens. +% And within curly braces tokens aren't find by \TeX's +% argument scanning process. Third curly braces as grouping characters +% cannot be expanded further, so they don't vanish by the string +% expansion above. So these characters with catcode 1 and 2 are +% removed in the following and replaced by an marker for the xspace +% support. +% \item \TeX{} silently removes the outmost pair of braces of an +% argument. To prevent this on unwanted places, in the following +% the character \verb+|+ is appended to the string to make an outer +% brace to an inner one. +% \end{itemize} +% First the top level spaces are protected by replacing. Then the +% string is scanned to detect token groups. Each token group +% will now be space protected and again scanned for another +% token groups. +% \begin{macrocode} + \HyPsd@ProtectSpaces#1% + \let\HyPsd@String\@empty + \expandafter\HyPsd@RemoveBraces\expandafter{#1|}% + \global\let#1\HyPsd@String +% \end{macrocode} +% +% \paragraph{Check tokens.} +% After removing the spaces and the grouping characters +% the string now should only consists of the following tokens/catcodes:\\ +% \begin{tabular}{rl} +% 0&command names with start with an escape character.\\ +% 3&math shift\\ +% 4&alignment tabs\\ +% 6¶meter, but this is unlikely.\\ +% 7&superscript\\ +% 8&subscript\\ +% 11&letter\\ +% 12&other\\ +% 13&commands that are active characters. +% \end{tabular} +% +% After \cs{HyPsd@CheckCatcodes} the command \cs{HyPsd@RemoveMask} is +% reused to remove the group protection character \verb+|+. +% This character is needed to ensure that the string at least +% consists of one token if \cs{HyPsd@CheckCatcodes} +% is called. +% +% Because of internal local assignments and tabulars +% group braces are used. +% \begin{macrocode} + \let\HyPsd@SPACEOPTI\relax + {% + \let\HyPsd@String\@empty + \expandafter\HyPsd@CheckCatcodes#1\HyPsd@End + \global\let#1\HyPsd@String + }% + \expandafter\HyPsd@RemoveMask\expandafter + |\expandafter\@empty#1\HyPsd@End#1% +% \end{macrocode} +% \cs{HyPsd@CheckCatcodes} should no have removed the tokens with +% catcode 3, 4, 7, and 8. Because a parameter token (6) would +% cause to many errors before, there should now be only tokens +% with catcodes 11 or 12. So I think there is no need for +% a safety step like: +%\begin{verbatim} +%\xdef#1{\expandafter\strip@prefix\meaning#1}% +%\end{verbatim} +% \paragraph{Looking for wrong glyphs.} +% The case that glyphs aren't defined in the PD1 encoding +% is catched above in such a way, that the glyph name and +% a marker is inserted into the string. Now we can safely +% scan the string for this marker and provide a descriptive +% warning. +% \begin{macrocode} + \expandafter\HyPsd@Subst\expandafter{\HyPsd@GLYPHERR}{\relax}#1% + \let\HyPsd@String\@empty + \expandafter\HyPsd@GlyphProcess#1\relax\@empty + \global\let#1\HyPsd@String +% \end{macrocode} +% +% \paragraph{Backslash.} +% The double backslash disturbs parsing octal sequenzes, for +% example in an string like |abc\\051| the sequence \cs{051} +% is detected although the second \cs{} belongs to the +% first backslash. +% \begin{macrocode} + \HyPsd@StringSubst{\\}{\textbackslash}#1% +% \end{macrocode} +% +% \paragraph{Spaces.} +% All spaces have already the form \cs{040}. +% The last postprocessing step will +% be an optimizing of the spaces, so we already introduce +% already the necessary command \cs{HyPsd@SPACEOPTI}. +% But first it is defined to be \cs{relax} in order to +% prevent a too early expansion by an \cs{edef}. +% Secondly a \cs{relax} serves as a marker for +% a token that is detected by \cs{xspace}. +% +% The code of |frenchb.ldf| can produce an additional +% space before \cs{guillemotright}, because \cs{lastskip} +% and \cs{unskip} do not work. Therefore it is removed here. +% \begin{macrocode} + \ifHy@unicode + \expandafter\HyPsd@StringSubst\csname 80\040\endcsname + \HyPsd@SPACEOPTI#1% + \edef\Hy@temp@A{\HyPsd@SPACEOPTI\HyPsd@SPACEOPTI\80\273}% + \expandafter\HyPsd@Subst\expandafter{\Hy@temp@A}% + {\HyPsd@SPACEOPTI\80\273}#1% + \else + \HyPsd@StringSubst{\040}\HyPsd@SPACEOPTI#1% + \expandafter\HyPsd@Subst\expandafter{% + \expandafter\HyPsd@SPACEOPTI\expandafter\HyPsd@SPACEOPTI + \string\273}{\HyPsd@SPACEOPTI\273}#1% + \fi +% \end{macrocode} +% +% \paragraph{Right parenthesis.} +% Also \cs{xspace} detects a right parenthesis. +% For the \cs{xspace} support and the following +% parenthesis check the different parenthesis +% notations |)|, \cs{)}, and \cs{051} are converted +% to one type \cs{)} and before \cs{HyPsd@empty} +% with the meaning of \cs{relax} is introduced for +% \cs{xspace}. By redefining to \cs{@empty} \cs{HyPsd@empty} +% can easily removed later. +% \begin{macrocode} + \ifHy@unicode + \HyPsd@StringSubst{\)}{\80\051}#1% + \HyPsd@Subst){\80\051}#1% + \let\HyPsd@empty\relax + \expandafter\HyPsd@StringSubst\csname 80\051\endcsname + {\HyPsd@empty\80\051}#1% + \else + \HyPsd@StringSubst{\)}{\051}#1% + \HyPsd@Subst){\051}#1% + \let\HyPsd@empty\relax + \HyPsd@StringSubst{\051}{\HyPsd@empty\string\)}#1% + \fi +% \end{macrocode} +% +% \paragraph{Support for package \texttt{xspace}.} +% \cs{xspace} looks for the next token and decides if it +% expands to a space or not. Following tokens prevent its +% transformation to a space: Beginning and end of group, +% handled above by replacing by an italic correction, +% several punctuation marks, a closing parentheses, and +% several spaces. +% +% Without package |xspace| there are tokens with catcode 11 and 12, +% \cs{HyPsd@empty} and \cs{HyPsd@SPACEOPTI}. With package |xspace| +% marker for the italic correction \cs{/} and \cs{xspace} come with. +% In the package |xspace| case the two markers are replaced by +% commands and an \cs{edef} performs the \cs{xspace} processing. +% +% In the opposite of the original \cs{xspace} \cs{HyPsd@xspace} uses +% an argument instead of a \cs{futurelet}, so we have to provide +% such an argument, if \cs{HyPsd@xspace} comes last. Because +% \cs{HyPsd@Subst} with several equal tokens (|--|) needs a safe +% last token, in both cases +% the string gets an additional \cs{HyPsd@empty}. +% \begin{macrocode} + \expandafter\HyPsd@Subst\expandafter{\/}\HyPsd@empty#1% + \@ifundefined{@xspace}{% + }{% + \let\HyPsd@xspace\relax + \expandafter\HyPsd@Subst\expandafter + {\HyPsd@XSPACE}\HyPsd@xspace#1% + \let\HyPsd@xspace\HyPsd@doxspace + }% + \xdef#1{#1\HyPsd@empty}% +% \end{macrocode} +% +% \paragraph{Ligatures.} +% \TeX{} forms ligatures in its stomach, but the PDF strings are +% treated only by \TeX's mouth. The PDFDocEncoding contains +% some ligatures, but the current +% version 3 of the AcrobatReader lacks the |fi| and |fl| glyphs, and +% the Linux version lacks the |emdash| and |endash| glyphs. +% So the necessary code is provided here, but currently disabled, +% hoping that version 4 of the AcrobatReader is better. +% To break the ligatures the user can use an empty group, +% because it leads to an insertion of an \cs{HyPsd@empty}. +% If this ligature code will be enabled some day, then the italic +% correction should also break the ligatures. Currently this occurs +% only, if package |xspace| is loaded. +% \begin{macrocode} +% \HyPsd@Subst{---}\textemdash#1% +% \HyPsd@Subst{--}\textendash#1% +% \HyPsd@Subst{fi}\textfi#1% +% \HyPsd@Subst{fl}\textfl#1% + \HyPsd@Subst{!`}\textexclamdown#1% + \HyPsd@Subst{?`}\textquestiondown#1% +% \end{macrocode} +% With the next \cs{edef} we get rid of the token \cs{HyPsd@empty}. +% \begin{macrocode} + \let\HyPsd@empty\@empty +% \end{macrocode} +% +% \paragraph{Left parentheses.} +% Left parentheses are now converted to safe forms to avoid +% problems with unmatched ones (\cs{(} with PDFDocEncoding, +% the octal sequence with Unicode. +% +% An optimization is possible. Matched parentheses can replaced +% by a |()| pair. But this code is removed to save \TeX{} memory +% and time. +% \begin{macrocode} + \ifHy@unicode + \HyPsd@StringSubst\(\textparenleft#1% + \HyPsd@Subst(\textparenleft#1% + \else + \HyPsd@StringSubst\({\050}#1% + \HyPsd@Subst({\050}#1% + \HyPsd@StringSubst{\050}{\string\(}#1% + \fi +% \end{macrocode} +% +% \paragraph{Optimizing spaces.} +% Spaces are often used, but they have a very long form \cs{040}. +% They are converted back to real spaces, but not all, so that +% no space follows after another. In the bookmark case several +% spaces are written to the |.out| file, but if the entries +% are read back, several spaces are merged to a single one. +% +% With Unicode the spaces are replaced by their octal sequences. +% \begin{macrocode} + \ifHy@unicode + \edef\HyPsd@SPACEOPTI{\80\040}% + \else + \let\HyPsd@SPACEOPTI\HyPsd@spaceopti + \fi + \xdef#1{#1\@empty}% + \fi +% \end{macrocode} +% +% \paragraph{Converting to Unicode.} +% At last the eight bit letters have to be converted to Unicode, +% the masks \cs{8} and \cs{9} are removed and the Unicode +% marker is added. +% \begin{macrocode} + \ifHy@unicode + \HyPsd@ConvertToUnicode#1% + \fi +% \end{macrocode} +% +% \paragraph{User hook.} +% The hook \cs{pdfstringdefPostHook} can be used +% for the purpose to postprocess the string further. +% \begin{macrocode} + \pdfstringdefPostHook#1% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Encodings} +% \subsubsection{PD1 encoding} +% The PD1 encoding implements the PDFDocEncoding for use with +% \LaTeXe's NFSS. Because the informational strings are not set by +% \TeX's typesetting mechanism but for interpreting by the PDF reader, +% the glyphs of the PD1 encoding are implemented to be safely written +% to a file (PDF output file, |.out| file). +% +% The PD1 encoding can be specified as an option of the 'fontenc' package +% or loaded here. It does not matter what font family is selected, +% as \TeX{} does not process it anyway. So use CM. +% \begin{macrocode} +\@ifundefined{T@PD1}{\input{pd1enc.def}}{} +\DeclareFontFamily{PD1}{pdf}{} +\DeclareFontShape{PD1}{pdf}{m}{n}{ <-> cmr10 }{} +\DeclareFontSubstitution{PD1}{pdf}{m}{n} +% \end{macrocode} +% +% \subsubsection{PU encoding} +% The PU encoding implements the Unicode encoding for use with +% \LaTeX's NFSS. Because of large memory requirements the +% encoding file for Unicode support is only loaded, if option +% |unicode| is specified as package option. +% \begin{macro}{\HyPsd@InitUnicode} +% Because the file |puenc.def| takes a lot of memory, the loading +% is defined in the macro \cs{HyPsd@InitUnicode} called by +% the package option |unicode|. +% \begin{macrocode} +\def\HyPsd@InitUnicode{% + \@ifundefined{T@PU}{\input{puenc.def}}{}% + \DeclareFontFamily{PU}{pdf}{}% + \DeclareFontShape{PU}{pdf}{m}{n}{ <-> cmr10 }{}% + \DeclareFontSubstitution{PU}{pdf}{m}{n}% + \let\HyPsd@InitUnicode\relax +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Additional user commands} +% +% \subsubsection{^^A +% \texorpdfstring{\cs{texorpdfstring}}{\\texorpdfstring}^^A +% } +% \begin{macro}{\texorpdfstring} +% While expanding the string in \cs{pdfstringdef} the switch +% \cs{ifHy@pdfstring} is set. This is used by the +% full expandible macro \cs{texorpdfstring}. It expects +% two arguments, the first contains the string that will be +% set and processed by \TeX's stomach, the second +% contains the replacement for PDF strings. +% \begin{macrocode} +\newcommand*{\texorpdfstring}{% + \ifHy@pdfstring + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Hooks for +% \texorpdfstring{\cs{pdfstringdef}}{\\pdfstringdef}^^A +% } +% \begin{macro}{\pdfstringdefPreHook} +% \begin{macro}{\pdfstringdefPostHook} +% Default definition of the hooks for \cs{pdfstringdef}. +% The construct \cs{@ifundefined} with \cs{let} is a little bit +% faster than \cs{providecommand}. +% \begin{macrocode} +\@ifundefined{pdfstringdefPreHook}{% + \let\pdfstringdefPreHook\@empty +}{} +\@ifundefined{pdfstringdefPostHook}{% + \let\pdfstringdefPostHook\@gobble +}{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pdfstringdefDisableCommands} +% In \cmd{\pdfstringdefPreHook} the user can add +% code that is executed before the string, that have +% to be converted by \cmd{\pdfstringdef}, is expanded. +% So replacements for problematic macros can be given. +% The code in \cmd{\pdfstringdefPreHook} should not +% be replaced perhaps by an \cmd{\renewcommand}, +% because a previous meaning gets lost. +% +% Macro \cmd{\pdfstringdefDisableCommands} avoids this, +% because it reuses the old meaning of the hook and appends +% the new code to \cmd{\pdfstringdefPreHook}, e.g.: +%\begin{verbatim} +%\pdfstringdefDisableCommands{% +% \let~\textasciitilde +% \def\url{\pdfstringdefWarn\url}% +% \let\textcolor\@gobble +%}% +%\end{verbatim} +% In the argument of \cmd{\pdfstringdefDisableCommands} the +% character |@| can be used in command names. So it is easy +% to use useful \LaTeX{} commands like \cmd{\@gobble} or +% \cmd{\@firstofone}. +% \begin{macrocode} +\def\pdfstringdefDisableCommands{% + \begingroup + \makeatletter + \HyPsd@DisableCommands +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@DisableCommands} +% \begin{macrocode} +\long\def\HyPsd@DisableCommands#1{% + \toks0=\expandafter{\pdfstringdefPreHook}% + \toks1={#1}% + \xdef\pdfstringdefPreHook{\the\toks0 \the\toks1}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfstringdefWarn} +% The purpose of \cmd{\pdfstringdefWarn} is to produce +% a warning message, so the user can see, that something +% can go wrong with the conversion to PDF strings. +% +% The prefix |\<>-| is added to the token. \cmd{\noexpand} +% protects the probably undefined one during the first +% expansion step. Then \cmd{\HyPsd@CheckCatcodes} can +% detect the not allowed token, \cmd{\HyPsd@CatcodeWarning} +% prints a warning message, after \cmd{\HyPsd@RemovePrefix} +% has removed the prefix. +% +% \cmd{\pdfstringdefWarn} is intended for document authors or +% package writers, examples for use can be seen in the definition +% of \cmd{\HyPsd@ifnextchar} or \cmd{\HyPsd@protected@testopt}. +% \begin{macrocode} +\def\pdfstringdefWarn#1{% + \expandafter\noexpand\csname<>-\string#1\endcsname +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Help macros for expansion} +% +% \subsubsection{Babel languages} +% \begin{macrocode} +\newif\ifHy@next +% \end{macrocode} +% +% Nothing to do for english. +% \begin{macrocode} +\@ifpackagewith{babel}{danish}{% + \def\HyPsd@babel@danish{% + \declare@shorthand{danish}{"|}{}% + \declare@shorthand{danish}{"~}{-}% + }% +}{} +\Hy@nextfalse +\@ifpackagewith{babel}{dutch}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{afrikaans}{\Hy@nexttrue}{}% +\ifHy@next + \def\HyPsd@babel@dutch{% + \declare@shorthand{dutch}{"|}{}% + \declare@shorthand{dutch}{"~}{-}% + }% +\fi +\@ifpackagewith{babel}{finnish}{% + \def\HyPsd@babel@finnish{% + \declare@shorthand{finnish}{"|}{}% + }% +}{} +\Hy@nextfalse +\@ifpackagewith{babel}{frenchb}{\Hy@nexttrue}{} +\@ifpackagewith{babel}{francais}{\Hy@nexttrue}{} +\ifHy@next + \def\HyPsd@babel@frenchb{% + \def\guill@spacing{ }% + }% +\fi +\Hy@nextfalse +\@ifpackagewith{babel}{german}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{germanb}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{austrian}{\Hy@nexttrue}{}% +\ifHy@next + \def\HyPsd@babel@german{% + \declare@shorthand{german}{"f}{f}% + \declare@shorthand{german}{"|}{}% + \declare@shorthand{german}{"~}{-}% + }% +\fi +\Hy@nextfalse +\@ifpackagewith{babel}{ngerman}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{ngermanb}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{naustrian}{\Hy@nexttrue}{}% +\ifHy@next + \def\HyPsd@babel@ngerman{% + \declare@shorthand{german}{"|}{}% + \declare@shorthand{german}{"~}{-}% + }% +\fi +\Hy@nextfalse +\@ifpackagewith{babel}{usorbian}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{uppersorbian}{\Hy@nexttrue}{}% +\ifHy@next + \def\HyPsd@babel@usorbian{% + \declare@shorthand{usorbian}{"f}{f}% + \declare@shorthand{usorbian}{"|}{}% + }% +\fi +\Hy@nextfalse +\@ifpackagewith{babel}{brazil}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{brazilian}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{portuges}{\Hy@nexttrue}{}% +\@ifpackagewith{babel}{portuguese}{\Hy@nexttrue}{}% +\ifHy@next + \def\HyPsd@babel@portuges{% + \declare@shorthand{portuges}{"|}{}% + }% +\fi +\Hy@nextfalse +\@ifpackagewith{babel}{russian}{\Hy@nexttrue}{} +\@ifpackagewith{babel}{russianb}{\Hy@nexttrue}{} +\ifHy@next + \def\HyPsd@babel@russian{% + \declare@shorthand{russian}{"|}{}% + \declare@shorthand{russian}{"~}{-}% + }% +\fi +\Hy@nextfalse +\@ifpackagewith{babel}{ukrainian}{\Hy@nexttrue}{} +\@ifpackagewith{babel}{ukraineb}{\Hy@nexttrue}{} +\ifHy@next + \def\HyPsd@babel@ukrainian{% + \declare@shorthand{ukrainian}{"|}{}% + \declare@shorthand{ukrainian}{"~}{-}% + }% +\fi +\@ifpackagewith{babel}{macedonian}{% + \def\HyPsd@babel@macedonian{% + \declare@shorthand{macedonian}{"|}{}% + \declare@shorthand{macedonian}{"~}{-}% + }% +}{} +\@ifpackagewith{babel}{slovene}{% + \def\HyPsd@babel@slovene{% + \declare@shorthand{slovene}{"|}{}% + }% +}{} +\@ifpackagewith{babel}{swedish}{% + \def\HyPsd@babel@swedish{% + \declare@shorthand{swedish}{"|}{}% + \declare@shorthand{swedish}{"~}{-}% + }% +}{} +% \end{macrocode} +% +% \subsubsection{CJK bookmarks} +% +% \begin{macro}{\HyPsd@CJKhook} +% Some internal commands of package cjk are redefined +% to avoid error messages. For a rudimental support +% of CJK bookmarks the active characters are +% redefined so that they print themselves. +% +% After preprocessing of Big5 encoded data the +% following string for a double-byte character +% is emitted: +%\begin{verbatim} +%^^7f^^7f^^7f +%\end{verbatim} +% \verb|| is the first byte in the range (always $>$ 0x80); +% \verb|| is the second byte in decimal notation +% ($\ge$ 0x40). +% \begin{macrocode} +\begingroup + \catcode"7F=\active + \toks@{% + \let\CJK@ignorespaces\empty + \def\CJK@char#1{\@gobbletwo}% + \let\CJK@charx\@gobblefour + \let\CJK@punctchar\@gobblefour + \def\CJK@punctcharx#1{\@gobblefour}% + \catcode"7F=\active + \def^^7f#1^^7f#2^^7f{% + \string #1\HyPsd@DecimalToOctal{#2}% + }% + % ... ? + \ifHy@unicode + \def\Hy@cjkpu{\80}% + \else + \let\Hy@cjkpu\@empty + \fi + \HyPsd@CJKActiveChars + }% + \count@=127 + \@whilenum\count@<255 \do{% + \advance\count@ by 1 + \lccode`\~=\count@ + \lowercase{% + \toks@\expandafter{\the\toks@ ~}% + }% + }% + \toks@\expandafter{\the\toks@ !}% + \xdef\HyPsd@CJKhook{\the\toks@}% +\endgroup +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@CJKActiveChars} +% The macro \cmd{\HyPsd@CJKActiveChars} is only defined +% to limit the memory consumption of \cmd{\HyPsd@CJKhook}. +% \begin{macrocode} +\def\HyPsd@CJKActiveChars#1{% + \ifx#1!% + \let\HyPsd@CJKActiveChars\relax + \else + \edef#1{\noexpand\Hy@cjkpu\string#1}% + \fi + \HyPsd@CJKActiveChars +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@DecimalToOctal} +% A character, given by the decimal number is converted +% to a PDF character. +% \begin{macrocode} +\def\HyPsd@DecimalToOctal#1{% + \ifcase #1 % + \000\or \001\or \002\or \003\or \004\or \005\or \006\or \007% + \or \010\or \011\or \012\or \013\or \014\or \015\or \016\or \017% + \or \020\or \021\or \022\or \023\or \024\or \025\or \026\or \027% + \or \030\or \031\or \032\or \033\or \034\or \035\or \036\or \037% + \or \040\or \041\or \042\or \043\or \044\or \045\or \046\or \047% + \or \050\or \051\or \052\or \053\or \054\or \055\or \056\or \057% + \or 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7% + \or 8\or 9\or \072\or \073\or \074\or \075\or \076\or \077% + \or @\or A\or B\or C\or D\or E\or F\or G% + \or H\or I\or J\or K\or L\or M\or N\or O% + \or P\or Q\or R\or S\or T\or U\or V\or W% + \or X\or Y\or Z\or \133\or \134\or \135\or \136\or \137% + \or \140\or a\or b\or c\or d\or e\or f\or g% + \or h\or i\or j\or k\or l\or m\or n\or o% + \or p\or q\or r\or s\or t\or u\or v\or w% + \or x\or y\or z\or \173\or \174\or \175\or \176\or \177% + \or \200\or \201\or \202\or \203\or \204\or \205\or \206\or \207% + \or \210\or \211\or \212\or \213\or \214\or \215\or \216\or \217% + \or \220\or \221\or \222\or \223\or \224\or \225\or \226\or \227% + \or \230\or \231\or \232\or \233\or \234\or \235\or \236\or \237% + \or \240\or \241\or \242\or \243\or \244\or \245\or \246\or \247% + \or \250\or \251\or \252\or \253\or \254\or \255\or \256\or \257% + \or \260\or \261\or \262\or \263\or \264\or \265\or \266\or \267% + \or \270\or \271\or \272\or \273\or \274\or \275\or \276\or \277% + \or \300\or \301\or \302\or \303\or \304\or \305\or \306\or \307% + \or \310\or \311\or \312\or \313\or \314\or \315\or \316\or \317% + \or \320\or \321\or \322\or \323\or \324\or \325\or \326\or \327% + \or \330\or \331\or \332\or \333\or \334\or \335\or \336\or \337% + \or \340\or \341\or \342\or \343\or \344\or \345\or \346\or \347% + \or \350\or \351\or \352\or \353\or \354\or \355\or \356\or \357% + \or \360\or \361\or \362\or \363\or \364\or \365\or \366\or \367% + \or \370\or \371\or \372\or \373\or \374\or \375\or \376\or \377% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\texorpdfstring{\cs{@inmathwarn}}{\\@inmathwarn}-Patch} +% \begin{macro}{\HyPsd@inmathwarn} +% The patch of \cs{@inmathwarn} is needed to get rid of the +% infinite error loop with glyphs of other encodings +% (see the explanation above). Potentially the patch is +% dangerous, if the code in |ltoutenc.dtx| changes. +% Checked with \LaTeXe{} versions [1998/06/01] and +% [1998/12/01]. I expect that versions below [1995/12/01] +% don't work. +% +% To understand the patch easier, the original code of +% \cs{@current@cmd} and \cs{@changed@cmd} follows +% (\LaTeXe{} release [1998/12/01]). +% In the normal case \cs{pdfstringdef} is executed in a context +% where \cs{protect} has the meaning of \cs{@typesetprotect} +% (=\cs{relax}). +%\begin{verbatim} +%\def\@current@cmd#1{% +% \ifx\protect\@typeset@protect +% \@inmathwarn#1% +% \else +% \noexpand#1\expandafter\@gobble +% \fi} +%\def\@changed@cmd#1#2{% +% \ifx\protect\@typeset@protect +% \@inmathwarn#1% +% \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax +% \expandafter\ifx\csname ?\string#1\endcsname\relax +% \expandafter\def\csname ?\string#1\endcsname{% +% \TextSymbolUnavailable#1% +% }% +% \fi +% \global\expandafter\let +% \csname\cf@encoding \string#1\expandafter\endcsname +% \csname ?\string#1\endcsname +% \fi +% \csname\cf@encoding\string#1% +% \expandafter\endcsname +% \else +% \noexpand#1% +% \fi} +%\gdef\TextSymbolUnavailable#1{% +% \@latex@error{% +% Command \protect#1 unavailable in encoding \cf@encoding% +% }\@eha} +%\def\@inmathwarn#1{% +% \ifmmode +% \@latex@warning{Command \protect#1 invalid in math mode}% +% \fi} +%\end{verbatim} +% \begin{macrocode} +\def\HyPsd@inmathwarn#1#2{% + \ifx#2\expandafter + \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax + \HyPsd@GLYPHERR + \expandafter\@gobble\string#1% + >% + \expandafter\expandafter\expandafter\HyPsd@EndWithElse + \else + \expandafter\expandafter\expandafter\HyPsd@GobbleFiFi + \fi + \else + \expandafter#2% + \fi +} +\def\HyPsd@GobbleFiFi#1\fi#2\fi{} +\def\HyPsd@EndWithElse#1\else{\else} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\texorpdfstring{\cs{add@accent}}{\\@addaccent}-Patch} +% Unknown composite characters are built with \cs{add@accent}, +% so it is redefined to provide a warning. +% \begin{macro}{\HyPsd@add@accent} +% \begin{macrocode} +\def\HyPsd@add@accent#1#2{% + \HyPsd@GLYPHERR\expandafter\@gobble\string#1+\string#2>% + #2% +}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Unexpandable spaces} +% \begin{macro}{\HyPsd@LetUnexpandableSpace} +% In \cmd{\HyPsd@@ProtectSpaces} the space tokens are replaced +% by not expandable commands, that work like spaces: +% \begin{itemize} +% \item So they can catched by undelimited arguments. +% \item And they work in number, dimen, and skip +% assignments. +% \end{itemize} +% These properties are used in \cmd{\HyPsd@CheckCatcodes}. +% \begin{macrocode} +\def\HyPsd@LetUnexpandableSpace#1{% + \expandafter\futurelet\expandafter#1\expandafter\@gobble\space\relax +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@UnexpandableSpace} +% \cmd{\HyPsd@UnexpandableSpace} is used +% in \cmd{\HyPsd@@ProtectSpaces}. +% In \cmd{HyPsd@@ProtectSpaces} the space tokens are replaced +% by unexpandable commands \cmd{\HyPsd@UnexpandableSpace}, +% but that have the effect of spaces. +% \begin{macrocode} +\HyPsd@LetUnexpandableSpace\HyPsd@UnexpandableSpace +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Marker for commands} +% \begin{macro}{\HyPsd@XSPACE} +% \begin{macro}{\HyPsd@ITALCORR} +% \begin{macro}{\HyPsd@GLYPHERR} +% Some commands and informations cannot be utilized before +% the string expansion and the checking process. +% Command names are filtered out, so we need another way +% to transport the information: An unusual |#| with catcode +% 12 marks the beginning of the extra information. +% \begin{macrocode} +\edef\HyPsd@XSPACE{\string#\string X} +\edef\HyPsd@ITALCORR{\string#\string I} +\edef\HyPsd@GLYPHERR{\string#\string G} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{\texorpdfstring{\cs{hspace}}{\\hspace} fix} +% \begin{macro}{\HyPsd@hspace} +% \begin{macrocode} +\def\HyPsd@hspace#1{\HyPsd@@hspace#1*\END} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@hspace} +% \cs{HyPsd@@hspace} checks whether \cs{hspace} +% is called in its star form. +% \begin{macrocode} +\def\HyPsd@@hspace#1*#2\END{% + \ifx\\#2\\% + \HyPsd@hspacetest{#1}% + \else + \expandafter\HyPsd@hspacetest + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@hspacetest} +% \cs{HyPsd@hyspacetest} replaces the \cs{hspace} by a space, if +% the length is greater than zero. +% \begin{macrocode} +\def\HyPsd@hspacetest#1{\ifdim#1>\z@\space\fi} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Fix for AMS classes} +% +% \begin{macrocode} +\@ifundefined{tocsection}{% + \let\HyPSD@AMSclassfix\relax +}{% + \def\HyPSD@AMSclassfix{% + \let\tocpart\HyPSD@tocsection + \let\tocchapter\HyPSD@tocsection + \let\tocappendix\HyPSD@tocsection + \let\tocsection\HyPSD@tocsection + \let\tocsubsection\HyPSD@tocsection + \let\tocsubsubsection\HyPSD@tocsection + \let\tocparagraph\HyPSD@tocsection + }% + \def\HyPSD@tocsection#1#2#3{% + \if @#2@\else\if @#1@\else#1 \fi#2. \fi + #3% + }% +} +% \end{macrocode} +% +% \subsubsection{Reference commands} +% +% \begin{macro}{\HyPsd@ref} +% Macro \cs{HyPsd@ref} calls the macro \cs{HyPsd@@ref} for star checking. +% The same methods like in \cs{HyPsd@hspace} is used. +% \begin{macrocode} +\def\HyPsd@ref#1{\HyPsd@@ref#1*\END}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@ref} +% Macro \cs{HyPsd@@ref} checks if a star is present. +% \begin{macrocode} +\def\HyPsd@@ref#1*#2\END{% + \ifx\\#2\\% + \HyPsd@@@ref{#1}% + \else + \expandafter\HyPsd@@@ref + \fi +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@@ref} +% \cs{HyPsd@@@ref} does the work and extracts the first argument. +% \begin{macrocode} +\def\HyPsd@@@ref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + ??% + \else + \expandafter\expandafter\expandafter\@car\csname r@#1\endcsname\@nil + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPsd@pageref} +% Macro \cs{HyPsd@pageref} calls the macro \cs{HyPsd@@pageref} for star checking. +% The same methods like in \cs{HyPsd@hspace} is used. +% \begin{macrocode} +\def\HyPsd@pageref#1{\HyPsd@@pageref#1*\END} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@pageref} +% Macro \cs{HyPsd@@pageref} checks if a star is present. +% \begin{macrocode} +\def\HyPsd@@pageref#1*#2\END{% + \ifx\\#2\\% + \HyPsd@@@pageref{#1}% + \else + \expandafter\HyPsd@@@pageref + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@@pageref} +% \cs{HyPsd@@@pageref} does the work and extracts the second argument. +% \begin{macrocode} +\def\HyPsd@@@pageref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + ??% + \else + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\@car + \expandafter\expandafter\expandafter\@gobble + \csname r@#1\endcsname\@nil + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Redefining the defining commands} +% \label{defcmd} +% Definitions aren't allowed, because they aren't executed in +% an only expanding context. So the command to be defined +% isn't defined and can perhaps be undefined. This would causes +% TeX to stop with an error message. +% With a deep trick it is possible to define commands in such +% a context: \cs{csname} does the job, it defines the command +% to be \cs{relax}, if it has no meaning. +% +% Active characters cannot be defined with this trick. It is +% possible to define all undefined active characters +% (perhaps that they have the meaning of \cs{relax}). +% To avoid side effects this should be done in \cs{pdfstringdef} +% shortly before the \cs{xdef} job. But checking and defining +% all possible active characters of the full range (0 until 255) +% would take a while. \cs{pdfstringdef} is slow enough, so +% this isn't done. +% +% \cs{HyPsd@DefCommand} and \cs{HyPsd@LetCommand} expands to the +% commands \cs{-command} and \cs{-command} +% with the meaning of \cs{def} and \cs{let}. So it is detected by +% \cs{HyPsd@CheckCatcodes} and the command name \cs{-command} +% or \cs{-command} should indicate a forbidden definition +% command. +% +% The command to be defined is converted to a string and back +% to a command name with the help of \cs{csname}. If the +% command is already defined, \cs{noexpand} prevents a +% further expansion, even though the command would +% expand to legal stuff. If the command don't have the meaning +% of \cs{relax}, \cs{HyPsd@CheckCatcodes} will produce a warning. +% (The command itself can be legal, but the warning is legitimate +% because of the position after a defining command.) +% +% The difference between \cs{HyPsd@DefCommand} and +% \cs{HyPsdLetCommand} is that the first one also cancels this +% arguments, the parameter and definition text. The right side +% of the \cs{let} commands cannot be canceled with an undelimited +% parameter because of a possible space token after \cs{futurelet}. +% +% \begin{macro}{\HyPsd@DefCommand} +% \begin{macro}{\HyPsd@LetCommand} +% \begin{macrocode} +\begingroup + \def\x#1#2{% + \endgroup + \let#1\def + \def\HyPsd@DefCommand##1##2##{% + #1% + \expandafter\noexpand + \csname\expandafter\@gobble\string##1\@empty\endcsname + \@gobble + }% + \let#2\let + \def\HyPsd@LetCommand##1{% + #2% + \expandafter\noexpand + \csname\expandafter\@gobble\string##1\@empty\endcsname + }% + }% +\expandafter\x\csname -command\expandafter\endcsname + \csname -command\endcsname +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{^^A +% \texorpdfstring{\cs{ifnextchar}}{\\ifnextchar}^^A +% } +% \begin{macro}{\HyPsd@ifnextchar} +% In \cs{pdfstringdef} \cs{@ifnextchar} is disabled +% via a \cs{let} command to save time. First a +% warning message is given, then the three arguments +% are canceled. \cs{@ifnextchar} cannot work in a correct +% manner, because it uses \cs{futurelet}, but this is a +% stomach feature, that doesn't work in an expanding context. +% \begin{macrocode} +\def\HyPsd@ifnextchar{% + \pdfstringdefWarn\@ifnextchar + \expandafter\@gobbletwo\@gobble +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{^^A +% \texorpdfstring{\cs{@protected@testoptifnextchar}}^^A +% {\\@protected@testopt}^^A +% } +% \begin{macro}{\HyPsd@protected@testopt} +% Macros with optional arguments doesn't work properly, because +% they call \cmd{\@ifnextchar} to detect the optional argument +% (see the explanation of \cmd{\HyPsd@ifnextchar}). +% But a warning, that \cmd{\@ifnextchar} doesn't work, doesn't +% help the user very much. Therefore \cmd{\@protected@testopt} +% is also disabled, because its first argument is the problematic +% macro with the optional argument and it is called before +% \cmd{\@ifnextchar}. +% \begin{macrocode} +\def\HyPsd@protected@testopt#1{% + \pdfstringdefWarn#1% + \@gobbletwo +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Help macros for postprocessing} +% +% \subsubsection{Generic warning.} +% \begin{macro}{\HyPsd@Warning} +% For several reasons \cs{space} is masked and does not have its +% normal meaning. But it is used in warning messages, so it is +% redefined locally: +% \begin{macrocode} +\def\HyPsd@Warning#1{% + \begingroup + \def\space{ }% + \Hy@Warning{#1}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Protecting spaces} +% \begin{macro}{\HyPsd@ProtectSpaces} +% \cs{HyPsd@ProtectSpaces} calls with the expanded +% string \cs{HyPsd@@ProtectSpaces}. The expanded string is +% protected by \verb+|+ at the beginning and end of +% the expanded string. Because of this there can be no group +% at the beginning or end of the string and grouping characters +% are not removed by the call of \cs{HyPsd@@ProtectSpaces}. +% \begin{macrocode} +\def\HyPsd@ProtectSpaces#1{% + \expandafter\HyPsd@@ProtectSpaces + \expandafter|\expandafter\@empty#1| \HyPsd@End#1% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@ProtectSpaces} +% The string can contain command tokens, so it is better +% to use an \cs{def} instead of an \cs{edef}. +% \begin{macrocode} +\def\HyPsd@@ProtectSpaces#1 #2\HyPsd@End#3{% + \ifx\scrollmode#2\scrollmode + \HyPsd@RemoveMask#1\HyPsd@End#3% + \else + \gdef#3{#1\HyPsd@UnexpandableSpace#2}% + \Hy@ReturnAfterFi{% + \expandafter\HyPsd@@ProtectSpaces#3\HyPsd@End#3% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \paragraph{Remove mask.} +% \begin{macro}{\HyPsd@RemoveMask} +% \cs{HyPsd@RemoveMask} removes the protecting \verb+|+. +% It is used by \cs{HyPsd@@ProtectSpaces} and by the code in +% \cs{pdfstringdef} that removes the grouping chararcters. +% \begin{macrocode} +\def\HyPsd@RemoveMask|#1|\HyPsd@End#2{% + \toks@\expandafter{#1}% + \xdef#2{\the\toks@}% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Remove grouping braces} +% \begin{macro}{\HyPsd@RemoveBraces} +% |#1| contains the expanded string, the result will +% be locally written in command \cs{HyPsd@String}. +% \begin{macrocode} +\def\HyPsd@RemoveBraces#1{% + \ifx\scrollmode#1\scrollmode + \else + \Hy@ReturnAfterFi{% + \HyPsd@@RemoveBraces#1\HyPsd@End{#1}% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@@RemoveBraces} +% \cs{HyPsd@@RemoveBraces} is called with the expanded string, +% the end marked by \cs{HyPsd@End}, the expanded string again, but +% enclosed in braces and the string command. The first expanded +% string is scanned by the parameter text |#1#2|. +% By a comparison with the original form in |#3| we can decide +% whether |#1| is a single token or a group. To avoid the +% case that |#2| is a group, the string is extended by a \verb+|+ +% before. +% +% While removing the grouping braces an italic correction +% marker is inserted for supporting package |xspace| and +% letting ligatures broken. +% +% Because the string is already expanded, the \cs{if} commands +% should disappeared. So we can move some parts out +% of the argument of \cs{Hy@ReturnAfterFi}. +% \begin{macrocode} +\def\HyPsd@@RemoveBraces#1#2\HyPsd@End#3{% + \def\Hy@temp@A{#1#2}% + \def\Hy@temp@B{#3}% + \ifx\Hy@temp@A\Hy@temp@B + \expandafter\def\expandafter\HyPsd@String\expandafter{% + \HyPsd@String#1% + }% + \Hy@ReturnAfterElseFi{% + \ifx\scrollmode#2\scrollmode + \else + \Hy@ReturnAfterFi{% + \HyPsd@RemoveBraces{#2}% + }% + \fi + }% + \else + \def\Hy@temp@A{#1}% + \HyPsd@AppendItalcorr\HyPsd@String + \Hy@ReturnAfterFi{% + \ifx\Hy@temp@A\@empty + \Hy@ReturnAfterElseFi{% + \HyPsd@RemoveBraces{#2}% + }% + \else + \Hy@ReturnAfterFi{% + \HyPsd@ProtectSpaces\Hy@temp@A + \HyPsd@AppendItalcorr\Hy@temp@A + \expandafter\HyPsd@RemoveBraces\expandafter + {\Hy@temp@A#2}% + }% + \fi + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@AppendItalcorr} +% \begin{macro}{\HyPsd@@AppendItalcorr} +% The string can contain commands yet, so it is better +% to use \cs{def} instead of a shorter \cs{edef}. +% The two help macros limit the count of \cs{expandafter}. +% \begin{macrocode} +\def\HyPsd@AppendItalcorr#1{% + \expandafter\HyPsd@@AppendItalcorr\expandafter{\/}#1% +} +\def\HyPsd@@AppendItalcorr#1#2{% + \expandafter\def\expandafter#2\expandafter{#2#1}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{Catcode check} +% \paragraph{Check catcodes.} +% \begin{macro}{\HyPsd@CheckCatcodes} +% Because \cs{ifcat} expands its arguments, this is +% prevented by \cs{noexpand}. In case of command tokens +% and active characters \cs{ifcat} now sees a \cs{relax}. +% After protecting spaces and removing braces |#1| should +% be a single token, no group of several tokens, nor an +% empty group. (So the \cs{expandafter}\cs{relax} between +% \cs{ifcat} and \cs{noexpand} is only for safety and +% it should be possible to remove it.) +% +% \cs{protect} and \cs{relax} should be removed silently. +% But it is too dangerous and breaks some code giving them +% the meaning of \cs{@empty}. So commands with the meaning +% of \cs{protect} are removed here. (\cs{protect} should +% have the meaning of \cs{@typeset@protect} that +% is equal to \cs{relax}). +% +% \begin{macrocode} +\def\HyPsd@CheckCatcodes#1#2\HyPsd@End{% + \global\let\HyPsd@Rest\relax + \ifcat\relax\noexpand#1\relax + \ifx#1\protect + \else + \ifx#1\penalty + \setbox\z@=\hbox{% + \afterassignment\HyPsd@AfterCountRemove + \count@=#2\HyPsd@End + }% + \else + \ifx#1\kern + \setbox\z@=\hbox{% + \afterassignment\HyPsd@AfterDimenRemove + \dimen@=#2\HyPsd@End + }% + \else + \ifx#1\hskip + \setbox\z@=\hbox{% + \afterassignment\HyPsd@AfterSkipRemove + \skip@=#2\HyPsd@End + }% + \else + \HyPsd@CatcodeWarning{#1}% + \fi + \fi + \fi + \fi + \else + \ifcat#1 %SPACE + \expandafter\def\expandafter\HyPsd@String\expandafter{% + \HyPsd@String\HyPsd@SPACEOPTI + }% + \else + \ifcat$#1% + \HyPsd@CatcodeWarning{math shift}% + \else + \ifcat% + \HyPsd@CatcodeWarning{alignment tab}% + \else + \ifcat^#1% + \HyPsd@CatcodeWarning{superscript}% + \else + \ifcat_#1% + \HyPsd@CatcodeWarning{subscript}% + \else + \expandafter\def\expandafter\HyPsd@String\expandafter{% + \HyPsd@String#1% + }% + \fi + \fi + \fi + \fi + \fi + \fi + \ifx\HyPsd@Rest\relax + \Hy@ReturnAfterElseFi{% + \ifx\scrollmode#2\scrollmode + \else + \Hy@ReturnAfterFi{% + \HyPsd@CheckCatcodes#2\HyPsd@End + }% + \fi + }% + \else + \Hy@ReturnAfterFi{% + \ifx\HyPsd@Rest\@empty + \else + \expandafter\HyPsd@CheckCatcodes\HyPsd@Rest\HyPsd@End + \fi + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \paragraph{Remove counts, dimens, skips.} +% \begin{macro}{\HyPsd@AfterCountRemove} +% Counts like \cs{penalty} are removed silently. +% \begin{macrocode} +\def\HyPsd@AfterCountRemove#1\HyPsd@End{% + \gdef\HyPsd@Rest{#1}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@AfterDimenRemove} +% If the value of the dimen (\cs{kern}) is zero, it can be +% removed silently. All other values are difficult to interpret. +% Negative values do not work in bookmarks. Should positive +% values be removed or should they be replaced by space(s)? +% The following code replaces positive values greater than +% |1ex| with a space and removes them else. +% \begin{macrocode} +\def\HyPsd@AfterDimenRemove#1\HyPsd@End{% + \ifdim\ifx\HyPsd@String\@empty\z@\else\dimen@\fi>1ex + \HyPsd@ReplaceSpaceWarning{\string\kern\space\the\dimen@}% + \gdef\HyPsd@Rest{\HyPsd@UnexpandableSpace #1}% + \else + \ifdim\dimen@=\z@ + \else + \HyPsd@RemoveSpaceWarning{\string\kern\space\the\dimen@}% + \fi + \gdef\HyPsd@Rest{#1}% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@AfterSkipRemove} +% The glue part of skips do not work in PDF strings and are ignored. +% Skips (\cs{hskip}), that are not zero, have the same +% interpreting problems like dimens (see above). +% \begin{macrocode} +\def\HyPsd@AfterSkipRemove#1\HyPsd@End{% + \ifdim\ifx\HyPsd@String\@empty\z@\else\skip@\fi>1ex + \HyPsd@ReplaceSpaceWarning{\string\hskip\space\the\skip@}% + \gdef\HyPsd@Rest{\HyPsd@UnexpandableSpace #1}% + \else + \ifdim\skip@=\z@ + \else + \HyPsd@RemoveSpaceWarning{\string\kern\space\the\skip@}% + \fi + \gdef\HyPsd@Rest{#1}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \paragraph{Catcode warnings.} +% \begin{macro}{\HyPsd@CatcodeWarning} +% \cs{HyPsd@CatcodeWarning} produces a warning for the user. +% \begin{macrocode} +\def\HyPsd@CatcodeWarning#1{% + \HyPsd@Warning{% + Token not allowed in a PDFDocEncoded string,% + \MessageBreak removing `\HyPsd@RemoveCmdPrefix#1'% + }% +} +\begingroup + \catcode`\|=0 + \catcode`\\=12 +% \end{macrocode} +% \SpecialEscapechar{\|} +% \vspace{-2\MacrocodeTopsep} +% \vspace{-\parskip} +% \vspace{-\partopsep} +% \begin{macrocode} + |gdef|HyPsd@RemoveCmdPrefix#1{% + |expandafter|HyPsd@@RemoveCmdPrefix + |string#1|@empty\<>-|@empty|@empty + }% + |gdef|HyPsd@@RemoveCmdPrefix#1\<>-#2|@empty#3|@empty{#1#2}% +|endgroup +% \end{macrocode} +% \SpecialEscapechar{\\} +% \end{macro} +% \begin{macro}{\HyPsd@RemoveSpaceWarning} +% \begin{macrocode} +\def\HyPsd@RemoveSpaceWarning#1{% + \HyPsd@Warning{% + Token not allowed in a PDFDocEncoded string:% + \MessageBreak #1\MessageBreak + removed% + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@ReplaceSpaceWarning} +% \begin{macrocode} +\def\HyPsd@ReplaceSpaceWarning#1{% + \HyPsd@Warning{% + Token not allowed in a PDFDocEncoded string:% + \MessageBreak #1\MessageBreak + replaced by space% + }% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Check for wrong glyphs} +% A wrong glyph is marked with \cs{relax}, the glyph +% name follows, delimited by |>|. \cs{@empty} ends +% the string. +% \begin{macrocode} +\def\HyPsd@GlyphProcess#1\relax#2\@empty{% + \expandafter\def\expandafter\HyPsd@String\expandafter{% + \HyPsd@String#1% + }% + \ifx\\#2\\% + \else + \Hy@ReturnAfterFi{% + \HyPsd@GlyphProcessWarning#2\@empty + }% + \fi +} +\def\HyPsd@GlyphProcessWarning#1>#2\@empty{% + \HyPsd@Warning{% + Glyph not defined in % + P\ifHy@unicode U\else D1\fi\space encoding,\MessageBreak + removing `\@backslashchar#1'% + }% + \HyPsd@GlyphProcess#2\@empty +} +% \end{macrocode} +% +% \paragraph{Spaces.} +% \begin{macro}{\HyPsd@spaceopti} +% In the string the spaces are represented by \cs{HyPsd@spaceopti} +% tokens. Within an \cs{edef} it prints itself as +% a simple space and looks for its next argument. +% If another space follows, so it replaces the next \cs{HyPsd@spaceopti} +% by an protected space \cs{040}. +% \begin{macrocode} +\def\HyPsd@spaceopti#1{ % first space + \ifx\HyPsd@spaceopti#1% + \040% + \else + #1% + \fi +}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Replacing tokens} +% \begin{macro}{\HyPsd@Subst} +% To save tokens \cs{HyPsd@StringSubst} is an wrapper for the +% command \cs{HyPsd@Subst} that does all the work: +% In string stored in command |#3| it replaces the tokens +% |#1| with |#2|.\\ +% \begin{tabular}{ll} +% |#1|& Exact the tokens that should be replaced.\\ +% |#2|& The replacement (don't need to be expanded).\\ +% |#3|& Command with the string. +% \end{tabular} +% \begin{macrocode} +\def\HyPsd@Subst#1#2#3{% + \def\HyPsd@@Replace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \Hy@ReturnAfterFi{% + \HyPsd@@Replace##2\END + }% + \fi + }% + \xdef#3{% + \expandafter\HyPsd@@Replace#3#1\END + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@StringSubst} +% To save tokens in \cs{pdfstringdef} \cs{HyPsd@StringSubst} is a wrapper, +% that expands argument |#1| before calling \cs{HyPsd@Subst}. +% \begin{macrocode} +\def\HyPsd@StringSubst#1{% + \expandafter\HyPsd@Subst\expandafter{\string#1}% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Support for package \texttt{xspace}} +% \begin{macro}{\HyPsd@doxspace} +% \cs{xspace} does not work, because it uses a \cs{futurelet} +% that cannot be executed in \TeX's mouth. So this implementation +% uses an argument to examine the next token. In a previous version +% I reused \cs{@xspace}, but this version is shorter and easier +% to understand. +% \begin{macrocode} +\def\HyPsd@doxspace#1{% + \ifx#1\relax\else + \ifx#1.\else + \ifx#1:\else + \ifx#1,\else + \ifx#1;\else + \ifx#1!\else + \ifx#1?\else + \ifx#1/\else + \ifx#1-\else + \ifx#1'\else + \HyPsd@SPACEOPTI + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + #1% +}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Converting to Unicode} +% Eight bit characters are converted to the sixteen bit ones, +% \cs{8} is replaced by \cs{00}, and \cs{9} is removed. +% The result should be a valid Unicode PDF string without the +% Unicode marker at the beginning. +% \begin{macrocode} +\begingroup + \catcode`\|=0 + \catcode`\\=12 +% \end{macrocode} +% \SpecialEscapechar{\|} +% \begin{macro}{\HyPsd@ConvertToUnicode} +% \begin{macrocode} + |gdef|HyPsd@ConvertToUnicode#1{% + |xdef#1{% + \376\377% + |expandafter|HyPsd@DoConvert#1|@empty|@empty|@empty + }% + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@DoConvert} +% \begin{macrocode} + |gdef|HyPsd@DoConvert#1{% + |ifx#1|@empty + |else + |Hy@ReturnAfterFi{% + |ifx#1\% + \% + |expandafter|HyPsd@DoEscape + |else + \000#1% + |expandafter|HyPsd@DoConvert + |fi + }% + |fi + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@DoEscape} +% \begin{macrocode} + |gdef|HyPsd@DoEscape#1{% + |ifx#19% + |expandafter|HyPsd@GetTwoBytes + |else + |Hy@ReturnAfterFi{% + |ifx#18% + 00% + |expandafter|HyPsd@GetTwoBytes + |else + #1% + |expandafter|HyPsd@GetOneByte + |fi + }% + |fi + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@GetTwoBytes} +% \begin{macrocode} + |gdef|HyPsd@GetTwoBytes#1\#2#3#4{% + #1\#2#3#4% + |HyPsd@DoConvert + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPsd@GetOneBye} +% \begin{macrocode} + |gdef|HyPsd@GetOneByte#1#2{% + #1#2% + |HyPsd@DoConvert + } +|endgroup +% \end{macrocode} +% \end{macro} +% \SpecialEscapechar{\\} +% \begin{macro}{\HyPsd@@GetNextTwoTokens} +% \TeX{} does only allow nine parameters, so we need another macro +% to get more arguments. +% \begin{macrocode} +\def\HyPsd@GetNextTwoTokens#1#2#3\END#4{% + \xdef#4{#4#1#2}% + \HyPsd@@ConvertToUnicode#3\END#4% +} +% \end{macrocode} +% \end{macro} +% +% \section{Support of other packages} +% +% \subsection{Package subfigure} +% Added fix for version 2.1. Here \cmd{\sub@label} is defined. +% \begin{macrocode} +\@ifpackageloaded{subfigure}{% + \@ifundefined{sub@label}{% + \Hy@hypertexnamesfalse + }{% + \renewcommand*{\sub@label}[1]{% + \@bsphack + \subfig@oldlabel{#1}% + \begingroup + \edef\@currentlabstr{% + \expandafter\strip@prefix\meaning\@currentlabelname + }% + \protected@write\@auxout{}{% + \string\newlabel{sub@#1}{% + {\@nameuse{@@thesub\@captype}}% + {\thepage}% + {\expandafter\strip@period\@currentlabstr\relax.\relax\@@@}% + {\@currentHref}% + {}% + }% + }% + \endgroup + \@esphack + }% + \@ifpackagelater{subfigure}{2002/03/26}{}{% + \providecommand*{\toclevel@subfigure}{1}% + \providecommand*{\toclevel@subtable}{1}% + }% + }% +}{} +% \end{macrocode} +% +% \subsection{Package xr and xr-hyper} +% The beta version of xr that supports \cmd{\XR@addURL} is called +% \verb|xr-hyper|. Therefore we test for the macro itself and not +% for the package name: +% \begin{macrocode} +\@ifundefined{XR@addURL}{% +}{% +% \end{macrocode} +% If reading external aux files check whether they have a non zero +% fourth field in |\newlabel| and if so, add the URL as the fifth field. +% \begin{macrocode} + \def\XR@addURL#1{\XR@@dURL#1{}{}{}{}\\}% + \def\XR@@dURL#1#2#3#4#5\\{% + {#1}{#2}% + \if!#4!% + \else + {#3}{#4}{\XR@URL}% + \fi + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\def\Hy@true{true} +\def\Hy@false{false} +% \end{macrocode} +% +% Providing dummy definitions. +% \begin{macrocode} +\let\literalps@out\@gobble +\newcommand\pdfbookmark[3][]{} +\let\Acrobatmenu\@gobble +\def\Hy@writebookmark#1#2#3#4#5{}% +% \end{macrocode} +% +% \section{Help macros for links} +% Anchors get created on the baseline of where they occur. If an +% XYZ PDF view is set, this means that the link places the top of the +% screen \emph{on the baseline} of the target. If this is an equation, +% for instance, it means that you cannot see anything. Some links, of +% course, are created at the start of environments, and so it works. To +% allow for this, anchors are raised, where possible, by some small +% amount. This defaults to |\baselineskip|, but users can set it to +% something else in two ways (thanks to Heiko Oberdiek for suggesting this): +% \begin{enumerate} +% \item Redefine |\HyperRaiseLinkDefault| to be eg the height of a |\strut| +% \item Redefine |\HyperRaiseLinkHook| to do something complicated; +% it must give a value to |\HyperRaiseLinkLength|, which is what +% actually gets used +% \end{enumerate} +% \begin{macrocode} +\let\HyperRaiseLinkLength\@tempdima +\let\HyperRaiseLinkHook\@empty +\def\HyperRaiseLinkDefault{\baselineskip} +% \end{macrocode} +% |\HyperRaiseLinkHook| allows the user to reassign +% |\HyperRaiseLinkLength|. +% \begin{macrocode} +\def\Hy@raisedlink#1{% + \setlength\HyperRaiseLinkLength\HyperRaiseLinkDefault + \HyperRaiseLinkHook + \ifvmode + #1% + \else + \smash{\raise\HyperRaiseLinkLength\hbox{#1}}% + \fi +} +% \end{macrocode} +% +% \begin{macro}{\Hy@SaveLastskip} +% \begin{macro}{\Hy@RestoreLastskip} +% Inserting a \cmd{\special} command to set a +% destination destroys the \cmd{\lastskip} value. +% +% \begin{macrocode} +\def\Hy@SaveLastskip{% + \let\Hy@RestoreLastskip\relax + \ifvmode + \ifdim\lastskip=\z@ + \let\Hy@RestoreLastskip\nobreak + \else + \begingroup + \skip@=-\lastskip + \edef\x{% + \endgroup + \def\noexpand\Hy@RestoreLastskip{% + \noexpand\ifvmode + \noexpand\nobreak + \vskip\the\skip@ + \vskip\the\lastskip\relax + \noexpand\fi + }% + }% + \x + \fi + \else + \ifhmode + \ifdim\lastskip=\z@ + \let\Hy@RestoreLastskip\nobreak + \else + \begingroup + \skip@=-\lastskip + \edef\x{% + \endgroup + \def\noexpand\Hy@RestoreLastskip{% + \noexpand\ifhmode + \noexpand\nobreak + \hskip\the\skip@ + \hskip\the\lastskip\relax + \noexpand\fi + }% + }% + \x + \fi + \fi + \fi +}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \section{Options} +% +% \subsection{Help macros} +% +% \begin{macro}{\Hy@boolkey} +% \begin{macrocode} +\def\Hy@boolkey{\@dblarg\Hy@@boolkey} +\def\Hy@@boolkey[#1]#2#3{% + \lowercase{\def\Hy@tempa{#3}}% + \ifx\Hy@tempa\@empty + \let\Hy@tempa\Hy@true + \fi + \ifx\Hy@tempa\Hy@true + \else + \ifx\Hy@tempa\Hy@false + \else + \let\Hy@tempa\relax + \fi + \fi + \ifx\Hy@tempa\relax + \Hy@WarnOptionValue{#3}{#1}{`true' or 'false'}% + \else + \Hy@Info{Option `#1' set `\Hy@tempa'}% + \csname Hy@#2\Hy@tempa\endcsname + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@WarnOptionValue} +% \begin{macrocode} +\def\Hy@WarnOptionValue#1#2#3{% + \Hy@Warning{% + Unexpected value `#1'\MessageBreak + of option `#2' instead of\MessageBreak + #3% + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Hy@DisableOption} +% \begin{macrocode} +\def\Hy@DisableOption#1{% + \@ifundefined{KV@Hyp@#1@default}{% + \define@key{Hyp}{#1}% + }{% + \define@key{Hyp}{#1}[]% + }% + {\Hy@WarnOptionDisabled{#1}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Hy@WarnOptionDisabled} +% \begin{macrocode} +\def\Hy@WarnOptionDisabled#1{% + \Hy@Warning{% + Option `#1' has already been used,\MessageBreak + setting the option has no effect% + }% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Defining the options} +% \begin{macrocode} +\define@key{Hyp}{implicit}[true]{% + \Hy@boolkey{implicit}{#1}% +} +\define@key{Hyp}{draft}[true]{% + \Hy@boolkey{draft}{#1}% +} +\define@key{Hyp}{final}[true]{% + \Hy@boolkey{draft}{#1}% + \ifHy@draft + \Hy@draftfalse + \else + \Hy@drafttrue + \fi +} +\let\KV@Hyp@nolinks\KV@Hyp@draft +\define@key{Hyp}{a4paper}[true]{% + \def\special@paper{210mm,297mm}% + \def\Hy@pageheight{842}% +} +\define@key{Hyp}{a5paper}[true]{% + \def\special@paper{148mm,210mm}% + \def\Hy@pageheight{595}% +} +\define@key{Hyp}{b5paper}[true]{% + \def\special@paper{176mm,250mm}% + \def\Hy@pageheight{709}% +} +\define@key{Hyp}{letterpaper}[true]{% + \def\special@paper{8.5in,11in}% + \def\Hy@pageheight{792}% +} +\define@key{Hyp}{legalpaper}[true]{% + \def\special@paper{8.5in,14in}% + \def\Hy@pageheight{1008}% +} +\define@key{Hyp}{executivepaper}[true]{% + \def\special@paper{7.25in,10.5in}% + \def\Hy@pageheight{720}% +} +\define@key{Hyp}{setpagesize}[true]{% + \Hy@boolkey{setpagesize}{#1}% +} +\define@key{Hyp}{debug}[true]{% + \Hy@boolkey[debug]{verbose}{#1}% +} +\define@key{Hyp}{linktocpage}[true]{% + \Hy@boolkey{linktocpage}{#1}% +} +\define@key{Hyp}{extension}{\def\XR@ext{#1}} +\def\XR@ext{dvi} +\define@key{Hyp}{verbose}[true]{% + \Hy@boolkey{verbose}{#1}% +} +\define@key{Hyp}{typexml}[true]{% + \Hy@boolkey{typexml}{#1}% +} +% \end{macrocode} +% If we are going to PDF via HyperTeX |\special| commands, +% the dvips (-z option) processor does not know +% the \emph{height} of a link, as it works solely on the +% position of the closing |\special|. If we use this option, +% the |\special| is raised up by the right amount, to fool +% the dvi processor. +% \begin{macrocode} +\define@key{Hyp}{raiselinks}[true]{% + \Hy@boolkey{raiselinks}{#1}% +} +% \end{macrocode} +% Most PDF-creating drivers do not allow links to be broken +% \begin{macrocode} +\define@key{Hyp}{breaklinks}[true]{% + \Hy@boolkey{breaklinks}{#1}% +} +% \end{macrocode} +% Determines whether an automatic anchor is put on each page +% \begin{macrocode} +\define@key{Hyp}{pageanchor}[true]{% + \Hy@boolkey{pageanchor}{#1}% +} +% \end{macrocode} +% Are the page links done as plain arabic numbers, or do +% they follow the formatting of the package? The latter loses +% if you put in typesetting like |\textbf| or the like. +% \begin{macrocode} +\define@key{Hyp}{plainpages}[true]{% + \Hy@boolkey{plainpages}{#1}% +} +% \end{macrocode} +% Are the names for anchors made as per the HyperTeX system, +% or do they simply use what \LaTeX\ provides? +% \begin{macrocode} +\define@key{Hyp}{naturalnames}[true]{% + \Hy@boolkey{naturalnames}{#1}% +} +% \end{macrocode} +% Completely ignore the names as per the HyperTeX system, +% and use unique counters. +% \begin{macrocode} +\define@key{Hyp}{hypertexnames}[true]{% + \Hy@boolkey{hypertexnames}{#1}% +} +% \end{macrocode} +% Currently, |dvips| doesn't allow anchors nested within targets, +% so this option tries to stop that happening. Other processors +% may be able to cope. +% \begin{macrocode} +\define@key{Hyp}{nesting}[true]{% + \Hy@boolkey{nesting}{#1}% +} +% \end{macrocode} +% +% \begin{macrocode} +\define@key{Hyp}{unicode}[true]{% + \Hy@boolkey{unicode}{#1}% + \HyPsd@InitUnicode +} +% \end{macrocode} +% +% \section{Options for different drivers}\label{drivers} +% \begin{macrocode} +\define@key{Hyp}{hyperref}[true]{} +\define@key{Hyp}{tex4ht}[true]{% + \def\XR@ext{html}% + \Hy@texhttrue + \def\Hy@raisedlink{}% + \setkeys{Hyp}{colorlinks=true}% + \def\BeforeTeXIVht{\usepackage{color}}% + \def\Hy@driver{htex4ht}% + \def\MaybeStopEarly{% + \typeout{Hyperref stopped early}% + \AfterBeginDocument{\PDF@FinishDoc}% + \endinput + }% +} +\define@key{Hyp}{pdftex}[true]{% + \def\Hy@driver{hpdftex}% + \def\XR@ext{pdf}% + \PassOptionsToPackage{pdftex}{color}% + \Hy@breaklinkstrue +} +\define@key{Hyp}{dvipdf}[true]{% +} +\define@key{Hyp}{nativepdf}[true]{% + \def\Hy@driver{hdvips}% + \def\Hy@raisedlink{}% + \def\XR@ext{pdf}% +} +\define@key{Hyp}{dvipdfm}[true]{% + \def\Hy@driver{hdvipdfm}% + \def\XR@ext{pdf}% + \Hy@breaklinkstrue +} +\define@key{Hyp}{pdfmark}[true]{% + \def\Hy@driver{hdvips}% + \def\Hy@raisedlink{}% + \def\XR@ext{pdf}% +} +\define@key{Hyp}{dvips}[true]{% + \def\Hy@driver{hdvips}% + \def\Hy@raisedlink{}% + \def\XR@ext{pdf}% +} +\define@key{Hyp}{hypertex}[true]{% + \def\Hy@driver{hypertex}% +} +\let\Hy@MaybeStopNow\relax +\define@key{Hyp}{vtex}[true]{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname OpMode\endcsname\relax + \@latex@error{Non-VTeX processor}{}% + \global\let\Hy@MaybeStopNow\endinput + \endinput + \else + \ifnum 0\ifnum\OpMode<1 1\fi \ifnum\OpMode>3 1\fi =0 % + \def\XR@ext{pdf}% + \def\Hy@driver{hvtex}% + \else + \ifnum\OpMode=10\relax + \def\XR@ext{htm}% + \def\Hy@driver{hvtexhtm}% + \def\MaybeStopEarly{% + \typeout{Hyperref stopped early}% + \AfterBeginDocument{\PDF@FinishDoc}% + \endinput + }% + \else + \@latex@error{Mode (\the\OpMode) has no hyperref driver}{}% + \global\let\Hy@MaybeStopNow\endinput + \endinput + \fi + \fi + \fi +} +\define@key{Hyp}{vtexpdfmark}[true]{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname OpMode\endcsname\relax + \@latex@error{Non-VTeX processor}{}% + \let\Hy@MaybeStopNow\endinput + \endinput + \else + \ifnum 0\ifnum\OpMode<1 1\fi \ifnum\OpMode>3 1\fi =0 % + \def\XR@ext{pdf}% + \def\Hy@driver{hvtexmrk}% + \def\Hy@raisedlink{}% + \else + \@latex@error{Mode (\the\OpMode) has no hyperref driver}{}% + \let\Hy@MaybeStopNow\endinput + \endinput + \fi + \fi +} +\define@key{Hyp}{dviwindo}[true]{% + \def\Hy@driver{hdviwind}% + \setkeys{Hyp}{colorlinks}% + \PassOptionsToPackage{dviwindo}{color}% +} +\define@key{Hyp}{dvipsone}[true]{% + \def\XR@ext{pdf}% + \def\Hy@driver{hdvipson}% + \def\Hy@raisedlink{}% +} +\define@key{Hyp}{textures}[true]{% + \def\XR@ext{pdf}% + \def\Hy@driver{htexture}% +} +\define@key{Hyp}{latex2html}[true]{% + \AtBeginDocument{\@@latextohtmlX}% +} +% \end{macrocode} +% No more special treatment for ps2pdf. Let it sink or swim. +% \begin{macrocode} +\define@key{Hyp}{ps2pdf}[true]{% + \def\Hy@driver{hdvips}% + \def\Hy@raisedlink{}% + \providecommand\@pdfborder{0 0 1}% +} +% \end{macrocode} +% +% \section{Options to add extra features}\label{features} +% Make included figures (assuming they use the standard graphics +% package) be hypertext links. Off by default. Needs more work. +% \begin{macrocode} +\define@key{Hyp}{hyperfigures}[true]{% + \Hy@boolkey[hyperfigures]{figures}{#1}% +} +% \end{macrocode} +% +% The automatic footnote linking can be disabled +% by option hyperfootnotes. +% \begin{macrocode} +\define@key{Hyp}{hyperfootnotes}[true]{% + \Hy@boolkey{hyperfootnotes}{#1}% +} +% \end{macrocode} +% +% Set up back-referencing to be hyper links, by page, +% slide or section number, +% \begin{macrocode} +\def\back@none{none} +\def\back@section{section} +\def\back@page{page} +\def\back@slide{slide} +\define@key{Hyp}{backref}[section]{% + \lowercase{\def\Hy@tempa{#1}}% + \ifx\Hy@tempa\@empty + \let\Hy@tempa\back@section + \fi + \ifx\Hy@tempa\Hy@false + \let\Hy@tempa\back@none + \fi + \ifx\Hy@tempa\back@slide + \let\Hy@tempa\back@section + \fi + \ifx\Hy@tempa\back@page + \PassOptionsToPackage{hyperpageref}{backref}% + \Hy@backreftrue + \else + \ifx\Hy@tempa\back@section + \PassOptionsToPackage{hyperref}{backref}% + \Hy@backreftrue + \else + \ifx\Hy@tempa\back@none + \Hy@backreffalse + \else + \Hy@WarnOptionValue{#1}{backref}{% + `section', `slide', `page', `none',\MessageBreak + or `false'}% + \fi + \fi + \fi +} +\define@key{Hyp}{pagebackref}[true]{% + \lowercase{\def\Hy@tempa{#1}}% + \ifx\Hy@tempa\@empty + \let\Hy@tempa\Hy@true + \fi + \ifx\Hy@tempa\Hy@true + \PassOptionsToPackage{hyperpageref}{backref}% + \Hy@backreftrue + \else + \ifx\Hy@tempa\Hy@false + \Hy@backreffalse + \else + \Hy@WarnOptionValue{#1}{pagebackref}{`true' or `false'}% + \fi + \fi +} +% \end{macrocode} +% Make index entries be links back to the relevant pages. By default +% this is turned on, but may be stopped. +% \begin{macrocode} +\define@key{Hyp}{hyperindex}[true]{% + \Hy@boolkey{hyperindex}{#1}% +} +% \end{macrocode} +% Configuration of encap char. +% \begin{macrocode} +\define@key{Hyp}{encap}[\|]{% + \def\HyInd@EncapChar{#1}% +} +% \end{macrocode} +% +% \section{Language options} +% +% The \cmd{\autoref} feature depends on the language. +% \begin{macrocode} +\def\HyLang@english{% + \def\equationautorefname{Equation}% + \def\footnoteautorefname{footnote}% + \def\itemautorefname{item}% + \def\figureautorefname{Figure}% + \def\tableautorefname{Table}% + \def\partautorefname{Part}% + \def\appendixautorefname{Appendix}% + \def\chapterautorefname{chapter}% + \def\sectionautorefname{section}% + \def\subsectionautorefname{subsection}% + \def\subsubsectionautorefname{subsubsection}% + \def\paragraphautorefname{paragraph}% + \def\subparagraphautorefname{subparagraph}% + \def\FancyVerbLineautorefname{line}% + \def\theoremautorefname{Theorem}% +} +\def\HyLang@german{% + \def\equationautorefname{Gleichung}% + \def\footnoteautorefname{Fu\ss note}% + \def\itemautorefname{Punkt}% + \def\figureautorefname{Abbildung}% + \def\tableautorefname{Tabelle}% + \def\partautorefname{Teil}% + \def\appendixautorefname{Anhang}% + \def\chapterautorefname{Kapitel}% + \def\sectionautorefname{Abschnitt}% + \def\subsectionautorefname{Unterabschnitt}% + \def\subsubsectionautorefname{Unterunterabschnitt}% + \def\paragraphautorefname{Absatz}% + \def\subparagraphautorefname{Unterabsatz}% + \def\FancyVerbLineautorefname{Zeile}% + \def\theoremautorefname{Theorem}% +} +\def\HyLang@portuges{% + \def\equationautorefname{Equa\c c\~ao}% + \def\footnoteautorefname{Nota de rodap\'e}% + \def\itemautorefname{Item}% + \def\figureautorefname{Figura}% + \def\tableautorefname{Tabela}% + \def\partautorefname{Parte}% + \def\appendixautorefname{Ap\^endice}% + \def\chapterautorefname{Cap\'itulo}% + \def\sectionautorefname{Se\c c\~ao}% + \def\subsectionautorefname{Subse\c c\~ao}% + \def\subsubsectionautorefname{Subsubse\c c\~ao}% + \def\paragraphautorefname{par\'agrafo}% + \def\subparagraphautorefname{subpar\'agrafo}% + \def\FancyVerbLineautorefname{linha}% + \def\theoremautorefname{Teorema}% +} +\def\HyLang@spanish{% + \def\equationautorefname{Ecuaci\'on}% + \def\footnoteautorefname{Nota a pie de p\'agina}% + \def\itemautorefname{Elemento}% + \def\figureautorefname{Figura}% + \def\tableautorefname{Tabla}% + \def\partautorefname{Parte}% + \def\appendixautorefname{Ap\'endice}% + \def\chapterautorefname{Cap\'itulo}% + \def\sectionautorefname{Secci\'on}% + \def\subsectionautorefname{Subsecci\'on}% + \def\subsubsectionautorefname{Subsubsecci\'on}% + \def\paragraphautorefname{P\'arrafo}% + \def\subparagraphautorefname{Subp\'arrafo}% + \def\FancyVerbLineautorefname{L\'inea}% + \def\theoremautorefname{Teorema}% +} +\def\HyLang@afrikaans{% + \def\equationautorefname{Vergelyking}% + \def\footnoteautorefname{Voetnota}% + \def\itemautorefname{Item}% + \def\figureautorefname{Figuur}% + \def\tableautorefname{Tabel}% + \def\partautorefname{Deel}% + \def\appendixautorefname{Bylae}% + \def\chapterautorefname{Hoofstuk}% + \def\sectionautorefname{Afdeling}% + \def\subsectionautorefname{Subafdeling}% + \def\subsubsectionautorefname{Subsubafdeling}% + \def\paragraphautorefname{Paragraaf}% + \def\subparagraphautorefname{Subparagraaf}% + \def\FancyVerbLineautorefname{Lyn}% + \def\theoremautorefname{Teorema}% +} +% \end{macrocode} +% +% Instead of package babel's definition of \cmd{\addto} the +% implementation of package varioref is used. Additionally +% argument |#1| is checked for \cmd{\relax}. +% \begin{macrocode} +\def\HyLang@addto#1#2{% + #2% + \@temptokena{#2}% + \ifx#1\relax + \let#1\@empty + \fi + \ifx#1\undefined + \edef#1{\the\@temptokena}% + \else + \toks@\expandafter{#1}% + \edef#1{\the\toks@\the\@temptokena}% + \fi + \@temptokena{}\toks@\@temptokena +} +% \end{macrocode} +% +% \begin{macrocode} +\def\HyLang@DeclareLang#1#2{% + \begingroup + \edef\x##1##2{% + \noexpand\ifx##2\relax + \errmessage{No definitions for language #2' found!}% + \noexpand\fi + \endgroup + \noexpand\define@key{Hyp}{#1}[]{% + \noexpand\HyLang@addto{\noexpand##1}{\noexpand##2}% + }% + }% + \expandafter\x\csname extras#1\expandafter\endcsname + \csname HyLang@#2\expandafter\endcsname +} +\HyLang@DeclareLang{english}{english} +\HyLang@DeclareLang{UKenglish}{english} +\HyLang@DeclareLang{british}{english} +\HyLang@DeclareLang{USenglish}{english} +\HyLang@DeclareLang{american}{english} +\HyLang@DeclareLang{german}{german} +\HyLang@DeclareLang{austrian}{german} +\HyLang@DeclareLang{ngerman}{german} +\HyLang@DeclareLang{naustrian}{german} +\HyLang@DeclareLang{brazil}{portuges} +\HyLang@DeclareLang{brazilian}{portuges} +\HyLang@DeclareLang{portuguese}{portuges} +\HyLang@DeclareLang{spanish}{spanish} +\HyLang@DeclareLang{afrikaans}{afrikaans} +% \end{macrocode} +% +% \section{Options to change appearance of links}\label{appearance} +% Colouring links at the \LaTeX\ level is useful for debugging, perhaps. +% \begin{macrocode} +\define@key{Hyp}{colorlinks}[true]{% + \Hy@boolkey{colorlinks}{#1}% + \ifHy@colorlinks + \def\@pdfborder{0 0 0}% + \fi +} +\define@key{Hyp}{frenchlinks}[true]{% + \Hy@boolkey{frenchlinks}{#1}% +} +% \end{macrocode} +% +% \section{Bookmarking} +% \begin{macrocode} +\define@key{Hyp}{bookmarks}[true]{% + \Hy@boolkey{bookmarks}{#1}% +} +\define@key{Hyp}{bookmarksopen}[true]{% + \Hy@boolkey{bookmarksopen}{#1}% +} +% `bookmarksopenlevel' to specify the open level. From Heiko Oberdiek. +\define@key{Hyp}{bookmarksopenlevel}{% + \def\@bookmarksopenlevel{#1}% +} +\def\@bookmarksopenlevel{\maxdimen} +% `bookmarkstype' to specify which `toc' file to mimic +\define@key{Hyp}{bookmarkstype}{% + \def\Hy@bookmarkstype{#1}% +} +\def\Hy@bookmarkstype{toc} +% \end{macrocode} +% Richard Curnow suggested this +% functionality. It adds section numbers etc to bookmarks. +% \begin{macrocode} +\define@key{Hyp}{bookmarksnumbered}[true]{% + \Hy@boolkey{bookmarksnumbered}{#1}% +} +% \end{macrocode} +% +% Option CJKbookmarks enables the patch for +% CJK bookmarks. +% \begin{macrocode} +\define@key{Hyp}{CJKbookmarks}[true]{% + \Hy@boolkey{CJKbookmarks}{#1}% +} +% \end{macrcode} +% +% \begin{macrocode} +\define@key{Hyp}{linkcolor}{\def\@linkcolor{#1}} +\define@key{Hyp}{anchorcolor}{\def\@anchorcolor{#1}} +\define@key{Hyp}{citecolor}{\def\@citecolor{#1}} +\define@key{Hyp}{urlcolor}{\def\@urlcolor{#1}} +\define@key{Hyp}{menucolor}{\def\@menucolor{#1}} +\define@key{Hyp}{filecolor}{\def\@filecolor{#1}} +\define@key{Hyp}{pagecolor}{\def\@pagecolor{#1}} +% \end{macrocode} +% Default values: +% \begin{macrocode} +\def\@linkcolor{red} +\def\@anchorcolor{black} +\def\@citecolor{green} +\def\@filecolor{cyan} +\def\@urlcolor{magenta} +\def\@menucolor{red} +\def\@pagecolor{red} +\def\hyperbaseurl#1{\def\@baseurl{#1}} +\define@key{Hyp}{baseurl}{\hyperbaseurl{#1}} +\let\@baseurl\@empty +\def\hyperlinkfileprefix#1{\def\Hy@linkfileprefix{#1}} +\define@key{Hyp}{linkfileprefix}{\hyperlinkfileprefix{#1}} +\hyperlinkfileprefix{file:} +% \end{macrocode} +% +% \section{PDF-specific options}\label{pdfopt} +% +% \begin{macro}{\@pdfpagetransition} +% The value of option |pdfpagetransition| is stored in +% \cmd{\@pdfpagetransition}. Its initial value is set +% to \cmd{\relax} in order to be able to differentiate +% between a not used option and an option with an empty +% value. +% \begin{macrocode} +\let\@pdfpagetransition\relax +\define@key{Hyp}{pdfpagetransition}{\def\@pdfpagetransition{#1}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@pdfpageduration} +% The value of option |pdfpageduration| is stored in +% \cmd{\@pdfpageduration}. Its initial value is set +% to \cmd{\relax} in order to be able to differentiate +% between a not used option and an option with an empty +% value. +% \begin{macrocode} +\let\@pdfpageduration\relax +\define@key{Hyp}{pdfpageduration}{\def\@pdfpageduration{#1}} +% \end{macrocode} +% \end{macro} +% +% The entry for the |/Hid| key in the page object is +% only necessary, if it is used and set to true for +% at least one time. If it is always false, then +% the |/Hid| key is not written to the pdf page +% object in order not to enlarge the pdf file. +% \begin{macrocode} +\newif\ifHy@useHidKey +\Hy@useHidKeyfalse +\define@key{Hyp}{pdfpagehidden}[true]{% + \Hy@boolkey{pdfpagehidden}{#1}% + \ifHy@pdfpagehidden + \global\Hy@useHidKeytrue + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\define@key{Hyp}{linkbordercolor}{\def\@linkbordercolor{#1}} +\define@key{Hyp}{urlbordercolor}{\def\@urlbordercolor{#1}} +\define@key{Hyp}{menubordercolor}{\def\@menubordercolor{#1}} +\define@key{Hyp}{filebordercolor}{\def\@filebordercolor{#1}} +\define@key{Hyp}{runbordercolor}{\def\@runbordercolor{#1}} +\define@key{Hyp}{citebordercolor}{\def\@citebordercolor{#1}} +\define@key{Hyp}{pagebordercolor}{\def\@pagebordercolor{#1}} +\define@key{Hyp}{pdfhighlight}{\def\@pdfhighlight{#1}} +\define@key{Hyp}{pdfborder}{\def\@pdfborder{#1}} +\define@key{Hyp}{pdfpagemode}{% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\@empty + \let\@pdfpagemode\@empty + \else + \def\@pdfpagemode{/#1 }% + \fi +} +\define@key{Hyp}{pdfnonfullscreenpagemode}{% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\@empty + \let\@pdfnonfullscreenpagemode\@empty + \else + \def\@pdfnonfullscreenpagemode{/#1 }% + \fi +} +\define@key{Hyp}{pdfusetitle}[true]{% + \Hy@boolkey[pdfusetitle]{usetitle}{#1}% +} +\define@key{Hyp}{pdftitle}{\pdfstringdef\@pdftitle{#1}} +\define@key{Hyp}{pdfauthor}{\pdfstringdef\@pdfauthor{#1}} +\define@key{Hyp}{pdfproducer}{\pdfstringdef\@pdfproducer{#1}} +\define@key{Hyp}{pdfcreator}{\pdfstringdef\@pdfcreator{#1}} +\define@key{Hyp}{pdfsubject}{\pdfstringdef\@pdfsubject{#1}} +\define@key{Hyp}{pdfkeywords}{\pdfstringdef\@pdfkeywords{#1}} +\define@key{Hyp}{pdfview}{\calculate@pdfview#1 \\} +\define@key{Hyp}{pdflinkmargin}{\setpdflinkmargin{#1}} +\let\setpdflinkmargin\@gobble +\def\calculate@pdfview#1 #2\\{% + \def\@pdfview{#1}% + \ifx\\#2\\% + \def\@pdfviewparams{ -32768}% + \else + \def\@pdfviewparams{ #2}% + \fi +} +\define@key{Hyp}{pdfstartpage}{\def\@pdfstartpage{#1}} +\define@key{Hyp}{pdfstartview}{% + \ifx\\#1\\% + \def\@pdfstartview{}% + \else + \hypercalcbpdef\@pdfstartview{ /#1 }% + \fi +} +\define@key{Hyp}{pdfpagescrop}{\edef\@pdfpagescrop{#1}} +\define@key{Hyp}{pdftoolbar}[true]{% + \Hy@boolkey[pdftoolbar]{toolbar}{#1}% +} +\define@key{Hyp}{pdfmenubar}[true]{% + \Hy@boolkey[pdfmenubar]{menubar}{#1}% +} +\define@key{Hyp}{pdfwindowui}[true]{% + \Hy@boolkey[pdfwindowui]{windowui}{#1}% +} +\define@key{Hyp}{pdffitwindow}[true]{% + \Hy@boolkey[pdffitwindow]{fitwindow}{#1}% +} +\define@key{Hyp}{pdfcenterwindow}[true]{% + \Hy@boolkey[pdfcenterwindow]{centerwindow}{#1}% +} +\define@key{Hyp}{pdfdisplaydoctitle}[true]{% + \Hy@boolkey[pdfdisplaydoctitle]{displaydoctitle}{#1}% +} +\define@key{Hyp}{pdfnewwindow}[true]{% + \Hy@boolkey[pdfnewwindow]{newwindow}{#1}% +} +\define@key{Hyp}{pdfpagelayout}{\def\pdf@pagelayout{#1}} +\def\pdf@pagelayout{} +\define@key{Hyp}{pdfpagelabels}[true]{% + \Hy@boolkey[pdfpagelabels]{pagelabels}{#1}% +} +% \end{macrocode} +% Default values: +% \begin{macrocode} +\def\@linkbordercolor{1 0 0} +\def\@urlbordercolor{0 1 1} +\def\@menubordercolor{1 0 0} +\def\@filebordercolor{0 .5 .5} +\def\@runbordercolor{0 .7 .7} +\def\@citebordercolor{0 1 0} +\def\@pagebordercolor{1 1 0} +\def\@pdfhighlight{/I} +\def\@pdfpagemode{} +\def\@pdfnonfullscreenpagemode{} +\def\@pdftitle{} +\def\@pdfauthor{} +\def\@pdfproducer{} +\def\@pdfcreator{LaTeX with hyperref package} +\def\@pdfsubject{} +\def\@pdfkeywords{} +\def\@pdfpagescrop{} +\def\@pdfstartview{ /Fit } +\def\@pdfstartpage{1} +\let\PDF@SetupDoc\@empty +\let\PDF@FinishDoc\@empty +\let\phantomsection\@empty +\@ifundefined{stockwidth}{% + \edef\special@paper{\the\paperwidth,\the\paperheight} +}{% + \edef\special@paper{\the\stockwidth,\the\stockheight} +} +\begingroup + \dimen@=\@ifundefined{stockheight}{\paperheight}{\stockheight}\relax + \dimen@=0.99626401\dimen@ + \xdef\Hy@pageheight{\strip@pt\dimen@} +\endgroup +\def\HyInd@EncapChar{\|} +% \end{macrocode} +% +% \begin{macrocode} +\def\hypersetup{\setkeys{Hyp}} +% \end{macrocode} +% +% Allow the user to use |\ExecuteOptions| in the cfg file even though +% this package does not use the normal option mechanism. +% Use |\hyper@normalise| as a scratch macro, since it is going to +% be defined in a couple of lines anyway. +% \begin{macrocode} +\let\hyper@normalise\ExecuteOptions +\let\ExecuteOptions\hypersetup +\Hy@RestoreCatcodes +\InputIfFileExists{hyperref.cfg}{}{} +\Hy@SetCatcodes +\let\ExecuteOptions\hyper@normalise +\Hy@MaybeStopNow +% \end{macrocode} +% To add flexibility, we will not use the ordinary processing of +% package options, but put them through the \emph{keyval} package. +% This section was written by David Carlisle. +% \begin{macrocode} +\def\ProcessOptionsWithKV#1{% + \let\@tempc\relax + \let\Hy@tempa\@empty +% \end{macrocode} +% Add any global options that are known to KV to the start of the list +% being built in |\Hy@tempa| and mark them used (by removing them from +% the unused option list). +% \begin{macrocode} + \@for\CurrentOption:=\@classoptionslist\do{% + \@ifundefined{KV@#1@\CurrentOption}% + {}% + {% + \edef\Hy@tempa{\Hy@tempa,\CurrentOption,}% + \@expandtwoargs\@removeelement\CurrentOption + \@unusedoptionlist\@unusedoptionlist + }% + }% +% \end{macrocode} +% +% Now stick the package options at the end of the list and wrap in a call +% to |\setkeys|. Can simply use |\edef|, normally KV takes care to avoid +% expansion, but the package system has already fully expanded the package +% option list before passing it to the package, so no more harm can occur +% here. +% \begin{macrocode} + \edef\Hy@tempa{% + \noexpand\setkeys{#1}{% + \Hy@tempa\@ptionlist{\@currname.\@currext}% + }% + }% +% \end{macrocode} +% +% Do it. +% \begin{macrocode} + \Hy@tempa +} +% \end{macrocode} +% +% Add option |tex4ht| if package |tex4ht| is loaded. +% \begin{macrocode} +\@ifpackageloaded{tex4ht}{% + \@ifpackagewith{hyperref}{tex4ht}{}{% + \PassOptionsToPackage{tex4ht}{hyperref}% + }% +}{} +% \end{macrocode} +% +% \begin{macrocode} +\let\ReadBookmarks\relax +\ProcessOptionsWithKV{Hyp} +% \end{macrocode} +% +% After processing options. +% +% \begin{macrocode} +\AtBeginDocument{% + \ifHy@draft + \let\hyper@@anchor\@gobble + \gdef\hyper@link#1#2#3{#3}% + \let\hyper@anchorstart\@gobble + \let\hyper@anchorend\@empty + \let\hyper@linkstart\@gobbletwo + \let\hyper@linkend\@empty + \def\hyper@linkurl#1#2{#1}% + \def\hyper@linkfile#1#2#3{#1}% + \def\Acrobatmenu#1#2{#2}% + \let\PDF@SetupDoc\@empty + \let\PDF@FinishDoc\@empty + \let\@fifthoffive\@secondoftwo + \let\@secondoffive\@secondoftwo + \let\ReadBookmarks\relax + \let\WriteBookmarks\relax + \Hy@WarningNoLine{ draft mode on}% + \fi + \Hy@DisableOption{draft}% + \Hy@DisableOption{nolinks}% + \Hy@DisableOption{final}% +}% +% \end{macrocode} +% +% If option |unicode| is already processed, then the +% command \cs{HyPsd@InitUnicode} is cleared after +% execution. Then the option code only sets +% the meaning of the switch \cs{ifHy@unicode}. +% \begin{macrocode} +\ifx\HyPsd@InitUnicode\relax + \define@key{Hyp}{unicode}[true]{% + \Hy@boolkey{unicode}{#1}% + } +\else + \define@key{Hyp}{unicode}[true]{% + \Hy@boolkey{unicode}{#1}% + \ifHy@unicode + \Hy@WarningNoLine{Set package option `unicode' first\MessageBreak + in order to load unicode support% + }% + \Hy@unicodefalse + \fi + } +\fi +% \end{macrocode} +% The macro \cs{HyPsd@InitUnicode} is no longer needed. +% \begin{macrocode} +\let\HyPsd@InitUnicode\@undefined +% \end{macrocode} +% +% \subsubsection{Patch for babel's +% \texorpdfstring{\cs{texttilde}}{\\texttilde}} +% Babel does not define \cmd{\texttilde} in NFSS2 manner, +% so the NFSS2 definitions of PD1 or PU encoding is not +% compatible. To fix this, \cmd{\texttilde} is defined +% in babel manner. +% \begin{macrocode} +\Hy@nextfalse +\@ifpackagewith{babel}{spanish}{\Hy@nexttrue}{} +\@ifpackagewith{babel}{galician}{\Hy@nexttrue}{} +\@ifpackagewith{babel}{estonian}{\Hy@nexttrue}{} +\ifHy@next + \let\texttilde\~% +\fi +% \end{macrocode} +% +% \begin{macrocode} +\ifHy@figures + \Hy@Info{Hyper figures ON} +\else + \Hy@Info{Hyper figures OFF} +\fi +\ifHy@nesting + \Hy@Info{Link nesting ON} +\else + \Hy@Info{Link nesting OFF} +\fi +\ifHy@hyperindex + \Hy@Info{Hyper index ON} +\else + \Hy@Info{Hyper index OFF} +\fi +\ifHy@plainpages + \Hy@Info{Plain pages ON} +\else + \Hy@Info{Plain pages OFF} +\fi +\ifHy@backref + \Hy@Info{Backreferencing ON} +\else + \Hy@Info{Backreferencing OFF} +\fi +\ifHy@typexml + \AtEndOfPackage{\RequirePackage{color}\RequirePackage{nameref}} +\fi +\Hy@DisableOption{typexml} +\ifHy@implicit + \typeout{Implicit mode ON; LaTeX internals redefined}% +\else + \typeout{Implicit mode OFF; no redefinition of LaTeX internals}% + \def\MaybeStopEarly{% + \typeout{Hyperref stopped early}% + \AfterBeginDocument{\PDF@FinishDoc}% + \endinput + }% + \AtBeginDocument{% + \let\autoref\ref + \ifx\@pdfpagemode\@empty + \gdef\@pdfpagemode{/UseNone}% + \fi + \global\Hy@backreffalse + }% + \AtEndOfPackage{% + \global\let\ReadBookmarks\relax + \global\let\WriteBookmarks\relax + }% +\fi +\Hy@DisableOption{implicit} +% \end{macrocode} +% +% \subsubsection{Driver loading} +% +% \begin{macrocode} +\AtEndOfPackage{% + \@ifpackageloaded{tex4ht}{% + \def\Hy@driver{htex4ht}% + \Hy@texhttrue + }{}% + \ifx\Hy@driver\@empty + \providecommand*{\Hy@defaultdriver}{hypertex}% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdfoutput\endcsname\relax + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname OpMode\endcsname\relax + \let\Hy@driver\Hy@defaultdriver + \else + \ifnum 0\ifnum\OpMode<1 1\fi \ifnum\OpMode>3 1\fi =0 % + \def\Hy@driver{hvtex}% + \def\XR@ext{pdf}% + \else + \ifnum\OpMode=10\relax + \def\XR@ext{htm}% + \def\Hy@driver{hvtexhtm}% + \def\MaybeStopEarly{% + \typeout{Hyperref stopped early}% + \AfterBeginDocument{\PDF@FinishDoc}% + \endinput + }% + \else + \let\Hy@driver\Hy@defaultdriver + \fi + \fi + \fi + \else + \ifcase\pdfoutput + \let\Hy@driver\Hy@defaultdriver + \else + \def\Hy@driver{hpdftex}% + \def\XR@ext{pdf}% + \PassOptionsToPackage{pdftex}{color}% + \Hy@breaklinkstrue + \fi + \fi + \typeout{*hyperref using default driver \Hy@driver*}% + \else + \typeout{*hyperref using driver \Hy@driver*}% + \fi + \input{\Hy@driver.def}% + \let\@unprocessedoptions\relax + \Hy@RestoreCatcodes +} +\Hy@DisableOption{tex4ht} +\Hy@DisableOption{pdftex} +\Hy@DisableOption{dvipdf} +\Hy@DisableOption{nativepdf} +\Hy@DisableOption{dvipdfm} +\Hy@DisableOption{pdfmark} +\Hy@DisableOption{dvips} +\Hy@DisableOption{hypertex} +\Hy@DisableOption{vtex} +\Hy@DisableOption{vtexpdfmark} +\Hy@DisableOption{dviwindo} +\Hy@DisableOption{dvipsone} +\Hy@DisableOption{textures} +\Hy@DisableOption{latex2html} +\Hy@DisableOption{ps2pdf} +% \end{macrocode} +% +% \subsubsection{Bookmarks} +% \begin{macrocode} +\def\WriteBookmarks{0} +\def\@bookmarkopenstatus#1{% + \ifHy@bookmarksopen +% \end{macrocode} +% The purpose of the |\@firstofone|-number-space-construct +% is that no |\relax| will be inserted by \TeX{} before the |\else|: +% \begin{macrocode} + \ifnum#1<\expandafter\@firstofone\expandafter + {\number\@bookmarksopenlevel} % explicit space + \else + -% + \fi + \else + -% + \fi +} +\ifHy@bookmarks + \Hy@Info{Bookmarks ON}% + \ifx\@pdfpagemode\@empty + \def\@pdfpagemode{/UseOutlines }% + \fi +\else + \def\@bookmarkopenstatus#1{}% + \Hy@Info{Bookmarks OFF}% + \AtEndOfPackage{% + \global\let\ReadBookmarks\relax + \global\let\WriteBookmarks\relax + } + \ifx\@pdfpagemode\@empty + \def\@pdfpagemode{/UseNone}% + \fi +\fi +\Hy@DisableOption{bookmarks} +% \end{macrocode} +% +% \begin{macrocode} +\AtBeginDocument{% + \ifHy@colorlinks + \ifHy@typexml\else\RequirePackage{color}\fi + \def\Hy@colorlink#1{\begingroup\color{#1}}% + \def\Hy@endcolorlink{\endgroup}% + \Hy@Info{Link coloring ON}% + \else + \ifHy@frenchlinks + \def\Hy@colorlink#1{\begingroup\fontshape{sc}\selectfont}% + \def\Hy@endcolorlink{\endgroup}% + \Hy@Info{French linking ON}% + \else +% \end{macrocode} +% for grouping consistency: +% \begin{macrocode} + \def\Hy@colorlink#1{\begingroup}% + \def\Hy@endcolorlink{\endgroup}% + \Hy@Info{Link coloring OFF}% + \fi + \fi + \Hy@DisableOption{colorlinks}% + \Hy@DisableOption{frenchlinks}% + \ifHy@texht + \long\def\@firstoffive#1#2#3#4#5{#1}% + \long\def\@secondoffive#1#2#3#4#5{#2}% + \long\def\@thirdoffive#1#2#3#4#5{#3}% + \long\def\@fourthoffive#1#2#3#4#5{#4}% + \long\def\@fifthoffive#1#2#3#4#5{#5}% + \providecommand*\@safe@activestrue{}% + \providecommand*\@safe@activesfalse{}% + \def\T@ref#1{% + \@safe@activestrue + \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}% + \@safe@activesfalse + }% + \def\T@pageref#1{% + \@safe@activestrue + \expandafter\@setref\csname r@#1\endcsname\@secondoffive{#1}% + \@safe@activesfalse + }% + \else + \ifHy@typexml\else\RequirePackage{nameref}\fi + \fi + \DeclareRobustCommand\ref{\@ifstar\@refstar\T@ref}% + \DeclareRobustCommand\pageref{% + \@ifstar\@pagerefstar\T@pageref + }% +} +\AfterBeginDocument{% + \ifHy@texht + \else + \ReadBookmarks + \fi +} +% \end{macrocode} +% \begin{macrocode} +\ifHy@backref + \RequirePackage{backref} +\else + \let\Hy@backout\@gobble +\fi +\Hy@DisableOption{backref} +\Hy@DisableOption{pagebackref} +% \end{macrocode} +% \begin{macrocode} +\Hy@activeanchorfalse +% \end{macrocode} +% +% \section{User hypertext macros}\label{usermacros} +% We need to normalise all user commands taking a URL argument; +% Within the argument the following special definitions apply: +% |\#|, |\%|, |~| produce |#|, |%|, |~| respectively. +% for consistency |\~| produces |~| as well. +% At the \emph{top level only} ie not within the argument of another +% command, you can use |#| and |%| unescaped, to produce themselves. +% even if, say, |#| is entered as |#| it will be converted to |\#| +% so it does not die if written to an aux file etc. |\#| will write +% as |#| locally while making |\special|s. +% \begin{macrocode} +\begingroup + \endlinechar=-1 + \catcode`\^^M\active + \catcode`\%\active + \catcode`\#\active + \catcode`\_\active + \gdef\hyper@normalise{ + \begingroup + \catcode`\^^M\active + \def^^M{ } + \catcode`\%\active + \let%\@percentchar + \let\%\@percentchar + \catcode`\#\active + \def#{\hyper@hash} + \def\#{\hyper@hash} + \edef\textunderscore{\string_} + \let\_\textunderscore + \catcode`\_\active + \let_\textunderscore + \let~\hyper@tilde + \let\~\hyper@tilde + \let\textasciitilde\hyper@tilde + \ifx\@safe@activestrue\@undefined\else\@safe@activestrue\fi + \hyper@n@rmalise + } + \catcode`\#=6 + \gdef\hyper@n@rmalise#1#2{ + \edef\Hy@tempa{ + \endgroup + \noexpand#1{\Hy@RemovePercentCr#2%^^M\@nil} + } + \Hy@tempa + } + \gdef\Hy@RemovePercentCr#1%^^M#2\@nil{ + #1 + \ifx\limits#2\limits + \else + \Hy@ReturnAfterFi{ + \Hy@RemovePercentCr #2\@nil + } + \fi + } +\endgroup +\providecommand\hyper@chars{% + \let\#\hyper@hash + \let\%\@percentchar +} +% \end{macrocode} +% +% \begin{macrocode} +\def\hyperlink#1#2{% + \hyper@@link{}{#1}{#2}% +} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand*{\href}{\hyper@normalise\href@} +\begingroup + \catcode`\$=6 + \catcode`\#=12 + \gdef\href@$1{\expandafter\href@split$1##\\} + \gdef\href@split$1#$2#$3\\{% + \hyper@@link{$1}{$2}% + } +\endgroup +% \end{macrocode} +% Load package |url.sty| and save the meaning of +% the original \cmd{\url} in \cmd{\nolinkurl}. +% \begin{macrocode} +\RequirePackage{url} +\let\HyOrg@url\url +\def\Hurl{\begingroup \Url} +\let\nolinkurl\Hurl +\DeclareRobustCommand*{\url}{\hyper@normalise\url@} +\def\url@#1{\hyper@linkurl{\Hurl{#1}}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand*{\hyperimage}{\hyper@normalise\hyper@image} +\providecommand\hyper@image[2]{#2} +% \end{macrocode} +% +% \begin{macrocode} +\def\hypertarget#1#2{% + \ifHy@nesting + \hyper@@anchor{#1}{#2}% + \else + \hyper@@anchor{#1}{\relax}#2% + \fi +} +% \end{macrocode} +% |\hyperref| is more complicated, as it includes the concept of a +% category of link, used to make the name. This is not really used in this +% package. |\hyperdef| sets up an anchor in the same way. They each have +% three parameters of category, linkname, and marked text, and |\hyperref| +% also has a first parameter of URL. +% If there is an optional first parameter to |\hyperdef|, +% it is the name of a \LaTeX\ label which can be used in +% a short form of |\hyperref| later, to avoid +% remembering the name and category. +% \begin{macrocode} +\DeclareRobustCommand*{\hyperref}{% + \@ifnextchar[{\Hy@babelnormalise\label@hyperref}\@hyperref +} +\def\Hy@babelnormalise#1[#2]{% + \begingroup + \csname @safe@activestrue\endcsname + \edef\Hy@tempa{% + \endgroup + \noexpand#1[{#2}]% + }% + \Hy@tempa +} +\def\@hyperref{\hyper@normalise\@@hyperref} +\def\@@hyperref#1#2#3{% + \edef\ref@one{\ifx\\#2\\\else#2.\fi#3}% + \expandafter\tryhyper@link\ref@one\\{#1}% +} +\def\tryhyper@link#1\\#2{% + \hyper@@link{#2}{#1}% +} +% \end{macrocode} +% +% \begin{macrocode} +\def\hyperdef{\@ifnextchar[{\label@hyperdef}{\@hyperdef}} +\def\@hyperdef#1#2#3{%, category, name, text + \ifHy@nesting + \hyper@@anchor{#1.#2}{#3}% + \else + \hyper@@anchor{#1.#2}{\relax}#3% + \fi +} +% \end{macrocode} +% We also have a need to give a \LaTeX\ \emph{label} to a +% hyper reference, to ease the pain of referring to it later. +% \begin{macrocode} +\def\label@hyperref[#1]{% + \expandafter\label@@hyperref\csname r@#1\endcsname{#1}% +}% +\def\label@@hyperref#1#2#3{% + \ifx#1\relax + \protect\G@refundefinedtrue + \@latex@warning{% + Hyper reference `#2' on page \thepage \space undefined% + }% + \hyper@@link{}{??}{#3}% + \else + \hyper@@link{\expandafter\@fifthoffive#1}% + {\expandafter\@fourthoffive#1\@empty\@empty}{#3}% + \fi +} +\def\label@hyperdef[#1]#2#3#4{% label name, category, name, + % anchor text + \@bsphack + \protected@write\@auxout{}% + {\string\newlabel{#1}{{}{}{}\##2.#3}}% + \@esphack + \ifHy@nesting + \hyper@@anchor{#2.#3}{#4}% + \else + \hyper@@anchor{#2.#3}{\relax}#4% + \fi +} +% \end{macrocode} +% \section{Underlying basic hypertext macros}\label{coremacros} +% Links have an optional type, a filename (possibly a URL), +% an internal name, and some marked text. (Caution: the internal +% name may contain babel shorthand characters.) +% If the second parameter is empty, its an internal link, +% otherwise we need to open another file or a URL. +% A link start has a type, and a URL. +% \begin{macrocode} +\def\hyper@@link{\let\Hy@reserved@a\relax + \@ifnextchar[{\hyper@link@}{\hyper@link@[link]}% +} +\def\hyper@link@[#1]#2#3#4{% + \begingroup + \protected@edef\Hy@tempa{#2}% + \csname @safe@activestrue\endcsname + \edef\x{#3}% + \ifx\Hy@tempa\@empty + \toks0{\hyper@link{#1}}% + \else + \toks0{\expandafter\hyper@readexternallink#2\\{#1}}% + \fi + \toks1{{#4}}% + \edef\x{\endgroup + \the\toks0 {\x}\the\toks1 % + }% + \x +} +% \end{macrocode} +% The problem here is that the first (URL) parameter may be a +% local \texttt{file:} reference +% (in which case some browsers treat it differently) +% or a genuine URL, in which case we'll have to activate +% a real Web browser. +% Note that a simple name is also a URL, as that is interpreted +% as a relative file name. We have to worry about |#| signs in a local +% file as well. +% +% \begin{macrocode} +\def\hyper@readexternallink#1\\#2#3#4{% +% \end{macrocode} +% Parameters are: +% \begin{enumerate} +% \item The URL or file name +% \item The type +% \item The internal name +% \item The link string +% \end{enumerate} +% We need to get the 1st parameter properly expanded, +% so we delimit the arguments rather than passing it inside a group. +% \begin{macrocode} + \expandafter\@hyper@readexternallink{#2}{#3}{#4}#1::\\{#1}% +} +% \end{macrocode} +% Now (potentially), we are passed: +% 1) The link type +% 2) The internal name, +% 3) the link string, +% 4) the URL type (http, mailto, file etc), +% 5) the URL details +% 6) anything after a real : in the URL +% 7) the whole URL again +% \begin{macrocode} +\def\@pdftempwordfile{file}% +\def\@pdftempwordrun{run}% +\def\@hyper@readexternallink#1#2#3#4:#5:#6\\#7{% +% \end{macrocode} +% If there are no colons at all (|#6| is blank), its a local +% file; if the URL type (|#4|) is blank, its probably a Mac filename, +% so treat it like a \texttt{file:} URL. The only flaw is if +% its a relative Mac path, with several colon-separated elements --- +% then we lose. Such names must be prefixed with an explicit |dvi:| +% \begin{macrocode} + \ifx\\#6\\% + \expandafter\@hyper@linkfile file:#7\\{#3}{#2}% + \else + \ifx\\#4\\% + \expandafter\@hyper@linkfile file:#7\\{#3}{#2}% + \else +% \end{macrocode} +% If the URL type is `file', pass it for local opening +% \begin{macrocode} + \def\@pdftempa{#4}% + \ifx\@pdftempa\@pdftempwordfile + \expandafter\@hyper@linkfile#7\\{#3}{#2}% + \else +% \end{macrocode} +% if it starts `run:', its to launch an application. +% \begin{macrocode} + \ifx\@pdftempa\@pdftempwordrun + \expandafter\@hyper@launch#7\\{#3}{#2}% + \else +% \end{macrocode} +% otherwise its a URL +% \begin{macrocode} + \hyper@linkurl{#3}{#7\ifx\\#2\\\else\##2\fi}% + \fi + \fi + \fi + \fi +} +% \end{macrocode} +% By default, turn |run:| into |file:| +% \begin{macrocode} +\def\@hyper@launch run:#1\\#2#3{% filename, anchor text, linkname + \hyper@linkurl{#2}{\Hy@linkfileprefix#1\ifx\\#3\\\else\##3\fi}% +} +% \end{macrocode} +% D P Story pointed out that relative paths +% starting .. fell over. Switched to using |\filename@parse| to +% solve this. +% \begin{macrocode} +\def\@hyper@linkfile file:#1\\#2#3{% + %file url,link string, name + \filename@parse{#1}% + \ifx\filename@ext\relax + \edef\filename@ext{\XR@ext}% + \fi + \def\use@file{\filename@area\filename@base.\filename@ext}% + \ifx\filename@ext\XR@ext + \hyper@linkfile{#2}{\use@file}{#3}% + \else + \ifx\@baseurl\@empty + \hyper@linkurl{#2}{% + \Hy@linkfileprefix\use@file\ifx\\#3\\\else\##3\fi + }% + \else + \hyper@linkurl{#2}{\use@file\ifx\\#3\\\else\##3\fi}% + \fi + \fi +} +% \end{macrocode} +% Anchors have a name, and marked text. +% We have to be careful with the marked text, as if we break +% off part of something to put a |\special| around it, all hell breaks +% loose. Therefore, we check the category code of the first token, +% and only proceed if its safe. Tanmoy sorted this out. +% +% A curious case arises if the original parameter +% was in braces. That means that |#2| comes here a multiple +% letters, and the |noexpand| just looks at the first one, +% putting the rest in the output. Yuck. +% \begin{macrocode} +\long\def\hyper@@anchor#1#2{\@hyper@@anchor#1\relax#2\relax} +\long\def\@hyper@@anchor#1\relax#2#3\relax{% + \ifx\\#1\\% + #2\Hy@WarningNoLine{empty link? #1: #2#3}% + \else + \def\anchor@spot{#2#3}% + \let\put@me@back\@empty + \ifx\relax#2\relax + \else + \ifHy@nesting + \else + \ifcat a\noexpand#2\relax + \else + \ifcat 0\noexpand#2 \relax + \else +% \typeout{Anchor start is not alphanumeric % +% on input line\the\inputlineno% +% }% + \let\anchor@spot\@empty + \def\put@me@back{#2#3}% + \fi + \fi + \fi + \fi + \ifHy@activeanchor + \anchor@spot + \else + \hyper@anchor{#1}% + \fi + \expandafter\put@me@back + \fi + \let\anchor@spot\@empty +} +% \end{macrocode} +% \section{Compatibility with the \emph{\LaTeX{}2html} package}\label{latex2html} +% Map our macro names on to Nikos', so that documents prepared +% for that system will work without change. +% +% Note, however, that the whole complicated structure for +% segmenting documents is not supported; it is assumed that the user +% will load |html.sty| first, and then |hyperref.sty|, so that the +% definitions in |html.sty| take effect, and are then overridden +% in a few circumstances by this package. +% \begin{macrocode} +\let\htmladdimg\hyperimage +% \end{macrocode} +% +% \begin{macrocode} +\def\htmladdnormallink#1#2{\href{#2}{#1}} +\def\htmladdnormallinkfoot#1#2{\href{#2}{#1}\footnote{#2}} +\def\htmlref#1#2{% anchor text, label + \label@hyperref[{#2}]{#1}% +} +% \end{macrocode} +% This is really too much. The \LaTeX2html package defines its own +% |\hyperref| command, with a different syntax. Was this always here? +% Its weird, anyway. We interpret it in the `printed' way, since +% we are about fidelity to the page. +% \begin{macrocode} +\def\@@latextohtmlX{% + \let\hhyperref\hyperref + \def\hyperref##1##2##3##4{% anchor text for HTML + % text to print before label in print + % label + % post-label text in print + ##2\ref{##4}##3% + }% +} +% \end{macrocode} +% +% \section{Forms creation} +% Allow for creation of PDF or HTML forms. The effects here are +% limited somewhat by the need to support both output formats, +% so it may not be as clever as something which only wants +% to make PDF forms. +% +% I could not have started this without the encouragement of T V Raman. +% \begin{macrocode} +\newif\ifFld@checked +\newif\ifFld@hidden +\newif\ifFld@multiline +\newif\ifFld@readonly +\newif\ifFld@disabled +\newif\ifFld@password +\newif\ifFld@radio +\newif\ifFld@combo +\newif\ifFld@popdown +\Fld@multilinefalse +\Fld@checkedfalse +\Fld@hiddenfalse +\Fld@readonlyfalse +\Fld@disabledfalse +\Fld@radiofalse +\Fld@combofalse +\Fld@popdownfalse +\Fld@passwordfalse +\newcount\Fld@menulength +\newdimen\Field@Width +\newdimen\Fld@charsize +\Fld@charsize=10\p@ +\def\Fld@maxlen{0} +\def\Fld@align{0} +\def\Fld@color{0 0 0} +\def\Fld@bcolor{1 1 1} +\def\Fld@bordercolor{1 0 0} +\def\Fld@bordersep{1\p@} +\def\Fld@borderwidth{1} +\def\Fld@borderstyle{S} +\def\Fld@cbsymbol{4} +\newtoks\Choice@toks +\def\Form{\@ifnextchar[{\@Form}{\@Form[]}} +\def\endForm{\@endForm} +\newif\ifForm@html +\Form@htmlfalse +\def\Form@boolkey#1#2{% + \csname Form@#2\ifx\relax#1\relax true\else#1\fi\endcsname +} +\define@key{Form}{action}{% + \def\Form@action{#1}% +} +\def\enc@@html{html} +\define@key{Form}{encoding}{% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\enc@@html + \Form@htmltrue + \else + \typeout{hyperref: form `encoding' key set to #1 % + -- unknown type% + }% + \Form@htmlfalse + \fi +} +\define@key{Form}{method}{% + \def\Form@method{#1}% +} +\def\Form@method{} +\def\Field@boolkey#1#2{% + \csname Fld@#2\ifx\relax#1\relax true\else#1\fi\endcsname +} +\newtoks\Field@toks +\Field@toks={ }% +\def\Field@addtoks#1#2{% + \edef\@processme{\Field@toks{\the\Field@toks\space #1="#2"}}% + \@processme +} +\def\Fld@checkequals#1=#2=#3\\{% + \def\@currDisplay{#1}% + \ifx\\#2\\% + \def\@currValue{#1}% + \else + \def\@currValue{#2}% + \fi +} +\define@key{Field}{loc}{% + \def\Fld@loc{#1}% +} +\define@key{Field}{multiline}[true]{% + \lowercase{\Field@boolkey{#1}}{multiline}% +} +\define@key{Field}{checked}[true]{% + \lowercase{\Field@boolkey{#1}}{checked}% +} +\define@key{Field}{hidden}[true]{% + \lowercase{\Field@boolkey{#1}}{hidden}% +} +\define@key{Field}{readonly}[true]{% + \lowercase{\Field@boolkey{#1}}{readonly}% +} +\define@key{Field}{disabled}[true]{% + \lowercase{\Field@boolkey{#1}}{disabled}% +} +\define@key{Field}{password}[true]{% + \lowercase{\Field@boolkey{#1}}{password}% +} +\define@key{Field}{radio}[true]{% + \lowercase{\Field@boolkey{#1}}{radio}% +} +\define@key{Field}{combo}[true]{% + \lowercase{\Field@boolkey{#1}}{combo}% +} +\define@key{Field}{popdown}[true]{% + \lowercase{\Field@boolkey{#1}}{popdown}% +} +\define@key{Field}{accesskey}{% + \Field@addtoks{accesskey}{#1}% +} +\define@key{Field}{tabkey}{% + \Field@addtoks{tabkey}{#1}% +} +\define@key{Field}{name}{% + \def\Fld@name{#1}% +} +\define@key{Field}{width}{% + \def\Fld@width{#1}% + \Field@Width#1\setbox0=\hbox{m}% +} +\define@key{Field}{maxlen}{% + \def\Fld@maxlen{#1}% +} +\define@key{Field}{menulength}{% + \Fld@menulength=#1\relax +} +\define@key{Field}{height}{% + \def\Fld@height{#1}% +} +\define@key{Field}{charsize}{% + \Fld@charsize#1% +} +\define@key{Field}{fillcolor}{% + \def\Fld@fillcolor{#1}% +} +\define@key{Field}{bordercolor}{% + \def\Fld@bordercolor{#1}% +} +\define@key{Field}{color}{% + \def\Fld@color{#1}% +} +\define@key{Field}{borderwidth}{% + \def\Fld@borderwidth{#1}% +} +\define@key{Field}{borderstyle}{% + \def\Fld@borderstyle{#1}% +} +\define@key{Field}{bordersep}{% + \def\Fld@bordersep{#1}% +} +\define@key{Field}{default}{% + \def\Fld@default{#1}% +} +\define@key{Field}{align}{% + \def\Fld@align{#1}% +} +\define@key{Field}{value}{% + \def\Fld@value{#1}% +} +\define@key{Field}{backgroundcolor}{% + \def\Fld@bcolor{#1}% +} +\define@key{Field}{checkboxsymbol}{% + \def\Fld@cbsymbol{#1}% +} +\def\Fld@format@code{} +\def\Fld@validate@code{} +\def\Fld@calculate@code{} +\def\Fld@keystroke@code{} +\def\Fld@onfocus@code{} +\def\Fld@onblur@code{} +\def\Fld@onmousedown@code{} +\def\Fld@onmouseup@code{} +\def\Fld@onenter@code{} +\def\Fld@onexit@code{} +\define@key{Field}{keystroke}{% + \def\Fld@keystroke@code{#1}% +} +\define@key{Field}{format}{% + \def\Fld@format@code{#1}% +} +\define@key{Field}{validate}{% + \def\Fld@validate@code{#1}% +} +\define@key{Field}{calculate}{% + \def\Fld@calculate@code{#1}% +} +\define@key{Field}{onfocus}{% + \def\Fld@onfocus@code{#1}% +} +\define@key{Field}{onblur}{% + \def\Fld@onblur@code{#1}% +} +\define@key{Field}{onenter}{% + \def\Fld@onenter@code{#1}% +} +\define@key{Field}{onexit}{% + \def\Fld@onexit@code{#1}% +} +\define@key{Field}{onselect}{% + \Field@addtoks{onselect}{#1}% +} +\define@key{Field}{onchange}{% + \Field@addtoks{onchange}{#1}% +} +\define@key{Field}{onclick}{% + \def\Fld@onclick{#1}% + \Field@addtoks{onclick}{#1}% +} +\define@key{Field}{ondblclick}{% + \Field@addtoks{ondblclick}{#1}% +} +\define@key{Field}{onmousedown}{% + \Field@addtoks{onmousedown}{#1}% +} +\define@key{Field}{onmouseup}{% + \Field@addtoks{onmouseup}{#1}% +} +\define@key{Field}{onmouseover}{% + \Field@addtoks{onmouseover}{#1}% +} +\define@key{Field}{onmousemove}{% + \Field@addtoks{onmousemove}{#1}% +} +\define@key{Field}{onmouseout}{% + \Field@addtoks{onmouseout}{#1}% +} +\define@key{Field}{onkeypress}{% + \Field@addtoks{onkeypress}{#1}% +} +\define@key{Field}{onkeydown}{% + \Field@addtoks{onkeydown}{#1}% +} +\define@key{Field}{onkeyup}{% + \Field@addtoks{onkeyup}{#1}% +} +% +\DeclareRobustCommand\TextField{% + \@ifnextchar[{\@TextField}{\@TextField[]}% +} +\DeclareRobustCommand\ChoiceMenu{% + \@ifnextchar[{\@ChoiceMenu}{\@ChoiceMenu[]}% +} +\DeclareRobustCommand\CheckBox{% + \@ifnextchar[{\@CheckBox}{\@CheckBox[]}% +} +\DeclareRobustCommand\PushButton{% + \@ifnextchar[{\@PushButton}{\@PushButton[]}% +} +\DeclareRobustCommand\Gauge{% + \@ifnextchar[{\@Gauge}{\@Gauge[]}% +} +\DeclareRobustCommand\Submit{% + \@ifnextchar[{\@Submit}{\@Submit[]}% +} +\DeclareRobustCommand\Reset{% + \@ifnextchar[{\@Reset}{\@Reset[]}% +} +\def\LayoutTextField#1#2{% label, field + #1 #2% +} +\def\LayoutChoiceField#1#2{% label, field + #1 #2% +} +\def\LayoutCheckField#1#2{% label, field + #1 #2% +} +\def\LayoutPushButtonField#1{% button + #1% +} +\def\MakeRadioField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}} +\def\MakeCheckField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}} +\def\MakeTextField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}} +\def\MakeChoiceField#1#2{\vbox to #2{\hbox to #1{\hfill}\vfill}} +\def\MakeButtonField#1{% + \sbox0{% + \hskip\Fld@borderwidth bp#1\hskip\Fld@borderwidth bp% + }% + \@tempdima\ht0 + \advance\@tempdima by \Fld@borderwidth bp + \advance\@tempdima by \Fld@borderwidth bp + \ht0\@tempdima + \@tempdima\dp0 + \advance\@tempdima by \Fld@borderwidth bp + \advance\@tempdima by \Fld@borderwidth bp + \dp0\@tempdima + \box0\relax +} +\def\DefaultHeightofSubmit{14pt} +\def\DefaultWidthofSubmit{2cm} +\def\DefaultHeightofReset{14pt} +\def\DefaultWidthofReset{2cm} +\def\DefaultHeightofCheckBox{\baselineskip} +\def\DefaultWidthofCheckBox{\baselineskip} +\def\DefaultHeightofChoiceMenu{\baselineskip} +\def\DefaultWidthofChoiceMenu{\baselineskip} +\def\DefaultHeightofText{\baselineskip} +\def\DefaultWidthofText{3cm} +% \end{macrocode} +% +% \section{Setup} +% \begin{macrocode} +\ifHy@figures + \Hy@Info{Hyper figures ON} +\else + \Hy@Info{Hyper figures OFF} +\fi +\ifHy@nesting + \Hy@Info{Link nesting ON} +\else + \Hy@Info{Link nesting OFF} +\fi +\ifHy@hyperindex + \Hy@Info{Hyper index ON} +\else + \Hy@Info{Hyper index OFF} +\fi +\ifHy@backref + \Hy@Info{backreferencing ON} +\else + \Hy@Info{backreferencing OFF} +\fi +\ifHy@colorlinks + \Hy@Info{Link coloring ON} +\else + \Hy@Info{Link coloring OFF} +\fi +% \end{macrocode} +% \section{Low-level utility macros} +% We need unrestricted access to the |#|, |~| and |"| characters, so make +% them nice macros. +% \begin{macrocode} +\edef\hyper@hash{\string#} +\edef\hyper@tilde{\string~} +\edef\hyper@quote{\string"} +\let\@currentHref\@empty +\let\Hy@footnote@currentHref\@empty +% \end{macrocode} +% We give the start of document a special label; this is used +% in backreferencing-by-section, to allow for cites before +% any sectioning commands. Set up PDF info. +% \begin{macrocode} +\AfterBeginDocument{% + \Hy@pdfstringtrue + \PDF@SetupDoc + \let\PDF@SetupDoc\@empty + \Hy@DisableOption{pdfpagescrop}% + \Hy@DisableOption{pdfpagemode}% + \Hy@DisableOption{pdfnonfullscreenpagemode}% + \Hy@DisableOption{pdfstartview}% + \Hy@DisableOption{pdfstartpage}% + \Hy@DisableOption{pdftoolbar}% + \Hy@DisableOption{pdfmenubar}% + \Hy@DisableOption{pdfwindowui}% + \Hy@DisableOption{pdffitwindow}% + \Hy@DisableOption{pdfcenterwindow}% + \Hy@DisableOption{pdfdisplaydoctitle}% + \Hy@DisableOption{pdfpagelayout}% + \Hy@DisableOption{baseurl}% + \ifHy@texht\else\hyper@anchorstart{Doc-Start}\hyper@anchorend\fi + \Hy@pdfstringfalse +} +% \end{macrocode} +% +% \section{Localized nullifying of package} +% Sometimes we just don't want the wretched package interfering +% with us. Define an environment we can put in manually, or include +% in a style file, which stops the hypertext functions doing anything. +% This is used, for instance, in the Elsevier classes, to stop +% |hyperref| playing havoc in the front matter. +% \begin{macrocode} +\def\NoHyper{% + \def\hyper@link@[##1]##2##3##4{##4}% + \def\hyper@@anchor##1{}% + \global\let\hyper@livelink\hyper@link + \gdef\hyper@link##1##2##3{##3}% + \def\hyper@anchorstart##1{}% + \let\hyper@anchorend\@empty + \def\hyper@linkstart##1##2{}% + \let\hyper@linkend\@empty + \def\hyper@linkurl##1##2{##1}% + \def\hyper@linkfile##1##2##3{##1}% + \let\Hy@backout\@gobble +} +\def\stop@hyper{% + \def\hyper@link@[##1]##2##3##4{##4}% + \let\Hy@backout\@gobble + \def\hyper@@anchor##1{}% + \def\hyper@link##1##2##3{##3}% + \def\hyper@anchorstart##1{}% + \let\hyper@anchorend\@empty + \def\hyper@linkstart##1##2{}% + \let\hyper@linkend\@empty + \def\hyper@linkurl##1##2{##1}% + \def\hyper@linkfile##1##2##3{##1}% +} +\def\endNoHyper{% + \global\let\hyper@link\hyper@livelink +} +% +% \end{macrocode} +% +% \section{Package nohyperref} +% +% This package is introduced by Sebastian Rahtz. +% +% Package nohyperref is a dummy package that defines +% some low level and some top-level commands. +% It is done for jadetex, which calls hyperref +% low-level commands, but it would also be useful with people using +% normal hyperref, who really do not want the package loaded at all. +% +% Some low-level commands: +% \begin{macrocode} +%<*nohyperref> +\let\hyper@@anchor\@gobble +\def\hyper@link#1#2#3{#3}% +\let\hyper@anchorstart\@gobble +\let\hyper@anchorend\@empty +\let\hyper@linkstart\@gobbletwo +\let\hyper@linkend\@empty +\def\hyper@linkurl#1#2{#1}% +\def\hyper@linkfile#1#2#3{#1}% +\let\PDF@SetupDoc\@empty +\let\PDF@FinishDoc\@empty +% \end{macrocode} +% Some top-level commands: +% \begin{macrocode} +\let\Acrobatmenu\@gobble +\let\pdfstringdefDisableCommands\@gobbletwo +\let\texorpdfstring\@firstoftwo +\let\pdfbookmark\@undefined +\newcommand\pdfbookmark[3][]{} +\let\phantomsection\@empty +\let\hypersetup\@gobble +\let\hyperbaseurl\@gobble +\let\href\@gobble +\let\hyperdef\@gobbletwo +\let\hyperlink\@gobble +\let\hypertarget\@gobble +\def\hyperref{\@ifnextchar[\@gobbleopt{\expandafter\@gobbletwo\@gobble}} +\long\def\@gobbleopt[#1]{} +\let\hyperpage\@empty +% +% \end{macrocode} +% +% \section{The Mangling Of Aux and Toc Files} +% Some extra tests so that the hyperref package may be removed or added +% to a document without having to remove .aux and .toc files +% (this section is by David Carlisle) +% All the code is delayed to |\begin{document}| +% \begin{macrocode} +%<*package> +\AfterBeginDocument{% +% \end{macrocode} +% First the code to deal with removing the hyperref package from +% a document. +% +% Write some stuff into the aux file so if the next run is done +% without hyperref, then |\contentsline| and |\newlabel| are defined +% to cope with the extra arguments. +% \begin{macrocode} + \if@filesw + \ifHy@typexml + \immediate\closeout\@mainaux + \immediate\openout\@mainaux\jobname.aux + \immediate\write\@auxout{\relax}% + \fi + \immediate\write\@auxout{% +% \end{macrocode} +% +% \begin{macrocode} + \string\ifx\string\hyper@anchor\string\@undefined^^J% +% \end{macrocode} +% +% \begin{macrocode} + \global\let\string\oldcontentsline\string\contentsline^^J% + \gdef\string\contentsline% + \string#1\string#2\string#3\string#4{% + \string\oldcontentsline% + {\string#1}{\string#2}{\string#3}}^^J% + \global\let\string\oldnewlabel\string\newlabel^^J% + \gdef\string\newlabel\string#1\string#2{% + \string\newlabelxx{\string#1}\string#2}^^J% + \gdef\string\newlabelxx% + \string#1\string#2\string#3\string#4\string#5\string#6{% + \string\oldnewlabel{\string#1}{{\string#2}{\string#3}}}^^J% +% \end{macrocode} +% +% But the new aux file will be read again at the end, with the normal +% definitions expected, so better put things back as they were. +% \begin{macrocode} + \string\AtEndDocument{% + \let\string\contentsline\string\oldcontentsline^^J% + \let\string\newlabel\string\oldnewlabel}^^J% +% \end{macrocode} +% +% If the document is being run with hyperref put this definition +% into the aux file, so we can spot it on the next run. +% \begin{macrocode} + \string\else^^J% + \global\let\string\hyper@last\relax^^J% + \string\fi^^J% + }% + \fi +% \end{macrocode} +% +% Now the code to deal with adding the hyperref package to a document +% with aux and toc written the standard way. +% +% If hyperref was used last time, do nothing. If it was not used, +% or an old version of hyperref was used, don't use that TOC at all +% but generate a warning. Not ideal, but better than failing +% with pre-5.0 hyperref TOCs. +% \begin{macrocode} + \ifx\hyper@last\@undefined + \def\@starttoc#1{% + \begingroup + \makeatletter + \IfFileExists{\jobname.#1}{% + \Hy@WarningNoLine{% + old #1 file detected, not used; run LaTeX again% + }% + }{}% + \if@filesw + \expandafter\newwrite\csname tf@#1\endcsname + \immediate\openout\csname tf@#1\endcsname \jobname.#1\relax + \fi + \@nobreakfalse + \endgroup + }% + \def\newlabel#1#2{\@newl@bel r{#1}{#2{}{}{}{}}}% + \fi +} +% \end{macrocode} +% +% \section{Title strings} +% +% If options |pdftitle| and |pdfauthor| are not used, +% these informations for the pdf information dictionary +% can be extracted by the \title and \author. +% \begin{macrocode} +\ifHy@usetitle + \let\HyOrg@title\title + \let\HyOrg@author\author + \def\title{\@ifnextchar[{\Hy@scanopttitle}{\Hy@scantitle}}% + \def\Hy@scanopttitle[#1]{% + \gdef\Hy@title{#1}% + \HyOrg@title[{#1}]% + }% + \def\Hy@scantitle#1{% + \gdef\Hy@title{#1}% + \HyOrg@title{#1}% + } + \def\author{\@ifnextchar[{\Hy@scanoptauthor}{\Hy@scanauthor}}% + \def\Hy@scanoptauthor[#1]{% + \gdef\Hy@author{#1}% + \HyOrg@author[{#1}]% + }% + \def\Hy@scanauthor#1{% + \gdef\Hy@author{#1}% + \HyOrg@author{#1}% + } +% \end{macrocode} +% +% The case, that \title, or \author are given before +% hyperref is loaded, is much more complicate, because +% LaTeX initializes the macros \@title and \@author with +% LaTeX error and warning messages. +% \begin{macrocode} + \begingroup + \def\process@me#1\@nil#2{% + \expandafter\let\expandafter\x\csname @#2\endcsname + \edef\y{\expandafter\strip@prefix\meaning\x}% + \def\c##1#1##2\@nil{% + \ifx\\##1\\% + \else + \expandafter\gdef\csname Hy@#2\expandafter\endcsname + \expandafter{\x}% + \fi + }% + \expandafter\c\y\relax#1\@nil + }% + \expandafter\process@me\string\@latex@\@nil{title}% + \expandafter\process@me\string\@latex@\@nil{author}% + \endgroup +\fi +\Hy@DisableOption{pdfusetitle} +% \end{macrocode} +% +% Macro |\Hy@UseMaketitleInfos| is used in the driver files, +% before the information entries are used. +% +% The newline macro |\newline| or |\\| is much more +% complicate. In the title a good replacement can be +% a space, but can be already a space after |\\| in +% the title string. So this space is removed by +% scanning for the next non-empty argument. +% +% In the macro |\author| the newline can perhaps +% separate the different authors, so the newline +% expands here to a comma with space. +% +% The possible arguments such as space or the optional +% argument after the newline macros are not detected. +% +% \begin{macrocode} +\def\Hy@UseMaketitleString#1{% + \@ifundefined{Hy@#1}{}{% + \begingroup + \let\Hy@saved@hook\pdfstringdefPreHook + \pdfstringdefDisableCommands{% + \expandafter\let\expandafter\\\csname Hy@newline@#1\endcsname + \let\newline\\% + }% + \expandafter\ifx\csname @pdf#1\endcsname\@empty + \expandafter\pdfstringdef\csname @pdf#1\endcsname{% + \csname Hy@#1\endcsname\@empty + }% + \fi + \global\let\pdfstringdefPreHook\Hy@saved@hook + \endgroup + }% +} +\def\Hy@newline@title#1{ #1} +\def\Hy@newline@author#1{, #1} +\def\Hy@UseMaketitleInfos{% + \Hy@UseMaketitleString{title}% + \Hy@UseMaketitleString{author}% +} +% \end{macrocode} +% +% \section{Page numbers} +% This stuff is done by Heiko Oberdiek. +% +% \subsection{PDF /PageLabels} +% Internal macros of this module are marked with |\HyPL@|. +% +% \begin{macrocode} +\ifHy@pagelabels +% \end{macrocode} +% +% \begin{macro}{\thispdfpagelabel} +% The command \cmd{\thispdfpagelabel} allows to label a special +% page without the redefinition of \cmd{\thepage} for the page. +% \begin{macrocode} + \def\thispdfpagelabel#1{% + \gdef\HyPL@thisLabel{#1}% + } + \global\let\HyPL@thisLabel\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@Labels} +% The page labels are collected in \cmd{\HyPL@Labels} and +% set at the end of the document. +% \begin{macrocode} + \def\HyPL@Labels{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@abspage} +% We have to know the the absolute page number and introduce +% a new counter for that. +% \begin{macrocode} + \newcount\Hy@abspage + \Hy@abspage=0 +% \end{macrocode} +% \end{macro} +% For comparisons with the values of the previous page, some +% variables are needed: +% \begin{macrocode} + \def\HyPL@LastType{init}% + \def\HyPL@LastNumber{0}% + \def\HyPL@LastPrefix{}% +% \end{macrocode} +% Definitions for the PDF names of the \LaTeX{} pendents. +% \begin{macrocode} + \def\HyPL@arabic{D}% + \def\HyPL@Roman{R}% + \def\HyPL@roman{r}% + \def\HyPL@Alph{A}% + \def\HyPL@alph{a}% +% \end{macrocode} +% +% \begin{macro}{\HyPL@EveryPage} +% If a page is shipout and the page number is known, +% \cmd{\HyPL@EveryPage} has to be called. It stores the +% current page label. +% \begin{macrocode} + \def\HyPL@EveryPage{% + \begingroup + \ifx\HyPL@thisLabel\relax + \let\HyPL@page\thepage + \else + \let\HyPL@page\HyPL@thisLabel + \global\let\HyPL@thisLabel\relax + \fi + \let\HyPL@Type\relax + \ifnum\the\c@page>0 + \expandafter\HyPL@CheckThePage\HyPL@page\@nil + \fi + \let\Hy@temp Y% + \ifx\HyPL@Type\HyPL@LastType + \else + \let\Hy@temp N% + \fi + \ifx\HyPL@Type\relax + \pdfstringdef\HyPL@Prefix{\HyPL@page}% + \else + \pdfstringdef\HyPL@Prefix\HyPL@Prefix + \fi + \ifx\HyPL@Prefix\HyPL@LastPrefix + \else + \let\Hy@temp N% + \fi + \if Y\Hy@temp + \advance\c@page by -1 + \ifnum\HyPL@LastNumber=\the\c@page\relax + \else + \let\Hy@temp N% + \fi + \Hy@StepCount\c@page + \fi + \if N\Hy@temp + \ifx\HyPL@Type\relax + \HyPL@StorePageLabel{/P (\HyPL@Prefix)}% + \else + \HyPL@StorePageLabel{% + \ifx\HyPL@Prefix\@empty + \else + /P (\HyPL@Prefix) + \fi + /S /\csname HyPL\HyPL@Type\endcsname + \ifnum\the\c@page=1 + \else + \space/St \the\c@page + \fi + }% + \fi + \fi + \xdef\HyPL@LastNumber{\the\c@page}% + \global\let\HyPL@LastType\HyPL@Type + \global\let\HyPL@LastPrefix\HyPL@Prefix + \endgroup + \Hy@GlobalStepCount\Hy@abspage + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@CheckThePage} +% Macro \cmd{\HyPL@CheckThePage} calls \cmd{\HyPL@@CheckThePage} +% that does the job. +% \begin{macrocode} + \def\HyPL@CheckThePage#1\@nil{% + \HyPL@@CheckThePage{#1}#1\csname\endcsname\c@page\@nil + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\HyPL@@CheckThePage} +% The first check is, is \cmd{\thepage} is defined +% such as in \LaTeX, e.\,g.: |\csname @arabic\endcsname\c@page|. +% In the current implemenation the check fails, if there is +% another \cmd{\csname} before. +% +% The second check tries to detect |\arabic{page}| at the +% end of the definition text of \cmd{\thepage}. +% \begin{macrocode} + \def\HyPL@@CheckThePage#1#2\csname#3\endcsname\c@page#4\@nil{% + \def\Hy@tempa{#4}% + \def\Hy@tempb{\csname\endcsname\c@page}% + \ifx\Hy@tempa\Hy@tempb + \expandafter\ifx\csname HyPL#3\endcsname\relax + \else + \def\HyPL@Type{#3}% + \def\HyPL@Prefix{#2}% + \fi + \else + \begingroup + \let\Hy@next\endgroup + \let\HyPL@found\@undefined + \def\arabic{\HyPL@Format{arabic}}% + \def\Roman{\HyPL@Format{Roman}}% + \def\roman{\HyPL@Format{roman}}% + \def\Alph{\HyPL@Format{Alph}}% + \def\alph{\HyPL@Format{alph}}% + \protected@edef\Hy@temp{#1}% + \ifx\HyPL@found\relax + \toks@\expandafter{\Hy@temp}% + \edef\Hy@next{\endgroup + \noexpand\HyPL@@@CheckThePage\the\toks@ + \noexpand\HyPL@found\relax\noexpand\@nil + }% + \fi + \Hy@next + \fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@Format} +% The help macro \cmd{\HyPL@Format} is executed while +% a \cmd{\protected@edef} in the second check +% method of \cmd{\HyPL@@CheckPage}. +% The first occurences of, for example, |\arabic{page}| is +% marked by \cmd{\HyPL@found} that is also defined by +% \cmd{\csname}. +% \begin{macrocode} + \def\HyPL@Format#1#2{% + \ifx\HyPL@found\@undefined + \expandafter\ifx\csname c@#2\endcsname\c@page + \expandafter\noexpand\csname HyPL@found\endcsname{#1}% + \else + \expandafter\noexpand\csname#1\endcsname{#2}% + \fi + \else + \expandafter\noexpand\csname#1\endcsname{#2}% + \fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@@@CheckThePage} +% If the second check method is successful, +% \cmd{\HyPL@@@CheckThePage} scans the result of +% \cmd{\HyPL@Format} and stores the found values. +% \begin{macrocode} + \def\HyPL@@@CheckThePage#1\HyPL@found#2#3\@nil{% + \def\Hy@tempa{#3}% + \def\Hy@tempb{\HyPL@found\relax}% + \ifx\Hy@tempa\Hy@tempb + \def\HyPL@Type{@#2}% + \def\HyPL@Prefix{#1}% + \fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@StorePageLabel} +% Dummy for drivers that does not support /PageLabel. +% \begin{macrocode} + \providecommand*{\HyPL@StorePageLabel}[1]{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@Useless} +% The |/PageLabels| entry does not make sense, +% if the absolute page numbers and the page labels are the +% same. Then \cmd{\HyPL@Labels} has the meaning of \cmd{\HyPL@Useless}. +% \begin{macrocode} + \def\HyPL@Useless{0 << /S /D >> }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@SetPageLabels} +% The page labels are written to the PDF cataloge. +% The command \cmd{\Hy@PutCatalog} is defined in the +% driver files. +% \begin{macrocode} + \def\HyPL@SetPageLabels{% + \ifx\HyPL@Labels\@empty + \else + \ifx\HyPL@Labels\HyPL@Useless + \else + \Hy@PutCatalog{/PageLabels << /Nums [\HyPL@Labels] >>}% + \fi + \fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HyPL@EveryPage} +% Without option `pdfpagelabels' we need a dummy for +% \cmd{\HyPL@EveryPage}. +% \begin{macrocode} +\else + \let\HyPL@EveryPage\@empty +\fi +% \end{macrocode} +% \end{macro} +% +% Option `pdfpagelabels' has been used and is now disabled. +% \begin{macrocode} +\Hy@DisableOption{pdfpagelabels} +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \subsubsection{pdfTeX and VTeX} +% +% Because of pdfTeX's \cmd{\pdfcatalog} command +% the /PageLabels entry can set at end of document +% in the first run. +% +% \begin{macro}{\Hy@PutCatalog} +% \begin{macrocode} +%\let\Hy@PutCatalog\pdfcatalog +% \end{macrocode} +% The code for VTeX is more complicate, because it does +% not allow the direct access to the /Catalog object. +% The command scans its argument and looks +% for a /PageLabels entry. +% +% VTeX 6.59g is the first version, that +% implements \verb|\special{!pdfpagelabels...}|. +% For this version \cmd{\VTeXversion} reports 660. +% \begin{macrocode} +%<*vtex> +\edef\Hy@VTeXversion{% + \ifx\VTeXversion\@undefined + \z@ + \else + \ifx\VTeXversion\relax + \z@ + \else + \VTeXversion + \fi + \fi +} +\begingroup + \ifnum\Hy@VTeXversion<660 % + \gdef\Hy@PutCatalog#1{% + \Hy@WarningNoLine{% + VTeX 6.59g or above required for pdfpagelabels% + }% + } + \else + \gdef\Hy@PutCatalog#1{% + \Hy@vt@PutCatalog#1/PageLabels <<>>\@nil + } + \gdef\Hy@vt@PutCatalog#1/PageLabels <<#2>>#3\@nil{% + \ifx\\#2\\% + \else + \immediate\special{!pdfpagelabels #2}% + \fi + } + \fi +\endgroup +% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%<*pdftex|vtex> +% \end{macrocode} +% +% \begin{macro}{\HyPL@StorePageLabel} +% This macro adds the entry |#1| to \cmd{\HyPL@Labels}. +% \begin{macrocode} +\ifHy@pagelabels + \def\HyPL@StorePageLabel#1{% + \toks@\expandafter{\HyPL@Labels}% + \xdef\HyPL@Labels{% + \the\toks@ + \the\Hy@abspage\space<< #1 >> % + }% + } +% \end{macrocode} +% \end{macro} +% +% At the end of the document, \cmd{\clearpage} tries +% to make sure, that no further pages will follow. +% Then the PDF catalog entry for |\PageLabels| is set. +% \begin{macrocode} + \AtEndDocument{\clearpage\HyPL@SetPageLabels} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% +% \end{macrocode} +% +% \subsubsection{pdfmarkbase, dvipdfm} +% +% \begin{macro}{\Hy@PutCatalog} +% \begin{macrocode} +%\def\Hy@PutCatalog#1{\@pdfm@mark{docview << #1 >>}} +%<*pdfmarkbase> +\def\Hy@PutCatalog#1{% + \pdfmark{pdfmark=/PUT,Raw={\string{Catalog\string} << #1 >>}}% +} +% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%<*pdfmarkbase|dvipdfm> +\ifHy@pagelabels +% \end{macrocode} +% +% \begin{macro}{\HyPL@StorePageLabel} +% This macro writes a string to the .aux file. +% \begin{macrocode} + \def\HyPL@StorePageLabel#1{% + \if@filesw + \begingroup + \edef\Hy@tempa{\the\Hy@abspage\space<< #1 >> }% + \immediate\write\@mainaux{% + \string\HyPL@Entry{\Hy@tempa}% + }% + \endgroup + \fi + } +% \end{macrocode} +% \end{macro} +% +% Write a dummy definition of \cmd{\HyPL@Entry} for the case, +% that the next run is done without hyperref. +% A marker for the rerun warning is set and the /PageLabels +% is written. +% \begin{macrocode} + \AfterBeginDocument{% + \if@filesw + \immediate\write\@mainaux{% + \string\providecommand\string*\string\HyPL@Entry[1]{}% + }% + \fi + \ifx\HyPL@Labels\@empty + \Hy@WarningNoLine{Rerun to get /PageLabels entry}% + \else + \HyPL@SetPageLabels + \fi + \let\HyPL@Entry\@gobble + }% +% \end{macrocode} +% +% \begin{macro}{\HyPL@Entry} +% \begin{macrocode} + \def\HyPL@Entry#1{% + \expandafter\gdef\expandafter\HyPL@Labels\expandafter{% + \HyPL@Labels + #1% + }% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\fi +% +% \end{macrocode} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +\MaybeStopEarly +% \end{macrocode} +% +% \section{Automated \LaTeX\ hypertext cross-references}\label{latexxref} +% Anything which can be referenced advances some counter; we overload +% this to put in a hypertext starting point (with no visible anchor), +% and make a note of that for later use in |\label|. +% This will fail badly if |\theH| +% does not expand to a sensible reference. This means that classes +% or package which introduce new elements need to define +% an equivalent |\theH| for every |\the|. We do make +% a trap to make |\theH| be the same as |\arabic{}|, +% if |\theH| is not defined, but this is not necessarily a good idea. +% Alternatively, the `naturalnames' option uses whatever \LaTeX\ +% provides, which may be useable. But then its up to you to make +% sure these are legal PDF and HTML names. The `hypertexnames=false' option +% just makes up arbitrary names. +% +% All the shenanigans is to make sure section numbers etc +% are always arabic, separated by dots. Who knows how people +% will set up |\@currentlabel|? If they put spaces in, or brackets +% (quite legal) then the hypertext processors will get upset. +% +% But this is flaky, and open to abuse. Styles like +% |subeqn| will mess it up, for starters. Appendices are an issue, too. +% We just hope to cover most situations. We can at least cope +% with the standard sectioning structure, allowing for |\part| +% and |\chapter|. +% +% Start with a fallback for equations +% \begin{macrocode} +\newcommand\theHequation{\theHsection.\arabic{equation}} +\@ifundefined{thepart}{}{\newcommand\theHpart{\arabic{part}}} +\@ifundefined{thechapter}{% + \newcommand\theHsection {\arabic{section}} + \newcommand\theHfigure {\arabic{figure}} + \newcommand\theHtable {\arabic{table}} +}{% + \newcommand\theHchapter {\arabic{chapter}} + \newcommand\theHfigure {\theHchapter.\arabic{figure}} + \newcommand\theHtable {\theHchapter.\arabic{table}} + \newcommand\theHsection {\theHchapter.\arabic{section}} +} +\newcommand\theHsubsection {\theHsection.\arabic{subsection}} +\newcommand\theHsubsubsection{\theHsubsection.\arabic{subsubsection}} +\newcommand\theHparagraph {\theHsubsubsection.\arabic{paragraph}} +\newcommand\theHsubparagraph {\theHparagraph.\arabic{subparagraph}} +\newcommand\theHtheorem {\theHsection.\arabic{theorem}} +\newcommand\theHthm {\theHsection.\arabic{thm}} +% \end{macrocode} +% Thanks to Greta Meyer (gbd@pop.cwru.edu) for making me realize +% that enumeration starts at 0 for every list! But |\item| +% occurs inside |\trivlist|, so check if its a real |\item| before +% incrementing counters. +% \begin{macrocode} +\let\H@item\item +\newcounter{Item} +\def\theHItem{\arabic{Item}} +\def\item{% + \@hyper@itemfalse + \if@nmbrlist\@hyper@itemtrue\fi + \H@item +} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\theHenumi {\theHItem} +\newcommand\theHenumii {\theHItem} +\newcommand\theHenumiii {\theHItem} +\newcommand\theHenumiv {\theHItem} +\newcommand\theHHfootnote {\arabic{Hfootnote}} +\newcommand\theHmpfootnote{\arabic{mpfootnote}} +\let\theHHmpfootnote\theHHfootnote +% \end{macrocode} +% Tanmoy asked for this default handling of undefined |\theH| +% situations. It really isn't clear what would be ideal, whether to +% turn off hyperizing of unknown elements, to pick up the textual +% definition of the counter, or to default it to something like +% |\arabic{name}|. We take the latter course, slightly worriedly. +% \begin{macrocode} +\let\H@refstepcounter\refstepcounter +\edef\name@of@eq{equation}% +\edef\name@of@slide{slide}% +% \end{macrocode} +% We do not want the handler for |\refstepcounter| to cut in +% during the processing of |\item| (we handle that separately), +% so we provide a bypass conditional. +% \begin{macrocode} +\newif\if@hyper@item +\newif\if@skiphyperref +\@hyper@itemfalse +\@skiphyperreffalse +\def\refstepcounter#1{% + \H@refstepcounter{#1}% + \edef\This@name{#1}% + \ifx\This@name\name@of@slide + \else + \if@skiphyperref + \else + \if@hyper@item + \stepcounter{Item}% + \hyper@refstepcounter{Item}% + \else + \hyper@refstepcounter{#1}% + \fi + \fi + \fi +} +% \end{macrocode} +% AMS\LaTeX\ processes all equations twice; we want to make sure +% that the hyper stuff is not executed twice, so we use the AMS +% |\ifmeasuring@|, initialized if AMS math is not used. +% \begin{macrocode} +\@ifpackageloaded{amsmath}{}{\newif\ifmeasuring@\measuring@false} +% \end{macrocode} +% +% \begin{macro}{\hyper@refstepcounter} +% \begin{macrocode} +\def\hyper@refstepcounter#1{% + \edef\This@name{#1}% + \ifx\This@name\name@of@eq + \make@stripped@name{\theequation}% + \let\theHequation\newname + \fi + \@ifundefined{theH#1}{% + \expandafter\def\csname theH#1\endcsname{\arabic{#1}}% + }{}% + \hyper@makecurrent{#1}% + \ifmeasuring@ + \else + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% After \cmd{\appendix} ``chapter'' should be replaced +% by ``appendix'' to get \cmd{\autoref} work. +% Macro \cmd{\Hy@chapapp} contains the current valid +% name like \cmd{\@chapapp}, which cannot be used, +% because this string depends on the current language. +% +% The ``french'' package defines counter \cmd{\thechapter} +% by \cmd{\newcounter{chapter}}, if \cmd{\@ifundefined{chapter}}. +% \begin{macrocode} +\def\Hy@chapterstring{chapter} +\def\Hy@appendixstring{appendix} +\def\Hy@chapapp{\Hy@chapterstring} +\let\HyOrg@appendix\appendix +\def\appendix{% + \@ifundefined{chapter}% + {\gdef\theHsection{\Alph{section}}}% + {\gdef\theHchapter{\Alph{chapter}}}% + \xdef\Hy@chapapp{\Hy@appendixstring}% + \HyOrg@appendix +} +% \end{macrocode} +% \begin{macro}{\hyper@makecurrent} +% Because of Babel mucking around, nullify |\textlatin| when making names. +% And |\@number| because of babel's lrbabel.def. +% \begin{macrocode} +\def\hyper@makecurrent#1{% + \begingroup + \edef\Hy@param{#1}% + \ifx\Hy@param\Hy@chapterstring + \let\Hy@param\Hy@chapapp + \fi + \ifHy@hypertexnames + \let\@number\@firstofone + \ifHy@naturalnames + \let\textlatin\@firstofone + \xdef\@currentHlabel{\csname the#1\endcsname}% + \else + \xdef\@currentHlabel{\csname theH#1\endcsname}% + \fi + \xdef\@currentHref{% + \Hy@param.\expandafter\strip@prefix\meaning\@currentHlabel + }% + \else + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@param.\the\Hy@linkcounter}% + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\@ifpackageloaded{fancyvrb}{% + \def\FV@StepLineNo{% + \FV@SetLineNo + \def\FV@StepLineNo{\H@refstepcounter{FancyVerbLine}}% + \FV@StepLineNo + }% +}{} +% \end{macrocode} +% +% \section{Package lastpage support} +% Package lastpage directly writes the |\newlabel| command to the +% aux file. Because package hyperref requires additional arguments, +% the internal command |\lastpage@putlabel| is redefined. +% The patch is deferred by |\AtBeginDocument|, because it is possible +% that package lastpage is loaded after package hyperref. +% The same algorithm (options hypertexnames and plainpages) +% is used to get the page anchor name as +% in |\@hyperfixhead| (see sec. \ref{pagenum}). +% The link will not work if option pageanchor is set to false. +% \begin{macro}{\lastpage@putlabel} +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{lastpage}{% + \ifHy@pageanchor + \else + \Hy@WarningNoLine{% + The \string\pageref{LastPage} link doesn't work\MessageBreak + with disabled option `pageanchor'% + }% + \fi + \def\lastpage@putlabel{% + \addtocounter{page}{-1}% + \if@filesw + \begingroup + \let\@number\@firstofone + \ifHy@pageanchor + \ifHy@hypertexnames + \ifHy@plainpages + \def\Hy@temp{\arabic{page}}% + \else + \let\textlatin\@firstofone + \edef\Hy@temp{\thepage}% + \fi + \else + \def\Hy@temp{\the\Hy@pagecounter}% + \fi + \fi + \immediate\write\@auxout{% + \string\newlabel + {LastPage}{{}{\thepage}{}{% + \ifHy@pageanchor page.\Hy@temp\fi}{}}% + }% + \endgroup + \fi + \addtocounter{page}{1}% + }% + }{}% +} +% +%<*check> +\checkpackage{lastpage}[1994/06/25] +\checkcommand\def\lastpage@putlabel{% + \addtocounter{page}{-1}% + \immediate\write\@auxout{% + \string\newlabel{LastPage}{{}{\thepage}}% + }% + \addtocounter{page}{1}% +} +% +%<*package> +% \end{macrocode} +% \end{macro} +% +% \section{Package ifthen support} +% +% \begin{macro}{\hypergetpageref} +% Package ifthen's \cmd{\isodd} does not work with +% \cmd{\pageref} because of the extra link and the +% star form. Therefore we need an expandable variant: +% \begin{macrocode} +\newcommand*{\hypergetpageref}[1]{% + \expandafter\Hy@getpageref\csname r@#1\endcsname{#1}% +} +\def\Hy@getpageref#1#2{% + \ifx#1\relax + 0% + \protect\G@refundefinedtrue + \@latex@warning{Reference `#2' on page \thepage\space + undefined% + }% + \else + \expandafter\Hy@GetSecondArg#1\@nil + \fi +} +\long\def\Hy@GetSecondArg#1#2#3\@nil{#2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hypergetref} +% The corresponding macro of \cmd{\hypergetpageref} is +% \cmd{\hypergetref}: +% \begin{macrocode} +\newcommand*{\hypergetref}[1]{% + \expandafter\Hy@getref\csname r@#1\endcsname{#1}% +} +\def\Hy@getref#1#2{% + \ifx#1\relax + ??% + \protect\G@refundefinedtrue + \@latex@warning{Reference `#2' on page \thepage\space + undefined% + }% + \else + \expandafter\@car#1\@nil + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Hy@TE@begingroup} +% Unfortunately there is no hook in \cmd{\ifthenelse} in order +% to provide expandable versions without link of \cmd{\ref} +% and \cmd{\pageref}. As possible target I could only find +% \cmd{\begingroup}: +% \begin{macrocode} +\@ifpackageloaded{ifthen}{% + \let\HyOrg@ifthenelse\ifthenelse + \def\ifthenelse{% + \let\begingroup\Hy@TE@begingroup + \HyOrg@ifthenelse + }% + \let\HyOrg@begingroup\begingroup + \def\Hy@TE@begingroup{% + \let\begingroup\HyOrg@begingroup + \begingroup + \let\ref\hypergetref + \let\pageref\hypergetpageref + }% +}{} +% \end{macrocode} +% \end{macro} +% +% \section{Package titlesec and titletoc support} +% +% This code is contributed by Javier Bezos +% (Email: \Email{jbezos@arrakis.es}). +% +% Package titlesec support: +% \begin{macrocode} +\@ifpackageloaded{titlesec}{% + \def\ttl@Hy@steplink#1{% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{#1*.\the\Hy@linkcounter}% + \def\ttl@Hy@saveanchor{% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + }% + }% + \def\ttl@Hy@refstepcounter#1{% + \let\ttl@b\Hy@raisedlink + \def\Hy@raisedlink##1{\def\ttl@Hy@saveanchor{\Hy@raisedlink{##1}}}% + \refstepcounter{#1}% + \let\Hy@raisedlink\ttl@b + }% +}{} +% \end{macrocode} +% +% Package titletoc support: +% \begin{macrocode} +\@ifpackageloaded{titletoc}{% + \def\ttl@gobblecontents#1#2#3#4{\ignorespaces}% +}{} +% \end{macrocode} +% +% \section{Package varioref support} +% +% Package nameref uses five arguments for the ref system. +% Fix provided by Felix Neubauer (\Email{felix.neubauer@gmx.net}). +% \begin{macrocode} +\@ifpackageloaded{varioref}{% + \def\vref@pagenum#1#2{% + \@ifundefined{r@#2}{% + \@namedef{r@#2}{{??}{??}{}{}{}}% + }{}% + \edef#1{\hypergetpageref{#2}}% + }% +}{} +% \end{macrocode} +% +% \section{Package longtable support} +% +% Sometimes the anchor of the longtable goes to the previous +% page. Thus the following patch separates the anchor setting +% and counter incrementation by hyperref's \verb|\refstepcounter| +% and the anchor setting is moved after \verb|\vskip\LTpre|. +% +% Patch of \cmd{\LT@array}: +% replace \cmd{\refstepcounter} by the original +% \cmd{\H@refstepcounter} without anchor generation +% \begin{macrocode} +\@ifpackageloaded{longtable}{% + \begingroup + \def\y{\LT@array}% + \@ifundefined{scr@LT@array}{}{\def\y{\scr@LT@array}}% + \long\def\x\refstepcounter#1#2\@sharp#3#4\@nil{% + \expandafter\endgroup + \expandafter\def\y[##1]##2{% + \H@refstepcounter{#1}% + \hyper@makecurrent{table}% + #2\@sharp#####4% + }% + }% + \expandafter\expandafter\expandafter\x\y[#1]{#2}\@nil +% \end{macrocode} +% Patch of \cmd{\LT@start}: +% add anchor before first line after \verb|\vskip\LTpre| +% \begin{macrocode} + \begingroup + \def\x#1\ifvoid\LT@firsthead\copy#2\@nil{% + \endgroup + \def\LT@start{% + #1% + \hyper@refstepcounter{table}% + \ifvoid\LT@firsthead\copy + #2% + }% + }% + \expandafter\x\LT@start\@nil +}{} +% \end{macrocode} +% +% \section{Equations}\label{equations} +% We want to make the whole equation a target anchor. +% Overload equation, temporarily reverting to original +% |\refstepcounter|. If, however, it is in AMS math, we do not +% do anything, as the tag mechanism is used there (see section \ref{ams}). +% The execption is that we move the equation incrementation inside +% the math environment to avoid specials outside and a wrong vertical +% spacing of equation environments. +% \begin{macrocode} +\let\new@refstepcounter\refstepcounter +\let\H@equation\equation +\let\H@endequation\endequation +% \end{macrocode} +% +% \begin{macrocode} +\@ifpackageloaded{amsmath}{% + \long\def\Hy@temp{% + \incr@eqnum + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% + }% + \ifx\Hy@temp\equation + \expandafter\ifx\csname if@fleqn\expandafter\endcsname + \csname iftrue\endcsname + \else + \long\def\equation{% + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% + \incr@eqnum + }% + \fi + \fi +}{% + \def\equation{% + \let\refstepcounter\H@refstepcounter + \H@equation + \make@stripped@name{\theequation}% + \let\theHequation\newname + \hyper@makecurrent{equation}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}}% + \let\refstepcounter\new@refstepcounter + }% + \def\endequation{\Hy@raisedlink{\hyper@anchorend}\H@endequation}% +} +% \end{macrocode} +% My goodness, why can't \LaTeX{} be consistent? Why is |\eqnarray| +% set up differently from other objects? +% +% People (you know who you are, Thomas Beuth) sometimes make +% an eqnarray where \emph{all} the lines end with |\notag|, +% so there is no suitable anchor at all. In this case, pass by +% on the other side. +% \begin{macrocode} +\newif\if@eqnstar +\@eqnstarfalse +\let\H@eqnarray\eqnarray +\let\H@endeqnarray\endeqnarray +\def\eqnarray{% + \let\Hy@reserved@a\relax + \def\@currentHref{}% + \H@eqnarray + \if@eqnstar + \else + \ifx\\\@currentHref\\% + \else + \make@stripped@name{\theequation}% + \let\theHequation\newname + \hyper@makecurrent{equation}% + \hyper@anchorstart{\@currentHref}{}\hyper@anchorend + \fi + \fi +} +\def\endeqnarray{% + \H@endeqnarray +} +% \end{macrocode} +% This is quite heavy-handed, but it works for now. If its an |eqnarray*| +% we need to disable the hyperref actions. There may well be a cleaner +% way to trap this. Bill Moss found this. +% \begin{macrocode} +\@namedef{eqnarray*}{% + \def\@eqncr{\nonumber\@seqncr}\@eqnstartrue\eqnarray +} +\@namedef{endeqnarray*}{% + \nonumber\endeqnarray\@eqnstarfalse +} +% \end{macrocode} +% Then again, we have the \emph{subeqnarray} +% package. Tanmoy provided some code for this: +% \begin{macrocode} +\@ifundefined{subeqnarray}{}{% + \let\H@subeqnarray\subeqnarray + \let\H@endsubeqnarray\endsubeqnarray + \def\subeqnarray{% + \let\Hy@reserved@a\relax + \H@subeqnarray + \make@stripped@name{\theequation}% + \let\theHequation\newname + \hyper@makecurrent{equation}% + \hyper@anchorstart{\@currentHref}{}\hyper@anchorend + }% + \def\endsubeqnarray{% + \H@endsubeqnarray + }% + \newcommand\theHsubequation{\theHequation\alph{subequation}}% +} +% \end{macrocode} +% The aim of this macro is to produce a sanitized version of +% its argument, to make it a safe label. +% \begin{macrocode} +\def\make@stripped@name#1{% + \begingroup + \escapechar\m@ne + \global\let\newname\@empty + \protected@edef\Hy@tempa{#1}% + \edef\@tempb{% + \noexpand\@tfor\noexpand\Hy@tempa:=% + \expandafter\strip@prefix\meaning\Hy@tempa + }% + \@tempb\do{% + \if{\Hy@tempa\else + \if}\Hy@tempa\else + \xdef\newname{\newname\Hy@tempa}% + \fi + \fi + }% + \endgroup +} +% \end{macrocode} +% +% \section{Footnotes}\label{footnotes} +% The footnote mark is a hypertext link, and the text is a target. +% We separately number the footnotes sequentially through the +% text, separately from whatever labels the text assigns. Too hard +% to keep track of markers otherwise. If the raw forms |\footnotemark| +% and |\footnotetext| are used, force them to use un-hyper original. +% +% Tabularx causes footnote problems, disable the linking if that is loaded. +% \begin{macrocode} +\@ifpackageloaded{tabularx}{\Hy@hyperfootnotesfalse}{} +\ifHy@hyperfootnotes + \newcounter{Hfootnote} + \let\H@@footnotetext\@footnotetext + \let\H@@footnotemark\@footnotemark + \def\@xfootnotenext[#1]{% + \begingroup + \csname c@\@mpfn\endcsname #1\relax + \unrestored@protected@xdef\@thefnmark{\thempfn}% + \endgroup + \ifx\@footnotetext\@mpfootnotetext + \expandafter\H@@mpfootnotetext + \else + \expandafter\H@@footnotetext + \fi + }% + \def\@xfootnotemark[#1]{% + \begingroup + \c@footnote #1\relax + \unrestored@protected@xdef\@thefnmark{\thefootnote}% + \endgroup + \H@@footnotemark + }% + \let\H@@mpfootnotetext\@mpfootnotetext + \long\def\@mpfootnotetext#1{% + \H@@mpfootnotetext{% + \ifHy@nesting + \hyper@@anchor{\Hy@footnote@currentHref}{#1}% + \else + \Hy@raisedlink{% + \hyper@@anchor{\Hy@footnote@currentHref}{\relax}% + }#1% + \fi + }% + }% + \long\def\@footnotetext#1{% + \H@@footnotetext{% + \ifHy@nesting + \hyper@@anchor{\Hy@footnote@currentHref}{#1}% + \else + \Hy@raisedlink{% + \hyper@@anchor{\Hy@footnote@currentHref}{\relax}% + }% + \let\@currentHlabel\Hy@footnote@currentHlabel + \let\@currentHref\Hy@footnote@currentHref + \let\@currentlabelname\@empty + #1% + \fi + }% + }% +% \end{macrocode} +% Redefine \verb+\@footnotemark+, borrowing its code (at the +% cost of getting out of sync with latex.ltx), to take +% advantage of its white space and hyphenation fudges. If we just +% overload it, we can get variant documents (the word before the +% footnote is treated differently). Thanks to David Carlisle and +% Brian Ripley for confusing and helping me on this. +% \begin{macrocode} + \def\@footnotemark{% + \leavevmode + \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi + \stepcounter{Hfootnote}% + \global\let\Hy@saved@currentHlabel\@currentHlabel + \global\let\Hy@saved@currentHref\@currentHref + \hyper@makecurrent{Hfootnote}% + \global\let\Hy@footnote@currentHlabel\@currentHlabel + \global\let\Hy@footnote@currentHref\@currentHref + \global\let\@currentHlabel\Hy@saved@currentHlabel + \global\let\@currentHref\Hy@saved@currentHref + \hyper@linkstart{link}{\Hy@footnote@currentHref}% + \@makefnmark + \hyper@linkend + \ifhmode\spacefactor\@x@sf\fi + \relax + }% +% \end{macrocode} +% +% Support for footnotes in p columns of longtable. +% Here \verb+\footnote+ commands are splitted into +% \verb+\footnotemark+ and a call of \verb+\footnotetext+ +% with the optional argument, that is not supported +% by hyperref. The result is a link by \verb+\footnotemark+ +% without valid anchor. +% +% \begin{macrocode} + \@ifpackageloaded{longtable}{% + \CheckCommand*{\LT@p@ftntext}[1]{% + \edef\@tempa{% + \the\LT@p@ftn + \noexpand\footnotetext[\the\c@footnote]% + }% + \global\LT@p@ftn\expandafter{\@tempa{#1}}% + }% + \long\def\LT@p@ftntext#1{% + \edef\@tempa{% + \the\LT@p@ftn + \begingroup + \noexpand\c@footnote=\the\c@footnote\relax + \noexpand\protected@xdef + \noexpand\@thefnmark{\noexpand\thempfn}% + \noexpand\protected@xdef\noexpand\@thefnmark{% + \noexpand\thempfn + }% + \expandafter\expandafter\expandafter\noexpand + \expandafter\expandafter\expandafter\Hy@LT@footnotetext + \expandafter\expandafter\expandafter{% + \expandafter\Hy@footnote@currentHref\expandafter + }\expandafter{\Hy@footnote@currentHlabel}% + }% + \global\LT@p@ftn\expandafter{% + \@tempa{#1}% + \endgroup + }% + }% + \long\def\Hy@LT@footnotetext#1#2#3{% + \H@@footnotetext{% + \ifHy@nesting + \hyper@@anchor{#1}{#3}% + \else + \Hy@raisedlink{% + \hyper@@anchor{#1}{\relax}% + }% + \def\@currentHlabel{#2}% + \def\@currentHref{#1}% + \let\@currentlabelname\@empty + #3% + \fi + }% + }% + }{}% +% \end{macrocode} +% +% But the special footnotes +% in |\maketitle| are much too hard to deal with +% properly. Let them revert to plain behaviour. +% The koma classes add an optional argument. +% \begin{macrocode} + \let\HyOrg@maketitle\maketitle + \def\maketitle{% + \let\Hy@saved@footnotemark\@footnotemark + \let\Hy@saved@footnotetext\@footnotetext + \let\@footnotemark\H@@footnotemark + \let\@footnotetext\H@@footnotetext + \@ifnextchar[\Hy@maketitle@optarg{% ] + \HyOrg@maketitle + \Hy@maketitle@end + }% + }% + \def\Hy@maketitle@optarg[#1]{% + \HyOrg@maketitle[{#1}]% + \Hy@maketitle@end + }% + \def\Hy@maketitle@end{% + \ifx\@footnotemark\H@@footnotemark + \let\@footnotemark\Hy@saved@footnotemark + \fi + \ifx\@footnotetext\H@@footnotetext + \let\@footnotetext\Hy@saved@footnotetext + \fi + }% +% \end{macrocode} +% \begin{macro}{\realfootnote} +% Does anyone remember the function and purpose of \cmd{\realfootnote}? +% \begin{macrocode} + \def\realfootnote{% + \@ifnextchar[\@xfootnote{% + \stepcounter{\@mpfn}% + \protected@xdef\@thefnmark{\thempfn}% + \H@@footnotemark\H@@footnotetext + }% + }% +% \end{macrocode} +% \begin{macrocode} +\fi +\Hy@DisableOption{hyperfootnotes} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +% +%<*check> +\checklatex +\checkcommand\def\@xfootnotenext[#1]{% + \begingroup + \csname c@\@mpfn\endcsname #1\relax + \unrestored@protected@xdef\@thefnmark{\thempfn}% + \endgroup + \@footnotetext +} +\checkcommand\def\@xfootnotemark[#1]{% + \begingroup + \c@footnote #1\relax + \unrestored@protected@xdef\@thefnmark{\thefootnote}% + \endgroup + \@footnotemark +} +\checkcommand\def\@footnotemark{% + \leavevmode + \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi + \@makefnmark + \ifhmode\spacefactor\@x@sf\fi + \relax +} +% +%<*package> +% \end{macrocode} +% +% \section{Float captions}\label{captions} +% Make the float caption the hypertext anchor; curiously enough, +% we can't just copy the definition of |\@caption|. Its all to do +% with expansion. It screws up. Sigh. +% \begin{macrocode} +\def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \H@refstepcounter\@captype + \@ifundefined{fst@\@captype}{% + \let\Hy@tempa\@caption + }{% + \let\Hy@tempa\Hy@float@caption + }% + \expandafter\@firstofone + \fi + {\@dblarg{\Hy@tempa\@captype}}% +} +\long\def\@caption#1[#2]#3{% + \hyper@makecurrent{\@captype}% + \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% + \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% + }% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@#1\endcsname}{% + \ignorespaces +% \end{macrocode} +% If we cannot have nesting, the anchor is empty. +% \begin{macrocode} + \ifHy@nesting + \hyper@@anchor{\@currentHref}{#3}% + \else + \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3% + \fi + }% + \par + \endgroup +} +% \end{macrocode} +% Compatibility with float.sty: anchor setting at the top +% of the float, if the float is controlled by float.sty. +% Several \verb|\caption| commands inside one float are +% not supported. +% \begin{macrocode} +\let\Hy@float@caption\@caption +\@ifpackageloaded{float}{% + \def\Hy@float@caption{% + \hyper@makecurrent{\@captype}% + \float@caption + } + \let\HyOrg@float@makebox\float@makebox + \renewcommand{\float@makebox}[1]{% + \HyOrg@float@makebox{% + #1\relax + \hyper@@anchor{\@currentHref}{\relax}% + }% + }% +}{} +% \end{macrocode} +% +% \begin{macrocode} +% +%<*check> +\checklatex[1999/06/01 - 2000/06/01] +\checkcommand\def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \expandafter\@firstofone + \fi + {\@dblarg{\@caption\@captype}}% +} +\checkcommand\long\def\@caption#1[#2]#3{% + \par + \addcontentsline{\csname ext@#1\endcsname}{#1}% + {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par + \endgroup +} +% +%<*package> +% \end{macrocode} +% +% \section{Bibliographic references}\label{bib} +% This is not very robust, since many styles redefine these things. +% The package used to redefine |\@citex| and the like; then we tried +% adding the hyperref call explicitly into the .aux file. +% Now we redefine |\bibcite|; this still breaks some citation packages +% so we have to work around them. But this remains extremely dangerous. +% Any or all of \emph{achemso}, \emph{chapterbib}, +% and \emph{drftcite} may break. +% +% However, lets make an attempt to get \emph{natbib} right, because +% thats a powerful, important package. +% Patrick Daly (\Email{daly@linmpi.mpg.de}) has +% provided hooks for us, so all we need to do is activate them. +% \begin{macrocode} +\def\hyper@natlinkstart#1{% + \Hy@backout{#1}% + \hyper@linkstart{cite}{cite.#1}% + \def\hyper@nat@current{#1}% +} +\def\hyper@natlinkend{% + \hyper@linkend +} +\def\hyper@natlinkbreak#1#2{% + \hyper@linkend#1\hyper@linkstart{cite}{cite.#2}% +} +\def\hyper@natanchorstart#1{% + \Hy@raisedlink{\hyper@anchorstart{cite.#1}}% +} +\def\hyper@natanchorend{\hyper@anchorend} +% \end{macrocode} +% Do not play games if we have natbib support. +% Macro \@extra@binfo added for chapterbib support. +% \begin{macrocode} +\@ifundefined{NAT@parse}{% + \def\bibcite#1#2{% + \@newl@bel{b}{#1\@extra@binfo}{\hyper@@link[cite]{}{cite.#1}{#2}}% + }% + \gdef\@extra@binfo{}% +% \end{macrocode} +% Package |babel| redefines \cmd{\bibcite} with +% macro \cmd{\bbl@cite@choice}. It needs to be overwritten +% to avoid the warning ``Label(s) may have changed.''. +% \begin{macrocode} + \let\Hy@bibcite\bibcite + \begingroup + \@ifundefined{bbl@cite@choice}{}{% + \g@addto@macro\bbl@cite@choice{% + \let\bibcite\Hy@bibcite + }% + }% + \endgroup +% \end{macrocode} +% \begin{macrocode} +% |\@BIBLABEL| is working around a `feature' of Rev\TeX. +% \begin{macrocode} + \providecommand*{\@BIBLABEL}{\@biblabel}% + \def\@lbibitem[#1]#2{% + \@skiphyperreftrue + \H@item[% + \ifx\Hy@raisedlink\@empty + \hyper@anchorstart{cite.#2}\@BIBLABEL{#1}\hyper@anchorend + \else + \Hy@raisedlink{\hyper@anchorstart{cite.#2}\hyper@anchorend}% + \@BIBLABEL{#1}% + \fi + \hfill + ]% + \@skiphyperreffalse + \if@filesw + \begingroup + \let\protect\noexpand + \immediate\write\@auxout{% + \string\bibcite{#2}{#1}% + }% + \endgroup + \fi + \ignorespaces + }% +% \end{macrocode} +% Since |\bibitem| is doing its own labelling, call the raw +% version of |\item|, to avoid extra spurious labels +% \begin{macrocode} + \def\@bibitem#1{% + \@skiphyperreftrue\H@item\@skiphyperreffalse + \Hy@raisedlink{\hyper@anchorstart{cite.#1}\relax\hyper@anchorend}% + \if@filesw + \begingroup + \let\protect\noexpand + \immediate\write\@auxout{% + \string\bibcite{#1}{\the\value{\@listctr}}% + }% + \endgroup + \fi + \ignorespaces + }% +}{} +% \end{macrocode} +% +% \begin{macrocode} +% +%<*check> +\checklatex +\checkcommand\def\@lbibitem[#1]#2{% + \item[\@biblabel{#1}\hfill]% + \if@filesw + {% + \let\protect\noexpand + \immediate\write\@auxout{% + \string\bibcite{#2}{#1}% + }% + }% + \fi + \ignorespaces +} +\checkcommand\def\@bibitem#1{% + \item + \if@filesw + \immediate\write\@auxout{% + \string\bibcite{#1}{\the\value{\@listctr}}% + }% + \fi + \ignorespaces +} +% +%<*package> +% \end{macrocode} +% +% Revtex (bless its little heart) takes over |\bibcite| and looks +% at the result to measure something. Make this a hypertext link +% and it goes ape. Therefore, make an anodyne result first, call +% its business, then go back to the real thing. +% \begin{macrocode} +\@ifclassloaded{revtex}{% + \Hy@Info{*** compatibility with revtex **** }% + \def\revtex@checking#1#2{% + \expandafter\let\expandafter\T@temp\csname b@#1\endcsname + \expandafter\def\csname b@#1\endcsname{#2}% + \@SetMaxRnhefLabel{#1}% + \expandafter\let\csname b@#1\endcsname\T@temp + }% +% \end{macrocode} +% Tanmoy provided this replacement for CITEX. Lord knows what it does. +% For chapterbib added: \@extra@b@citeb +% \begin{macrocode} + \@ifundefined{@CITE}{\def\@CITE{\@cite}}{}% + \providecommand*{\@extra@b@citeb}{}% + \def\@CITEX[#1]#2{% + \let\@citea\@empty + \leavevmode + \unskip + $^{% + \scriptstyle + \@CITE{% + \@for\@citeb:=#2\do{% + \@citea + \def\@citea{,\penalty\@m\ }% + \edef\@citeb{\expandafter\@firstofone\@citeb}% + \if@filesw + \immediate\write\@auxout{\string\citation{\@citeb}}% + \fi + \@ifundefined{b@\@citeb\extra@b@citeb}{% + \mbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning{% + Citation `\@citeb' on page \thepage \space undefined% + }% + }{% + {\csname b@\@citeb\@extra@b@citeb\endcsname}% + }% + }% + }{#1}% + }$% + }% +% \end{macrocode} +% No, life is too short. I am not going to understand the +% Revtex |\@collapse| macro, I shall +% just restore the original behaviour of |\@citex|; +% sigh. This is SO vile. +% \begin{macrocode} + \def\@citex[#1]#2{% + \let\@citea\@empty + \@cite{% + \@for\@citeb:=#2\do{% + \@citea + \def\@citea{,\penalty\@m\ }% + \edef\@citeb{\expandafter\@firstofone\@citeb}% + \if@filesw + \immediate\write\@auxout{\string\citation{\@citeb}}% + \fi + \@ifundefined{b@\@citeb\@extra@b@citeb}{% + \mbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning{% + Citation `\@citeb' on page \thepage \space undefined% + }% + }{% + \hbox{\csname b@\@citeb\@extra@b@citeb\endcsname}% + }% + }% + }{#1}% + }% +}{} +% \end{macrocode} +% +% \subsection{Package harvard} +% +% Override Peter Williams' Harvard package; we have to +% a) make each of the citation types into a link; b) make +% each citation write a backref entry, and c) kick off a backreference +% section for each bibliography entry. +% +% The redefinitions have to be deferred to |\begin{document}|, +% because if harvard.sty is loaded and html.sty is present and +% detects pdf\TeX, then hyperref is already loaded at the begin +% of harvard.sty, and the |\newcommand| macros causes error +% messages. +% \begin{macrocode} +\@ifpackageloaded{harvard}{% + \AtBeginDocument{% + \Hy@Info{*** compatibility with harvard **** }% + \Hy@raiselinksfalse + \def\harvardcite#1#2#3#4{% + \global\@namedef{HAR@fn@#1}{\hyper@@link[cite]{}{cite.#1}{#2}}% + \global\@namedef{HAR@an@#1}{\hyper@@link[cite]{}{cite.#1}{#3}}% + \global\@namedef{HAR@yr@#1}{\hyper@@link[cite]{}{cite.#1}{#4}}% + \global\@namedef{HAR@df@#1}{\csname HAR@fn@#1\endcsname}% + }% + \def\HAR@citetoaux#1{% + \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi% + \ifHy@backref + \ifx\@empty\@currentlabel + \else + \@bsphack + \protected@write\@auxout{}{% + \string\@writefile{brf}{% + \string\backcite{#1}{% + {\thepage}{\@currentlabel}{\@currentHref}% + }% + }% + }% + \@esphack + \fi + \fi + }% + \def\harvarditem{% + \@ifnextchar[{\@harvarditem}{\@harvarditem[\null]}% + }% + \def\@harvarditem[#1]#2#3#4#5\par{% + \item[]% + \hyper@anchorstart{cite.#4}\relax\hyper@anchorend + \if@filesw + \begingroup + \def\protect##1{\string ##1\space}% + \ifthenelse{\equal{#1}{\null}}% + {\def\next{{#4}{#2}{#2}{#3}}}% + {\def\next{{#4}{#2}{#1}{#3}}}% + \immediate\write\@auxout{\string\harvardcite\codeof\next}% + \endgroup + \fi + \protect\hspace*{-\labelwidth}% + \protect\hspace*{-\labelsep}% + \ignorespaces + #5% + \ifHy@backref + \newblock + \backref{\csname br@#4\endcsname}% + \fi + \par + }% +% \end{macrocode} +% \begin{macro}{\HAR@checkcitations} +% Package hyperref has added \cmd{\hyper@@link}, so +% the original test \cmd{\HAR@checkcitations} will +% fail every time and always will appear the ``Changed +% labels'' warning. So we have to redefine +% \cmd{\Har@checkcitations}: +% \begin{macrocode} + \long\def\HAR@checkcitations#1#2#3#4{% + \def\HAR@tempa{\hyper@@link[cite]{}{cite.#1}{#2}}% + \expandafter\ifx\csname HAR@fn@#1\endcsname\HAR@tempa + \def\HAR@tempa{\hyper@@link[cite]{}{cite.#1}{#3}}% + \expandafter\ifx\csname HAR@an@#1\endcsname\HAR@tempa + \def\HAR@tempa{\hyper@@link[cite]{}{cite.#1}{#4}}% + \expandafter\ifx\csname HAR@yr@#1\endcsname\HAR@tempa + \else + \@tempswatrue + \fi + \else + \@tempswatrue + \fi + \else + \@tempswatrue + \fi + }% + }% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{Package chicago} +% The links by \cmd{\citeN} and \cmd{\shortciteN} should +% include the closing parentheses. +% +% \begin{macrocode} +\@ifpackageloaded{chicago}{% +% \end{macrocode} +% \begin{macro}{\citeN} +% \begin{macrocode} + \def\citeN{% + \def\@citeseppen{-1000}% + \def\@cite##1##2{##1}% + \def\citeauthoryear##1##2##3{##1 (##3\@cite@opt)}% + \@citedata@opt + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\shortciteN} +% \begin{macrocode} + \def\shortciteN{% + \def\@citeseppen{-1000}% + \def\@cite##1##2{##1}% + \def\citeauthoryear##1##2##3{##2 (##3\@cite@opt)}% + \@citedata@opt + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@citedata@opt} +% \begin{macrocode} + \def\@citedata@opt{% + \let\@cite@opt\@empty + \@ifnextchar [{% + \@tempswatrue + \@citedatax@opt + }{% + \@tempswafalse + \@citedatax[]% + }% + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@citedatax@opt} +% \begin{macrocode} + \def\@citedatax@opt[#1]{% + \def\@cite@opt{, #1}% + \@citedatax[{#1}]% + } +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \section{Page numbers}\label{pagenum} +% Give every page an automatic number anchor. This involves, sigh, +% overloading \LaTeX's output bits and pieces, which must be dangerous. +% This used to be |\@shipoutsetup|, now |\@begindvi|. We cannot even +% overload this, as it sets itself to null. SIGH. +% \begin{macrocode} +\def\@begindvi{% + \unvbox \@begindvibox + \Hy@begindvi + \global\let\@begindvi\Hy@begindvi +} +\def\Hy@begindvi{% + \ifHy@pageanchor + \@hyperfixhead + \fi + \HyPL@EveryPage +} +\def\pagenumbering#1{% + \global\c@page \@ne + \gdef\thepage{\csname @#1\endcsname\c@page}% +} +% \end{macrocode} +% This is needed for some unremembered reason\ldots +% \begin{macrocode} +\let\HYPERPAGEANCHOR\hyperpageanchor +% \end{macrocode} +% +% Macro \cmd{\@hyperfixhead} calls \cmd{\hyper@pagetransition} +% and \cmd{\hyper@pageduration}. Therefore empty definitions +% are provided for drivers that do not define these macros. +% +% The last page should not contain a /Dur key, because there +% is no page after the last page. Therefore at the last page +% there should be a command |\hypersetup{pdfpageduration={}}|. +% This can be set with \cmd{\AtEndDocument}, but it can +% be too late, if the last page is already finished, or too +% early, if lots of float pages will follow. +% Therefore currently nothing is done by hyperref. +% \begin{macrocode} +\providecommand\hyper@pagetransition{} +\providecommand\hyper@pageduration{} +\providecommand\hyper@pagehidden{} +% \end{macrocode} +% +% This where we supply a destination for each page. Test to see +% if there is some sort of header. The test used to be +% |\expandafter\ifx\expandafter\@empty\H@old@thehead|. +% \begin{macro}{\@hyperfixhead} +% \begin{macrocode} +\def\@hyperfixhead{% + \Hy@DistillerDestFix + \ifHy@hypertexnames + \ifHy@plainpages + \gdef\Hy@TempPageAnchor{\hyper@@anchor{page.\the\c@page}}% + \else + \begingroup + \let\@number\@firstofone + \let\textlatin\@firstofone + \xdef\@the@H@page{\thepage}% + \endgroup + \gdef\Hy@TempPageAnchor{\hyper@@anchor{page.\@the@H@page}}% + \fi + \else + \Hy@GlobalStepCount\Hy@pagecounter + \gdef\Hy@TempPageAnchor{\hyper@@anchor{page.\the\Hy@pagecounter}}% + \fi + \let\H@old@thehead\@thehead + \if^\@thehead^% + \def\H@old@thehead{\hfil}% + \fi + \ifHy@texht + \def\@thehead{}% + \else + \ifHy@seminarslides + \begingroup + \let\leavevmode\relax + \Hy@TempPageAnchor\relax + \hyper@pagetransition + \hyper@pageduration + \hyper@pagehidden + \endgroup + \else + \def\@thehead{% + \Hy@TempPageAnchor\relax + \hyper@pagetransition + \hyper@pageduration + \hyper@pagehidden + \H@old@thehead + }% + \fi + \fi + \ifx\PDF@FinishDoc\@empty + \else + \PDF@FinishDoc + \gdef\PDF@FinishDoc{}% + \fi +} +% \end{macrocode} +% \end{macro} +% +%\section{Table of contents}\label{toc} +% TV Raman noticed that people who add arbitrary material into the TOC +% generate a bad or null link. We avoid that by checking if the current +% destination is empty. But if `the most recent destination' is not +% what you expect, you will be in trouble. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname chapter\endcsname\relax + \def\toclevel@part{0} +\else + \def\toclevel@part{-1} +\fi +\def\toclevel@chapter{0} +\def\toclevel@section{1} +\def\toclevel@subsection{2} +\def\toclevel@subsubsection{3} +\def\toclevel@paragraph{4} +\def\toclevel@subparagraph{5} +\def\toclevel@figure{0} +\def\toclevel@table{0} +\@ifpackageloaded{listings}{% + \def\theHlstlisting{\thelstlisting}% + \def\toclevel@lstlisting{0}% +}{} +\@ifpackageloaded{listing}{% + \def\theHlisting{\thelisting}% + \def\toclevel@listing{0}% +}{} +\def\addcontentsline#1#2#3{% toc extension, type, tag + \begingroup + \let\label\@gobble + \let\textlatin\@firstofone + \ifx\@currentHref\@empty + \Hy@Warning{% + No destination for bookmark of \string\addcontentsline,% + \MessageBreak destination is added% + }% + \phantomsection + \fi + \expandafter\ifx\csname toclevel@#2\endcsname\relax + \begingroup + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\Hy@bookmarkstype + \Hy@WarningNoLine{bookmark level for unknown #2 defaults to 0}% + \else + \Hy@Info{bookmark level for unknown #2 defaults to 0}% + \fi + \endgroup + \expandafter\gdef\csname toclevel@#2\endcsname{0}% + \fi + \edef\Hy@toclevel{\csname toclevel@#2\endcsname}% + \Hy@writebookmark{\csname the#2\endcsname}% + {#3}% + {\@currentHref}% + {\Hy@toclevel}% + {#1}% + \ifHy@verbose + \typeout{pdftex: bookmark at \the\inputlineno: + {\csname the#2\endcsname} + {#3} + {\@currentHref}% + {\Hy@toclevel}% + {#1}% + }% + \fi + \addtocontents{#1}{% + \protect\contentsline{#2}{#3}{\thepage}{\@currentHref}% + }% + \endgroup +} +\def\contentsline#1#2#3#4{% + \ifx\\#4\\% + \csname l@#1\endcsname{#2}{#3}% + \else + \ifHy@linktocpage + \csname l@#1\endcsname{{#2}}{% + \hyper@linkstart{link}{#4}{#3}\hyper@linkend + }% + \else + \csname l@#1\endcsname{% + \hyper@linkstart{link}{#4}{#2}\hyper@linkend + }{#3}% + \fi + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +% +%<*check> +\checklatex +\checkcommand\def\addcontentsline#1#2#3{% + \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}% +} +\checkcommand\def\contentsline#1{\csname l@#1\endcsname} +% +%<*package> +% \end{macrocode} +% +% \section{New counters}\label{counters} +% The whole theorem business makes up new counters on the fly; +% we are going to intercept this. Sigh. Do it at the level where +% new counters are defined. +% \begin{macrocode} +\let\H@definecounter\@definecounter +\def\@definecounter#1{% + \H@definecounter{#1}% + \expandafter\def\csname theH#1\endcsname{\arabic{#1}}% +} +% \end{macrocode} +% But what if they have used the optional argument to e.g. |\newtheorem| +% to determine when the numbering is reset? OK, we'll trap that too. +% \begin{macrocode} +\let\H@newctr\@newctr +\def\@newctr#1[#2]{% + \H@newctr#1[{#2}]% + \expandafter\def\csname theH#1\endcsname{% + \csname the\@ifundefined{theH#2}{}{H}#2\endcsname.\arabic{#1}% + }% +} +% \end{macrocode} +% \section{AMS\LaTeX\ compatibility}\label{ams} +% Oh, no, they don't use anything as simple as |\refstepcounter| +% in the AMS! We need to intercept some low-level operations +% of theirs. Damned if we are going to try and work out what +% they get up to. Just stick a label of `AMS' on the front, and use the +% label \emph{they} worked out. If that produces something invalid, I give +% up. They'll change all the code again anyway, I expect. +% \begin{macrocode} +\let\Hmake@df@tag@@\make@df@tag@@ +\def\make@df@tag@@#1{% + \Hmake@df@tag@@{#1}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{AMS.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% +} +\let\Hmake@df@tag@@@\make@df@tag@@@ +\def\make@df@tag@@@#1{% + \Hmake@df@tag@@@{#1}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{AMS.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% +} +% \end{macrocode} +% Only play with |\seteqlebal| if we are using pdftex. Other drivers +% cause problems; requested by Michael Downes (AMS). +% \begin{macrocode} +\@ifpackagewith{hyperref}{pdftex}{% + \let\H@seteqlabel\@seteqlabel + \def\@seteqlabel#1{% + \H@seteqlabel{#1}% + \xdef\@currentHref{AMS.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + }% +}{} +% \end{macrocode} +% This code I simply cannot remember what I was trying to achieve. +% The final result seems to do nothing anyway. +%\begin{verbatim} +%\let\H@tagform@\tagform@ +%\def\tagform@#1{% +% \maketag@@@{\hyper@@anchor{\@currentHref}% +% {(\ignorespaces#1\unskip)}}% +%} +%\def\eqref#1{\textup{\H@tagform@{\ref{#1}}}} +%\end{verbatim} +% +% \subsection{\texorpdfstring{\cs{@addtoreset}}{\\@addtoreset} and +% \texorpdfstring{\cs{numberwithin}}{\\numberwithin} patches} +% +% \cs{@addtoreset} puts a counter to the reset list of +% another counter. After a reset the counter starts +% again with perhaps already used values. Therefore +% the hyperref version of the counter print command +% \cs{theHcounter} is redefined in order to add the +% parent counter. +% \begin{macrocode} +\let\HyOrg@addtoreset\@addtoreset +\def\@addtoreset#1#2{% + \HyOrg@addtoreset{#1}{#2}% + \expandafter\xdef\csname theH#1\endcsname{% + \expandafter\noexpand + \csname the\@ifundefined{theH#2}{}H#2\endcsname + .\noexpand\the\noexpand\value{#1}% + }% +} +% \end{macrocode} +% +% \begin{macro}{\numberwithin} +% A appropiate definition of hyperref's companion counter +% (\cmd{\theH...}) is added for correct link names. +% \begin{macrocode} +% +%<*check> +\checkpackage{amsmath}[1999/12/14 - 2000/06/06] +\checkcommand\newcommand{\numberwithin}[3][\arabic]{% + \@ifundefined{c@#2}{\@nocounterr{#2}}{% + \@ifundefined{c@#3}{\@nocnterr{#3}}{% + \@addtoreset{#2}{#3}% + \@xp\xdef\csname the#2\endcsname{% + \@xp\@nx\csname the#3\endcsname .\@nx#1{#2}% + }% + }% + }% +}% +% +%<*package> +\@ifpackageloaded{amsmath}{% + \@ifpackagelater{amsmath}{1999/12/14}{% + \renewcommand*{\numberwithin}[3][\arabic]{% + \@ifundefined{c@#2}{\@nocounterr{#2}}{% + \@ifundefined{c@#3}{\@nocnterr{#3}}{% + \HyOrg@addtoreset{#2}{#3}% + \@xp\xdef\csname the#2\endcsname{% + \@xp\@nx\csname the#3\endcsname .\@nx#1{#2}% + }% + \@xp\xdef\csname theH#2\endcsname{% + \@xp\@nx + \csname the\@ifundefined{theH#3}{}H#3\endcsname + .\@nx#1{#2}% + }% + }% + }% + }% + }{% + \Hy@WarningNoLine{% + \string\numberwithin\space of package `amsmath' + only fixed\MessageBreak + for version 2000/06/06 v2.12 or newer% + }% + } +}{} +% \end{macrocode} +% \end{macro} +% +% \section{Included figures} +% Simply intercept the low level graphics package macro. +% \begin{macrocode} +\ifHy@figures + \let\Hy@Gin@setfile\Gin@setfile + \def\Gin@setfile#1#2#3{% + \hyperimage{#3}{\Hy@Gin@setfile{#1}{#2}{#3}}% + } +\fi +\Hy@DisableOption{hyperfigures} +% \end{macrocode} +% +% \section{hyperindex entries}\label{hyperindex} +% Internal command names are prefixed with \cmd{\HyInd@}. +% +% Hyper-indexing works crudely, by forcing code onto the end of the index +% entry with the \verb+|+ feature; this puts a hyperlink around +% the printed page numbers. It will not proceed if the author has already +% used the \verb+|+ specifier for something like emboldening entries. +% That would make Makeindex fail (cannot have two \verb+|+ specifiers). +% The solution is for the author to use generic coding, and put in +% the requisite |\hyperpage| in his/her own macros along with the boldness. +% +% This section is poor stuff; it's open to all sorts of abuse. Sensible +% large projects will design their own indexing macros any bypass this. +% \begin{macrocode} +\ifHy@hyperindex + \def\HyInd@ParenLeft{(}% + \def\HyInd@ParenRight{)}% + \Hy@nextfalse + \@ifpackageloaded{multind}{\Hy@nexttrue}{}% + \@ifpackageloaded{index}{\Hy@nexttrue}{}% + \begingroup + \lccode`\|=\expandafter`\HyInd@EncapChar\relax + \lowercase{\endgroup + \ifHy@next + \let\HyInd@org@wrindex\@wrindex + \def\@wrindex#1#2{\HyInd@@wrindex{#1}#2||\\}% + \def\HyInd@@wrindex#1#2|#3|#4\\{% + \ifx\\#3\\% + \HyInd@org@wrindex{#1}{#2|hyperpage}% + \else + \def\Hy@temp@A{#3}% + \ifcase0\ifx\Hy@temp@A\HyInd@ParenLeft 1\fi + \ifx\Hy@temp@A\HyInd@ParenRight 1\fi + \relax + \HyInd@org@wrindex{#1}{#2|#3}% + \else + \HyInd@org@wrindex{#1}{#2|#3hyperpage}% + \fi + \fi + }% + \else + \def\@wrindex#1{\@@wrindex#1||\\} + \def\@@wrindex#1|#2|#3\\{% + \ifx\\#2\\% + \protected@write\@indexfile{}{% + \string\indexentry{#1|hyperpage}{\thepage}% + }% + \else + \def\Hy@temp@A{#2}% + \ifcase0\ifx\Hy@temp@A\HyInd@ParenLeft 1\fi + \ifx\Hy@temp@A\HyInd@ParenRight 1\fi + \relax + \protected@write\@indexfile{}{% + \string\indexentry{#1|#2}{\thepage}% + }% + \else + \protected@write\@indexfile{}{% + \string\indexentry{#1|#2hyperpage}{\thepage}% + }% + \fi + \fi + \endgroup + \@esphack + }% + \fi + }% +\fi +\Hy@DisableOption{hyperindex} +\Hy@DisableOption{encap} +% \end{macrocode} +% This again is quite flaky, but allow for the common situation of a +% page range separated by en-rule. We split this into two different +% hyperlinked pages. +% \begin{macrocode} +\def\hyperpage#1{\@hyperpage#1----\\} +\def\@hyperpage#1--#2--#3\\{% + \ifx\\#2\\% + \@commahyperpage{#1}% + \else + \HyInd@pagelink{#1}--\HyInd@pagelink{#2}% + \fi +} +\def\@commahyperpage#1{\@@commahyperpage#1, ,\\} +\def\@@commahyperpage#1, #2,#3\\{% + \ifx\\#2\\% + \HyInd@pagelink{#1}% + \else + \HyInd@pagelink{#1}, \HyInd@pagelink{#2}% + \fi +} +% \end{macrocode} +% +% The argument of \cmd{\hyperpage} can be empty. And the +% line breaking algorithm of Makeindex can introduce spaces. +% So we have to remove them. +% \begin{macrocode} +\def\HyInd@pagelink#1{% + \begingroup + \toks@={}% + \HyInd@removespaces#1 \@nil + \endgroup +} +\def\HyInd@removespaces#1 #2\@nil{% + \toks@=\expandafter{\the\toks@#1}% + \ifx\\#2\\% + \edef\x{\the\toks@}% + \ifx\x\@empty + \else + \hyperlink{page.\the\toks@}{\the\toks@}% + \fi + \else + \Hy@ReturnAfterFi{% + \HyInd@removespaces#2\@nil + }% + \fi +} +% \end{macrocode} +% +% \section{Compatibility with foiltex} +% +% \begin{macrocode} +\@ifclassloaded{foils}{% + \providecommand*\ext@table{lot}% + \providecommand*\ext@figure{lof}% +}{} +% \end{macrocode} +% +% \section{Compatibility with seminar slide package}\label{seminar} +% This requires \texttt{seminar.bg2}, version 1.6 or later. +% Contributions by Denis Girou (\Email{denis.girou@idris.fr}). +% \begin{macrocode} +\@ifclassloaded{seminar}{% + \Hy@seminarslidestrue\newcommand\theHslide{\arabic{slide}}% +}{% + \Hy@seminarslidesfalse +} +\@ifpackageloaded{slidesec}{% + \newcommand\theHslidesection {\arabic{slidesection}}% + \newcommand\theHslidesubsection{% + \theHslidesection.\arabic{slidesubsection}% + }% + \def\slide@heading[#1]#2{% + \H@refstepcounter{slidesection}% + \@addtoreset{slidesubsection}{slidesection}% + \addtocontents{los}{% + \protect\l@slide{\the\c@slidesection}{\ignorespaces#1}% + {\@SCTR}{slideheading.\theslidesection}% + }% + \def\Hy@tempa{#2}% + \ifx\Hy@tempa\@empty + \else + {% + \edef\@currentlabel{% + \csname p@slidesection\endcsname\theslidesection + }% + \makeslideheading{#2}% + }% + \fi + \gdef\theslideheading{#1}% + \gdef\theslidesubheading{}% + \ifHy@bookmarksnumbered + \def\Hy@slidetitle{\theslidesection\space #1}% + \else + \def\Hy@slidetitle{#1}% + \fi + \ifHy@hypertexnames + \ifHy@naturalnames + \hyper@@anchor{slideheading.\theslidesection}{\relax}% + \Hy@writebookmark + {\theslidesection}% + {\Hy@slidetitle}% + {slideheading.\theslidesection}% + {1}% + {toc}% + \else + \hyper@@anchor{slideheading.\theHslidesection}{\relax}% + \Hy@writebookmark + {\theslidesection}% + {\Hy@slidetitle}% + {slideheading.\theHslidesection}% + {1}% + {toc}% + \fi + \else + \Hy@GlobalStepCount\Hy@linkcounter + \hyper@@anchor{slideheading.\the\Hy@linkcounter}{\relax}% + \Hy@writebookmark + {\theslidesection}% + {\Hy@slidetitle}% + {slideheading.\the\Hy@linkcounter}% + {1}% + {toc}% + \fi + }% + \def\slide@subheading[#1]#2{% + \H@refstepcounter{slidesubsection}% + \addtocontents{los}{% + \protect\l@subslide{\the\c@slidesubsection}{\ignorespaces#1}% + {\@SCTR}{slideheading.\theslidesubsection}% + }% + \def\Hy@tempa{#2}% + \ifx\Hy@tempa\@empty + \else + {% + \edef\@currentlabel{% + \csname p@slidesubsection\endcsname\theslidesubsection + }% + \makeslidesubheading{#2}% + }% + \fi + \gdef\theslidesubheading{#1}% + \ifHy@bookmarksnumbered + \def\Hy@slidetitle{\theslidesubsection\space #1}% + \else + \def\Hy@slidetitle{#1}% + \fi + \ifHy@hypertexnames + \ifHy@naturalnames + \hyper@@anchor{slideheading.\theslidesubsection}{\relax}% + \Hy@writebookmark + {\theslidesubsection}% + {\Hy@slidetitle}% + {slideheading.\theslidesubsection}% + {2}% + {toc}% + \else + \hyper@@anchor{slideheading.\theHslidesubsection}{\relax}% + \Hy@writebookmark + {\theslidesubsection}% + {\Hy@slidetitle}% + {slideheading.\theHslidesubsection}% + {2}% + {toc}% + \fi + \else + \Hy@GlobalStepCount\Hy@linkcounter + \hyper@@anchor{slideheading.\the\Hy@linkcounter}{\relax}% + \Hy@writebookmark + {\theslidesubsection}% + {\Hy@slidetitle}% + {slideheading.\the\Hy@linkcounter}% + {1}% + {toc}% + \fi + }% + \providecommand*{\listslidename}{List of Slides}% + \def\listofslides{% + \section*{% + \listslidename + \@mkboth{% + \expandafter\MakeUppercase\listslidename + }{% + \expandafter\MakeUppercase\listslidename + }% + }% + \def\l@slide##1##2##3##4{% + \slide@undottedcline{% + \slidenumberline{##3}{\hyperlink{##4}{##2}}% + }{}% + }% + \let\l@subslide\l@slide + \@startlos + }% + \def\slide@contents{% + \def\l@slide##1##2##3##4{% + \slide@cline{\slidenumberline{##3}{\hyperlink{##4}{##2}}}{##3}% + }% + \let\l@subslide\@gobblefour + \@startlos + }% + \def\Slide@contents{% + \def\l@slide##1##2##3##4{% + \ifcase\lslide@flag + \message{##1 ** \the\c@slidesection}% + \ifnum##1>\c@slidesection + \def\lslide@flag{1}% + {% + \large + \slide@cline{% + \slidenumberline{$\Rightarrow\bullet$}% + {\hyperlink{##4}{##2}}% + }{##3}% + }% + \else + {% + \large + \slide@cline{% + \slidenumberline{$\surd\;\bullet$}% + {\hyperlink{##4}{##2}}% + }{##3}% + }% + \fi + \or + \def\lslide@flag{2}% + {% + \large + \slide@cline{% + \slidenumberline{$\bullet$}% + {\hyperlink{##4}{##2}}% + }{##3}% + }% + \or + {% + \large + \slide@cline{% + \slidenumberline{$\bullet$}% + {\hyperlink{##4}{##2}}% + }{##3}% + }% + \fi + }% + \def\l@subslide##1##2##3##4{% + \ifnum\lslide@flag=1 + \@undottedtocline{2}{3.8em}{3.2em}{\hyperlink{##4}{##2}}{}% + \fi + }% + \def\lslide@flag{0}% + \@startlos + }% +}{} +% \end{macrocode} +% This breaks TeX4ht, so leave it to last. +% Emend |\@setref| to put out a hypertext link as well as its +% normal text (which is used as an anchor). +% (|\endinput| have to be on the same line like |\fi|, or you +% have to use |\expandafter| before.) +% \begin{macrocode} +\ifHy@texht + \expandafter\endinput +\fi +\let\real@setref\@setref +\def\@setref#1#2#3{% csname, extract group, refname + \ifx#1\relax + \protect\G@refundefinedtrue + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{% + Reference `#3' on page \thepage \space undefined% + }% + \else + \expandafter\Hy@setref@link#1\@empty\@empty\@nil{#2}% + \fi +} +% \end{macrocode} +% \cmd{\Hy@setref@link} extracts the reference information entries, +% because \cmd{\hyper@@link} does not expand arguments for the +% automatic link type detection. +% \begin{macrocode} +\def\Hy@setref@link#1#2#3#4#5#6\@nil#7{% + \begingroup + \toks0={\hyper@@link{#5}{#4}}% + \toks1=\expandafter{#7{#1}{#2}{#3}{#4}{#5}}% + \edef\x{\endgroup + \the\toks0 {\the\toks1 }% + }% + \x +} +\def\@pagesetref#1#2#3{% csname, extract macro, ref + \ifx#1\relax + \protect\G@refundefinedtrue + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{% + Reference `#3' on page \thepage \space undefined% + }% + \else + \protect\hyper@@link + {\expandafter\@fifthoffive#1}% + {page.\expandafter\@secondoffive#1}% + {\expandafter\@secondoffive#1}% + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +% +%<*check> +\checklatex +\checkcommand\def\@setref#1#2#3{% + \ifx#1\relax + \protect\G@refundefinedtrue + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{% + Reference `#3' on page \thepage\space undefined% + }% + \else + \expandafter#2#1\null + \fi +} +% +%<*package> +% \end{macrocode} +% +% Now some extended referencing. |\ref*| and |\pageref*| are not linked, +% and |\autoref| prefixes with a tag based on the type. +% \begin{macrocode} +\def\@refstar#1{% + \@safe@activestrue + \expandafter\real@setref\csname r@#1\endcsname\@firstoffive{#1}% + \@safe@activesfalse +} +\def\@pagerefstar#1{% + \@safe@activestrue + \expandafter\real@setref\csname r@#1\endcsname\@secondoffive{#1}% + \@safe@activesfalse +} +\DeclareRobustCommand\autoref[1]{% + \@safe@activestrue + \expandafter\auto@setref\csname r@#1\endcsname\@firstoffive{#1}% + \@safe@activesfalse +} +\def\auto@setref#1#2#3{% csname, extract group, refname + \ifx#1\relax + \protect\G@refundefinedtrue + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{% + Reference `#3' on page \thepage \space undefined% + }% + \else + \edef\@thisref{\expandafter\@fourthoffive#1\@empty\@empty}% + \expandafter\test@reftype\@thisref\\% + \hyper@@link + {\expandafter\@fifthoffive#1}% + {\expandafter\@fourthoffive#1\@empty\@empty}% + {\@currentHtag\expandafter#2#1\@empty\@empty\null}% + \fi +} +\def\test@reftype#1.#2\\{% + \@ifundefined{#1autorefname}{% + \@ifundefined{#1name}{% + \def\@currentHtag{}% + \@latex@warning{no tag name for #1 at \the\inputlineno}% + }{% + \def\@currentHtag{\csname#1name\endcsname~}% + }% + }{% + \def\@currentHtag{\csname#1autorefname\endcsname~}% + }% +} +\def\@currentHtag{} +% \end{macrocode} +% +% Defaults for the names that \cmd{\autoref} uses. +% \begin{macrocode} +\providecommand\AMSautorefname{\equationautorefname} +\providecommand\Hfootnoteautorefname{\footnoteautorefname} +\providecommand\Itemautorefname{\itemautorefname} +\providecommand\itemautorefname{item} +\providecommand\equationautorefname{Equation} +\providecommand\footnoteautorefname{footnote} +\providecommand\itemautorefname{item} +\providecommand\figureautorefname{Figure} +\providecommand\tableautorefname{Table} +\providecommand\partautorefname{Part} +\providecommand\appendixautorefname{Appendix} +\providecommand\chapterautorefname{chapter} +\providecommand\sectionautorefname{section} +\providecommand\subsectionautorefname{subsection} +\providecommand\subsubsectionautorefname{subsubsection} +\providecommand\paragraphautorefname{paragraph} +\providecommand\subparagraphautorefname{subparagraph} +\providecommand\FancyVerbLineautorefname{line} +\providecommand\theoremautorefname{Theorem} +% \end{macrocode} +% +% \begin{macrocode} +% +%<*pdftex> +% \end{macrocode} +% \section{Configuration files} +% \subsection{pdftex} +% +% \begin{macrocode} +% \end{macrocode} +% This driver is for Han The Thanh's \TeX{} variant +% which produces PDF directly. This has new primitives +% to do PDF things, which usually translate almost directly to +% PDF code, so there is a lot of flexibility which we do not at +% present harness. +% +% First, allow for some changes and additions to pdftex syntax: +% \begin{macrocode} +\def\setpdflinkmargin#1{\pdflinkmargin#1} +\ifx\pdfstartlink\@undefined% less than version 14 + \let\pdfstartlink\pdfannotlink + \let\pdflinkmargin\@tempdima + \let\pdfxform\pdfform + \let\pdflastxform\pdflastform + \let\pdfrefxform\pdfrefform +\else + \pdflinkmargin1pt +\fi +% \end{macrocode} +% First set up the default linking +% \begin{macrocode} +\providecommand\@pdfview{XYZ} +% \end{macrocode} +% First define the anchors: +% \begin{macrocode} +\def\new@pdflink#1{% + \ifHy@verbose + \typeout{pdftex: define anchor at line \the\inputlineno: #1}% + \fi + \Hy@SaveLastskip + \pdfdest name {#1}\@pdfview + \Hy@RestoreLastskip +} +\let\pdf@endanchor\@empty +% \end{macrocode} +% +% Now the links; the interesting part here is the set of attributes +% which define how the link looks. We probably want to add a border +% and color it, but there are other choices. This directly translates +% to PDF code, so consult the manual for how to change this. We will +% add an interface at some point. +% \begin{macrocode} +\providecommand\@pdfborder{0 0 1} +\def\Hy@undefinedname{UNDEFINED} +\def\find@pdflink#1#2{% + \leavevmode + \protected@edef\Hy@testname{#2}% + \ifx\Hy@testname\@empty + \let\Hy@testname\Hy@undefinedname + \fi + \pdfstartlink + attr{% + /Border[\@pdfborder]% + /H\@pdfhighlight + /C[\CurrentBorderColor]% + }% + goto name {\Hy@testname}% + \Hy@colorlink{\csname @#1color\endcsname}% +} +\def\close@pdflink{\Hy@endcolorlink\pdfendlink} +\def\hyper@anchor#1{\new@pdflink{#1}\anchor@spot\pdf@endanchor} +\def\hyper@anchorstart#1{\new@pdflink{#1}\Hy@activeanchortrue} +\def\hyper@anchorend{\pdf@endanchor\Hy@activeanchorfalse} +\def\hyper@linkstart#1#2{% + \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}% + \find@pdflink{#1}{#2}} +\def\hyper@linkend{\close@pdflink} +\def\hyper@link#1#2#3{% + \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}% + \find@pdflink{#1}{#2}#3\close@pdflink +} +\def\CurrentBorderColor{\@linkbordercolor} +\def\hyper@linkurl#1#2{% + \bgroup + \hyper@chars + \leavevmode + \pdfstartlink + attr{% + /Border[\@pdfborder]% + /H\@pdfhighlight + /C[\@urlbordercolor]% + }% + user{% + /Subtype/Link% + /A<<% + /Type/Action% + /S/URI% + /URI(#2)% + >>% + }% + \Hy@colorlink{\@urlcolor}#1% + \close@pdflink + \egroup +} +\def\hyper@linkfile#1#2#3{% anchor text, filename, linkname + \bgroup + \leavevmode + \pdfstartlink + attr{% + /Border[\@pdfborder]% + /H\@pdfhighlight + /C[\@filebordercolor]% + }% + user {% + /Subtype/Link% + /A<<% + /F(#2)% + /S/GoToR% + \ifHy@newwindow /NewWindow true \fi +% \end{macrocode} +% If |#3| is empty, page 0; if its a number, Page number, otherwise +% a named destination. +% \begin{verbatim} +% \afterassignment\xxx\count@=0\foo!% +% +%\def\xxx#1!{% +% \ifx\xxx#1\xxx +% foo was an integer +% \else +% it wasnt +% \fi} +% \end{verbatim} +% \begin{macrocode} + \ifx\\#3\\% + /D[0 \@pdfstartview]% + \else + /D(#3)% + \fi + >>% + }% + \Hy@colorlink{\@filecolor}#1% + \close@pdflink + \egroup +} +\def\@hyper@launch run:#1\\#2#3{% filename, anchor text linkname + \bgroup + \leavevmode + \pdfstartlink + attr{% + /Border[\@pdfborder]% + /H\@pdfhighlight + /C[\@runbordercolor]% + }% + user {% + /Subtype/Link% + /A<<% + /F(#1)% + /S/Launch% + \ifHy@newwindow /NewWindow true \fi + \ifx\\#3\\% + \else + /Win<>% + \fi + >>% + }% + \Hy@colorlink{\@filecolor}#2% + \close@pdflink + \egroup +} +% \end{macrocode} +% \begin{macro}{\@pdfproducer} +% \begin{macrocode} +\def\@pdfproducer{pdfTeX} +\ifx\eTeXversion\@undefined +\else + \ifx\eTeXversion\relax + \else + \ifnum\eTeXversion>0 % + \def\@pdfproducer{pdfeTeX} + \fi + \fi +\fi +\ifx\pdftexversion\@undefined +\else + \ifnum\pdftexversion<100 % + \edef\@pdfproducer{% + \@pdfproducer + \the\pdftexversion.\pdftexrevision + } + \else + \edef\@pdfproducer{% + \@pdfproducer-% + \expandafter\@car\the\pdftexversion\@empty\@nil.% + \expandafter\@cdr\the\pdftexversion\@empty\@nil + \pdftexrevision + } + \fi +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDF@SetupDox} +% \begin{macrocode} +\def\PDF@SetupDoc{% + \ifx\@pdfpagescrop\@empty + \else + \edef\process@me{% + \pdfpagesattr={% + /CropBox[\@pdfpagescrop]% + \expandafter\ifx\expandafter\\\the\pdfpagesattr\\% + \else + ^^J\the\pdfpagesattr + \fi + }% + }% + \process@me + \fi + \pdfcatalog{% + /PageMode \@pdfpagemode + \ifx\@baseurl\@empty + \else + /URI<> + \fi + }% + \ifx\@pdfstartview\@empty + \else + openaction goto page \@pdfstartpage {\@pdfstartview}% + \fi + \edef\Hy@temp{% + \ifHy@toolbar\else /HideToolbar true\fi + \ifHy@menubar\else /HideMenubar true\fi + \ifHy@windowui\else /HideWindowUI true\fi + \ifHy@fitwindow /FitWindow true\fi + \ifHy@centerwindow /CenterWindow true\fi + \ifHy@displaydoctitle /DisplayDocTitle true\fi + \ifx\@pdfnonfullscreenpagemode\@empty + \else + /NonFullScreenPageMode\@pdfnonfullscreenpagemode + \fi + }% + \pdfcatalog{% + \ifx\Hy@temp\@empty + \else + /ViewerPreferences<<\Hy@temp>>% + \fi + \ifx\pdf@pagelayout\@empty + \else + /PageLayout/\pdf@pagelayout\space + \fi + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDF@FinishDoc} +% \begin{macrocode} +\def\PDF@FinishDoc{% + \Hy@UseMaketitleInfos + \pdfinfo{% + /Author(\@pdfauthor)% + /Title(\@pdftitle)% + /Subject(\@pdfsubject)% + /Creator(\@pdfcreator)% + /Producer(\@pdfproducer)% + /Keywords(\@pdfkeywords)% + }% + \Hy@DisableOption{pdfauthor}% + \Hy@DisableOption{pdftitle}% + \Hy@DisableOption{pdfsubject}% + \Hy@DisableOption{pdfcreator}% + \Hy@DisableOption{pdfproducer}% + \Hy@DisableOption{pdfkeywords}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\hyper@pagetransition} +% \cmd{\@pdfpagetransition} is initialized with \cmd{\relax}. So +% it indicates, if option pdfpagetransition is used. First previous +% |/Trans| entries are removed. If a new |/Trans| key exists, it is +% appended to \cmd{\pdfpageattr}. +% \begin{macrocode} +\def\hyper@pagetransition{% + \ifx\@pdfpagetransition\relax + \else + \expandafter\Hy@RemoveTransPageAttr\the\pdfpageattr^^J/Trans{}>>\END + \ifx\@pdfpagetransition\@empty + \else + \edef\@processme{% + \global\pdfpageattr{% + \the\pdfpageattr + ^^J/Trans << /S /\@pdfpagetransition\space >>% + }% + }% + \@processme + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@RemoveTransPageAttr} +% Macro \cmd{\Hy@RemoveTransPageAttr} removes a |/Trans| +% entry from \cmd{\pdfpageattr}. It is called with +% the end marker |^^J/Trans{}>>\END|. The trick is the +% empty group that does not appear in legal +% \cmd{\pdfpageattr} code. It appears in argument +% |#2| and shows, whether the parameter text +% catches a really |/Trans| object or the end marker. +% \begin{macrocode} +\gdef\Hy@RemoveTransPageAttr#1^^J/Trans#2#3>>#4\END{% + \ifx\\#2\\% + \global\pdfpageattr{#1}% + \else + \Hy@RemoveTransPageAttr#1#4\END + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hyper@pageduration} +% \cmd{\@pdfpageduration} is initialized with \cmd{\relax}. So +% it indicates, if option pdfpageduration is used. First previous +% |/Dur| entries are removed. If a new |/Dur| key exists, it is +% appended to \cmd{\pdfpageattr}. +% \begin{macrocode} +\def\hyper@pageduration{% + \ifx\@pdfpageduration\relax + \else + \expandafter\Hy@RemoveDurPageAttr\the\pdfpageattr^^J/Dur{} \END + \ifx\@pdfpageduration\@empty + \else + \edef\@processme{% + \global\pdfpageattr{% + \the\pdfpageattr + ^^J/Dur \@pdfpageduration\space + }% + }% + \@processme + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@RemoveDurPageAttr} +% Macro \cmd{\Hy@RemoveDurPageAttr} removes a |/Dur| +% entry from \cmd{\pdfpageattr}. It is called with +% the end marker |^^J/Dur{} \END|. The trick is the +% empty group that does not appear in legal +% \cmd{\pdfpageattr} code. It appears in argument +% |#2| and shows, whether the parameter text +% catches a really |/Dur| object or the end marker. +% \begin{macrocode} +\gdef\Hy@RemoveDurPageAttr#1^^J/Dur#2#3 #4\END{% + \ifx\\#2\\% + \global\pdfpageattr{#1}% + \else + \Hy@RemoveDurPageAttr#1#4\END + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hyper@pagehidden} +% The boolean value of the key |/Hid| is stored in switch +% \cmd{\ifHy@pdfpagehidden}. +% First previous |/Hid| entries are removed, then the new +% one is appended, if the value is true (the PDF default +% is false). +% \begin{macrocode} +\def\hyper@pagehidden{% + \ifHy@useHidKey + \expandafter\Hy@RemoveHidPageAttr\the\pdfpageattr^^J/Hid{} \END + \ifHy@pdfpagehidden + \edef\@processme{% + \global\pdfpageattr{% + \the\pdfpageattr + ^^J/Hid true % SPACE + }% + }% + \@processme + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Hy@RemoveHidPageAttr} +% Macro \cmd{\Hy@RemoveHidPageAttr} removes a |/Hid| +% entry from \cmd{\pdfpageattr}. It is called with +% the end marker |^^J/Hid{} \END|. The trick is the +% empty group that does not appear in legal +% \cmd{\pdfpageattr} code. It appears in argument +% |#2| and shows, whether the parameter text +% catches a really |/Hid| object or the end marker. +% \begin{macrocode} +\gdef\Hy@RemoveHidPageAttr#1^^J/Hid#2#3 #4\END{% + \ifx\\#2\\% + \global\pdfpageattr{#1}% + \else + \Hy@RemoveHidPageAttr#1#4\END + \fi +} +% \end{macrocode} +% \end{macro} +% +% Let us explicitly turn on PDF generation; they can reverse +% this decision in the document, but since we are emitting PDF +% links anyway, we \emph{must} be in PDF mode. +% \begin{macrocode} +\pdfoutput=1 +\pdfcompresslevel=9 +\AtBeginDocument{% + \ifHy@setpagesize + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + {% + \@ifclassloaded{seminar}{% + \setlength{\pdfhorigin}{1truein}% + \setlength{\pdfvorigin}{1truein}% + \ifportrait + \ifdim\paperwidth=\z@ + \else + \setlength{\pdfpagewidth}{\strip@pt\paperwidth truept}% + \fi + \ifdim\paperheight=\z@ + \else + \setlength{\pdfpageheight}{\strip@pt\paperheight truept}% + \fi + \else + \ifdim\paperheight=\z@ + \else + \setlength{\pdfpagewidth}{\strip@pt\paperheight truept}% + \fi + \ifdim\paperwidth=\z@ + \else + \setlength{\pdfpageheight}{\strip@pt\paperwidth truept}% + \fi + \fi + }{% + \@ifundefined{stockwidth}{% + \ifdim\paperwidth=\z@ + \else + \setlength{\pdfpagewidth}{\paperwidth}% + \fi + \ifdim\paperheight=\z@ + \else + \setlength{\pdfpageheight}{\paperheight}% + \fi + }{% + \ifdim\stockwidth=\z@ + \else + \setlength{\pdfpagewidth}{\stockwidth}% + \fi + \ifdim\stockheight=\z@ + \else + \setlength{\pdfpageheight}{\stockheight}% + \fi + }% + }% + }% + \Hy@DisableOption{setpagesize}% +} +\def\Acrobatmenu#1#2{% + \leavevmode + \pdfstartlink + attr{% + /Border [\@pdfborder] + /H \@pdfhighlight\space + /C [\@menubordercolor]% + }% + user{ + /Subtype /Link + /A << + /S /Named /N /#1 + >> + }% + \Hy@colorlink{\@menucolor}#2\close@pdflink +} +% +%<*hypertex> +% \end{macrocode} +% \subsection{hypertex} +% The Hyper\TeX\ specification (this is +% borrowed from an article by Arthur Smith) +% says that conformant viewers/translators +% must recognize the following set of |\special| commands: +% \begin{description} +% \item[href:] |html:| +% \item[name:] |html:| +% \item[end:] |html:| +% \item[image:] |html:| +% \item[base\_name:] |html:| +% \end{description} +% +% The \emph{href}, \emph{name} and \emph{end} commands are used to do +% the basic hypertext operations of establishing links between sections +% of documents. The \emph{image} command is intended (as with current +% html viewers) to place an image of arbitrary graphical +% format on the page in the current location. The \emph{base\_name} +% command is be used to communicate to the \emph{dvi} viewer the full (URL) +% location of the current document so that +% files specified by relative URL's may be retrieved correctly. +% +% The \emph{href} and \emph{name} commands must be paired with an +% \emph{end} command later in +% the \TeX{} file --- the \TeX{} commands between the two ends of a pair +% form an \emph{anchor} in the document. In the case of an \emph{href} +% command, the \emph{anchor} is to be highlighted in the +% \emph{dvi} viewer, and +% when clicked on will cause the scene to shift to the destination +% specified by \emph{href\_string}. The \emph{anchor} associated with a +% name command represents a possible location to which other hypertext +% links may refer, either as local references (of the form +% \texttt{href="\#name\_string"} with the \emph{name\_string} +% identical to the one in the name command) or as part of a URL (of the +% form \emph{URL\#name\_string}). Here \emph{href\_string} is a valid +% URL or local identifier, while name\_string could be any string at +% all: the only caveat is that `|"|' characters should be escaped with a +% backslash (|\|), and if it looks like a URL name it may cause +% problems. +% +% \begin{macrocode} +\def\PDF@FinishDoc{} +\def\PDF@SetupDoc{% + \ifx\@baseurl\@empty + \else + \special{html:}% + \fi +} +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \let\protect=\string + \hyper@chars + \special{html:}% + \endgroup + \Hy@activeanchortrue + \Hy@colorlink{\@anchorcolor}\anchor@spot\Hy@endcolorlink + \special{html:}% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \begingroup + \hyper@chars + \special{html:}% + \endgroup + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \special{html:}% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\@urltype{url} +\def\hyper@linkstart#1#2{% + \Hy@colorlink{\csname @#1color\endcsname}% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\@urltype + \special{html:}% + \else + \begingroup + \hyper@chars + \special{html:}% + \endgroup + \fi +} +\def\hyper@linkend{% + \special{html:}% + \Hy@endcolorlink +} +\def\hyper@linkfile#1#2#3{% + \hyper@linkurl{#1}{\Hy@linkfileprefix#2\ifx\\#3\\\else\##3\fi}% +} +\def\hyper@linkurl#1#2{% +% \end{macrocode} +% If we want to raise up the final link |\special|, we need to +% get its height; ask me why \LaTeX\ constructs make this totally +% foul up, and make us revert to basic \TeX. I do not know. +% \begin{macrocode} + \leavevmode + \ifHy@raiselinks + \setbox\@tempboxa=\color@hbox #1\color@endbox + \@linkdim\dp\@tempboxa + \lower\@linkdim\hbox{% + \hyper@chars + \special{html:}% + }% + \Hy@colorlink{\@urlcolor}#1% + \@linkdim\ht\@tempboxa +% \end{macrocode} +% Because of the interaction with the dvihps processor, we have to subtract a +% little from the height. This is not clean, or checked. Check with Mark +% Doyle about what gives here. It may not be needed with +% the new dvips (Jan 1997). +% \begin{macrocode} + \advance\@linkdim by -6.5\p@ + \raise\@linkdim\hbox{\special{html:}}% + \Hy@endcolorlink + \else + \begingroup + \hyper@chars + \special{html:}% + \Hy@colorlink{\@urlcolor}#1% + \special{html:}% + \Hy@endcolorlink + \endgroup + \fi +} +\def\hyper@link#1#2#3{% + \hyper@linkurl{#3}{\##2}% +} +% \end{macrocode} +% +% \begin{macrocode} +\def\hyper@image#1#2{% + \begingroup + \hyper@chars + \special{html:}% + \endgroup +} +% +%<*dviwindo> +% \end{macrocode} +% \subsection{dviwindo} +% [This was developed by David Carlisle]. +% Within a file dviwindo hyperlinking is used, for external +% URL's a call to |\wwwbrowser| is made. (You can define +% this command before or after loading the hyperref package +% if the default |c:/netscape/netscape| is not suitable) +% Dviwindo could in fact handle external links to dvi files on +% the same machine without calling a web browser, but that would +% mean parsing the URL to recognise such, and this is currently +% not done. +% +% This was more or less blindly copied from the hypertex cfg. +% For dviwindo, \LaTeX{} must specify the size of the active area +% for links. For some hooks this information is available +% but for some, the start and end of the link are +% specified separately in which case a fixed size area +% of 10000000sp wide by |\baselineskip| high is used. +% \begin{macrocode} +\providecommand\wwwbrowser{c:\string\netscape\string\netscape} +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \let\protect=\string + \special{mark: #1}% + \endgroup + \Hy@activeanchortrue + \Hy@colorlink{\@anchorcolor}\anchor@spot\Hy@endcolorlink + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \special{mark: #1}% + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@linkstart#1#2{% + \Hy@colorlink{\csname @#1color\endcsname}% + \special{button: + 10000000 + \number\baselineskip\space + #2% + }% +} +\def\hyper@linkend{% + \Hy@endcolorlink +} +\def\hyper@link#1#2#3{% + \setbox\@tempboxa=\color@hbox #3\color@endbox + \leavevmode + \ifHy@raiselinks + \@linkdim\dp\@tempboxa + \lower\@linkdim\hbox{% + \special{button: + \number\wd\@tempboxa\space + \number\ht\@tempboxa\space + #2% + }% + \Hy@colorlink{\csname @#1color\endcsname}#3% + \Hy@endcolorlink + }% + \@linkdim\ht\@tempboxa + \advance\@linkdim by -6.5\p@ + \raise\@linkdim\hbox{}% + \else + \special{button: + \number\wd\@tempboxa\space + \number\ht\@tempboxa\space + #2% + }% + \Hy@colorlink{\csname @#1color\endcsname}#3\Hy@endcolorlink + \fi +} +\def\hyper@linkurl#1#2{% + \begingroup + \hyper@chars + \leavevmode + \setbox\@tempboxa=\color@hbox #1\color@endbox + \ifHy@raiselinks + \@linkdim\dp\@tempboxa + \lower\@linkdim\hbox{% + \special{button: + \number\wd\@tempboxa\space + \number\ht\@tempboxa\space + launch: \wwwbrowser\space + #2% + }% + \Hy@colorlink{\@urlcolor}#1\Hy@endcolorlink + }% + \@linkdim\ht\@tempboxa + \advance\@linkdim by -6.5\p@ + \raise\@linkdim\hbox{}% + \else + \special{button: + \number\wd\@tempboxa\space + \number\ht\@tempboxa\space + launch: \wwwbrowser\space + #2% + }% + \Hy@colorlink{\@urlcolor}#1\Hy@endcolorlink + \fi + \endgroup +} +\def\hyper@linkfile#1#2#3{% + \begingroup + \hyper@chars + \leavevmode + \setbox\@tempboxa=\color@hbox #1\color@endbox + \ifHy@raiselinks + \@linkdim\dp\@tempboxa + \lower\@linkdim\hbox{% + \special{button: + \number\wd\@tempboxa\space + \number\ht\@tempboxa\space + #3, + file: #2% + }% + \Hy@colorlink{\@filecolor}#1\Hy@endcolorlink + }% + \@linkdim\ht\@tempboxa + \advance\@linkdim by -6.5\p@ + \raise\@linkdim\hbox{}% + \else + \special{button: + \number\wd\@tempboxa\space + \number\ht\@tempboxa\space + #3, + file: #2 + }% + \Hy@colorlink{\@filecolor}#1\Hy@endcolorlink + \fi + \endgroup +} +\def\@pdfproducer{dviwindo + Distiller} +\def\PDF@FinishDoc{% + \Hy@UseMaketitleInfos + \special{PDF: Keywords \@pdfkeywords}% + \special{PDF: Title \@pdftitle}% + \special{PDF: Creator \@pdfcreator}% + \special{PDF: Author \@pdfauthor}% + \special{PDF: Producer \@pdfproducer}% + \special{PDF: Subject \@pdfsubject}% + \Hy@DisableOption{pdfauthor}% + \Hy@DisableOption{pdftitle}% + \Hy@DisableOption{pdfsubject}% + \Hy@DisableOption{pdfcreator}% + \Hy@DisableOption{pdfproducer}% + \Hy@DisableOption{pdfkeywords}% +} +\def\PDF@SetupDoc{% + \ifx\@baseurl\@empty + \else + \special{PDF: Base \@baseurl}% + \fi + \ifx\@pdfpagescrop\@empty\else + \special{PDF: BBox \@pdfpagescrop}% + \fi + \pdfmark{pdfmark=/DOCVIEW, + Page=\@pdfstartpage, + View=\@pdfstartview, + PageMode=\@pdfpagemode + }% + \ifx\@pdfpagescrop\@empty + \else + \pdfmark{pdfmark=/PAGES,CropBox=\@pdfpagescrop}% + \fi + \edef\Hy@temp{% + \ifHy@toolbar\else /HideToolbar true\fi + \ifHy@menubar\else /HideMenubar true\fi + \ifHy@windowui\else /HideWindowUI true\fi + \ifHy@fitwindow /FitWindow true\fi + \ifHy@centerwindow /CenterWindow true\fi + \ifHy@displaydoctitle /DisplayDocTitle true\fi + \ifx\@pdfnonfullscreenpagemode\@empty + \else + /NonFullScreenPageMode\@pdfnonfullscreenpagemode + \fi + }% + \pdfmark{pdfmark=/PUT, + Raw={% + \string{Catalog\string} << + \ifx\Hy@temp\@empty + \else + /ViewerPreferences<<\Hy@temp>>% + \fi + \ifx\pdf@pagelayout\@empty + \else + /PageLayout /\pdf@pagelayout\space + \fi + >>% + }% + }% +} +% +%<*dvipdfm> +% \end{macrocode} +% \subsection{dvipdfm dvi to PDF converter} +% Provided by Mark Wicks (mwicks@kettering.edu) +% \begin{macrocode} +\newsavebox{\pdfm@box} +\def\@pdfm@mark#1{\special{pdf:#1}} +\def\@pdfm@dest#1{% + \Hy@SaveLastskip + \@pdfm@mark{dest (#1) [@thispage /\@pdfview\space @xpos @ypos]}% + \Hy@RestoreLastskip +} +\providecommand\@pdfview{XYZ} +\providecommand\@pdfborder{0 0 1} +\def\hyper@anchor#1{% + \@pdfm@dest{#1}% +} +\def\hyper@anchorstart#1{% + \Hy@activeanchortrue + \@pdfm@dest{#1}% +} +\def\hyper@anchorend{% + \Hy@activeanchorfalse +} +\def\Hy@undefinedname{UNDEFINED} +\def\hyper@linkstart#1#2{% + \protected@edef\Hy@testname{#2}% + \ifx\Hy@testname\@empty + \let\Hy@testname\Hy@undefinedname + \fi + \@pdfm@mark{% + bann << + /Type /Annot + /Subtype /Link + /Border [\@pdfborder] + /C [\csname @#1bordercolor\endcsname] + /A << + /S /GoTo + /D (\Hy@testname) + >> + >> + }% + \Hy@colorlink{\csname @#1color\endcsname}% +} +\def\hyper@linkend{% + \Hy@endcolorlink + \@pdfm@mark{eann}% +} +\def\hyper@link#1#2#3{% + \hyper@linkstart{#1}{#2}#3\hyper@linkend +} +\def\hyper@linkfile#1#2#3{% + \@pdfm@mark{% + bann << + /Type /Annot + /Subtype /Link + /Border [\@pdfborder] + /C [\@filebordercolor] + /A << + /S /GoToR + /F (#2) + /D \ifx\\#3\\[0 \@pdfstartview]\else(#3)\fi\space + \ifHy@newwindow /NewWindow true \fi + >> + >>% + }% + \Hy@colorlink{\@filecolor}#1\Hy@endcolorlink + \@pdfm@mark{eann}% +} +\def\@hyper@launch run:#1\\#2#3{% filename, anchor text linkname + \@pdfm@mark{% + bann << + /Type /Annot + /Subtype /Link + /Border [\@pdfborder] + /C [\@filebordercolor] + /A << + /S /Launch + /F (#1) + \ifHy@newwindow /NewWindow true \fi + \ifx\\#3\\% + \else + /Win << /P (#3) /F (#1) >> + \fi + >> + >>% + }% + \Hy@colorlink{\@filecolor}#2\Hy@endcolorlink + \@pdfm@mark{eann}% +} +\def\hyper@linkurl#1#2{% + \@pdfm@mark{% + bann << + /Type /Annot + /Subtype /Link + /Border [\@pdfborder] + /C [\@urlbordercolor] + /A << + /S /URI + /URI (#2) + >> + >>% + }% + \Hy@colorlink{\@urlcolor}#1\Hy@endcolorlink + \@pdfm@mark{eann}% +} +\def\Acrobatmenu#1#2{% + \@pdfm@mark{% + bann << + /Type /Annot + /Subtype /Link + /A << + /S /Named + /N /#1 + >> + /Border [\@pdfborder] + /C [\@menubordercolor] + >>% + }% + \Hy@colorlink{\@menucolor}#2\Hy@endcolorlink + \@pdfm@mark{eann}% +} +\def\@pdfproducer{dvipdfm} +\def\PDF@FinishDoc{% + \Hy@UseMaketitleInfos + \@pdfm@mark{% + docinfo << + /Title (\@pdftitle) + /Subject (\@pdfsubject) + /Creator (\@pdfcreator) + /Author (\@pdfauthor) + /Producer (\@pdfproducer) + /Keywords (\@pdfkeywords) + >>% + }% + \Hy@DisableOption{pdfauthor}% + \Hy@DisableOption{pdftitle}% + \Hy@DisableOption{pdfsubject}% + \Hy@DisableOption{pdfcreator}% + \Hy@DisableOption{pdfproducer}% + \Hy@DisableOption{pdfkeywords}% +} +% \end{macrocode} +% \begin{macrocode} +\def\PDF@SetupDoc{% + \edef\Hy@temp{% + \ifHy@toolbar\else /HideToolbar true\fi + \ifHy@menubar\else /HideMenubar true\fi + \ifHy@windowui\else /HideWindowUI true\fi + \ifHy@fitwindow /FitWindow true\fi + \ifHy@centerwindow /CenterWindow true\fi + \ifHy@displaydoctitle /DisplayDocTitle true\fi + \ifx\@pdfnonfullscreenpagemode\@empty + \else + /NonFullScreenPageMode\@pdfnonfullscreenpagemode + \fi + }% + \@pdfm@mark{% + docview <<% + \ifx\@pdfstartview\@empty + \else + /OpenAction[@page\@pdfstartpage\@pdfstartview]% + \fi + \ifx\@baseurl\@empty + \else + /URI<>% + \fi + /PageMode \@pdfpagemode + \ifx\Hy@temp\@empty + \else + /ViewerPreferences<<\Hy@temp>>% + \fi + \ifx\pdf@pagelayout\@empty + \else + /PageLayout/\pdf@pagelayout\space + \fi + >>% + }% + \ifx\@pdfpagescrop\@empty + \else + \@pdfm@mark{put @pages <>} + \fi +} +% +% \end{macrocode} +% +% \subsection{VTeX typesetting system} +% Provided by MicroPress, May 1998. +% They require VTeX version 6.02 or newer; +% see \url{http://www.micropress-inc.com/} for details. +% \begin{macrocode} +%<*vtexhtml> +\RequirePackage{vtexhtml} +\newif\if@Localurl +\def\PDF@FinishDoc{} +\def\PDF@SetupDoc{% + \ifx\@baseurl\@empty + \else + \special{!direct }% + \fi +} +\def\@urltype{url} +\def\hyper@link#1#2#3{% + \leavevmode + \special{!direct }% + #3% + \special{!direct }% +} +\def\hyper@linkurl#1#2{% + \begingroup + \hyper@chars + \leavevmode + \MathBSuppress=1\relax + \special{!direct }% + #1% + \MathBSuppress=0\relax + \special{!direct }% + \endgroup +} +\def\hyper@linkfile#1#2#3{% + \hyper@linkurl{#1}{\Hy@linkfileprefix#2\ifx\\#3\\\else\##3\fi}% +} +\def\hyper@linkstart#1#2{% + \def\Hy@tempa{#1}\ifx\Hy@tempa\@urltype + \@Localurltrue + \special{!direct }% + \else + \@Localurlfalse + \begingroup + \hyper@chars + \special{!aref #2}% + \endgroup + \fi +} +\def\hyper@linkend{% + \if@Localurl + \special{!endaref}% + \else + \special{!direct }% + \fi +} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \begingroup + \hyper@chars + \special{!aname #1}% + \special{!direct }% + \endgroup + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \special{!direct }% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \let\protect=\string + \hyper@chars + \leavevmode + \special{!aname #1}% + \special{!direct }% + \endgroup + \Hy@activeanchortrue + \bgroup\anchor@spot\egroup + \special{!direct }% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\@Form[#1]{\typeout{Sorry, TeXpider does not yet support FORMs}} +\def\@endForm{} +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, TeXpider does not yet support FORM gauges}% +} +\def\@TextField[#1]#2{% parameters, label + \typeout{Sorry, TeXpider does not yet support FORM text fields}% + } +\def\@CheckBox[#1]#2{% parameters, label + \typeout{Sorry, TeXpider does not yet support FORM checkboxes}% + } +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \typeout{Sorry, TeXpider does not yet support FORM choice menus}% +} +\def\@PushButton[#1]#2{% parameters, label + \typeout{Sorry, TeXpider does not yet support FORM pushbuttons}% +} +\def\@Reset[#1]#2{\typeout{Sorry, TeXpider does not yet support FORMs}} +\def\@Submit[#1]#2{\typeout{Sorry, TeXpider does not yet support FORMs}} +% +% \end{macrocode} +% \begin{macrocode} +%<*vtex> +% \end{macrocode} +% VTeX version 6.68 supports \cs{mediawidth} and \cs{mediaheight}. +% The \cs{ifx} construct is better than a \cs{csname}, because +% it avoids the definition and the hash table entry of a +% previous undefined macro. +% \begin{macrocode} +\ifx\mediaheight\@undefined +\else + \ifx\mediaheight\relax + \else + \ifHy@setpagesize + \providecommand*{\VTeXInitMediaSize}{% + \@ifundefined{stockwidth}{% + \ifdim\paperheight>0pt % + \setlength\mediaheight\paperheight + \fi + \ifdim\paperheight>0pt % + \setlength\mediawidth\paperwidth + \fi + }{% + \ifdim\stockheight>0pt % + \setlength\mediaheight\stockheight + \fi + \ifdim\stockwidth>0pt % + \setlength\mediawidth\stockwidth + \fi + }% + }% + \AtBeginDocument{\VTeXInitMediaSize}% + \fi + \Hy@DisableOption{setpagesize}% + \fi +\fi +% \end{macrocode} +% Older versions of VTeX require |xyz| in lower case. +% \begin{macrocode} +\providecommand\@pdfview{xyz} +\providecommand\@pdfborder{0 0 1}% +\def\CurrentBorderColor{\@linkbordercolor} +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \let\protect=\string + \hyper@chars + \special{!aname #1;\@pdfview}% + \endgroup + \Hy@activeanchortrue + \Hy@colorlink{\@anchorcolor}\anchor@spot\Hy@endcolorlink + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \begingroup + \hyper@chars + \special{!aname #1;\@pdfview}% + \endgroup + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\@urltype{url} +\def\Hy@undefinedname{UNDEFINED} +\def\hyper@linkstart#1#2{% + \Hy@colorlink{\csname @#1color\endcsname}% + \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\@urltype + \special{!% + aref ;% + a=% + }% + \else + \protected@edef\Hy@testname{#2}% + \ifx\Hy@testname\@empty + \let\Hy@testname\Hy@undefinedname + \fi + \special{!% + aref \Hy@testname;% + a=% + }% + \fi +} +\def\hyper@linkend{% + \special{!endaref}% + \Hy@endcolorlink +} +\def\hyper@linkfile#1#2#3{% + \leavevmode + \special{!% + aref <% + \ifnum\Hy@VTeXversion>753 \ifHy@newwindow n\fi\fi + f=#2>#3;% + a=% + }% + \Hy@colorlink{\@filecolor}#1\Hy@endcolorlink + \special{!endaref}% +} +\def\hyper@linkurl#1#2{% + \begingroup + \hyper@chars + \leavevmode + \special{!% + aref ;% + a=% + }% + \Hy@colorlink{\@urlcolor}#1\Hy@endcolorlink + \special{!endaref}% + \endgroup +} +\def\hyper@link#1#2#3{% + \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}% + \leavevmode + \protected@edef\Hy@testname{#2}% + \ifx\Hy@testname\@empty + \let\Hy@testname\Hy@undefinedname + \fi + \special{!% + aref \Hy@testname;% + a=% + }% + \Hy@colorlink{\csname @#1color\endcsname}#3\Hy@endcolorlink + \special{!endaref}% +} +\def\hyper@image#1#2{% + \hyper@linkurl{#2}{#1}% +} +\def\@hyper@launch run:#1\\#2#3{% + \leavevmode + \special{!aref + > \fi% + >;% + a=% + }% + \Hy@colorlink{\@filecolor}#2\Hy@endcolorlink + \special{!endaref}% +} +\def\Acrobatmenu#1#2{% + \leavevmode + \special{!% + aref ;% + a=% + }% + \Hy@colorlink{\@menucolor}#2\Hy@endcolorlink + \special{!endaref}% +} +% \end{macrocode} +% +% The following code (transition effects) is +% made by Alex Kostin. +% +% The code below makes sense for V\TeX\ 7.02 or later. +% +% Please never use |\@ifundefined{VTeXversion}{..}{..}| \emph{globally}. +% \begin{macrocode} +\ifnum\Hy@VTeXversion<702 % +\else + \def\hyper@pagetransition{% + \ifx\@pdfpagetransition\relax + \else + \ifx\@pdfpagetransition\@empty +% \end{macrocode} +% +% Standard incantation. +% +% 1. Does an old entry have to be deleted? +% 2. If 1=yes, how to delete? +% \begin{macrocode} + \else + \hvtex@parse@trans\@pdfpagetransition + \fi + \fi + } +% \end{macrocode} +% +% I have to write an ``honest'' parser to convert raw PDF code +% into V\TeX\ |\special|. (AVK) +% +% Syntax of V\TeX\ |\special{!trans }|: +%\begin{verbatim} +% ::= [,] +% ::= | | +% | | +% | +% ::= B[] +% ::= X[] +% ::= D +% ::= G[] +% ::= S[][] +% ::= W[] +% ::= R +% ::= +% ::= H | V +% ::= I | O +% ::= +%\end{verbatim} +% +% Transition codes: +% \begin{macrocode} + \def\hvtex@trans@effect@Blinds{\def\hvtex@trans@code{B}} + \def\hvtex@trans@effect@Box{\def\hvtex@trans@code{X}} + \def\hvtex@trans@effect@Dissolve{\def\hvtex@trans@code{D}} + \def\hvtex@trans@effect@Glitter{\def\hvtex@trans@code{G}} + \def\hvtex@trans@effect@Split{\def\hvtex@trans@code{S}} + \def\hvtex@trans@effect@Wipe{\def\hvtex@trans@code{W}} + \def\hvtex@trans@effect@R{\def\hvtex@trans@code{R}} +% \end{macrocode} +% +% Optional parameters: +% \begin{macrocode} + \def\hvtex@par@dimension{/Dm} + \def\hvtex@par@direction{/Di} + \def\hvtex@par@duration{/D} + \def\hvtex@par@motion{/M} +% \end{macrocode} +% +% Tokenizer: +% \begin{macrocode} + \def\hvtex@gettoken{\expandafter\hvtex@gettoken@\hvtex@buffer\@nil} +% \end{macrocode} +% +% Notice that tokens in the input buffer must be space delimited. +% \begin{macrocode} + \def\hvtex@gettoken@#1 #2\@nil{% + \edef\hvtex@token{#1}% + \edef\hvtex@buffer{#2}% + } + \def\hvtex@parse@trans#1{% +% \end{macrocode} +% +% Initializing code: +% \begin{macrocode} + \let\hvtex@trans@code\@empty + \let\hvtex@param@dimension\@empty + \let\hvtex@param@direction\@empty + \let\hvtex@param@duration\@empty + \let\hvtex@param@motion\@empty + \edef\hvtex@buffer{#1\space}% +% \end{macrocode} +% First token is the PDF transition name without escape. +% \begin{macrocode} + \hvtex@gettoken + \ifx\hvtex@token\@empty +% \end{macrocode} +% Leading space(s)? +% \begin{macrocode} + \ifx\hvtex@buffer\@empty +% \end{macrocode} +% The buffer is empty, nothing to do. +% \begin{macrocode} + \else + \hvtex@gettoken + \fi + \fi + \csname hvtex@trans@effect@\hvtex@token\endcsname +% \end{macrocode} +% Now is time to parse optional parameters. +% \begin{macrocode} + \hvtex@trans@params + } +% \end{macrocode} +% +% Reentrable macro to parse optional parameters. +% \begin{macrocode} + \def\hvtex@trans@params{% + \ifx\hvtex@buffer\@empty + \else + \hvtex@gettoken + \let\hvtex@trans@par\hvtex@token + \ifx\hvtex@buffer\@empty + \else + \hvtex@gettoken + \ifx\hvtex@trans@par\hvtex@par@duration +% \end{macrocode} +% /D is the effect duration in seconds. V\TeX\ special +% takes it in milliseconds. +% \begin{macrocode} + \let\hvtex@param@duration\hvtex@token + \else \ifx\hvtex@trans@par\hvtex@par@motion +% \end{macrocode} +% /M can be either /I or /O +% \begin{macrocode} + \expandafter\edef\expandafter\hvtex@param@motion + \expandafter{\expandafter\@gobble\hvtex@token}% + \else \ifx\hvtex@trans@par\hvtex@par@dimension +% \end{macrocode} +% /Dm can be either /H or /V +% \begin{macrocode} + \expandafter\edef\expandafter\hvtex@param@dimension + \expandafter{\expandafter\@gobble\hvtex@token}% + \else \ifx\hvtex@trans@par\hvtex@par@direction +% \end{macrocode} +% +% Valid values for /Di are 0, 270, 315 (the Glitter effect) or +% 0, 90, 180, 270 (the Wipe effect). +% \begin{macrocode} + \let\hvtex@param@direction\hvtex@token + \fi\fi\fi\fi + \fi + \fi + \ifx\hvtex@buffer\@empty + \let\next\hvtex@produce@trans + \else + \let\next\hvtex@trans@params + \fi + \next + } +% \end{macrocode} +% +% Merge || and issue the special when possible. +% Too lazy to validate optional parameters. +% \begin{macrocode} + \def\hvtex@produce@trans{% + \let\vtex@trans@special\@empty + \if S\hvtex@trans@code + \edef\vtex@trans@special{\hvtex@trans@code + \hvtex@param@dimension\hvtex@param@motion}% + \else \if B\hvtex@trans@code + \edef\vtex@trans@special{\hvtex@trans@code\hvtex@param@dimension}% + \else \if X\hvtex@trans@code + \edef\vtex@trans@special{\hvtex@trans@code\hvtex@param@motion}% + \else \if W\hvtex@trans@code + \edef\vtex@trans@special{\hvtex@trans@code\hvtex@param@direction}% + \else \if D\hvtex@trans@code + \let\vtex@trans@special\hvtex@trans@code + \else \if R\hvtex@trans@code + \let\vtex@trans@special\hvtex@trans@code + \else \if G\hvtex@trans@code + \edef\vtex@trans@special{\hvtex@trans@code\hvtex@param@direction}% + \fi\fi\fi\fi\fi\fi\fi + \ifx\vtex@trans@special\@empty + \else + \ifx\hvtex@param@duration\@empty + \else + \setlength{\dimen@}{\hvtex@param@duration\p@}% +% \end{macrocode} +% I'm not guilty of possible overflow. +% \begin{macrocode} + \multiply\dimen@\@m + \edef\vtex@trans@special{\vtex@trans@special,\strip@pt\dimen@}% + \fi +% \end{macrocode} +% +% And all the mess is just for this. +% +% \begin{macrocode} + \special{!trans \vtex@trans@special}% + \fi + } +% \end{macrocode} +% \begin{macrocode} + \def\hyper@pageduration{% + \ifx\@pdfpageduration\relax + \else + \ifx\@pdfpageduration\@empty + \special{!duration-}% + \else + \special{!duration \@pdfpageduration}% + \fi + \fi + } + \def\hyper@pagehidden{% + \ifHy@useHidKey + \special{!hidden\ifHy@pdfpagehidden +\else -\fi}% + \fi + } +\fi +% \end{macrocode} +% +% Caution: In opposite to the other drivers, +% the argument of |\special{!onopen #1}| is +% a reference name. The VTeX's postscript +% mode will work with a version higher than +% 7.0x. +% +% The command \verb|\VTeXOS| is defined since version 7.45. +% Magic values encode the operating system:\\ +% \begin{tabular}{@{}l@{: }l@{}} +% 1 & WinTel\\ +% 2 & Linux\\ +% 3 & OS/2\\ +% 4 & MacOS\\ +% 5 & MacOS/X\\ +% \end{tabular} +% \begin{macrocode} +\def\@pdfproducer{VTeX} +\ifnum\Hy@VTeXversion>\z@ + \count@\VTeXversion + \divide\count@ 100 + \edef\@pdfproducer{\@pdfproducer\space v\the\count@} + \multiply\count@ -100 + \advance\count@\VTeXversion + \edef\@pdfproducer{% + \@pdfproducer + .\ifnum\count@<10 0\fi\the\count@ + \ifx\VTeXOS\@undefined\else + \ifnum\VTeXOS>0 % + \ifnum\VTeXOS<6 % + \space(% + \ifcase\VTeXOS + \or Windows\or Linux\or OS/2\or MacOS\or MacOS/X% + \fi + )% + \fi + \fi + \fi + ,\space + \ifnum\OpMode=\@ne PDF\else PS\fi + \space backend% + \ifx\gexmode\@undefined\else + \ifnum\gexmode>\z@\space with GeX\fi + \fi + } +\fi +% \end{macrocode} +% +% Current |!pdfinfo| key syntax: +% +% \begin{tabular}{lll} +% \hline +% Key & Field & Type \\ +% \hline +% \texttt{a} & \textbf{A}uthor & String \\ +% \texttt{b} & Crop\textbf{B}ox & String \\ +% \texttt{c} & \textbf{C}reator & String \\ +% \texttt{k} & \textbf{K}eywords & String \\ +% \texttt{l} & Page\textbf{L}ayout & PS \\ +% \texttt{p} & \textbf{P}ageMode & PS \\ +% \texttt{r} & P\textbf{r}oducer & String \\ +% \texttt{s} & \textbf{S}ubject & String \\ +% \texttt{t} & \textbf{T}itle & String \\ +% \texttt{u} & \textbf{U}RI & PS \\ +% \texttt{v} & \textbf{V}iewPreferences & PS \\ +% \hline +% \end{tabular} +% +% Note: PS objects that are dicts are in |<<<..>>>| (yuck; no choice). +% +% \begin{macrocode} +\def\PDF@SetupDoc{% + \ifx\@pdfpagescrop\@empty + \else + \special{!pdfinfo b=<\@pdfpagescrop>}% + \fi + \special{!onopen Page\@pdfstartpage}% + \special{!pdfinfo p=<\@pdfpagemode>}% + \ifx\@baseurl\@empty + \else + \special{!pdfinfo u=<<>>}% + \fi + \special{!pdfinfo v=<<<% + \ifHy@toolbar\else /HideToolbar true\fi + \ifHy@menubar\else /HideMenubar true\fi + \ifHy@windowui\else /HideWindowUI true\fi + \ifHy@fitwindow /FitWindow true\fi + \ifHy@centerwindow /CenterWindow true\fi + \ifHy@displaydoctitle /DisplayDocTitle true\fi + \ifx\@pdfnonfullscreenpagemode\@empty + \else + /NonFullScreenPageMode\@pdfnonfullscreenpagemode + \fi + >>>}% + \ifx\pdf@pagelayout\@empty + \else + \special{!pdfinfo l=}% + \fi +}% +\def\PDF@FinishDoc{% + \Hy@UseMaketitleInfos + \special{!pdfinfo a=<\@pdfauthor>}% + \special{!pdfinfo t=<\@pdftitle>}% + \special{!pdfinfo s=<\@pdfsubject>}% + \special{!pdfinfo c=<\@pdfcreator>}% + \special{!pdfinfo r=<\@pdfproducer>}% + \special{!pdfinfo k=<\@pdfkeywords>}% + \Hy@DisableOption{pdfauthor}% + \Hy@DisableOption{pdftitle}% + \Hy@DisableOption{pdfsubject}% + \Hy@DisableOption{pdfcreator}% + \Hy@DisableOption{pdfproducer}% + \Hy@DisableOption{pdfkeywords}% +} +% +% \end{macrocode} +% +% \subsection{Fix for Adobe bug number 466320} +% If a destination occurs at the very begin of a page, +% the destination is moved to the previous page by +% Adobe Distiller 5. +% As workaround Adobe suggests: +%\begin{verbatim} +%/showpage { +% //showpage +% clippath stroke erasepage +%} bind def +%\end{verbatim} +% +% But unfortunately this fix generates an empty page +% at the end of the document. Therefore another fix +% is used by writing some clipped text. +% \begin{macrocode} +%\def\literalps@out#1{\special{ps:#1}}% +%\providecommand*{\Hy@DistillerDestFix}{} +%<*pdfmark|dviwindo> +\def\Hy@DistillerDestFix{% + \begingroup + \let\x\literalps@out +% \end{macrocode} +% The fix has to be passed unchanged through GeX, if +% VTeX in PostScript mode with GeX is used. +% \begin{macrocode} + \ifnum \@ifundefined{OpMode}{0}{% + \@ifundefined{gexmode}{0}{% + \ifnum\gexmode>0 \OpMode\else 0\fi + }}>1 % + \def\x##1{% + \immediate\special{!=##1}% + }% + \fi + \x{% + /product where{% + pop % + product(Distiller)search{% + pop pop pop % + version(.)search{% + exch pop exch pop% + (3011)eq{% + gsave % + newpath 0 0 moveto closepath clip% + /Courier findfont 10 scalefont setfont % + 72 72 moveto(.)show % + grestore% + }if% + }{pop}ifelse% + }{pop}ifelse% + }if% + }% + \endgroup +} +% +% \end{macrocode} +% +% \subsection{Direct pdfmark support (dvipdf and pdfmark)} +% Drivers that load |pdfmark.def| have to provide the +% correct macro definitions of +% \begin{center} +% \begin{tabular}{@{}ll@{}} +% |\@pdfproducer|& for document information\\ +% |\literalps@out|& PostScript output\\ +% |\headerps@out|& PostScript output that goes in the header area\\ +% \end{tabular} +% \end{center} +% and the correct definitions of the following PostScript procedures: +% \begin{center} +% \begin{tabular}{@{}ll@{}} +% |H.S|& start of anchor, link or rect\\ +% |#1 H.A|& end of anchor, argument=baselineskip in pt\\ +% |#1 H.L|& end of link, argument=baselineskip in pt\\ +% |H.R|& end of rect\\ +% |H.B|& raw rect code\\ +% \end{tabular} +% \end{center} +% +% \begin{macrocode} +%<*pdfmark|dvipdf> +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \pdfmark[\anchor@spot]{% + pdfmark=/DEST,% + linktype=anchor,% + View=/\@pdfview \@pdfviewparams,% + DestAnchor={#1}% + }% + \endgroup + \Hy@RestoreLastskip +} +%<*dvipdf> +\def\hyper@anchorstart#1{\Hy@activeanchortrue} +\def\hyper@anchorend{\Hy@activeanchorfalse} +\def\hyper@linkstart#1#2{% + \Hy@colorlink{\csname @#1color\endcsname}% + \xdef\hyper@currentanchor{#2}% +} +\def\hyper@linkend{% + \Hy@endcolorlink +} +% +%<*pdfmark> +\@ifundefined{hyper@anchorstart}{}{\endinput} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \literalps@out{H.S}% + \xdef\hyper@currentanchor{#1}% + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \literalps@out{\strip@pt@and@otherjunk\baselineskip\space H.A}% + \pdfmark{% + pdfmark=/DEST,% + linktype=anchor,% + View=/\@pdfview \@pdfviewparams,% + DestAnchor=\hyper@currentanchor,% + Raw=H.B% + }% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@linkstart#1#2{% + \ifHy@breaklinks + \else + \leavevmode\hbox\bgroup + \fi + \Hy@colorlink{\csname @#1color\endcsname}% + \literalps@out{H.S}% + \xdef\hyper@currentanchor{#2}% + \gdef\hyper@currentlinktype{#1}% +} +\def\hyper@linkend{% + \literalps@out{\strip@pt@and@otherjunk\baselineskip\space H.L}% + \edef\Hy@temp{\csname @\hyper@currentlinktype bordercolor\endcsname}% + \pdfmark{% + pdfmark=/ANN,% + linktype=link,% + Subtype=/Link,% + Dest=\hyper@currentanchor,% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\Hy@temp,% + Raw=H.B% + }% + \Hy@endcolorlink + \ifHy@breaklinks + \else + \egroup + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +%<*pdfmark> +% \end{macrocode} +% We have to allow for |\baselineskip| having an optional +% stretch and shrink (you meet this in slide packages, for instance), +% so we need to strip off the junk. David Carlisle, of course, +% wrote this bit of code. +% \begin{macrocode} +\begingroup + \catcode`P=12 + \catcode`T=12 + \lowercase{\endgroup + \gdef\rem@ptetc#1.#2PT#3!{#1\ifnum#2>\z@.#2\fi}% +} +\def\strip@pt@and@otherjunk#1{\expandafter\rem@ptetc\the#1!} +% +% \end{macrocode} +% +% \begin{macro}{\hyper@pagetransition} +% \begin{macrocode} +\def\hyper@pagetransition{% + \ifx\@pdfpagetransition\relax + \else + \ifx\@pdfpagetransition\@empty + % 1. Does an old entry have to be deleted? + % 2. If 1=yes, how to delete? + \else + \pdfmark{% + pdfmark=/PUT,% + Raw={% + \string{ThisPage\string}% + <> >>% + }% + }% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\hyper@pageduration} +% \begin{macrocode} +\def\hyper@pageduration{% + \ifx\@pdfpageduration\relax + \else + \ifx\@pdfpageduration\@empty + % 1. Does an old entry have to be deleted? + % 2. If 1=yes, how to delete? + \else + \pdfmark{% + pdfmark=/PUT,% + Raw={% + \string{ThisPage\string}% + <>% + }% + }% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\hyper@pagehidden} +% \begin{macrocode} +\def\hyper@pagehidden{% + \ifHy@useHidKey + \pdfmark{% + pdfmark=/PUT,% + Raw={% + \string{ThisPage\string}% + <>% + }% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +\def\hyper@image#1#2{% + \hyper@linkurl{#2}{#1}} +\def\Hy@undefinedname{UNDEFINED} +\def\hyper@link#1#2#3{% + \edef\Hy@temp{\csname @#1bordercolor\endcsname}% + \begingroup + \protected@edef\Hy@testname{#2}% + \ifx\Hy@testname\@empty + \let\Hy@testname\Hy@undefinedname + \fi +%<*dvipdf> + \pdfmark[{#3}]{% + pdfmark=/LNK,% + {},% + linktype={#1},% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\Hy@temp,% + Dest=\Hy@testname + }% +% +%<*pdfmarkbase> + \pdfmark[{#3}]{% + Color=\Hy@temp,% + linktype={#1},% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + pdfmark=/ANN,% + Subtype=/Link,% + Dest=\Hy@testname + }% +% + \endgroup +} +\newtoks\pdf@docset +\def\PDF@FinishDoc{% + \Hy@UseMaketitleInfos + \pdfmark{% + pdfmark=/DOCINFO,% + Title=\@pdftitle,% + Subject=\@pdfsubject,% + Creator=\@pdfcreator,% + Author=\@pdfauthor,% + Producer=\@pdfproducer,% + Keywords=\@pdfkeywords + }% + \Hy@DisableOption{pdfauthor}% + \Hy@DisableOption{pdftitle}% + \Hy@DisableOption{pdfsubject}% + \Hy@DisableOption{pdfcreator}% + \Hy@DisableOption{pdfproducer}% + \Hy@DisableOption{pdfkeywords}% +} +\def\PDF@SetupDoc{% + \pdfmark{% + pdfmark=/DOCVIEW,% + Page=\@pdfstartpage,% + View=\@pdfstartview,% + PageMode=\@pdfpagemode + }% + \ifx\@pdfpagescrop\@empty + \else + \pdfmark{pdfmark=/PAGES,CropBox=\@pdfpagescrop}% + \fi + \edef\Hy@temp{% + \ifHy@toolbar\else /HideToolbar true\fi + \ifHy@menubar\else /HideMenubar true\fi + \ifHy@windowui\else /HideWindowUI true\fi + \ifHy@fitwindow /FitWindow true\fi + \ifHy@centerwindow /CenterWindow true\fi + \ifHy@displaydoctitle /DisplayDocTitle true\fi + \ifx\@pdfnonfullscreenpagemode\@empty + \else + /NonFullScreenPageMode\@pdfnonfullscreenpagemode + \fi + }% + \pdfmark{% + pdfmark=/PUT,% + Raw={% + \string{Catalog\string} << + \ifx\Hy@temp\@empty + \else + /ViewerPreferences<<\Hy@temp>>% + \fi + \ifx\pdf@pagelayout\@empty + \else + /PageLayout /\pdf@pagelayout\space + \fi + \ifx\@baseurl\@empty + \else + /URI << /Base (\@baseurl) >>% + \fi + >>% + }% + }% +} +% +%<*pdfmarkbase|dvipdf> +% \end{macrocode} +% We define a single macro, pdfmark, which uses the `keyval' system +% to define the various allowable keys; these are \emph{exactly} +% as listed in the pdfmark reference for Acrobat 3.0. The only addition +% is \texttt{pdfmark} which specifies the type of pdfmark to create +% (like ANN, LINK etc). The +% surrounding round and square brackets in the pdfmark commands +% are supplied, but you have to put in / characters as needed for the +% values. +% +% \begin{macrocode} +\def\pdfmark{\@ifnextchar[{\pdfmark@}{\pdfmark@[]}} +\def\pdfmark@[#1]#2{% + \edef\@processme{\noexpand\pdf@toks={\the\pdf@defaulttoks}}% + \@processme + \let\pdf@type\relax + \setkeys{PDF}{#2}% + \ifx\pdf@type\relax + \Hy@WarningNoLine{no pdfmark type specified in #2!!}% + \ifx\\#1\\\relax\else\pdf@rect{#1}\fi + \else + \ifx\\#1\\\relax +% \literalps@out{[\the\pdf@toks\space\pdf@type\space pdfmark}% +% \literalps@out{/ANN >>}% + \else + \Hy@colorlink{\@ifundefined{@\pdf@linktype color}% + {\@linkcolor}% + {\csname @\pdf@linktype color\endcsname}}% + \pdf@rect{#1}% +% \literalps@out{[\the\pdf@toks\space\pdf@type\space pdfmark}% +% \literalps@out{/ANN >>}% + \Hy@endcolorlink + \fi + \fi +} +% \end{macrocode} +% The complicated bit is working out the right enclosing rectangle of +% some piece of \TeX\ text, needed by the /Rect key. This solution originates +% with Toby Thain (\texttt{tobyt@netspace.net.au}). +% \begin{macrocode} +\newsavebox{\pdf@box} +\def\pdf@rect#1{% +% \literalps@out{/ANN \pdf@type\space\the\pdf@toks\space <<}#1% + \leavevmode + \sbox\pdf@box{#1}% + \dimen@\ht\pdf@box + \leavevmode + \ifdim\dp\pdf@box=\z@ + \literalps@out{H.S}% + \else + \lower\dp\pdf@box\hbox{\literalps@out{H.S}}% + \fi +% \end{macrocode} +% If the text has to be horizontal mode stuff then just unbox +% the saved box like this, which saves executing it twice, which can +% mess up counters etc (thanks DPC\ldots). +% \begin{macrocode} + \ifHy@breaklinks\unhbox\else\box\fi\pdf@box +% \end{macrocode} +% but if it can have multiple paragraphs you'd need one of these, +% but in that case the measured box size would be wrong anyway. +% \begin{quote} +% |\ifHy@breaklinks#1\else\box\pdf@box\fi|\\ +% |\ifHy@breaklinks{#1}\else\box\pdf@box\fi| +% \end{quote} +% \begin{macrocode} + \ifdim\dimen@=\z@ + \literalps@out{H.R}% + \else + \raise\dimen@\hbox{\literalps@out{H.R}}% + \fi + \pdf@addtoksx{H.B}% +} +% \end{macrocode} +% All the supplied material is stored in a token list; since I do not +% feel sure I quite understand these, things may not work as expected +% with expansion. We'll have to experiment. +% \begin{macrocode} +\newtoks\pdf@toks +\newtoks\pdf@defaulttoks +\pdf@defaulttoks={}% +\def\pdf@addtoks#1#2{% + \edef\@processme{\pdf@toks{\the\pdf@toks\space /#2 #1}}% + \@processme +} +\def\pdf@addtoksx#1{% + \edef\@processme{\pdf@toks{\the\pdf@toks\space #1}}% + \@processme +} +\def\PDFdefaults#1{% + \pdf@defaulttoks={#1}% +} +% \end{macrocode} +% This is the list of allowed keys. See the Acrobat manual for an +% explanation. +% \begin{macrocode} +% what is the type of pdfmark? +\define@key{PDF}{pdfmark}{\def\pdf@type{#1}} +% what is the link type? +\define@key{PDF}{linktype}{\def\pdf@linktype{#1}} +\def\pdf@linktype{link} +% parameter is a stream of PDF +\define@key{PDF}{Raw}{\pdf@addtoksx{#1}} +% parameter is a name +\define@key{PDF}{Action}{\pdf@addtoks{#1}{Action}} +% parameter is a array +\define@key{PDF}{Border}{\pdf@addtoks{[#1]}{Border}} +% parameter is a array +\define@key{PDF}{Color}{\pdf@addtoks{[#1]}{Color}} +% parameter is a string +\define@key{PDF}{Contents}{\pdf@addtoks{(#1)}{Contents}} +% parameter is a integer +\define@key{PDF}{Count}{\pdf@addtoks{#1}{Count}} +% parameter is a array +\define@key{PDF}{CropBox}{\pdf@addtoks{[#1]}{CropBox}} +% parameter is a string +\define@key{PDF}{DOSFile}{\pdf@addtoks{(#1)}{DOSFile}} +% parameter is a string or file +\define@key{PDF}{DataSource}{\pdf@addtoks{(#1)}{DataSource}} +% parameter is a destination +\define@key{PDF}{Dest}{% + \begingroup + \edef\x{#1}% + \expandafter\endgroup + \ifx\x\@empty\else\pdf@addtoks{(#1) cvn}{Dest}\fi +} +\define@key{PDF}{DestAnchor}{% + \begingroup + \edef\x{#1}% + \expandafter\endgroup + \ifx\x\@empty\else\pdf@addtoks{(#1) cvn}{Dest}\fi +} +% parameter is a string +\define@key{PDF}{Dir}{\pdf@addtoks{(#1)}{Dir}} +% parameter is a string +\define@key{PDF}{File}{\pdf@addtoks{(#1)}{File}} +% parameter is a int +\define@key{PDF}{Flags}{\pdf@addtoks{#1}{Flags}} +% parameter is a name +\define@key{PDF}{AcroHighlight}{\pdf@addtoks{#1}{H}} +% parameter is a string +\define@key{PDF}{ID}{\pdf@addtoks{[#1]}{ID}} +% parameter is a string +\define@key{PDF}{MacFile}{\pdf@addtoks{(#1)}{MacFile}} +% parameter is a string +\define@key{PDF}{ModDate}{\pdf@addtoks{(#1)}{ModDate}} +% parameter is a string +\define@key{PDF}{Op}{\pdf@addtoks{(#1)}{Op}} +% parameter is a Boolean +\define@key{PDF}{Open}{\pdf@addtoks{#1}{Open}} +% parameter is a integer or name +\define@key{PDF}{Page}{\pdf@addtoks{#1}{Page}} +% parameter is a name +\define@key{PDF}{PageMode}{\pdf@addtoks{#1}{PageMode}} +% parameter is a string +\define@key{PDF}{Params}{\pdf@addtoks{(#1)}{Params}} +% parameter is a array +\define@key{PDF}{Rect}{\pdf@addtoks{[#1]}{Rect}} +% parameter is a integer +\define@key{PDF}{SrcPg}{\pdf@addtoks{#1}{SrcPg}} +% parameter is a name +%\define@key{PDF}{Subtype}{\pdf@addtoks{#1}{Subtype}} +%\define@key{PDF}{Subtype}{\pdf@addtoks{#1}{}} +% parameter is a string +\define@key{PDF}{Title}{\pdf@addtoks{(#1)}{Title}} +% parameter is a string +\define@key{PDF}{Unix}{\pdf@addtoks{(#1)}{Unix}} +% parameter is a string +\define@key{PDF}{UnixFile}{\pdf@addtoks{(#1)}{UnixFile}} +% parameter is an array +\define@key{PDF}{View}{\pdf@addtoks{[#1]}{View}} +% parameter is a string +\define@key{PDF}{WinFile}{\pdf@addtoks{(#1)}{WinFile}} +% \end{macrocode} +% These are the keys used in the DOCINFO section. +% \begin{macrocode} +\define@key{PDF}{Author}{\pdf@addtoks{(#1)}{Author}} +\define@key{PDF}{CreationDate}{\pdf@addtoks{(#1)}{CreationDate}} +\define@key{PDF}{Creator}{\pdf@addtoks{(#1)}{Creator}} +\define@key{PDF}{Producer}{\pdf@addtoks{(#1)}{Producer}} +\define@key{PDF}{Subject}{\pdf@addtoks{(#1)}{Subject}} +\define@key{PDF}{Keywords}{\pdf@addtoks{(#1)}{Keywords}} +\define@key{PDF}{ModDate}{\pdf@addtoks{(#1)}{ModDate}} +\define@key{PDF}{Base}{\pdf@addtoks{(#1)}{Base}} +\define@key{PDF}{URI}{\pdf@addtoks{#1}{URI}} +% +%<*pdfmark|dvipdf> +\def\Acrobatmenu#1#2{% + \pdfmark[{#2}]{% + linktype=menu,% + pdfmark=/ANN,% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Action={<< /Subtype /Named /N /#1 >>},% + Subtype=/Link% + }% +} +% \end{macrocode} +% And now for some useful examples: +% \begin{macrocode} +\def\PDFNextPage{\@ifnextchar[{\PDFNextPage@}{\PDFNextPage@[]}} +\def\PDFNextPage@[#1]#2{% + \pdfmark[{#2}]{#1,Border=\@pdfborder,Color=.2 .1 .5, + pdfmark=/ANN,Subtype=/Link,Page=/Next}} +\def\PDFPreviousPage{% + \@ifnextchar[{\PDFPreviousPage@}{\PDFPreviousPage@[]}% +} +\def\PDFPreviousPage@[#1]#2{% + \pdfmark[{#2}]{#1,Border=\@pdfborder,Color=.4 .4 .1, + pdfmark=/ANN,Subtype=/Link,Page=/Prev}} +\def\PDFOpen#1{% + \pdfmark{#1,pdfmark=/DOCVIEW}% +} +% \end{macrocode} +% This is not as simple as it looks; if we make the argument of +% this macro eg |\pageref{foo}| and expect it to expand to `3', +% we need a special version of |\pageref| +% which does \emph{not} produce +% `3 \hbox{}'\ldots. David Carlisle looked at this bit and provided +% the solution, as ever! +% \begin{macrocode} +\def\PDFPage{\@ifnextchar[{\PDFPage@}{\PDFPage@[]}} +\def\PDFPage@[#1]#2#3{% + \let\pageref\simple@pageref + \pdfmark[{#3}]{% + #1,% + Page={#2},% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\@pagebordercolor,% + pdfmark=/ANN,% + Subtype=/Link% + }% +} +\def\simple@pageref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + 0% + \else + \expandafter\expandafter\expandafter + \@secondoffive\csname r@#1\endcsname + \fi} +% \end{macrocode} +% This will only work if you use Distiller 2.1 or higher. +% \begin{macrocode} +\def\hyper@linkurl#1#2{% + \begingroup + \hyper@chars + \leavevmode +%<*pdfmarkbase> + \pdfmark[{#1}]{% + pdfmark=/ANN,% + linktype=url,% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\@urlbordercolor,% + Action={<< /Subtype /URI /URI (#2) >>},% + Subtype=/Link% + }% +% +%<*dvipdf> + \pdfmark[{#1}]{% + pdfmark=/LNK,% + linktype=url,% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\@urlbordercolor,% + Action={URI /URI (#2)}% + }% +% + \endgroup +} +\def\hyper@linkfile#1#2#3{% + \begingroup + \leavevmode +%<*pdfmark> + \pdfmark[{#1}]{% + pdfmark=/ANN,% + Subtype=/Link, + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + linktype=file,% + Color=\@filebordercolor,% + Action={<< + /S /GoToR + \ifHy@newwindow /NewWindow true \fi + /F (#2) + /D \ifx\\#3\\[0 \@pdfstartview]\else(#3) cvn\fi + >>}% + }% +% +%<*dvipdf> + \pdfmark[{#1}]{% + pdfmark=/LNK,% + linktype=file, + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\@filebordercolor,% + Action={<< + /S /GoToR + \ifHy@newwindow /NewWindow true \fi + /F (#2) + /D \ifx\\#3\\[0 \@pdfstartview]\else(#3) cvn\fi + >>}% + }% +% + \endgroup +} +\def\@hyper@launch run:#1\\#2#3{% + \begingroup + \leavevmode +%<*pdfmark> + \pdfmark[{#2}]{% + pdfmark=/ANN,% + Subtype=/Link,% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + linktype=file,% + Color=\@filebordercolor,% + Action={<< + /S /Launch + \ifHy@newwindow /NewWindow true \fi + /F (#1) + \ifx\\#3\\\else /Win << /P (#3) /F (#1) >> \fi + >>}% + }% +% +%<*dvipdf> + \pdfmark[{#2}]{% + pdfmark=/LNK,% + linktype=file,% + AcroHighlight=\@pdfhighlight,% + Border=\@pdfborder,% + Color=\@filebordercolor,% + Action={<< + /S /GoToR + \ifHy@newwindow /NewWindow true \fi + /F (#1) + /D \ifx\\#3\\[0 \@pdfstartview]\else(#3)\fi + >>}% + }% +% + \endgroup +} +% +% \end{macrocode} +% Unfortunately, some parts of the |pdfmark| +% PostScript code depend on vagaries +% of the dvi driver. We isolate here all the problems. +% +% \subsection{Rokicki's dvips} +% dvips thinks in 10ths of a big point, its +% coordinate space is resolution dependent, +% and its $y$ axis starts at the top of the +% page. Other drivers can and will be different! +% +% The work is done in |SDict|, because we add in some header +% definitions in a moment. +% \begin{macrocode} +%<*dvips> +\input{pdfmark.def}% +\def\@pdfproducer{dvips + Distiller} +\def\literalps@out#1{\special{ps:SDict begin #1 end}}% +\def\headerps@out#1{\special{! #1}}% +\providecommand\@pdfborder{0 0 12} +\providecommand\@pdfview{XYZ} +\providecommand\@pdfviewparams{ H.V} +% \end{macrocode} +% +% \begin{macrocode} +\AtBeginDvi{% + \headerps@out{% +% \end{macrocode} +% Unless I am going mad, this \emph{appears} to be the relationship +% between the default coordinate system (PDF), and dvips; +% \begin{verbatim} +% /DvipsToPDF { .01383701 div Resolution div } def +% /PDFToDvips { .01383701 mul Resolution mul } def +% \end{verbatim} +% the latter's coordinates are resolution dependent, but what that +% .01383701 is, who knows? well, almost everyone except me, I expect\ldots +% And yes, Maarten Gelderman \texttt{} +% points out that its 1/72.27 (the number of points to an inch, big points +% to inch is 1/72). This also suggests that the code would be more +% understandable (and exact) if 0.013 div would be replaced by 72.27 mul, +% so here we go. If this isn't right, I'll revert it. +% \begin{macrocode} + /DvipsToPDF { 72.27 mul Resolution div } def + /PDFToDvips { 72.27 div Resolution mul } def +% \end{macrocode} +% The rectangle around the links starts off +% \emph{exactly} the size of the box; +% we will to make it slightly bigger, 1 point on all sides. +% \begin{macrocode} + /HyperBorder { 1 PDFToDvips } def + /H.V {pdf@hoff pdf@voff null} def + /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def +% \end{macrocode} +% |H.S| (start of anchor, link, or rect) stores +% the $x$ and $y$ coordinates of the current point, in PDF coordinates +% \begin{macrocode} + /H.S { + currentpoint + HyperBorder add /pdf@lly exch def + dup DvipsToPDF /pdf@hoff exch def + HyperBorder sub /pdf@llx exch def + } def +% \end{macrocode} +% +% The calculation of upper left $y$ is done without +% raising the point in \TeX, +% by simply adding on the current |\baselineskip| to the current $y$. +% This is usually too much, so we remove a notional 2 points. +% +% We have to see what the current baselineskip is, and convert it +% to the dvips coordinate system. +% +% Argument: baselineskip in pt. +% The $x$ and $y$ coordinates of the current point, minus the baselineskip +% \begin{macrocode} + /H.L { + 2 sub dup + /HyperBasePt exch def + PDFToDvips /HyperBaseDvips exch def + currentpoint + HyperBaseDvips sub /pdf@ury exch def + /pdf@urx exch def + } def + /H.A { + H.L +% |/pdf@voff| = the distance from the top of the page to a point +% |\baselineskip| above the current point in PDF coordinates + currentpoint exch pop + vsize 72 sub exch DvipsToPDF + HyperBasePt sub % baseline skip + sub /pdf@voff exch def + } def + /H.R { + currentpoint + HyperBorder sub /pdf@ury exch def + HyperBorder add /pdf@urx exch def +% |/pdf@voff| = the distance from the top of the page to the current point, in +% PDF coordinates + currentpoint exch pop vsize 72 sub + exch DvipsToPDF sub /pdf@voff exch def + } def + systemdict + /pdfmark known not + {userdict /pdfmark systemdict /cleartomark get put} if + }% +} +\AfterBeginDocument{% + \ifx\special@paper\@empty\else + \ifHy@setpagesize + \special{papersize=\special@paper}% + \fi + \Hy@DisableOption{setpagesize}% + \fi +} +% +% \end{macrocode} +% +% \subsection{VTeX's vtexpdfmark driver} +% +% This part is derived from the dvips +% (many names reflect this). +% +% The origin seems to be the same as TeX's origin, +% 1 in from the left and 1 in downwards from the top. +% The direction of the $y$ axis is downwards, +% the opposite of the dvips case. Units seems +% to be pt or bp. +% +% \begin{macrocode} +%<*vtexpdfmark> +\input{pdfmark.def}% +\ifnum\OpMode=\@ne + \def\@pdfproducer{VTeX} +\else + \def\@pdfproducer{VTeX + Distiller} +\fi +\def\literalps@out#1{\special{pS:#1}}% +\def\headerps@out#1{\immediate\special{pS:#1}}% +\providecommand\@pdfborder{0 0 1} +\providecommand\@pdfview{XYZ} +\providecommand\@pdfviewparams{ H.V} +% \end{macrocode} +% +% \begin{macrocode} +\AtBeginDvi{% + \headerps@out{% + /vsize {\Hy@pageheight} def +% \end{macrocode} +% The rectangle around the links starts off +% \emph{exactly} the size of the box; +% we will to make it slightly bigger, 1 point on all sides. +% \begin{macrocode} + /HyperBorder {1} def + /H.V {pdf@hoff pdf@voff null} def + /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def +% \end{macrocode} +% +% |H.S| (start of anchor, link, or rect) stores +% the $x$ and $y$ coordinates of the current point, in PDF coordinates: +% $\mathtt{pdf@lly} = Y_c - \mathtt{HyperBorder}$, +% $\mathtt{pdf@hoff} = X_c + 72$, +% $\mathtt{pdf@llx} = X_c - \mathtt{HyperBorder}$ +% \begin{macrocode} + /H.S { + currentpoint + HyperBorder sub + /pdf@lly exch def + dup 72 add /pdf@hoff exch def + HyperBorder sub + /pdf@llx exch def + } def +% \end{macrocode} +% The $x$ and $y$ coordinates of the current point, minus the +% |\baselineskip|: +% $\mathtt{pdf@ury} = Y_c + \mathtt{HyperBasePt} + \mathtt{HyperBorder}$, +% $\mathtt{pdf@urx} = X_c + \mathtt{HyperBorder}$ +% \begin{macrocode} + /H.L { + 2 sub + /HyperBasePt exch def + currentpoint + HyperBasePt add HyperBorder add + /pdf@ury exch def + HyperBorder add + /pdf@urx exch def + } def + /H.A { + H.L + currentpoint exch pop + vsize 72 sub exch + HyperBasePt add add + /pdf@voff exch def + } def +% \end{macrocode} +% $\mathtt{pdf@ury} = Y_c + \mathtt{HyperBorder}$, +% $\mathtt{pdf@urx} = X_c + \mathtt{HyperBorder}$ +% \begin{macrocode} + /H.R { + currentpoint + HyperBorder add + /pdf@ury exch def + HyperBorder add + /pdf@urx exch def + currentpoint exch pop vsize 72 sub add + /pdf@voff exch def + } def + }% +} +% +% \end{macrocode} +% +% \subsection{Textures} +% At the suggestion of Jacques Distler (distler@golem.ph.utexas.edu), try +% to derive a suitable driver for Textures. This was initially a copy of +% dvips, with some guesses about Textures behaviour. +% Ross Moore (\Email{ross@maths.mq.edu.au}) has added modifications +% for better compatibility, and to support use of pdfmark. +% +% Start by defining a macro that expands to the end-of-line character. +% This will be used to format the appearance of PostScript code, +% to enhance readability, and avoid excessively long lines which +% might otherwise become broken to bad places. +% +% \begin{macro}{\Hy@ps@CR} +% The macro \verb|\Hy@ps@CR| contains the end-of-line character. +% \begin{macrocode} +%<*textures> +\begingroup + \obeylines % + \gdef\Hy@ps@CR{\noexpand + }% +\endgroup % +% \end{macrocode} +% \end{macro} +% +% Textures has two types of \verb|\special| command for inserting +% PostScript code directly into the dvi output. The `postscript' +% way preserves TeX's idea of where on the page the \verb|\special| +% occurred, but it wraps the contents with a \verb|save|--\verb|restore| +% pair, and adjusts the user-space coordinate system for local drawing +% commands. The `rawpostscript' way simply inserts code, without regard +% for the location on the page. +% +% Thus, to put arbitrary PostScript coding at a fixed location requires +% using \emph{both} \verb|\special| constructions. +% It works by pushing the device-space coordinates onto the operand stack, +% where they can be used to transform back to the correct user-space +% coordinates for the whole page, within a `rawpostscript' \verb|\special|. +% +% \begin{macrocode} +\def\literalps@out#1{% + \special{postscript 0 0 transform}% + \special{rawpostscript itransform moveto\Hy@ps@CR #1}% +}% +% +% \end{macrocode} +% +% The `prepostscript' is a 3rd kind of \verb|\special|, used for +% inserting definitions into the dictionaries, before page-building +% begins. These are to be available for use on all pages. +% +% \begin{macrocode} +\def\headerps@out#1{% + \special{% + prepostscript TeXdict begin\Hy@ps@CR + #1\Hy@ps@CR + end% + }% +}% +% +% \end{macrocode} +% +% To correctly support the \verb|pdfmark| method, for embedding +% PDF definitions with \verb|.ps| files in a non-intrusive way, +% an appropriate definition needs to be made \emph{before} +% the file \verb|pdfmark.def| is read. Other parameters are best +% set afterwards. +% +% \begin{macrocode} +\AtBeginDvi{% + \headerps@out{% + /betterpdfmark {% + systemdict begin + dup /BP eq + {cleartomark gsave nulldevice [} + {dup /EP eq + {cleartomark cleartomark grestore} + {cleartomark} + ifelse + }ifelse + end + }def\Hy@ps@CR + __pdfmark__ not{/pdfmark /betterpdfmark load def}if + }% end of \headerps@out +}% end of \AtBeginDvi +% +\input{pdfmark.def}% +% +\def\@pdfproducer{Textures + Distiller}% +\providecommand\@pdfborder{0 0 1} +\providecommand\@pdfview{XYZ} +\providecommand\@pdfviewparams{ H.V} +% +% \end{macrocode} +% These are called at the start and end of unboxed links; +% their job is to leave available PS variables called +% |pdf@llx pdf@lly pdf@urx pdf@ury|, which are the coordinates +% of the bounding rectangle of the link, and |pdf@hoff pdf@voff| +% which are the PDF page offsets. +% The Rect pair are called at the LL and UR corners of a box +% known to \TeX. +% \begin{macrocode} +\headerps@out{% +% \end{macrocode} +% Textures lives in normal points, I think. So conversion from one +% coordinate system to another involves doing nothing. +% +% \begin{macrocode} + /vsize {\Hy@pageheight} def + /DvipsToPDF {} def + /PDFToDvips {} def + /HyperBorder { 1 PDFToDvips } def\Hy@ps@CR + /H.V {pdf@hoff pdf@voff null} def\Hy@ps@CR + /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def\Hy@ps@CR + /H.S { + currentpoint + HyperBorder add /pdf@lly exch def + dup DvipsToPDF /pdf@hoff exch def + HyperBorder sub /pdf@llx exch def + } def\Hy@ps@CR + /H.L { + 2 sub + PDFToDvips /HyperBase exch def + currentpoint + HyperBase sub /pdf@ury exch def + /pdf@urx exch def + } def\Hy@ps@CR + /H.A { + H.L + currentpoint exch pop + vsize 72 sub exch DvipsToPDF + HyperBase sub % baseline skip + sub /pdf@voff exch def + } def\Hy@ps@CR + /H.R { + currentpoint + HyperBorder sub /pdf@ury exch def + HyperBorder add /pdf@urx exch def + currentpoint exch pop vsize 72 sub + exch DvipsToPDF sub /pdf@voff exch def + } def\Hy@ps@CR +} +% \end{macrocode} +% \begin{macrocode} +\AfterBeginDocument{% + \ifHy@colorlinks + \headerps@out{/PDFBorder{/Border [0 0 0]}def}% + \fi +} +% \end{macrocode} +% Textures provides built-in support for HyperTeX specials +% so this part combines code from \verb|hypertex.def| with what +% is established by loading \verb|pdfmark.def|, or any other driver. +% \begin{macrocode} +\expandafter\let\expandafter\keepPDF@SetupDoc + \csname PDF@SetupDoc\endcsname +\def\PDF@SetupDoc{% + \ifx\@baseurl\@empty + \else + \special{html:}% + \fi + \keepPDF@SetupDoc +} +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \let\protect=\string + \special{html:}% + \endgroup + \Hy@activeanchortrue + \Hy@colorlink{\@anchorcolor}\anchor@spot\Hy@endcolorlink + \special{html:}% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \begingroup + \hyper@chars + \special{html:}% + \endgroup + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \special{html:}% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\@urltype{url} +\def\hyper@linkstart#1#2{% + \Hy@colorlink{\csname @#1color\endcsname}% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\@urltype + \special{html:}% + \else + \begingroup + \hyper@chars + \special{html:}% + \endgroup + \fi +} +\def\hyper@linkend{% + \special{html:}% + \Hy@endcolorlink +} +\def\hyper@linkfile#1#2#3{% + \hyper@linkurl{#1}{\Hy@linkfileprefix#2\ifx\\#3\\\else\##3\fi}% +} +\def\hyper@linkurl#1#2{% + \leavevmode + \ifHy@raiselinks + \setbox\@tempboxa=\color@hbox #1\color@endbox + \@linkdim\dp\@tempboxa + \lower\@linkdim\hbox{% + \hyper@chars + \special{html:}% + }% + \Hy@colorlink{\@urlcolor}#1% + \@linkdim\ht\@tempboxa + \advance\@linkdim by -6.5\p@ + \raise\@linkdim\hbox{\special{html:}}% + \Hy@endcolorlink + \else + \begingroup + \hyper@chars + \special{html:}% + \Hy@colorlink{\@urlcolor}#1% + \special{html:}% + \Hy@endcolorlink + \endgroup + \fi +} +\def\hyper@link#1#2#3{% + \hyper@linkurl{#3}{\##2}% +} +\def\hyper@image#1#2{% + \begingroup + \hyper@chars + \special{html:}% + \endgroup +} +% +% \end{macrocode} +% \subsection{dvipsone} +% \begin{macrocode} +% \subsection{dvipsone driver} +% Over-ride the default setup macro in pdfmark driver to use Y\&Y +% |\special| commands. +%<*dvipsone> +\providecommand\@pdfborder{0 0 65781} +\input{pdfmark.def}% +\def\@pdfproducer{dvipsone + Distiller} +\def\literalps@out#1{\special{ps:#1}}% +\def\headerps@out#1{\special{! #1}}% +\def\PDF@FinishDoc{% + \Hy@UseMaketitleInfos + \special{PDF: Keywords \@pdfkeywords}% + \special{PDF: Title \@pdftitle}% + \special{PDF: Creator \@pdfcreator}% + \special{PDF: Author \@pdfauthor}% + \special{PDF: Producer \@pdfproducer}% + \special{PDF: Subject \@pdfsubject}% + \Hy@DisableOption{pdfauthor}% + \Hy@DisableOption{pdftitle}% + \Hy@DisableOption{pdfsubject}% + \Hy@DisableOption{pdfcreator}% + \Hy@DisableOption{pdfproducer}% + \Hy@DisableOption{pdfkeywords}% +} +\def\PDF@SetupDoc{% + \pdfmark{% + pdfmark=/DOCVIEW, + Page=\@pdfstartpage, + View=\@pdfstartview, + PageMode=\@pdfpagemode + }% + \ifx\@pdfpagescrop\@empty + \else + \pdfmark{pdfmark=/PAGES,CropBox=\@pdfpagescrop}% + \fi + \edef\Hy@temp{% + \ifHy@toolbar\else /HideToolbar true\fi + \ifHy@menubar\else /HideMenubar true\fi + \ifHy@windowui\else /HideWindowUI true\fi + \ifHy@fitwindow /FitWindow true\fi + \ifHy@centerwindow /CenterWindow true\fi + \ifHy@displaydoctitle /DisplayDocTitle true\fi + \ifx\@pdfnonfullscreenpagemode\@empty + \else + /NonFullScreenPageMode\@pdfnonfullscreenpagemode + \fi + }% + \pdfmark{% + pdfmark=/PUT,% + Raw={% + \string{Catalog\string} << + \ifx\Hy@temp\@empty + \else + /ViewerPreferences<<\Hy@temp>>% + \fi + \ifx\pdf@pagelayout\@empty + \else + /PageLayout /\pdf@pagelayout\space + \fi + \ifx\@baseurl\@empty + \else + /URI << /Base (\@baseurl) >>% + \fi + >>% + }% + }% +} +\providecommand\@pdfview{XYZ} +\providecommand\@pdfviewparams{ % + gsave revscl currentpoint grestore + 72 add exch pop null exch null +} +% \end{macrocode} +% These are called at the start and end of unboxed links; +% their job is to leave available PS variables called +% |pdf@llx pdf@lly pdf@urx pdf@ury|, which are the coordinates +% of the bounding rectangle of the link, and |pdf@hoff pdf@voff| +% which are the PDF page offsets. These latter are currently not +% used in the dvipsone setup. +% The Rect pair are called at the LL and UR corners of a box +% known to \TeX. +% \begin{macrocode} +\special{headertext= +% \end{macrocode} +% dvipsone lives in scaled points; does this mean 65536 or 65781? +% \begin{macrocode} + /DvipsToPDF { 65781 div } def + /PDFToDvips { 65781 mul } def + /HyperBorder { 1 PDFToDvips } def + /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def +% \end{macrocode} +% +% \begin{macrocode} + /H.S { + currentpoint + HyperBorder add /pdf@lly exch def + dup DvipsToPDF /pdf@hoff exch def + HyperBorder sub /pdf@llx exch def + } def + /H.L { + 2 sub + PDFToDvips /HyperBase exch def + currentpoint + HyperBase sub /pdf@ury exch def + /pdf@urx exch def + } def + /H.A { + H.L + currentpoint exch pop + HyperBase sub % baseline skip + DvipsToPDF /pdf@voff exch def + } def + /H.R { + currentpoint + HyperBorder sub /pdf@ury exch def + HyperBorder add /pdf@urx exch def + currentpoint exch pop DvipsToPDF /pdf@voff exch def + } def + systemdict + /pdfmark known not + {userdict /pdfmark systemdict /cleartomark get put} if +} +% +%<*dvipdf> +\def\literalps@out#1{\special{pdf: #1}}% +\providecommand\@pdfborder{0 0 1} +% +% \end{macrocode} +% +% \subsection{TeX4ht} +% \begin{macrocode} +%<*tex4ht> +\@ifpackageloaded{tex4ht} + {\typeout{hyperref tex4ht: tex4ht already loaded}}% + {\RequirePackage[htex4ht]{tex4ht}} +\def\PDF@FinishDoc{} +\def\PDF@SetupDoc{% + \ifx\@baseurl\@empty + \else + \special{t4ht=}% + \fi +} +\def\hyper@anchor#1{% + \Hy@SaveLastskip + \begingroup + \let\protect=\string + \special{t4ht=}% + \endgroup + \Hy@activeanchortrue + \Hy@colorlink{\@anchorcolor}\anchor@spot\Hy@endcolorlink + \special{t4ht=}% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\hyper@anchorstart#1{% + \Hy@SaveLastskip + \begingroup + \hyper@chars\special{t4ht=}% + \endgroup + \Hy@activeanchortrue +} +\def\hyper@anchorend{% + \special{t4ht=}% + \Hy@activeanchorfalse + \Hy@RestoreLastskip +} +\def\@urltype{url} +\def\hyper@linkstart#1#2{% + \Hy@colorlink{\csname @#1color\endcsname}% + \def\Hy@tempa{#1}% + \ifx\Hy@tempa\@urltype + \special{t4ht=}% + \else + {\hyper@chars\special{t4ht=}}% + \fi +} +\def\hyper@linkend{% + \special{t4ht=}% + \Hy@endcolorlink +} +\def\hyper@linkfile#1#2#3{% + \hyper@linkurl{#1}{\Hy@linkfileprefix#2\ifx\\#3\\\else\##3\fi}% +} +\def\hyper@linkurl#1#2{% + \leavevmode + \ifHy@raiselinks + \setbox\@tempboxa=\color@hbox #1\color@endbox + \@linkdim\dp\@tempboxa + \lower\@linkdim\hbox{% + \begingroup + \hyper@chars\special{t4ht=}% + \endgroup + }% + \Hy@colorlink{\@urlcolor}#1\Hy@endcolorlink + \@linkdim\ht\@tempboxa + \advance\@linkdim by -6.5\p@ + \raise\@linkdim\hbox{\special{t4ht=}}% + \else + \begingroup + \hyper@chars + \special{t4ht=}% + \Hy@colorlink{\@urlcolor}#1\Hy@endcolorlink + \special{t4ht=}% + \endgroup + \fi +} +\def\hyper@link#1#2#3{% + \hyper@linkurl{#3}{\##2}% +} +\def\hyper@image#1#2{% + \begingroup + \hyper@chars + \special{t4ht=}% + \endgroup +} +\let\autoref\ref +\ifx \rEfLiNK \UnDef + \def\rEfLiNK #1#2{#2}% +\fi +\def\backref#1{} +% +%<*tex4htcfg> +\IfFileExists{\jobname.cfg}{\endinput}{} +\Preamble{html} + \begin{document} +\EndPreamble +\def\TeX{TeX} +\def\OMEGA{Omega} +\def\LaTeX{La\TeX} +\def\LaTeXe{\LaTeX2e} +\def\eTeX{e-\TeX} +\def\MF{Metafont} +\def\MP{Metapost} +% +% \end{macrocode} +% +% \section{Driver-specific form support} +% \subsection{pdfmarks} +% \begin{macrocode} +%<*pdfmark> +\long\def\@Form[#1]{% +\AtBeginDvi{% + \headerps@out{% +[ /_objdef {pdfDocEncoding} + /type /dict +/OBJ pdfmark +[ {pdfDocEncoding} + << /Type /Encoding + /Differences [ 24 /breve /caron /circumflex /dotaccent +/hungarumlaut /ogonek /ring /tilde 39 /quotesingle 96 /grave 128 +/bullet /dagger /daggerdbl /ellipsis /emdash /endash /florin /fraction +/guilsinglleft /guilsinglright /minus /perthousand /quotedblbase +/quotedblleft /quotedblright /quoteleft /quoteright /quotesinglbase +/trademark /fi /fl /Lslash /OE /Scaron /Ydieresis /Zcaron /dotlessi +/lslash /oe /scaron /zcaron 164 /currency 166 /brokenbar 168 /dieresis +/copyright /ordfeminine 172 /logicalnot /.notdef /registered /macron +/degree /plusminus /twosuperior /threesuperior /acute /mu 183 +/periodcentered /cedilla /onesuperior /ordmasculine 188 /onequarter +/onehalf /threequarters 192 /Agrave /Aacute /Acircumflex /Atilde +/Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex +/Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash +/Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls +/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla +/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex +/idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde +/odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis +/yacute /thorn /ydieresis ] +>> +/PUT pdfmark +[ /_objdef {ZaDb} + /type /dict +/OBJ pdfmark +[ {ZaDb} + << + /Type /Font + /Subtype /Type1 + /Name /ZaDb + /BaseFont /ZapfDingbats + >> +/PUT pdfmark +[ /_objdef {Helv} + /type /dict +/OBJ pdfmark +[ {Helv} + << + /Type /Font + /Subtype /Type1 + /Name /Helv + /BaseFont /Helvetica + /Encoding {pdfDocEncoding} + >> +/PUT pdfmark +[ /_objdef {aform} + /type /dict +/OBJ pdfmark +[ /_objdef {afields} + /type /array +/OBJ pdfmark +[/BBox [0 0 100 100] /_objdef {Check} /BP pdfmark +1 0 0 setrgbcolor /ZapfDingbats 80 selectfont 20 20 moveto (4) show +[/EP pdfmark +[/BBox [0 0 100 100] /_objdef {Cross} /BP pdfmark +1 0 0 setrgbcolor /ZapfDingbats 80 selectfont 20 20 moveto (8) show +[/EP pdfmark +[/BBox [0 0 250 100] /_objdef {Submit} /BP pdfmark 0.6 setgray 0 0 250 +100 rectfill 1 setgray 2 2 moveto 2 98 lineto 248 98 lineto 246 96 +lineto 4 96 lineto 4 4 lineto fill 0.34 setgray 248 98 moveto 248 2 +lineto 2 2 lineto 4 4 lineto 246 4 lineto 246 96 lineto fill +/Helvetica 76 selectfont 0 setgray 8 22.5 moveto (Submit) show +[/EP pdfmark +[/BBox [0 0 250 100] /_objdef {SubmitP} /BP pdfmark 0.6 setgray 0 0 +250 100 rectfill 0.34 setgray 2 2 moveto 2 98 lineto 248 98 lineto 246 +96 lineto 4 96 lineto 4 4 lineto fill 1 setgray 248 98 moveto 248 2 +lineto 2 2 lineto 4 4 lineto 246 4 lineto 246 96 lineto fill +/Helvetica 76 selectfont 0 setgray 10 20.5 moveto (Submit) show +[/EP pdfmark +[ {aform} + << + /Fields {afields} + /DR << /Font << /ZaDb {ZaDb} /Helv {Helv} >> >> + /DA (/Helv 10 Tf 0 g ) + /CO {corder} + /NeedAppearances true + >> +/PUT pdfmark +[ \string{Catalog\string} + << + /AcroForm {aform} + >> +/PUT pdfmark +[ /_objdef {corder} /type /array /OBJ pdfmark % dps +}}% + \setkeys{Form}{#1}% +} +\def\@endForm{} +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, pdfmark drivers do not support FORM gauges}% +} +\def\@TextField[#1]#2{% parameters, label + \def\Fld@name{#2}% + \def\Fld@default{}% + \let\Fld@value\@empty + \def\Fld@width{\DefaultWidthofText}% + \def\Fld@height{\DefaultHeightofText}% + \ifFld@multiline + \begingroup + \dimen@=\DefaultHeightofText + \dimen@=4\dimen@ + \edef\x{\endgroup + \def\noexpand\Fld@height{\the\dimen@}% + }% + \x + \fi + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi + \LayoutTextField{#2}{% + \pdfmark[\MakeTextField{\Fld@width}{\Fld@height}]{% + pdfmark=/ANN,Raw={\PDFForm@Text}% + }% + }% + \egroup +} +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \def\Fld@name{#2}% + \def\Fld@default{}% + \def\Fld@width{\DefaultWidthofChoiceMenu}% + \def\Fld@height{\DefaultHeightofChoiceMenu}% + \bgroup + \Fld@menulength=0 + \@tempdima\z@ + \@for\@curropt:=#3\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@menulength + \settowidth{\@tempdimb}{\@currDisplay}% + \ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi + }% + \advance\@tempdima by 15\p@ + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutChoiceField{#2}{% + \ifFld@radio + \@@Radio{#3}% + \else + {% + \ifdim\Fld@width<\@tempdima + \ifdim\@tempdima<1cm\@tempdima1cm\fi + \edef\Fld@width{\the\@tempdima}% + \fi + \def\Fld@flags{}% + \ifFld@combo\def\Fld@flags{/Ff 917504}\fi + \ifFld@popdown\def\Fld@flags{/Ff 131072}\fi + \ifx\Fld@flags\@empty + \@tempdima=\the\Fld@menulength\Fld@charsize + \advance\@tempdima by \Fld@borderwidth bp + \advance\@tempdima by \Fld@borderwidth bp + \edef\Fld@height{\the\@tempdima}% + \fi + \@@Listbox{#3}% + }% + \fi + }% + \egroup +} +\def\@@Radio#1{% + \Fld@listcount=0 + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@listcount + \@currDisplay\space + \pdfmark[\MakeRadioField{\Fld@width}{\Fld@height}]{% + pdfmark=/ANN,% + Raw={\PDFForm@Radio /AP <> >>}% + } % deliberate space between radio buttons + }% +} +\newcount\Fld@listcount +\def\@@Listbox#1{% + \Choice@toks={ }% + \Fld@listcount=0 + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@listcount + \edef\@processme{% + \Choice@toks{\the\Choice@toks [(\@currValue) (\@currDisplay)]}% + }\@processme + }% + \pdfmark[\MakeChoiceField{\Fld@width}{\Fld@height}]{% + pdfmark=/ANN,Raw={\PDFForm@List}% + }% +} +\def\@PushButton[#1]#2{% parameters, label + \def\Fld@name{#2}% + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutPushButtonField{% + \pdfmark[\MakeButtonField{#2}]{% + pdfmark=/ANN,Raw={\PDFForm@Push}% + }% + }% + \egroup +} +\def\@Submit[#1]#2{% + \Field@toks={ }% + \def\Fld@width{\DefaultWidthofSubmit}% + \def\Fld@height{\DefaultHeightofSubmit}% + \bgroup + \def\Fld@name{Submit}% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \pdfmark[\MakeButtonField{#2}]{% + pdfmark=/ANN,% + Raw={\PDFForm@Submit /AP << /N {Submit} /D {SubmitP} >>}% + }% + \egroup +} +\def\@Reset[#1]#2{% + \Field@toks={ }% + \def\Fld@width{\DefaultWidthofReset}% + \def\Fld@height{\DefaultHeightofReset}% + \bgroup + \def\Fld@name{Reset}% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \pdfmark[\MakeButtonField{#2}]{% + pdfmark=/ANN,Raw={\PDFForm@Reset}% + }% + \egroup +} +\def\@CheckBox[#1]#2{% parameters, label + \def\Fld@name{#2}% + \def\Fld@default{0}% + \bgroup + \def\Fld@width{\DefaultWidthofCheckBox}% + \def\Fld@height{\DefaultHeightofCheckBox}% + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutCheckField{#2}{% + \pdfmark[\MakeCheckField{\Fld@width}{\Fld@height}]{% + pdfmark=/ANN,Raw={\PDFForm@Check}% + }% + }% + \egroup +} +% +% \end{macrocode} +% \subsection{dvipdf} +% \begin{macrocode} +%<*dvipdf> +\def\@Form[#1]{\typeout{Sorry, I do not support FORMs}} +\def\@endForm{} +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, dvipdf does not support FORM gauges}% +} +\def\@TextField[#1]#2{% parameters, label + \typeout{Sorry, dvipdf does not support FORM text fields}% +} +\def\@CheckBox[#1]#2{% parameters, label + \typeout{Sorry, dvipdf does not support FORM checkboxes}% +} +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \typeout{Sorry, dvipdf does not support FORM choice menus}% +} +\def\@PushButton[#1]#2{% parameters, label + \typeout{Sorry, dvipdf does not support FORM pushbuttons}% +} +\def\@Reset[#1]#2{\typeout{Sorry, dvipdf does not support FORMs}} +\def\@Submit[#1]#2{\typeout{Sorry, dvipdf does not support FORMs}} +% +% \end{macrocode} +% \subsection{HyperTeX} +% \begin{macrocode} +%<*hypertex> +\def\@Form[#1]{\typeout{Sorry, HyperTeX does not support FORMs}} +\def\@endForm{} +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, HyperTeX does not support FORM gauges}% +} +\def\@TextField[#1]#2{% parameters, label + \typeout{Sorry, HyperTeX does not support FORM text fields}% +} +\def\@CheckBox[#1]#2{% parameters, label + \typeout{Sorry, HyperTeX does not support FORM checkboxes}% +} +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \typeout{Sorry, HyperTeX does not support FORM choice menus}% +} +\def\@PushButton[#1]#2{% parameters, label + \typeout{Sorry, HyperTeX does not support FORM pushbuttons}% +} +\def\@Reset[#1]#2{\typeout{Sorry, HyperTeX does not support FORMs}} +\def\@Submit[#1]#2{\typeout{Sorry, HyperTeX does not support FORMs}} +% +% \end{macrocode} +% \subsection{TeX4ht} +% \begin{macrocode} +%<*tex4ht> +\def\@Form[#1]{% + \setkeys{Form}{#1}% + \HCode{
}% +} +\def\@endForm{\HCode{
}} +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, TeX4ht does not support gauges}% +} +\def\@TextField[#1]#2{% parameters, label + \let\Hy@reserved@a\@empty + \def\Fld@name{#2}% + \def\Fld@default{}% + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \HCode{}% + \ifFld@password + \@@PasswordField + \else + \@@TextField + \fi + \egroup +} +\def\@@PasswordField{% + \HCode{% + % + }% +} +\def\@@TextField{% + \ifFld@multiline + \HCode{}% + \else + \HCode{ + }% + \fi +} +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \def\Fld@name{#2}% + \def\Fld@default{}% + \let\Hy@reserved@a\relax + \bgroup + \expandafter\Fld@findlength#3\\% + \Field@toks={ }% + \setkeys{Field}{#1}% + #2% + \ifFld@radio + \expandafter\@@Radio#3\\% + \else + \expandafter\@@Menu#3\\% + \fi + \egroup +} +\def\Fld@findlength#1\\{% + \Fld@menulength=0 + \@for\@curropt:=#1\do{\Hy@StepCount\Fld@menulength}% +} +\def\@@Menu#1\\{% + \HCode{}% +} +\def\@@Radio#1\\{% + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \HCode{% + }% + \@currDisplay + }% +} +\def\@PushButton[#1]#2{% parameters, label + \def\Fld@name{#2}% + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \HCode{% + }% + \HCode{}% + \egroup +} +\def\@Submit[#1]#2{% + \HCode{}% +} +\def\@Reset[#1]#2{% + \HCode{}% +} +\def\@CheckBox[#1]#2{% parameters, label + \let\Hy@reserved@a\@empty + \def\Fld@name{#2}% + \def\Fld@default{0}% + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \HCode{% + #2% + }% + \egroup +} +% +% \end{macrocode} +% +% \subsection{pdfTeX} +% \begin{macrocode} +%<*pdftex> +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, pdftex does not support FORM gauges}% +} +\RequirePackage{pifont}% +\def\MakeFieldObject#1#2{\sbox0{#1}% + \immediate\pdfxform0 % + \expandafter\edef\csname #2Object\endcsname{% + \the\pdflastxform\space 0 R% + }% +% \hbox to 0pt{\hskip-\maxdimen{\pdfrefxform \the\pdflastxform}}% +}% +\def\@Form[#1]{% + \@ifundefined{textcolor}{\let\textcolor\@gobble}{}% + \setkeys{Form}{#1}% + \ifnum\pdftexversion>13 + \pdfrefobj\OBJ@pdfdocencoding + \pdfrefobj\OBJ@ZaDb + \pdfrefobj\OBJ@Helv + \pdfrefobj\OBJ@acroform + \fi + \pdfcatalog{/AcroForm \OBJ@acroform\space 0 R}% + \MakeFieldObject{\ding{123}}{Ding}% + \MakeFieldObject{\fbox{\textcolor{yellow}{\textsf{Submit}}}}{Submit}% + \MakeFieldObject{\fbox{\textcolor{yellow}{\textsf{SubmitP}}}}{SubmitP}% +} +\def\@endForm{} +\def\@TextField[#1]#2{% parameters, label + \def\Fld@name{#2}% + \def\Fld@default{}% + \let\Fld@value\@empty + \def\Fld@width{\DefaultWidthofText}% + \def\Fld@height{\DefaultHeightofText}% + \ifFld@multiline + \begingroup + \dimen@=\DefaultHeightofText + \dimen@=4\dimen@ + \edef\x{\endgroup + \def\noexpand\Fld@height{\the\dimen@}% + }% + \x + \fi + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi + \LayoutTextField{#2}{% + \pdfstartlink user {\PDFForm@Text}% + \MakeTextField{\Fld@width}{\Fld@height}\pdfendlink}% + \egroup +} +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \def\Fld@name{#2}% + \def\Fld@default{}% + \def\Fld@width{\DefaultWidthofChoiceMenu}% + \def\Fld@height{\DefaultHeightofChoiceMenu}% + \bgroup + \Fld@menulength=0 + \@tempdima\z@ + \@for\@curropt:=#3\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@menulength + \settowidth{\@tempdimb}{\@currDisplay}% + \ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi + }% + \advance\@tempdima by 15\p@ + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutChoiceField{#2}{% + \ifFld@radio + \@@Radio{#3}% + \else + {% + \ifdim\Fld@width<\@tempdima + \ifdim\@tempdima<1cm\@tempdima1cm\fi + \edef\Fld@width{\the\@tempdima}% + \fi + \def\Fld@flags{}% + \ifFld@combo\def\Fld@flags{/Ff 917504}\fi + \ifFld@popdown\def\Fld@flags{/Ff 131072}\fi + \ifx\Fld@flags\@empty + \@tempdima=\the\Fld@menulength\Fld@charsize + \advance\@tempdima by \Fld@borderwidth bp + \advance\@tempdima by \Fld@borderwidth bp + \edef\Fld@height{\the\@tempdima}% + \fi + \@@Listbox{#3}% + }% + \fi + }% + \egroup +} +\def\@@Radio#1{% + \Fld@listcount=0 + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@listcount + \@currDisplay\space + \leavevmode + \pdfstartlink user {% + \PDFForm@Radio + /AP << + /N << +% \end{macrocode} +% Laurent.Guillope@math.univ-nantes.fr (Laurent Guillope) +% persuades me that this was wrong: +% |/\Fld@name\the\Fld@listcount|. But I leave it here to remind +% me that it is untested. +% \begin{macrocode} + /\@currValue\space \DingObject + >> + >> + }% + \MakeRadioField{\Fld@width}{\Fld@height}\pdfendlink + \space% deliberate space between radio buttons + }% +} +\newcount\Fld@listcount +\def\@@Listbox#1{% + \Choice@toks={ }% + \Fld@listcount=0 + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@listcount + \edef\@processme{% + \Choice@toks{\the\Choice@toks [(\@currValue) (\@currDisplay)]}% + }\@processme + }% + \leavevmode + \pdfstartlink user {\PDFForm@List}% + \MakeChoiceField{\Fld@width}{\Fld@height}% + \pdfendlink +} +\def\@PushButton[#1]#2{% parameters, label + \def\Fld@name{#2}% + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutPushButtonField{% + \leavevmode + \pdfstartlink user {\PDFForm@Push}% + \MakeButtonField{#2}% + \pdfendlink + }% + \egroup +} +\def\@Submit[#1]#2{% + \Field@toks={ }% + \def\Fld@width{\DefaultWidthofSubmit}% + \def\Fld@height{\DefaultHeightofSubmit}% + \bgroup + \def\Fld@name{Submit}% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \leavevmode + \pdfstartlink user {% + \PDFForm@Submit + /AP << /N \SubmitObject\space /D \SubmitPObject >> + }% + \MakeButtonField{#2}% + \pdfendlink + \egroup +} +\def\@Reset[#1]#2{% + \Field@toks={ }% + \def\Fld@width{\DefaultWidthofReset}% + \def\Fld@height{\DefaultHeightofReset}% + \bgroup + \def\Fld@name{Reset}% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \leavevmode + \pdfstartlink user {\PDFForm@Reset}% + \MakeButtonField{#2}% + \pdfendlink + \egroup +} +\def\@CheckBox[#1]#2{% parameters, label + \def\Fld@name{#2}% + \def\Fld@default{0}% + \bgroup + \def\Fld@width{\DefaultWidthofCheckBox}% + \def\Fld@height{\DefaultHeightofCheckBox}% + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutCheckField{#2}{% + \pdfstartlink user {\PDFForm@Check}% + \MakeCheckField{\Fld@width}{\Fld@height}% + \pdfendlink + }% + \egroup +} +\pdfobj { << /Type /Encoding /Differences [ 24 /breve /caron +/circumflex /dotaccent /hungarumlaut /ogonek /ring /tilde 39 +/quotesingle 96 /grave 128 /bullet /dagger /daggerdbl /ellipsis +/emdash /endash /florin /fraction /guilsinglleft /guilsinglright +/minus /perthousand /quotedblbase /quotedblleft /quotedblright +/quoteleft /quoteright /quotesinglbase /trademark /fi /fl /Lslash /OE +/Scaron /Ydieresis /Zcaron /dotlessi /lslash /oe /scaron /zcaron 164 +/currency 166 /brokenbar 168 /dieresis /copyright /ordfeminine 172 +/logicalnot /.notdef /registered /macron /degree /plusminus +/twosuperior /threesuperior /acute /mu 183 /periodcentered /cedilla +/onesuperior /ordmasculine 188 /onequarter /onehalf /threequarters 192 +/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex +/Idieresis /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde +/Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis +/Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde +/adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex +/edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde +/ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash +/ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ] >> +} +\edef\OBJ@pdfdocencoding{\the\pdflastobj} +\pdfobj { + << + /Type /Font + /Subtype /Type1 + /Name /ZaDb + /BaseFont /ZapfDingbats +>> +} +\edef\OBJ@ZaDb{\the\pdflastobj} +\pdfobj { << + /Type /Font + /Subtype /Type1 + /Name /Helv + /BaseFont /Helvetica + /Encoding \OBJ@pdfdocencoding\space 0 R + >> +} +\edef\OBJ@Helv{\the\pdflastobj} +\pdfobj { + << + /Fields [] + /DR << + /Font << /ZaDb \OBJ@ZaDb\space 0 R /Helv \OBJ@Helv\space0 R >> + >> + /DA (/Helv 10 Tf 0 g ) + /NeedAppearances true + >> +} +\edef\OBJ@acroform{\the\pdflastobj} +% +% \end{macrocode} +% +% \subsection{dvipdfm} +% D. P. Story adapted the pdf\TeX{} forms part for dvipdfm, of which +% version 0.12.7b or higher is required because of a bug. +% \begin{macrocode} +%<*dvipdfm> +% \end{macrocode} +% +% \begin{macro}{\@Gauge} +% \begin{macrocode} +\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum + \typeout{Sorry, dvipdfm does not support FORM gauges}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@Form} +% \begin{macrocode} +\def\@Form[#1]{% + \@ifundefined{textcolor}{\let\textcolor\@gobble}{}% + \setkeys{Form}{#1}% + \@pdfm@mark{obj @afields [ ]}% + \@pdfm@mark{obj @corder [ ]}% + \@pdfm@mark{% + obj @aform << + /Fields @afields + /DR << /Font << /ZaDb @OBJZaDb /Helv @OBJHelv >> >> + /DA (/Helv 10 Tf 0 g ) + /CO @corder + /NeedAppearances true + >>% + }% + \@pdfm@mark{put @catalog << /AcroForm @aform >>}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@endForm} +% \begin{macrocode} +\def\@endForm{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dvipdfm@setdim} +% \cmd{\dvipdfm@setdim} sets dimensions for ann using +% \cmd{\pdfm@box}. +% \begin{macrocode} +\def\dvipdfm@setdim{% + height \the\ht\pdfm@box\space + width \the\wd\pdfm@box\space + depth \the\dp\pdfm@box\space +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@TextField} +% \begin{macrocode} +\def\@TextField[#1]#2{% parameters, label + \def\Fld@name{#2}% + \def\Fld@default{}% + \let\Fld@value\@empty + \def\Fld@width{\DefaultWidthofText}% + \def\Fld@height{\DefaultHeightofText}% + \ifFld@multiline + \begingroup + \dimen@=\DefaultHeightofText + \dimen@=4\dimen@ + \edef\x{\endgroup + \def\noexpand\Fld@height{\the\dimen@}% + }% + \x + \fi + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi + \setbox\pdfm@box=\hbox{% + \MakeTextField{\Fld@width}{\Fld@height}% + }% + \LayoutTextField{#2}{% + \@pdfm@mark{% + ann @\Fld@name\space \dvipdfm@setdim << \PDFForm@Text >>% + }% + }% + \unhbox\pdfm@box + \@pdfm@mark{put @afields @\Fld@name}% record in @afields array + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ChoiceMenu} +% \begin{macrocode} +\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices + \def\Fld@name{#2}% + \def\Fld@default{}% + \def\Fld@width{\DefaultWidthofChoiceMenu}% + \def\Fld@height{\DefaultHeightofChoiceMenu}% + \bgroup + \Fld@menulength=0 + \@tempdima\z@ + \@for\@curropt:=#3\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@menulength + \settowidth{\@tempdimb}{\@currDisplay}% + \ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi + }% + \advance\@tempdima by 15\p@ + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \LayoutChoiceField{#2}{% + \ifFld@radio + \@@Radio{#3}% + \else + {% + \ifdim\Fld@width<\@tempdima + \ifdim\@tempdima<1cm\@tempdima1cm\fi + \edef\Fld@width{\the\@tempdima}% + \fi + \def\Fld@flags{}% + \ifFld@combo\def\Fld@flags{/Ff 917504}\fi + \ifFld@popdown\def\Fld@flags{/Ff 131072}\fi + \ifx\Fld@flags\@empty + \@tempdima=\the\Fld@menulength\Fld@charsize + \advance\@tempdima by \Fld@borderwidth bp + \advance\@tempdima by \Fld@borderwidth bp + \edef\Fld@height{\the\@tempdima}% + \fi + \@@Listbox{#3}% + }% + \fi + }% + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@Radio} +% \begin{macrocode} +\def\@@Radio#1{% + \Fld@listcount=0 + \setbox\pdfm@box=\hbox{\MakeRadioField{\Fld@width}{\Fld@height}}% + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@listcount + \@currDisplay\space + \leavevmode + \@pdfm@mark{% + ann \ifnum\Fld@listcount=1 @\Fld@name\space\fi + \dvipdfm@setdim + << + \PDFForm@Radio\space + /AP << /N << /\@currValue /null >> >> + >>% + }% + \unhcopy\pdfm@box\space% deliberate space between radio buttons + \ifnum\Fld@listcount=1\@pdfm@mark{put @afields @\Fld@name}\fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Fld@listcount} +% \begin{macrocode} +\newcount\Fld@listcount +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@@Listbox} +% \begin{macrocode} +\def\@@Listbox#1{% + \Choice@toks={ }% + \Fld@listcount=0 + \@for\@curropt:=#1\do{% + \expandafter\Fld@checkequals\@curropt==\\% + \Hy@StepCount\Fld@listcount + \edef\@processme{% + \Choice@toks{\the\Choice@toks [(\@currValue) (\@currDisplay)]}% + }\@processme + }% + \setbox\pdfm@box=\hbox{\MakeChoiceField{\Fld@width}{\Fld@height}}% + \leavevmode + \@pdfm@mark{% + ann @\Fld@name\space\dvipdfm@setdim + << \PDFForm@List >>% + }% + \unhbox\pdfm@box + \@pdfm@mark{put @afields @\Fld@name}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@PushButton} +% \begin{macrocode} +\def\@PushButton[#1]#2{% parameters, label + \def\Fld@name{#2}% + \bgroup + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \setbox\pdfm@box=\hbox{\MakeButtonField{#2}}% + \LayoutPushButtonField{% + \leavevmode + \@pdfm@mark{% + ann @\Fld@name\space\dvipdfm@setdim + << \PDFForm@Push >>% + }% + }% + \unhbox\pdfm@box + \@pdfm@mark{put @afields @\Fld@name}% + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@Submit} +% \begin{macrocode} +\def\@Submit[#1]#2{% + \Field@toks={ }% + \def\Fld@width{\DefaultWidthofSubmit}% + \def\Fld@height{\DefaultHeightofSubmit}% + \bgroup + \def\Fld@name{Submit}% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \setbox\pdfm@box=\hbox{\MakeButtonField{#2}}% + \leavevmode + \@pdfm@mark{% + ann @\Fld@name\space\dvipdfm@setdim + << \PDFForm@Submit >>% + }% + \unhbox\pdfm@box% + \@pdfm@mark{put @afields @\Fld@name}% + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@Reset} +% \begin{macrocode} +\def\@Reset[#1]#2{% + \Field@toks={ }% + \def\Fld@width{\DefaultWidthofReset}% + \def\Fld@height{\DefaultHeightofReset}% + \bgroup + \def\Fld@name{Reset}% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \setbox\pdfm@box=\hbox{\MakeButtonField{#2}}% + \leavevmode + \@pdfm@mark{% + ann @\Fld@name\space\dvipdfm@setdim + << \PDFForm@Reset >>% + }% + \unhbox\pdfm@box + \@pdfm@mark{put @afields @\Fld@name}% + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@CheckBox} +% \begin{macrocode} +\def\@CheckBox[#1]#2{% parameters, label + \def\Fld@name{#2}% + \def\Fld@default{0}% + \bgroup + \def\Fld@width{\DefaultWidthofCheckBox}% + \def\Fld@height{\DefaultHeightofCheckBox}% + \Field@toks={ }% + \setkeys{Field}{#1}% + \ifFld@hidden\def\Fld@width{1sp}\fi + \setbox\pdfm@box=\hbox{\MakeCheckField{\Fld@width}{\Fld@height}}% + \LayoutCheckField{#2}{% + \@pdfm@mark{% + ann @\Fld@name\space\dvipdfm@setdim + << \PDFForm@Check >>% + }% + \unhbox\pdfm@box + \@pdfm@mark{put @afields @\Fld@name}% + }% + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\@pdfm@mark{obj @OBJpdfdocencoding << /Type /Encoding /Differences [% + 24 /breve /caron /circumflex /dotaccent /hungarumlaut /ogonek /ring + /tilde + 39 /quotesingle + 96 /grave + 128 /bullet /dagger /daggerdbl /ellipsis /emdash /endash /florin + /fraction /guilsinglleft /guilsinglright /minus /perthousand + /quotedblbase /quotedblleft /quotedblright /quoteleft /quoteright + /quotesinglbase /trademark /fi /fl /Lslash /OE /Scaron /Ydieresis + /Zcaron /dotlessi /lslash /oe /scaron /zcaron + 164 /currency + 166 /brokenbar + 168 /dieresis /copyright /ordfeminine + 172 /logicalnot /.notdef /registered /macron /degree /plusminus + /twosuperior /threesuperior /acute /mu + 183 /periodcentered /cedilla /onesuperior /ordmasculine + 188 /onequarter /onehalf /threequarters + 192 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE + /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute + /Icircumflex /Idieresis /Eth /Ntilde /Ograve /Oacute /Ocircumflex + /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex + /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex + /atilde /adieresis /aring /ae /ccedilla /egrave /eacute + /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis + /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis + /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute + /thorn /ydieresis% + ] >> +} +\@pdfm@mark{obj @OBJZaDb + << + /Type /Font + /Subtype /Type1 + /Name /ZaDb + /BaseFont /ZapfDingbats + >> +} +\@pdfm@mark{obj @OBJHelv + << + /Type /Font + /Subtype /Type1 + /Name /Helv + /BaseFont /Helvetica + /Encoding @OBJpdfdocencoding + >> +} +% +% \end{macrocode} +% +% \subsection{Common forms part} +% \begin{macrocode} +%<*pdfform> +% \end{macrocode} +% \begin{macro}{\PDFForm@Check} +% \begin{macrocode} +\def\PDFForm@Check{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /Q \Fld@align\space + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /MK << + /BC [\Fld@bordercolor] + \ifx\Fld@bcolor\@empty + \else + /BG [\Fld@bcolor] + \fi + /CA (\Fld@cbsymbol) + >> + /DA (/ZaDb \strip@pt\Fld@charsize\space Tf \Fld@color\space rg) + /FT /Btn + /H /P + \ifFld@checked /V /Yes \else /V /Off \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDFForm@Push} +% \begin{macrocode} +\def\PDFForm@Push{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /FT /Btn + /Ff 65540 + /H /P + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /MK << + /BC [\Fld@bordercolor] + >> + /A << /S /JavaScript /JS (\Fld@onclick;) >> +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Fld@additionalactions} +% \begin{macrocode} +\def\Fld@additionalactions{% + /AA << +% \end{macrocode} +% K input (keystroke) format +% \begin{macrocode} + \ifx\Fld@keystroke@code\@empty + \else + /K << /S /JavaScript /JS (\Fld@keystroke@code) >> + \fi +% \end{macrocode} +% F display format +% \begin{macrocode} + \ifx\Fld@format@code\@empty + \else + /F << /S /JavaScript /JS (\Fld@format@code) >> + \fi +% \end{macrocode} +% V validation +% \begin{macrocode} + \ifx\Fld@validate@code\@empty + \else + /V << /S /JavaScript /JS (\Fld@validate@code) >> + \fi +% \end{macrocode} +% C calculation +% \begin{macrocode} + \ifx\Fld@calculate@code\@empty + \else + /C << /S /JavaScript /JS (\Fld@calculate@code) >> + \fi +% \end{macrocode} +% Fo receiving the input focus +% \begin{macrocode} + \ifx\Fld@onfocus@code\@empty + \else + /Fo << /S /JavaScript /JS (\Fld@onfocus@code) >> + \fi +% \end{macrocode} +% Bl loosing the input focus (blurred) +% \begin{macrocode} + \ifx\Fld@onblur@code\@empty + \else + /Bl << /S /JavaScript /JS (\Fld@onblur@code) >> + \fi +% \end{macrocode} +% D pressing the mouse button (down) +% \begin{macrocode} + \ifx\Fld@onmousedown@code\@empty + \else + /D << /S /JavaScript /JS (\Fld@onmousedown@code) >> + \fi +% \end{macrocode} +% U releasing the mouse button (up) +% \begin{macrocode} + \ifx\Fld@onmouseup@code\@empty + \else + /U << /S /JavaScript /JS (\Fld@onmouseup@code) >> + \fi +% \end{macrocode} +% E cursor enters the annotation's active area. +% \begin{macrocode} + \ifx\Fld@onenter@code\@empty + \else + /E << /S /JavaScript /JS (\Fld@onenter@code) >> + \fi +% \end{macrocode} +% X cursor exits the annotation's active area. +% \begin{macrocode} + \ifx\Fld@onexit@code\@empty + \else + /X << /S /JavaScript /JS (\Fld@onexit@code) >> + \fi + >> +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\PDFForm@List} +% \begin{macrocode} +\def\PDFForm@List{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /FT /Ch + /Q \Fld@align\space + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /MK << + /BC [\Fld@bordercolor] + \ifx\Fld@bcolor\@empty + \else + /BG [\Fld@bcolor] + \fi + >> + /DA (/Helv \strip@pt\Fld@charsize\space Tf \Fld@color\space rg ) + /Opt [\the\Choice@toks] + /DV (\Fld@default) + \Fld@additionalactions + \Fld@flags +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDFForm@Radio} +% \begin{macrocode} +\def\PDFForm@Radio{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /FT /Btn + /Ff 49152 + /H /P + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /MK << + /BC [\Fld@bordercolor] + \ifx\Fld@bcolor\@empty + \else + /BG [\Fld@bcolor] + \fi + /CA (H) + >> + /DA (/ZaDb \strip@pt\Fld@charsize\space Tf \Fld@color\space rg) + \ifx\@currValue\Fld@default + /V /\Fld@default\space + \else + /V /Off + \fi + \Fld@additionalactions +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDFForm@Text} +% \begin{macrocode} +\def\PDFForm@Text{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /Q \Fld@align\space + /FT /Tx + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /MK << + /BC [\Fld@bordercolor] + \ifx\Fld@bcolor\@empty + \else + /BG [\Fld@bcolor] + \fi + >> + /DA (/Helv \strip@pt\Fld@charsize\space Tf \Fld@color\space rg ) + /DV (\Fld@default) + /V (\Fld@value) + \Fld@additionalactions + \ifFld@multiline + \ifFld@readonly /Ff 4097 \else /Ff 4096 \fi + \else + \ifFld@password + \ifFld@readonly /Ff 8193 \else /Ff 8192 \fi + \else + \ifFld@readonly /Ff 1 \fi + \fi + \fi + \ifnum\Fld@maxlen>0/MaxLen \Fld@maxlen \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDFForm@Submit} +% \begin{macrocode} +\def\PDFForm@Submit{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /FT /Btn + /Ff 65540 + /H /P + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /MK << + /BC [\Fld@bordercolor] + >> + /A << + /S /SubmitForm + /F << + /FS /URL + /F (\Form@action) + >> + \ifForm@html /Flags 4 \fi + >> +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PDFForm@Reset} +% \begin{macrocode} +\def\PDFForm@Reset{% + /Subtype /Widget + \ifFld@hidden /F 6 \else /F 4 \fi + /T (\Fld@name) + /FT /Btn + /H /P + /DA (/Helv \strip@pt\Fld@charsize\space Tf 0 0 1 rg) + /Ff 65540 + /MK << + /BC [\Fld@bordercolor] +% /CA (Clear) +% /AC (Done) + >> + /BS << /W \Fld@borderwidth\space /S /\Fld@borderstyle\space >> + /A << /S /ResetForm >> +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +%<*package> +% \end{macrocode} +% +% \section{Bookmarks in the PDF file} +% This was originally developed by Yannis Haralambous +% (it was the separate |repere.sty|); it needed +% the |repere| or |makebook.pl| post-processor to work properly. Now +% redundant, as it is done entirely in \LaTeX{} macros. +% +% To write out the current section title, and its rationalized number, +% we have to intercept the |\@sect| command, which is rather +% dangerous. But how else to see the information we need? +% We do the \emph{same} for |\@ssect|, giving anchors to +% unnumbered sections. This allows things like bibliographies +% to get bookmarks when used with a manual |\addcontentsline| +% \begin{macrocode} +\def\phantomsection{% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{section*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% +} +%
+% \end{macrocode} +% +% \subsection{Bookmarks} +% \begin{macrocode} +%<*outlines> +% \end{macrocode} +% +% This section was written by Heiko Oberdiek; the code replaces +% an earlier version by David Carlisle. +% +% The first part of bookmark code is in section \ref{sec:pdfstring}. +% Further documentation is available as paper and slides of the +% talk, that Heiko Oberdiek has given at the EuroTeX'99 meating +% in Heidelberg. See |paper.pdf| and |slides.pdf| in the +% |doc| directory of hyperref. +% +% \begin{macrocode} +\newwrite\@outlinefile +\def\Hy@writebookmark#1#2#3#4#5{% section number, text, label, level, file + \ifx\WriteBookmarks\relax% + \else + \ifnum#4>\c@tocdepth + \else + \@@writetorep{#1}{#2}{#3}{#4}{#5}% + \fi + \fi} +\def\Hy@currentbookmarklevel{0} +\def\Hy@numberline#1{#1 } +\def\@@writetorep#1#2#3#4#5{% + \begingroup + \edef\Hy@tempa{#5}% + \ifx\Hy@tempa\Hy@bookmarkstype + \edef\Hy@level{#4}% + \ifx\Hy@levelcheck Y% + \@tempcnta\Hy@level\relax + \advance\@tempcnta by -1 + \ifnum\Hy@currentbookmarklevel<\@tempcnta + \advance\@tempcnta by -\Hy@currentbookmarklevel\relax + \advance\@tempcnta by 1 + \Hy@Warning{% + Difference (\the\@tempcnta) between bookmark levels is % + greater \MessageBreak than one, level fixed% + }% + \@tempcnta\Hy@currentbookmarklevel + \advance\@tempcnta by 1 + \edef\Hy@level{\the\@tempcnta}% + \fi + \else + \global\let\Hy@levelcheck Y% + \fi + \global\let\Hy@currentbookmarklevel\Hy@level + \@tempcnta\Hy@level\relax + \expandafter\xdef\csname Parent\Hy@level\endcsname{#3}% + \advance\@tempcnta by -1 + \edef\Hy@tempa{#3}% + \edef\Hy@tempb{\csname Parent\the\@tempcnta\endcsname}% + \ifx\Hy@tempa\Hy@tempb + \Hy@Warning{% + The anchor of a bookmark and its parent's must not% + \MessageBreak be the same. Added a new anchor% + }% + \phantomsection + \fi + \ifHy@bookmarksnumbered + \let\numberline\Hy@numberline + \else + \let\numberline\@gobble + \fi + \pdfstringdef\Hy@tempa{#2}% + \protected@write\@outlinefile{}{% + \protect\BOOKMARK + [\Hy@level][\@bookmarkopenstatus{\Hy@level}]{#3}% + {\Hy@tempa}{\Hy@tempb}% + }% + \fi + \endgroup +} +% \end{macrocode} +% In the call of \cmd{\BOOKMARK} the braces around \verb|#4| +% are omitted, because it is not likely, that the level number +% contains \verb|]|. +% \begin{macrocode} +\newcommand{\currentpdfbookmark}{% + \pdfbookmark[\Hy@currentbookmarklevel]% +} +\newcommand{\subpdfbookmark}{% + \@tempcnta\Hy@currentbookmarklevel + \Hy@StepCount\@tempcnta + \expandafter\pdfbookmark\expandafter[\the\@tempcnta]% +} +\newcommand{\belowpdfbookmark}[2]{% + \@tempcnta\Hy@currentbookmarklevel + \Hy@StepCount\@tempcnta + \expandafter\pdfbookmark\expandafter[\the\@tempcnta]{#1}{#2}% + \advance\@tempcnta by -1 + \xdef\Hy@currentbookmarklevel{\the\@tempcnta}% +} +% \end{macrocode} +% Tobias Oetiker rightly points out that we need a way to +% force a bookmark entry. So we introduce |\pdfbookmark|, +% with two parameters, the title, and a symbolic name. +% By default this is at level 1, but we can reset that with the +% optional first argument. +% \begin{macrocode} +\renewcommand\pdfbookmark[3][0]{% + \Hy@writebookmark{}{#2}{#3.#1}{#1}{toc}% + \hyper@anchorstart{#3.#1}\hyper@anchorend +} +\def\BOOKMARK{\@ifnextchar[{\@BOOKMARK}{\@@BOOKMARK[1][-]}} +\def\@BOOKMARK[#1]{\@ifnextchar[{\@@BOOKMARK[#1]}{\@@BOOKMARK[#1][-]}} +% \end{macrocode} +% The macros for calculating structure of outlines +% are derived from those by Petr Olsak used in the texinfopdf macros. +% +% The VTEX section was written originally by VTEX, but then +% amended by Denis Girou (\Email{denis.girou@idris.fr}), +% then by by Taco Hoekwater (\Email{taco.hoekwater@wkap.nl}. The problem +% is that VTEX, with its close integration of the PDF backend, does +% look at the contents of bookmarks, escaping |\| and the like. +% \begin{macrocode} +%<*vtex> +% \end{macrocode} +% \begin{macrocode} +\newcount\@serial@counter\@serial@counter=1\relax +% \end{macrocode} +% \begin{macro}{\hv@pdf@char} +% Plain octal codes doesn't work with versions below 6.50. +% So for early versions hex numbers have to be used. +% It would be possible to program this instead of the +% large |\ifcase|, but I'm too lazy to sort that out now. +% \begin{macrocode} +\begingroup + \catcode`\'=12 + \ifnum\Hy@VTeXversion<650 % + \catcode`\"=12 + \gdef\hv@pdf@char#1#2#3{% + \char + \ifcase'#1#2#3 + "00\or"01\or"02\or"03\or"04\or"05\or"06\or"07% + \or"08\or"09\or"0A\or"0B\or"0C\or"0D\or"0E\or"0F% + \or"10\or"11\or"12\or"13\or"14\or"15\or"16\or"17% + \or"18\or"19\or"1A\or"1B\or"1C\or"1D\or"1E\or"1F% + \or"20\or"21\or"22\or"23\or"24\or"25\or"26\or"27% + \or"28\or"29\or"2A\or"2B\or"2C\or"2D\or"2E\or"2F% + \or"30\or"31\or"32\or"33\or"34\or"35\or"36\or"37% + \or"38\or"39\or"3A\or"3B\or"3C\or"3D\or"3E\or"3F% + \or"40\or"41\or"42\or"43\or"44\or"45\or"46\or"47% + \or"48\or"49\or"4A\or"4B\or"4C\or"4D\or"4E\or"4F% + \or"50\or"51\or"52\or"53\or"54\or"55\or"56\or"57% + \or"58\or"59\or"5A\or"5B\or"5C\or"5D\or"5E\or"5F% + \or"60\or"61\or"62\or"63\or"64\or"65\or"66\or"67% + \or"68\or"69\or"6A\or"6B\or"6C\or"6D\or"6E\or"6F% + \or"70\or"71\or"72\or"73\or"74\or"75\or"76\or"77% + \or"78\or"79\or"7A\or"7B\or"7C\or"7D\or"7E\or"7F% + \or"80\or"81\or"82\or"83\or"84\or"85\or"86\or"87% + \or"88\or"89\or"8A\or"8B\or"8C\or"8D\or"8E\or"8F% + \or"90\or"91\or"92\or"93\or"94\or"95\or"96\or"97% + \or"98\or"99\or"9A\or"9B\or"9C\or"9D\or"9E\or"9F% + \or"A0\or"A1\or"A2\or"A3\or"A4\or"A5\or"A6\or"A7% + \or"A8\or"A9\or"AA\or"AB\or"AC\or"AD\or"AE\or"AF% + \or"B0\or"B1\or"B2\or"B3\or"B4\or"B5\or"B6\or"B7% + \or"B8\or"B9\or"BA\or"BB\or"BC\or"BD\or"BE\or"BF% + \or"C0\or"C1\or"C2\or"C3\or"C4\or"C5\or"C6\or"C7% + \or"C8\or"C9\or"CA\or"CB\or"CC\or"CD\or"CE\or"CF% + \or"D0\or"D1\or"D2\or"D3\or"D4\or"D5\or"D6\or"D7% + \or"D8\or"D9\or"DA\or"DB\or"DC\or"DD\or"DE\or"DF% + \or"E0\or"E1\or"E2\or"E3\or"E4\or"E5\or"E6\or"E7% + \or"E8\or"E9\or"EA\or"EB\or"EC\or"ED\or"EE\or"EF% + \or"F0\or"F1\or"F2\or"F3\or"F4\or"F5\or"F6\or"F7% + \or"F8\or"F9\or"FA\or"FB\or"FC\or"FD\or"FE\or"FF% + \fi + } + \else + \gdef\hv@pdf@char{\char'} + \fi +\endgroup +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@@BOOKMARK} +% \begin{macrocode} +\def\@@BOOKMARK[#1][#2]#3#4#5{% + \expandafter\edef\csname @count@#3\endcsname{\the\@serial@counter}% + \edef\@mycount{\the\@serial@counter}% + \Hy@StepCount\@serial@counter + \edef\@parcount{% + \expandafter\ifx\csname @count@#5\endcsname\relax + 0% + \else + \csname @count@#5\endcsname + \fi + }% + \immediate\special{!outline #3;p=\@parcount,i=\@mycount,s=\ifx#2-c\else +o\fi,t=#4}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ReadBookmarks} +% \begin{macrocode} +\def\ReadBookmarks{% + \begingroup + \def\0{\hv@pdf@char 0}% + \def\1{\hv@pdf@char 1}% + \def\2{\hv@pdf@char 2}% + \def\3{\hv@pdf@char 3}% + \def\({(}% + \def\){)}% + \def\do##1{% + \ifnum\the\catcode`##1=\active + \@makeother##1% + \fi + }% + \dospecials + \InputIfFileExists{\jobname.out}{}{}% + \endgroup + \ifx\WriteBookmarks\relax + \else + \if@filesw + \immediate\openout\@outlinefile=\jobname.out + \ifHy@typexml + \immediate\write\@outlinefile{\relax}% + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +% \end{macrocode} +% \begin{macrocode} +%<*!vtex> +\def\ReadBookmarks{% + \begingroup + \escapechar=`\\% + \let\escapechar\@gobble % + \def\@@BOOKMARK [##1][##2]##3##4##5{\calc@bm@number{##5}}% + \InputIfFileExists{\jobname.out}{}{}% + \ifx\WriteBookmarks\relax + \global\let\WriteBookmarks\relax + \fi + \def\@@BOOKMARK[##1][##2]##3##4##5{% + \def\Hy@temp{##4}% +%<*pdftex> + \pdfoutline goto + name{##3}% + count ##2\check@bm@number{##3}{% + \expandafter\strip@prefix\meaning\Hy@temp + }% +% +%<*pdfmark> + \pdfmark{% + pdfmark=/OUT,% + Count={##2\check@bm@number{##3}},% + Dest={##3},% + Title=\expandafter\strip@prefix\meaning\Hy@temp + }% +% +%<*dvipdfm> + \@pdfm@mark{% + outline ##1 << + /Title (\expandafter\strip@prefix\meaning\Hy@temp) + /A << + /S /GoTo + /D (##3) + >> + >> + }% +% + }% + {% + \def\WriteBookmarks{0}% + \InputIfFileExists{\jobname.out}{}{}% + }% + %{\escapechar\m@ne\InputIfFileExists{\jobname.out}{}{}}% + \ifx\WriteBookmarks\relax\else + \if@filesw\immediate\openout\@outlinefile=\jobname.out + \ifHy@typexml + \immediate\write\@outlinefile{\relax}% + \fi + \fi + \fi + \endgroup +} +\def\check@bm@number#1{% + \expandafter\ifx\csname B_#1\endcsname\relax + 0% + \else + \csname B_#1\endcsname + \fi +} +\def\calc@bm@number#1{% + \@tempcnta=\check@bm@number{#1}\relax + \advance\@tempcnta by1 + \expandafter\xdef\csname B_#1\endcsname{\the\@tempcnta}% +} +% +% \end{macrocode} +% +% This code is added, so that option `pdfpagenumbers' works +% with option `implicit' (suggestion of Sebastian Rahtz). +% \begin{macrocode} +\ifHy@implicit +\else + \def\@begindvi{% + \unvbox\@begindvibox + \HyPL@EveryPage + \global\let\@begindvi\HyPL@EveryPage + }% + \expandafter\endinput +\fi +% \end{macrocode} +% +% \begin{macrocode} +% +%<*outlines|hypertex> +% \end{macrocode} +% \begin{macrocode} +\let\H@old@ssect\@ssect +\def\@ssect#1#2#3#4#5{% + \H@old@ssect{#1}{#2}{#3}{#4}{#5}% + \phantomsection +} +\let\H@old@schapter\@schapter +\def\@schapter#1{% + \H@old@schapter{#1}% + \begingroup + \let\@mkboth\@gobbletwo + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + \endgroup +} +% \end{macrocode} +% If there is no chapter number (\cmd{\frontmatter} or +% \cmd{\backmatter}) then |\refstepcounter{chapter}| is not +% executed, so there will be no destination for \cmd{addcontentsline}. +% So \cmd{\@chapter} is overloaded to avoid this: +% \begin{macrocode} +\@ifundefined{@chapter}{}{% + \let\Hy@org@chapter\@chapter + \def\@chapter{% + \def\Hy@next{% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + }% + \ifnum\c@secnumdepth>\m@ne + \@ifundefined{if@mainmatter}% + \iftrue{\csname if@mainmatter\endcsname} + \let\Hy@next\relax + \fi + \fi + \Hy@next + \Hy@org@chapter + }% +} +% \end{macrocode} +% \begin{macrocode} +\let\H@old@spart\@spart +\def\@spart#1{% + \H@old@spart{#1}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{part*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% +} +\let\H@old@sect\@sect +\def\@sect#1#2#3#4#5#6[#7]#8{% + \ifnum #2>\c@secnumdepth + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{section*.\the\Hy@linkcounter}% + \fi + \H@old@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}% + \ifnum #2>\c@secnumdepth + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + \fi +} +% \end{macrocode} +% \begin{macrocode} +% +%<*outlines> +% \end{macrocode} +% +% \begin{macrocode} +\expandafter\def\csname Parent-4\endcsname{} +\expandafter\def\csname Parent-3\endcsname{} +\expandafter\def\csname Parent-2\endcsname{} +\expandafter\def\csname Parent-1\endcsname{} +\expandafter\def\csname Parent0\endcsname{} +\expandafter\def\csname Parent1\endcsname{} +\expandafter\def\csname Parent2\endcsname{} +\expandafter\def\csname Parent3\endcsname{} +\expandafter\def\csname Parent4\endcsname{} +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \section{Compatibility with koma-script classes} +% +% \begin{macrocode} +%<*outlines|hypertex> +% \end{macrocode} +% +% Hard-wire in an unpleasant over-ride of komascript `scrbook' class +% for \Email{Tobias.Isenberg@gmx.de}. +% With version 6.71b the hack is also applied to `scrreprt' class +% and is removed for koma-script versions since 2001/01/01, +% because Markus Kohm supports hyperref in komascript. +% \begin{macrocode} +\def\Hy@tempa{% + \def\@addchap[##1]##2{% + \typeout{##2}% + \if@twoside + \@mkboth{##1}{}% + \else + \@mkboth{}{##1}% + \fi + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + \if@twocolumn + \@topnewpage[\@makeschapterhead{##2}]% + \else + \@makeschapterhead{##2}% + \@afterheading + \fi + \addcontentsline{toc}{chapter}{##1}% + }% +} +\@ifclassloaded{scrbook}{% + \@ifclasslater{scrbook}{2001/01/01}{% + \let\Hy@tempa\@empty + }{}% +}{% + \@ifclassloaded{scrreprt}{% + \@ifclasslater{scrreprt}{2001/01/01}{% + \let\Hy@tempa\@empty + }{}% + }{% + \let\Hy@tempa\@empty + }% +}% +\Hy@tempa +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \section{Encoding definition files for encodings of PDF strings} +% This was contributed by +% Heiko Oberdiek \Email{oberdiek@ruf.uni-freiburg.de} +% +% \subsection{PD1 encoding} +% \begin{macrocode} +%<*pd1enc> +\DeclareFontEncoding{PD1}{}{} +% \end{macrocode} +% Special white space escape characters +% not for use in bookmarks but for other PDF strings. +% \begin{macrocode} +\DeclareTextCommand{\textLF}{PD1}{\012} % line feed +\DeclareTextCommand{\textCR}{PD1}{\015} % carriage return +\DeclareTextCommand{\textHT}{PD1}{\011} % horizontal tab +\DeclareTextCommand{\textBS}{PD1}{\010} % backspace +\DeclareTextCommand{\textFF}{PD1}{\014} % formfeed +% \end{macrocode} +% Accents +% \begin{macrocode} +\DeclareTextAccent{\`}{PD1}{\textgrave} +\DeclareTextAccent{\'}{PD1}{\textacute} +\DeclareTextAccent{\^}{PD1}{\textcircumflex} +\DeclareTextAccent{\~}{PD1}{\texttilde} +\DeclareTextAccent{\"}{PD1}{\textdieresis} +\DeclareTextAccent{\r}{PD1}{\textring} +\DeclareTextAccent{\v}{PD1}{\textcaron} +\DeclareTextAccent{\.}{PD1}{\textdotaccent} +\DeclareTextAccent{\c}{PD1}{\textcedilla} +\DeclareTextCompositeCommand{\`}{PD1}{\@empty}{\textgrave} +\DeclareTextCompositeCommand{\'}{PD1}{\@empty}{\textacute} +\DeclareTextCompositeCommand{\^}{PD1}{\@empty}{\textcircumflex} +\DeclareTextCompositeCommand{\~}{PD1}{\@empty}{\texttilde} +\DeclareTextCompositeCommand{\"}{PD1}{\@empty}{\textdieresis} +\DeclareTextCompositeCommand{\r}{PD1}{\@empty}{\textring} +\DeclareTextCompositeCommand{\v}{PD1}{\@empty}{\textcaron} +\DeclareTextCompositeCommand{\.}{PD1}{\@empty}{\textdotaccent} +\DeclareTextCompositeCommand{\c}{PD1}{\@empty}{\textcedilla} +% \end{macrocode} +% Accent glyph names +% \begin{macrocode} +\DeclareTextCommand{\textbreve}{PD1}{\030} % breve +\DeclareTextCommand{\textcaron}{PD1}{\031} % caron +\DeclareTextCommand{\textcircumflex}{PD1}{\032} % circumflex +\DeclareTextCommand{\textdotaccent}{PD1}{\033} % dotaccent +\DeclareTextCommand{\texthungarumlaut}{PD1}{\034} % hungarumlaut +\DeclareTextCommand{\textogonek}{PD1}{\035} % ogonek +\DeclareTextCommand{\textring}{PD1}{\036} % ring +\DeclareTextCommand{\texttilde}{PD1}{\037} % tilde +% \end{macrocode} +% \cs{040}: space\\ +% \cs{041}: exclam +% \begin{macrocode} +\DeclareTextCommand{\textquotedbl}{PD1}{\string"} % quotedbl \042 +\DeclareTextCommand{\textnumbersign}{PD1}{\043} % numbersign +\DeclareTextCommand{\textdollar}{PD1}{\044} % dollar +\DeclareTextCommand{\textpercent}{PD1}{\045} % percent +\DeclareTextCommand{\textampersand}{PD1}{\046} % ampersand +% \end{macrocode} +% \cs{047}: quotesingle +% \begin{macrocode} +\DeclareTextCommand{\textparenleft}{PD1}{\string\(} % parenleft \050 +\DeclareTextCommand{\textparenright}{PD1}{\string\)} % parenright \051 +% \end{macrocode} +% \cs{052}: asterisk\\ +% \cs{053}: plus\\ +% \cs{054}: comma\\ +% \cs{055}: hyphen\\ +% \cs{056}: period\\ +% \cs{057}: slash\\ +% \cs{060}\dots\cs{071}: 0\dots9\\ +% \cs{072}: colon\\ +% \cs{073}: semicolon +% \begin{macrocode} +\DeclareTextCommand{\textless}{PD1}{<} % less \074 +% \end{macrocode} +% \cs{075}: equal +% \begin{macrocode} +\DeclareTextCommand{\textgreater}{PD1}{>} % greater \076 +% \end{macrocode} +% \cs{077}: question\\ +% \cs{100}: at\\ +% \cs{101}\dots\cs{132}: A\dots Z\\ +% \cs{133}: bracketleft +% \begin{macrocode} +\DeclareTextCommand{\textbackslash}{PD1}{\134} % backslash +% \end{macrocode} +% \cs{135}: bracketright +% \begin{macrocode} +\DeclareTextCommand{\textasciicircum}{PD1}{\136} % asciicircum +\DeclareTextCommand{\textunderscore}{PD1}{\137} % underscore +\DeclareTextCommand{\textgrave}{PD1}{\140} % grave +% \end{macrocode} +% \cs{141}\dots\cs{172}: a\dots z +% \begin{macrocode} +\DeclareTextCompositeCommand{\.}{PD1}{i}{i} % i +\DeclareTextCommand{\textbraceleft}{PD1}{\173} % braceleft +\DeclareTextCommand{\textbar}{PD1}{|} % bar +\DeclareTextCommand{\textbraceright}{PD1}{\175} % braceright +\DeclareTextCommand{\textasciitilde}{PD1}{\176} % asciitilde +% \end{macrocode} +% No glyph \cs{177} in PDFDocEncoding. +% \begin{macrocode} +\DeclareTextCommand{\textbullet}{PD1}{\200} % bullet +\DeclareTextCommand{\textdagger}{PD1}{\201} % dagger +\DeclareTextCommand{\textdaggerdbl}{PD1}{\202} % daggerdbl +\DeclareTextCommand{\textellipsis}{PD1}{\203} % ellipsis +\DeclareTextCommand{\textemdash}{PD1}{\204} % emdash +\DeclareTextCommand{\textendash}{PD1}{\205} % endash +\DeclareTextCommand{\textflorin}{PD1}{\206} % florin +\DeclareTextCommand{\textfractionmark}{PD1}{/} % fraction, \207 +\DeclareTextCommand{\guilsinglleft}{PD1}{\210} % guilsinglleft +\DeclareTextCommand{\guilsinglright}{PD1}{\211} % guilsinglright +\DeclareTextCommand{\textminus}{PD1}{-} % minus, \212 +\DeclareTextCommand{\textperthousand}{PD1}{\213} % perthousand +\DeclareTextCommand{\quotedblbase}{PD1}{\214} % quotedblbase +\DeclareTextCommand{\textquotedblleft}{PD1}{\215} % quotedblleft +\DeclareTextCommand{\textquotedblright}{PD1}{\216} % quotedblright +\DeclareTextCommand{\textquoteleft}{PD1}{\217} % quoteleft +\DeclareTextCommand{\textquoteright}{PD1}{\220} % quoteright +\DeclareTextCommand{\quotesinglbase}{PD1}{\221} % quotesinglbase +\DeclareTextCommand{\texttrademark}{PD1}{\222} % trademark +\DeclareTextCommand{\textfi}{PD1}{fi} % fi ?? \223 +\DeclareTextCommand{\textfl}{PD1}{fl} % fl ?? \224 +\DeclareTextCommand{\L}{PD1}{L} % Lslash, \225 +\DeclareTextCommand{\OE}{PD1}{\226} % OE +\DeclareTextCompositeCommand{\v}{PD1}{S}{\227} % Scaron +\DeclareTextCompositeCommand{\"}{PD1}{Y}{\230} % Ydieresis +\DeclareTextCommand{\IJ}{PD1}{\230} +\DeclareTextCompositeCommand{\v}{PD1}{Z}{Z} % Zcaron, \231 +\DeclareTextCommand{\i}{PD1}{i} % dotlessi, \232 +\DeclareTextCommand{\l}{PD1}{l} % lslash, \233 +\DeclareTextCommand{\oe}{PD1}{\234} % oe +\DeclareTextCompositeCommand{\v}{PD1}{s}{\235} % scaron +\DeclareTextCompositeCommand{\v}{PD1}{z}{z} % zcaron, 236 +% \end{macrocode} +% No glyph \cs{237} in PDFDocEncoding.\\ +% The euro \cs{240} is inserted in version 1.3 of the pdf +% specification. +% \begin{macrocode} +\DeclareTextCommand{\texteuro}{PD1}{\240} % Euro +\DeclareTextCommand{\textexclamdown}{PD1}{\241} % exclamdown +\DeclareTextCommand{\textcent}{PD1}{\242} % cent +\DeclareTextCommand{\textsterling}{PD1}{\243} % sterling +\DeclareTextCommand{\textcurrency}{PD1}{\244} % currency +\DeclareTextCommand{\textyen}{PD1}{\245} % yen +\DeclareTextCommand{\textbrokenbar}{PD1}{\246} % brokenbar +\DeclareTextCommand{\textsection}{PD1}{\247} % section +\DeclareTextCommand{\textdieresis}{PD1}{\250} % dieresis +\DeclareTextCommand{\textcopyright}{PD1}{\251} % copyright +\DeclareTextCommand{\textordfeminine}{PD1}{\252} % ordfeminine +\DeclareTextCommand{\guillemotleft}{PD1}{\253} % guillemotleft +\DeclareTextCommand{\textlogicalnot}{PD1}{\254} % logicalnot +% \end{macrocode} +% No glyph \cs{255} in PDFDocEncoding. +% \begin{macrocode} +\DeclareTextCommand{\textregistered}{PD1}{\256} % registered +\DeclareTextCommand{\textmacron}{PD1}{\257} % macron +\DeclareTextCommand{\textdegree}{PD1}{\260} % degree +\DeclareTextCommand{\textplusminus}{PD1}{\261} % plusminus +\DeclareTextCommand{\texttwosuperior}{PD1}{\262} % twosuperior +\DeclareTextCommand{\textthreesuperior}{PD1}{\263} % threesuperior +\DeclareTextCommand{\textacute}{PD1}{\264} % acute +\DeclareTextCommand{\textmu}{PD1}{\265} % mu +\DeclareTextCommand{\textparagraph}{PD1}{\266} % paragraph +\DeclareTextCommand{\textperiodcentered}{PD1}{\267} % periodcentered +\DeclareTextCommand{\textcedilla}{PD1}{\270} % cedilla +\DeclareTextCommand{\textonesuperior}{PD1}{\271} % onesuperior +\DeclareTextCommand{\textordmasculine}{PD1}{\272} % ordmasculine +\DeclareTextCommand{\guillemotright}{PD1}{\273} % guillemotright +\DeclareTextCommand{\textonequarter}{PD1}{\274} % onequarter +\DeclareTextCommand{\textonehalf}{PD1}{\275} % onehalf +\DeclareTextCommand{\textthreequarters}{PD1}{\276} % threequarters +\DeclareTextCommand{\textquestiondown}{PD1}{\277} % questiondown +\DeclareTextCompositeCommand{\`}{PD1}{A}{\300} % Agrave +\DeclareTextCompositeCommand{\'}{PD1}{A}{\301} % Aacute +\DeclareTextCompositeCommand{\^}{PD1}{A}{\302} % Acircumflex +\DeclareTextCompositeCommand{\~}{PD1}{A}{\303} % Atilde +\DeclareTextCompositeCommand{\"}{PD1}{A}{\304} % Adieresis +\DeclareTextCompositeCommand{\r}{PD1}{A}{\305} % Aring +\DeclareTextCommand{\AE}{PD1}{\306} % AE +\DeclareTextCompositeCommand{\c}{PD1}{C}{\307} % Ccedilla +\DeclareTextCompositeCommand{\`}{PD1}{E}{\310} % Egrave +\DeclareTextCompositeCommand{\'}{PD1}{E}{\311} % Eacute +\DeclareTextCompositeCommand{\^}{PD1}{E}{\312} % Ecircumflex +\DeclareTextCompositeCommand{\"}{PD1}{E}{\313} % Edieresis +\DeclareTextCompositeCommand{\`}{PD1}{I}{\314} % Igrave +\DeclareTextCompositeCommand{\'}{PD1}{I}{\315} % Iacute +\DeclareTextCompositeCommand{\^}{PD1}{I}{\316} % Icircumflex +\DeclareTextCompositeCommand{\"}{PD1}{I}{\317} % Idieresis +\DeclareTextCommand{\DH}{PD1}{\320} % Eth +\DeclareTextCommand{\DJ}{PD1}{\320} % Eth +\DeclareTextCompositeCommand{\~}{PD1}{N}{\321} % Ntilde +\DeclareTextCompositeCommand{\`}{PD1}{O}{\322} % Ograve +\DeclareTextCompositeCommand{\'}{PD1}{O}{\323} % Oacute +\DeclareTextCompositeCommand{\^}{PD1}{O}{\324} % Ocircumflex +\DeclareTextCompositeCommand{\~}{PD1}{O}{\325} % Otilde +\DeclareTextCompositeCommand{\"}{PD1}{O}{\326} % Odieresis +\DeclareTextCommand{\textmultiply}{PD1}{\327} % multiply +\DeclareTextCommand{\O}{PD1}{\330} % Oslash +\DeclareTextCompositeCommand{\`}{PD1}{U}{\331} % Ugrave +\DeclareTextCompositeCommand{\'}{PD1}{U}{\332} % Uacute +\DeclareTextCompositeCommand{\^}{PD1}{U}{\333} % Ucircumflex +\DeclareTextCompositeCommand{\"}{PD1}{U}{\334} % Udieresis +\DeclareTextCompositeCommand{\'}{PD1}{Y}{\335} % Yacute +\DeclareTextCommand{\TH}{PD1}{\336} % Thorn +\DeclareTextCommand{\ss}{PD1}{\337} % germandbls +\DeclareTextCompositeCommand{\`}{PD1}{a}{\340} % agrave +\DeclareTextCompositeCommand{\'}{PD1}{a}{\341} % aacute +\DeclareTextCompositeCommand{\^}{PD1}{a}{\342} % acircumflex +\DeclareTextCompositeCommand{\~}{PD1}{a}{\343} % atilde +\DeclareTextCompositeCommand{\"}{PD1}{a}{\344} % adieresis +\DeclareTextCompositeCommand{\r}{PD1}{a}{\345} % aring +\DeclareTextCommand{\ae}{PD1}{\346} % ae +\DeclareTextCompositeCommand{\c}{PD1}{c}{\347} % ccedilla +\DeclareTextCompositeCommand{\`}{PD1}{e}{\350} % egrave +\DeclareTextCompositeCommand{\'}{PD1}{e}{\351} % eacute +\DeclareTextCompositeCommand{\^}{PD1}{e}{\352} % ecircumflex +\DeclareTextCompositeCommand{\"}{PD1}{e}{\353} % edieresis +\DeclareTextCompositeCommand{\`}{PD1}{i}{\354} % igrave +\DeclareTextCompositeCommand{\`}{PD1}{\i}{\354} % igrave +\DeclareTextCompositeCommand{\'}{PD1}{i}{\355} % iacute +\DeclareTextCompositeCommand{\'}{PD1}{\i}{\355} % iacute +\DeclareTextCompositeCommand{\^}{PD1}{i}{\356} % icircumflex +\DeclareTextCompositeCommand{\^}{PD1}{\i}{\356} % icircumflex +\DeclareTextCompositeCommand{\"}{PD1}{i}{\357} % idieresis +\DeclareTextCompositeCommand{\"}{PD1}{\i}{\357} % idieresis +\DeclareTextCommand{\dh}{PD1}{\360} % eth +\DeclareTextCompositeCommand{\~}{PD1}{n}{\361} % ntilde +\DeclareTextCompositeCommand{\`}{PD1}{o}{\362} % ograve +\DeclareTextCompositeCommand{\'}{PD1}{o}{\363} % oacute +\DeclareTextCompositeCommand{\^}{PD1}{o}{\364} % ocircumflex +\DeclareTextCompositeCommand{\~}{PD1}{o}{\365} % otilde +\DeclareTextCompositeCommand{\"}{PD1}{o}{\366} % odieresis +\DeclareTextCommand{\textdivide}{PD1}{\367} % divide +\DeclareTextCommand{\o}{PD1}{\370} % oslash +\DeclareTextCompositeCommand{\`}{PD1}{u}{\371} % ugrave +\DeclareTextCompositeCommand{\'}{PD1}{u}{\372} % uacute +\DeclareTextCompositeCommand{\^}{PD1}{u}{\373} % ucircumflex +\DeclareTextCompositeCommand{\"}{PD1}{u}{\374} % udieresis +\DeclareTextCompositeCommand{\'}{PD1}{y}{\375} % yacute +\DeclareTextCommand{\th}{PD1}{\376} % thorn +\DeclareTextCompositeCommand{\"}{PD1}{y}{\377} % ydieresis +\DeclareTextCommand{\ij}{PD1}{\377} +% \end{macrocode} +% Glyphs that consist of several characters. +% \begin{macrocode} +\DeclareTextCommand{\SS}{PD1}{SS} +\DeclareTextCommand{\textcelsius}{PD1}{\textdegree C} +% \end{macrocode} +% Aliases (german.sty) +% \begin{macrocode} +\DeclareTextCommand{\textglqq}{PD1}{\quotedblbase} +\DeclareTextCommand{\textgrqq}{PD1}{\textquotedblleft} +\DeclareTextCommand{\textglq}{PD1}{\quotesinglbase} +\DeclareTextCommand{\textgrq}{PD1}{\textquoteleft} +\DeclareTextCommand{\textflqq}{PD1}{\guillemotleft} +\DeclareTextCommand{\textfrqq}{PD1}{\guillemotright} +\DeclareTextCommand{\textflq}{PD1}{\guilsinglleft} +\DeclareTextCommand{\textfrq}{PD1}{\guilsinglright} +% \end{macrocode} +% Aliases (math names) +% \begin{macrocode} +\DeclareTextCommand{\textneg}{PD1}{\textlogicalnot} +\DeclareTextCommand{\texttimes}{PD1}{\textmultiply} +\DeclareTextCommand{\textdiv}{PD1}{\textdivide} +\DeclareTextCommand{\textpm}{PD1}{\textplusminus} +\DeclareTextCommand{\textcdot}{PD1}{\textperiodcentered} +\DeclareTextCommand{\textbeta}{PD1}{\ss} +% \end{macrocode} +% Polish aliases. PDF encoding does not have the characters, but it +% is useful to Poles to have the plain letters regardless. Requested by +% Wojciech Myszka +% \begin{macrocode} +\DeclareTextCompositeCommand{\k}{PD1}{a}{a} % aogonek +\DeclareTextCompositeCommand{\'}{PD1}{c}{c} % cacute +\DeclareTextCompositeCommand{\k}{PD1}{e}{e} % eogonek +\DeclareTextCompositeCommand{\'}{PD1}{n}{n} % nacute +\DeclareTextCompositeCommand{\'}{PD1}{s}{s} % sacute +\DeclareTextCompositeCommand{\'}{PD1}{z}{z} % zacute +\DeclareTextCompositeCommand{\.}{PD1}{z}{z} % zdot +% \end{macrocode} +% \begin{macrocode} +\DeclareTextCompositeCommand{\k}{PD1}{A}{A} % Aogonek +\DeclareTextCompositeCommand{\'}{PD1}{C}{C} % Cacute +\DeclareTextCompositeCommand{\k}{PD1}{E}{E} % Eogonek +\DeclareTextCompositeCommand{\'}{PD1}{N}{N} % Nacute +\DeclareTextCompositeCommand{\'}{PD1}{S}{S} % Sacute +\DeclareTextCompositeCommand{\'}{PD1}{Z}{Z} % Zacute +\DeclareTextCompositeCommand{\.}{PD1}{Z}{Z} % Zdot +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} +% +% \subsection{PU encoding} +% \begin{macrocode} +%<*puenc> +\DeclareFontEncoding{PU}{}{} +% \end{macrocode} +% \subsubsection{Basic Latin} +% Special white space escape characters +% not for use in bookmarks but for other PDF strings. +% \begin{macrocode} +\DeclareTextCommand{\textLF}{PU}{\80\012} % line feed +\DeclareTextCommand{\textCR}{PU}{\80\015} % carriage return +\DeclareTextCommand{\textHT}{PU}{\80\011} % horizontal tab +\DeclareTextCommand{\textBS}{PU}{\80\010} % backspace +\DeclareTextCommand{\textFF}{PU}{\80\014} % formfeed +% \end{macrocode} +% Accents +% \begin{macrocode} +\DeclareTextAccent{\`}{PU}{\textgrave} +\DeclareTextAccent{\'}{PU}{\textacute} +\DeclareTextAccent{\^}{PU}{\textcircumflex} +\DeclareTextAccent{\~}{PU}{\texttilde} +\DeclareTextAccent{\"}{PU}{\textdieresis} +\DeclareTextAccent{\r}{PU}{\textring} +\DeclareTextAccent{\v}{PU}{\textcaron} +\DeclareTextAccent{\.}{PU}{\textdotaccent} +\DeclareTextAccent{\c}{PU}{\textcedilla} +\DeclareTextAccent{\U}{PU}{\textbreve} +\DeclareTextAccent{\C}{PU}{\textdoublegrave} +\DeclareTextCompositeCommand{\`}{PU}{\@empty}{\textgrave} +\DeclareTextCompositeCommand{\'}{PU}{\@empty}{\textacute} +\DeclareTextCompositeCommand{\^}{PU}{\@empty}{\textcircumflex} +\DeclareTextCompositeCommand{\~}{PU}{\@empty}{\texttilde} +\DeclareTextCompositeCommand{\"}{PU}{\@empty}{\textdieresis} +\DeclareTextCompositeCommand{\r}{PU}{\@empty}{\textring} +\DeclareTextCompositeCommand{\v}{PU}{\@empty}{\textcaron} +\DeclareTextCompositeCommand{\.}{PU}{\@empty}{\textdotaccent} +\DeclareTextCompositeCommand{\c}{PU}{\@empty}{\textcedilla} +\DeclareTextCompositeCommand{\U}{PU}{\@empty}{\textbreve} +\DeclareTextCompositeCommand{\C}{PU}{\@empty}{\textdoublegrave} +% \end{macrocode} +% Accent glyph names +% \begin{macrocode} +\DeclareTextCommand{\textbreve}{PU}{\80\030} % breve +\DeclareTextCommand{\textcaron}{PU}{\80\031} % caron +\DeclareTextCommand{\textcircumflex}{PU}{\80\032} % circumflex +\DeclareTextCommand{\textdotaccent}{PU}{\80\033} % dotaccent +\DeclareTextCommand{\texthungarumlaut}{PU}{\80\034} % hungarumlaut +\DeclareTextCommand{\textogonek}{PU}{\80\035} % ogonek +\DeclareTextCommand{\textring}{PU}{\80\036} % ring +\DeclareTextCommand{\texttilde}{PU}{\80\037} % tilde +\DeclareTextCommand{\textdoublegrave}{PU}{\83\017} % double grave +% \end{macrocode} +% \cs{040}: space\\ +% \cs{041}: exclam +% \begin{macrocode} +\DeclareTextCommand{\textquotedbl}{PU}{\string"} % quotedbl \80\042 +\DeclareTextCommand{\textnumbersign}{PU}{\80\043} % numbersign +\DeclareTextCommand{\textdollar}{PU}{\80\044} % dollar +\DeclareTextCommand{\textpercent}{PU}{\80\045} % percent +\DeclareTextCommand{\textampersand}{PU}{\80\046} % ampersand +% \end{macrocode} +% \cs{047}: quotesingle +% \begin{macrocode} +\DeclareTextCommand{\textparenleft}{PU}{\80\050} % parenleft +\DeclareTextCommand{\textparenright}{PU}{\80\051} % parenright +% \end{macrocode} +% \cs{052}: asterisk\\ +% \cs{053}: plus\\ +% \cs{054}: comma\\ +% \cs{055}: hyphen\\ +% \cs{056}: period\\ +% \cs{057}: slash\\ +% \cs{060}\dots\cs{071}: 0\dots9\\ +% \cs{072}: colon\\ +% \cs{073}: semicolon +% \begin{macrocode} +\DeclareTextCommand{\textless}{PU}{<} % less \80\074 +% \end{macrocode} +% \cs{075}: equal +% \begin{macrocode} +\DeclareTextCommand{\textgreater}{PU}{>} % greater \80\076 +% \end{macrocode} +% \cs{077}: question\\ +% \cs{100}: at\\ +% \cs{101}\dots\cs{132}: A\dots Z\\ +% \cs{133}: bracketleft +% \begin{macrocode} +\DeclareTextCommand{\textbackslash}{PU}{\80\134} % backslash +% \end{macrocode} +% \cs{135}: bracketright +% \begin{macrocode} +\DeclareTextCommand{\textasciicircum}{PU}{\80\136} % asciicircum +\DeclareTextCommand{\textunderscore}{PU}{\80\137} % underscore +\DeclareTextCommand{\textgrave}{PU}{\80\140} % grave +% \end{macrocode} +% \cs{141}\dots\cs{172}: a\dots z +% \begin{macrocode} +\DeclareTextCompositeCommand{\.}{PU}{i}{i} % i +\DeclareTextCommand{\j}{PU}{j} % jdotless +\DeclareTextCommand{\textbraceleft}{PU}{\80\173} % braceleft +\DeclareTextCommand{\textbar}{PU}{|} % bar +\DeclareTextCommand{\textbraceright}{PU}{\80\175} % braceright +\DeclareTextCommand{\textasciitilde}{PU}{\80\176} % asciitilde +% \end{macrocode} +% No glyph \cs{177} in PDFDocEncoding. +% +% \subsubsection{Latin-1 Supplement} +% \begin{macrocode} +\DeclareTextCommand{\textbullet}{PU}{\80\200} % bullet +\DeclareTextCommand{\textdagger}{PU}{\80\201} % dagger +\DeclareTextCommand{\textdaggerdbl}{PU}{\80\202} % daggerdbl +\DeclareTextCommand{\textellipsis}{PU}{\80\203} % ellipsis +\DeclareTextCommand{\textemdash}{PU}{\80\204} % emdash +\DeclareTextCommand{\textendash}{PU}{\80\205} % endash +\DeclareTextCommand{\textflorin}{PU}{\80\206} % florin +\DeclareTextCommand{\textfractionmark}{PU}{/} % fraction, \80\207 +\DeclareTextCommand{\guilsinglleft}{PU}{\80\210} % guilsinglleft +\DeclareTextCommand{\guilsinglright}{PU}{\80\211} % guilsinglright +\DeclareTextCommand{\textminus}{PU}{-} % minus, \80\212 +\DeclareTextCommand{\textperthousand}{PU}{\80\213} % perthousand +\DeclareTextCommand{\quotedblbase}{PU}{\80\214} % quotedblbase +\DeclareTextCommand{\textquotedblleft}{PU}{\80\215} % quotedblleft +\DeclareTextCommand{\textquotedblright}{PU}{\80\216} % quotedblright +\DeclareTextCommand{\textquoteleft}{PU}{\80\217} % quoteleft +\DeclareTextCommand{\textquoteright}{PU}{\80\220} % quoteright +\DeclareTextCommand{\quotesinglbase}{PU}{\80\221} % quotesinglbase +\DeclareTextCommand{\texttrademark}{PU}{\80\222} % trademark +\DeclareTextCommand{\textfi}{PU}{fi} % fi ?? \80\223 +\DeclareTextCommand{\textfl}{PU}{fl} % fl ?? \80\224 +% \end{macrocode} +% There are two positions for the glyphs from |\80\225| until +% |\80\236|. See the test files |testbmoe.|, |testbml|, +% |testbmsc|, |testbmzc|, and |testbmyi| for details. +% Problematic are all positions, but especially \cmd{\OE}, +% \cmd{\oe}, and \cmd{\i}. +% \begin{macrocode} +\DeclareTextCommand{\OE}{PU}{\80\226} % OE +\DeclareTextCommand{\oe}{PU}{\80\234} % oe +% \end{macrocode} +% The euro \cs{240} is inserted in version 1.3 of the pdf +% specification. +% \begin{macrocode} +\DeclareTextCommand{\textexclamdown}{PU}{\80\241} % exclamdown +\DeclareTextCommand{\textcent}{PU}{\80\242} % cent +\DeclareTextCommand{\textsterling}{PU}{\80\243} % sterling +\DeclareTextCommand{\textcurrency}{PU}{\80\244} % currency +\DeclareTextCommand{\textyen}{PU}{\80\245} % yen +\DeclareTextCommand{\textbrokenbar}{PU}{\80\246} % brokenbar +\DeclareTextCommand{\textsection}{PU}{\80\247} % section +\DeclareTextCommand{\textdieresis}{PU}{\80\250} % dieresis +\DeclareTextCommand{\textcopyright}{PU}{\80\251} % copyright +\DeclareTextCommand{\textordfeminine}{PU}{\80\252} % ordfeminine +\DeclareTextCommand{\guillemotleft}{PU}{\80\253} % guillemotleft +\DeclareTextCommand{\textlogicalnot}{PU}{\80\254} % logicalnot +% \end{macrocode} +% No glyph \cs{255} in PDFDocEncoding. +% \begin{macrocode} +\DeclareTextCommand{\textregistered}{PU}{\80\256} % registered +\DeclareTextCommand{\textmacron}{PU}{\80\257} % macron +\DeclareTextCommand{\textdegree}{PU}{\80\260} % degree +\DeclareTextCommand{\textplusminus}{PU}{\80\261} % plusminus +\DeclareTextCommand{\texttwosuperior}{PU}{\80\262} % twosuperior +\DeclareTextCommand{\textthreesuperior}{PU}{\80\263} % threesuperior +\DeclareTextCommand{\textacute}{PU}{\80\264} % acute +\DeclareTextCommand{\textmu}{PU}{\80\265} % mu +\DeclareTextCommand{\textparagraph}{PU}{\80\266} % paragraph +\DeclareTextCommand{\textperiodcentered}{PU}{\80\267} % periodcentered +\DeclareTextCommand{\textcedilla}{PU}{\80\270} % cedilla +\DeclareTextCommand{\textonesuperior}{PU}{\80\271} % onesuperior +\DeclareTextCommand{\textordmasculine}{PU}{\80\272} % ordmasculine +\DeclareTextCommand{\guillemotright}{PU}{\80\273} % guillemotright +\DeclareTextCommand{\textonequarter}{PU}{\80\274} % onequarter +\DeclareTextCommand{\textonehalf}{PU}{\80\275} % onehalf +\DeclareTextCommand{\textthreequarters}{PU}{\80\276} % threequarters +\DeclareTextCommand{\textquestiondown}{PU}{\80\277} % questiondown +\DeclareTextCompositeCommand{\`}{PU}{A}{\80\300} % Agrave +\DeclareTextCompositeCommand{\'}{PU}{A}{\80\301} % Aacute +\DeclareTextCompositeCommand{\^}{PU}{A}{\80\302} % Acircumflex +\DeclareTextCompositeCommand{\~}{PU}{A}{\80\303} % Atilde +\DeclareTextCompositeCommand{\"}{PU}{A}{\80\304} % Adieresis +\DeclareTextCompositeCommand{\r}{PU}{A}{\80\305} % Aring +\DeclareTextCommand{\AE}{PU}{\80\306} % AE +\DeclareTextCompositeCommand{\c}{PU}{C}{\80\307} % Ccedilla +\DeclareTextCompositeCommand{\`}{PU}{E}{\80\310} % Egrave +\DeclareTextCompositeCommand{\'}{PU}{E}{\80\311} % Eacute +\DeclareTextCompositeCommand{\^}{PU}{E}{\80\312} % Ecircumflex +\DeclareTextCompositeCommand{\"}{PU}{E}{\80\313} % Edieresis +\DeclareTextCompositeCommand{\`}{PU}{I}{\80\314} % Igrave +\DeclareTextCompositeCommand{\'}{PU}{I}{\80\315} % Iacute +\DeclareTextCompositeCommand{\^}{PU}{I}{\80\316} % Icircumflex +\DeclareTextCompositeCommand{\"}{PU}{I}{\80\317} % Idieresis +\DeclareTextCommand{\DH}{PU}{\80\320} % Eth +\DeclareTextCompositeCommand{\~}{PU}{N}{\80\321} % Ntilde +\DeclareTextCompositeCommand{\`}{PU}{O}{\80\322} % Ograve +\DeclareTextCompositeCommand{\'}{PU}{O}{\80\323} % Oacute +\DeclareTextCompositeCommand{\^}{PU}{O}{\80\324} % Ocircumflex +\DeclareTextCompositeCommand{\~}{PU}{O}{\80\325} % Otilde +\DeclareTextCompositeCommand{\"}{PU}{O}{\80\326} % Odieresis +\DeclareTextCommand{\textmultiply}{PU}{\80\327} % multiply +\DeclareTextCommand{\O}{PU}{\80\330} % Oslash +\DeclareTextCompositeCommand{\`}{PU}{U}{\80\331} % Ugrave +\DeclareTextCompositeCommand{\'}{PU}{U}{\80\332} % Uacute +\DeclareTextCompositeCommand{\^}{PU}{U}{\80\333} % Ucircumflex +\DeclareTextCompositeCommand{\"}{PU}{U}{\80\334} % Udieresis +\DeclareTextCompositeCommand{\'}{PU}{Y}{\80\335} % Yacute +\DeclareTextCommand{\TH}{PU}{\80\336} % Thorn +\DeclareTextCommand{\ss}{PU}{\80\337} % germandbls +\DeclareTextCompositeCommand{\`}{PU}{a}{\80\340} % agrave +\DeclareTextCompositeCommand{\'}{PU}{a}{\80\341} % aacute +\DeclareTextCompositeCommand{\^}{PU}{a}{\80\342} % acircumflex +\DeclareTextCompositeCommand{\~}{PU}{a}{\80\343} % atilde +\DeclareTextCompositeCommand{\"}{PU}{a}{\80\344} % adieresis +\DeclareTextCompositeCommand{\r}{PU}{a}{\80\345} % aring +\DeclareTextCommand{\ae}{PU}{\80\346} % ae +\DeclareTextCompositeCommand{\c}{PU}{c}{\80\347} % ccedilla +\DeclareTextCompositeCommand{\`}{PU}{e}{\80\350} % egrave +\DeclareTextCompositeCommand{\'}{PU}{e}{\80\351} % eacute +\DeclareTextCompositeCommand{\^}{PU}{e}{\80\352} % ecircumflex +\DeclareTextCompositeCommand{\"}{PU}{e}{\80\353} % edieresis +\DeclareTextCompositeCommand{\`}{PU}{i}{\80\354} % igrave +\DeclareTextCompositeCommand{\`}{PU}{\i}{\80\354} % igrave +\DeclareTextCompositeCommand{\'}{PU}{i}{\80\355} % iacute +\DeclareTextCompositeCommand{\'}{PU}{\i}{\80\355} % iacute +\DeclareTextCompositeCommand{\^}{PU}{i}{\80\356} % icircumflex +\DeclareTextCompositeCommand{\^}{PU}{\i}{\80\356} % icircumflex +\DeclareTextCompositeCommand{\"}{PU}{i}{\80\357} % idieresis +\DeclareTextCompositeCommand{\"}{PU}{\i}{\80\357} % idieresis +\DeclareTextCommand{\dh}{PU}{\80\360} % eth +\DeclareTextCompositeCommand{\~}{PU}{n}{\80\361} % ntilde +\DeclareTextCompositeCommand{\`}{PU}{o}{\80\362} % ograve +\DeclareTextCompositeCommand{\'}{PU}{o}{\80\363} % oacute +\DeclareTextCompositeCommand{\^}{PU}{o}{\80\364} % ocircumflex +\DeclareTextCompositeCommand{\~}{PU}{o}{\80\365} % otilde +\DeclareTextCompositeCommand{\"}{PU}{o}{\80\366} % odieresis +\DeclareTextCommand{\textdivide}{PU}{\80\367} % divide +\DeclareTextCommand{\o}{PU}{\80\370} % oslash +\DeclareTextCompositeCommand{\`}{PU}{u}{\80\371} % ugrave +\DeclareTextCompositeCommand{\'}{PU}{u}{\80\372} % uacute +\DeclareTextCompositeCommand{\^}{PU}{u}{\80\373} % ucircumflex +\DeclareTextCompositeCommand{\"}{PU}{u}{\80\374} % udieresis +\DeclareTextCompositeCommand{\'}{PU}{y}{\80\375} % yacute +\DeclareTextCommand{\th}{PU}{\80\376} % thorn +\DeclareTextCompositeCommand{\"}{PU}{y}{\80\377} % ydieresis +\DeclareTextCommand{\ij}{PU}{\80\377} +% \end{macrocode} +% Glyphs that consist of several characters. +% \begin{macrocode} +\DeclareTextCommand{\SS}{PU}{SS} +\DeclareTextCommand{\textcelsius}{PU}{\textdegree C} +% \end{macrocode} +% Aliases (german.sty) +% \begin{macrocode} +\DeclareTextCommand{\textglqq}{PU}{\quotedblbase} +\DeclareTextCommand{\textgrqq}{PU}{\textquotedblleft} +\DeclareTextCommand{\textglq}{PU}{\quotesinglbase} +\DeclareTextCommand{\textgrq}{PU}{\textquoteleft} +\DeclareTextCommand{\textflqq}{PU}{\guillemotleft} +\DeclareTextCommand{\textfrqq}{PU}{\guillemotright} +\DeclareTextCommand{\textflq}{PU}{\guilsinglleft} +\DeclareTextCommand{\textfrq}{PU}{\guilsinglright} +% \end{macrocode} +% Aliases (math names) +% \begin{macrocode} +\DeclareTextCommand{\textneg}{PU}{\textlogicalnot} +\DeclareTextCommand{\texttimes}{PU}{\textmultiply} +\DeclareTextCommand{\textdiv}{PU}{\textdivide} +\DeclareTextCommand{\textpm}{PU}{\textplusminus} +\DeclareTextCommand{\textcdot}{PU}{\textperiodcentered} +\DeclareTextCommand{\textbeta}{PU}{\ss} +% \end{macrocode} +% +% \subsubsection{Latin Extended-A} +% \begin{macrocode} +\DeclareTextCompositeCommand{\=}{PU}{A}{\81\000}% Amacron +\DeclareTextCompositeCommand{\=}{PU}{a}{\81\001}% amacron +\DeclareTextCompositeCommand{\u}{PU}{A}{\81\002}% Abreve +\DeclareTextCompositeCommand{\u}{PU}{a}{\81\003}% abreve +\DeclareTextCompositeCommand{\k}{PU}{A}{\81\004} % Aogonek +\DeclareTextCompositeCommand{\k}{PU}{a}{\81\005} % aogonek +\DeclareTextCompositeCommand{\'}{PU}{C}{\81\006} % Cacute +\DeclareTextCompositeCommand{\'}{PU}{c}{\81\007} % cacute +\DeclareTextCompositeCommand{\^}{PU}{C}{\81\010} % Ccircumflex +\DeclareTextCompositeCommand{\^}{PU}{c}{\81\011} % ccircumflex +\DeclareTextCompositeCommand{\.}{PU}{C}{\81\012} % Cdot +\DeclareTextCompositeCommand{\.}{PU}{c}{\81\013} % cdot +\DeclareTextCompositeCommand{\v}{PU}{C}{\81\014} % Ccaron +\DeclareTextCompositeCommand{\v}{PU}{c}{\81\015} % ccaron +\DeclareTextCompositeCommand{\v}{PU}{D}{\81\016} % Dcaron +\DeclareTextCompositeCommand{\v}{PU}{d}{\81\017} % dcaron +\DeclareTextCommand{\DJ}{PU}{\81\020} % Dslash +\DeclareTextCommand{\dj}{PU}{\81\021} % dslash +\DeclareTextCompositeCommand{\=}{PU}{E}{\81\022} % Emacron +\DeclareTextCompositeCommand{\=}{PU}{e}{\81\023} % emacron +\DeclareTextCompositeCommand{\u}{PU}{E}{\81\024} % Ebreve +\DeclareTextCompositeCommand{\u}{PU}{e}{\81\025} % ebreve +\DeclareTextCompositeCommand{\.}{PU}{E}{\81\026} % Edot +\DeclareTextCompositeCommand{\.}{PU}{e}{\81\027} % edot +\DeclareTextCompositeCommand{\k}{PU}{E}{\81\030} % Eogonek +\DeclareTextCompositeCommand{\k}{PU}{e}{\81\031} % eogonek +\DeclareTextCompositeCommand{\v}{PU}{E}{\81\032} % Ecaron +\DeclareTextCompositeCommand{\v}{PU}{e}{\81\033} % ecaron +\DeclareTextCompositeCommand{\^}{PU}{G}{\81\034} % Gcircumflex +\DeclareTextCompositeCommand{\^}{PU}{g}{\81\035} % gcircumflex +\DeclareTextCompositeCommand{\u}{PU}{G}{\81\036} % Gbreve +\DeclareTextCompositeCommand{\u}{PU}{g}{\81\037} % gbreve +\DeclareTextCompositeCommand{\.}{PU}{G}{\81\040} % Gdot +\DeclareTextCompositeCommand{\.}{PU}{g}{\81\041} % gdot +\DeclareTextCompositeCommand{\c}{PU}{G}{\81\042} % Gcedilla +\DeclareTextCompositeCommand{\c}{PU}{g}{\81\043} % gcedilla +\DeclareTextCompositeCommand{\^}{PU}{H}{\81\044} % Hcircumflex +\DeclareTextCompositeCommand{\^}{PU}{h}{\81\045} % hcircumflex +\DeclareTextCommand{\textHslash}{PU}{\81\046} % Hslash +\DeclareTextCommand{\texthslash}{PU}{\81\047} % hslash +\DeclareTextCompositeCommand{\~}{PU}{I}{\81\050} % Itilde +\DeclareTextCompositeCommand{\~}{PU}{i}{\81\051} % itilde +\DeclareTextCompositeCommand{\~}{PU}{\i}{\81\051} % itilde +\DeclareTextCompositeCommand{\=}{PU}{I}{\81\052} % Imacron +\DeclareTextCompositeCommand{\=}{PU}{i}{\81\053} % imacron +\DeclareTextCompositeCommand{\=}{PU}{\i}{\81\053} % imacron +\DeclareTextCompositeCommand{\u}{PU}{I}{\81\054} % Ibreve +\DeclareTextCompositeCommand{\u}{PU}{i}{\81\055} % ibreve +\DeclareTextCompositeCommand{\u}{PU}{\i}{\81\055} % ibreve +\DeclareTextCompositeCommand{\k}{PU}{I}{\81\056} % Iogonek +\DeclareTextCompositeCommand{\k}{PU}{i}{\81\057} % iogonek +\DeclareTextCompositeCommand{\k}{PU}{\i}{\81\057} % iogonek +\DeclareTextCompositeCommand{\.}{PU}{I}{\81\060} % Idot +\DeclareTextCommand{\i}{PU}{\81\061} % idotless +% IJlig +% ijlig +\DeclareTextCompositeCommand{\^}{PU}{J}{\81\064} % Jcircumflex +\DeclareTextCompositeCommand{\^}{PU}{j}{\81\065} % jcircumflex +\DeclareTextCompositeCommand{\^}{PU}{\j}{\81\065} % jcircumflex +\DeclareTextCompositeCommand{\c}{PU}{K}{\81\066} % Kcedilla +\DeclareTextCompositeCommand{\c}{PU}{k}{\81\067} % kcedilla +% kgreen +\DeclareTextCompositeCommand{\'}{PU}{L}{\81\071} % Lacute +\DeclareTextCompositeCommand{\'}{PU}{l}{\81\072} % lacute +\DeclareTextCompositeCommand{\c}{PU}{L}{\81\073} % Lcedilla +\DeclareTextCompositeCommand{\c}{PU}{l}{\81\074} % lcedilla +\DeclareTextCompositeCommand{\v}{PU}{L}{\81\075} % Lcaron +\DeclareTextCompositeCommand{\v}{PU}{l}{\81\076} % lcaron +% L middle dot +% l middle dot +\DeclareTextCommand{\L}{PU}{\81\101} % Lslash +\DeclareTextCommand{\l}{PU}{\81\102} % lslash +\DeclareTextCompositeCommand{\'}{PU}{N}{\81\103} % Nacute +\DeclareTextCompositeCommand{\'}{PU}{n}{\81\104} % nacute +\DeclareTextCompositeCommand{\c}{PU}{N}{\81\105} % Ncedilla +\DeclareTextCompositeCommand{\c}{PU}{n}{\81\106} % ncedilla +\DeclareTextCompositeCommand{\v}{PU}{N}{\81\107} % Ncaron +\DeclareTextCompositeCommand{\v}{PU}{n}{\81\110} % ncaron +% n apostrophe +\DeclareTextCommand{\NG}{PU}{NG} % \81\112 +\DeclareTextCommand{\ng}{PU}{ng} % \81\113 +\DeclareTextCompositeCommand{\=}{PU}{O}{\81\114} % Omacron +\DeclareTextCompositeCommand{\=}{PU}{o}{\81\115} % omacron +\DeclareTextCompositeCommand{\u}{PU}{O}{\81\116} % Obreve +\DeclareTextCompositeCommand{\u}{PU}{o}{\81\117} % obreve +\DeclareTextCompositeCommand{\H}{PU}{O}{\81\120} % Odoubleacute +\DeclareTextCompositeCommand{\H}{PU}{o}{\81\121} % odoubleacute +%\DeclareTextCommand{\OE}{PU}{\81\122} % OE +%\DeclareTextCommand{\oe}{PU}{\81\123} % oe +\DeclareTextCompositeCommand{\'}{PU}{R}{\81\124} % Racute +\DeclareTextCompositeCommand{\'}{PU}{r}{\81\125} % racute +\DeclareTextCompositeCommand{\c}{PU}{R}{\81\126} % Rcedilla +\DeclareTextCompositeCommand{\c}{PU}{r}{\81\127} % rcedilla +\DeclareTextCompositeCommand{\v}{PU}{R}{\81\130} % Rcaron +\DeclareTextCompositeCommand{\v}{PU}{r}{\81\131} % rcaron +\DeclareTextCompositeCommand{\'}{PU}{S}{\81\132} % Sacute +\DeclareTextCompositeCommand{\'}{PU}{s}{\81\133} % sacute +\DeclareTextCompositeCommand{\^}{PU}{S}{\81\134} % Scircumflex +\DeclareTextCompositeCommand{\^}{PU}{s}{\81\135} % scircumflex +\DeclareTextCompositeCommand{\c}{PU}{S}{\81\136} % Scedilla +\DeclareTextCompositeCommand{\c}{PU}{s}{\81\137} % scedilla +\DeclareTextCompositeCommand{\v}{PU}{S}{\81\140} % Scaron +\DeclareTextCompositeCommand{\v}{PU}{s}{\81\141} % scaron +\DeclareTextCompositeCommand{\c}{PU}{T}{\81\142} % Tcedilla +\DeclareTextCompositeCommand{\c}{PU}{t}{\81\143} % tcedilla +\DeclareTextCompositeCommand{\v}{PU}{T}{\81\144} % Tcaron +\DeclareTextCompositeCommand{\v}{PU}{t}{\81\145} % tcaron +\DeclareTextCommand{\textTslash}{PU}{\81\146} % Tslash +\DeclareTextCommand{\texttslash}{PU}{\81\147} % tslash +\DeclareTextCompositeCommand{\~}{PU}{U}{\81\150} % Utilde +\DeclareTextCompositeCommand{\~}{PU}{u}{\81\151} % utilde +\DeclareTextCompositeCommand{\=}{PU}{U}{\81\152} % Umacron +\DeclareTextCompositeCommand{\=}{PU}{u}{\81\153} % umacron +\DeclareTextCompositeCommand{\u}{PU}{U}{\81\154} % Ubreve +\DeclareTextCompositeCommand{\u}{PU}{u}{\81\155} % ubreve +\DeclareTextCompositeCommand{\r}{PU}{U}{\81\156} % Uring +\DeclareTextCompositeCommand{\r}{PU}{u}{\81\157} % uring +\DeclareTextCompositeCommand{\H}{PU}{U}{\81\160} % Udoubleacute +\DeclareTextCompositeCommand{\H}{PU}{u}{\81\161} % udoubleacute +\DeclareTextCompositeCommand{\k}{PU}{U}{\81\162} % Uogonek +\DeclareTextCompositeCommand{\k}{PU}{u}{\81\163} % uogonek +\DeclareTextCompositeCommand{\^}{PU}{W}{\81\164} % Wcircumflex +\DeclareTextCompositeCommand{\^}{PU}{w}{\81\165} % wcircumflex +\DeclareTextCompositeCommand{\^}{PU}{Y}{\81\166} % Ycircumflex +\DeclareTextCompositeCommand{\^}{PU}{y}{\81\167} % ycircumflex +\DeclareTextCompositeCommand{\"}{PU}{Y}{\81\170} % Ydieresis +\DeclareTextCommand{\IJ}{PU}{\81\170} +\DeclareTextCompositeCommand{\'}{PU}{Z}{\81\171} % Zacute +\DeclareTextCompositeCommand{\'}{PU}{z}{\81\172} % zacute +\DeclareTextCompositeCommand{\.}{PU}{Z}{\81\173} % Zdot +\DeclareTextCompositeCommand{\.}{PU}{z}{\81\174} % zdot +\DeclareTextCompositeCommand{\v}{PU}{Z}{\81\175} % Zcaron +\DeclareTextCompositeCommand{\v}{PU}{z}{\81\176} % zcaron +% \end{macrocode} +% +% \subsubsection{Latin Extended-B} +% \begin{macrocode} +\DeclareTextCompositeCommand{\v}{PU}{A}{\81\315} % Acaron +\DeclareTextCompositeCommand{\v}{PU}{a}{\81\316} % acaron +\DeclareTextCompositeCommand{\v}{PU}{I}{\81\317} % Icaron +\DeclareTextCompositeCommand{\v}{PU}{i}{\81\320} % icaron +\DeclareTextCompositeCommand{\v}{PU}{\i}{\81\320} % icaron +\DeclareTextCompositeCommand{\v}{PU}{O}{\81\321} % Ocaron +\DeclareTextCompositeCommand{\v}{PU}{o}{\81\322} % ocaron +\DeclareTextCompositeCommand{\v}{PU}{U}{\81\323} % Ucaron +\DeclareTextCompositeCommand{\v}{PU}{u}{\81\324} % ucaron +\DeclareTextCommand{\textGslash}{PU}{\81\344} % Gslash +\DeclareTextCommand{\textgslash}{PU}{\81\345} % gslash +\DeclareTextCompositeCommand{\v}{PU}{G}{\81\346} % Gcaron +\DeclareTextCompositeCommand{\v}{PU}{g}{\81\347} % gcaron +\DeclareTextCompositeCommand{\v}{PU}{K}{\81\350} % Kcaron +\DeclareTextCompositeCommand{\v}{PU}{k}{\81\351} % kcaron +\DeclareTextCompositeCommand{\k}{PU}{O}{\81\352} % Oogonek +\DeclareTextCompositeCommand{\k}{PU}{o}{\81\353} % oogonek +% \end{macrocode} +% +% \subsubsection{Greek} +% \begin{macrocode} +\DeclareTextCompositeCommand{\'}{PU}{\textAlpha}{\83\206} +\DeclareTextCompositeCommand{\'}{PU}{\textEpsilon}{\83\210} +\DeclareTextCompositeCommand{\'}{PU}{\textEta}{\83\211} +\DeclareTextCompositeCommand{\'}{PU}{\textIota}{\83\212} +\DeclareTextCompositeCommand{\'}{PU}{\textOmicron}{\83\214} +\DeclareTextCompositeCommand{\'}{PU}{\textUpsilon}{\83\216} +\DeclareTextCompositeCommand{\'}{PU}{\textOmega}{\83\217} +\DeclareTextCommand{\textIotadieresis}{PU}{\83\252} +\DeclareTextCompositeCommand{\'}{PU}{\textIotadieresis}{\83\220} +\DeclareTextCommand{\textAlpha}{PU}{\83\221} +\DeclareTextCommand{\textBeta}{PU}{\83\222} +\DeclareTextCommand{\textGamma}{PU}{\83\223} +\DeclareTextCommand{\textDelta}{PU}{\83\224} +\DeclareTextCommand{\textEpsilon}{PU}{\83\225} +\DeclareTextCommand{\textZeta}{PU}{\83\226} +\DeclareTextCommand{\textEta}{PU}{\83\227} +\DeclareTextCommand{\textTheta}{PU}{\83\230} +\DeclareTextCommand{\textIota}{PU}{\83\231} +\DeclareTextCommand{\textKappa}{PU}{\83\232} +\DeclareTextCommand{\textLambda}{PU}{\83\233} +\DeclareTextCommand{\textMu}{PU}{\83\234} +\DeclareTextCommand{\textNu}{PU}{\83\235} +\DeclareTextCommand{\textXi}{PU}{\83\236} +\DeclareTextCommand{\textOmicron}{PU}{\83\237} +\DeclareTextCommand{\textPi}{PU}{\83\240} +\DeclareTextCommand{\textRho}{PU}{\83\241} +\DeclareTextCommand{\textSigma}{PU}{\83\243} +\DeclareTextCommand{\textTau}{PU}{\83\244} +\DeclareTextCommand{\textUpsilon}{PU}{\83\245} +\DeclareTextCommand{\textPhi}{PU}{\83\246} +\DeclareTextCommand{\textChi}{PU}{\83\247} +\DeclareTextCommand{\textPsi}{PU}{\83\250} +\DeclareTextCommand{\textOmega}{PU}{\83\251} +\DeclareTextCompositeCommand{\"}{PU}{\textIota}{\83\252} +\DeclareTextCompositeCommand{\"}{PU}{\textUpsilon}{\83\253} +\DeclareTextCompositeCommand{\'}{PU}{\textalpha}{\83\254} +\DeclareTextCompositeCommand{\'}{PU}{\textepsilon}{\83\255} +\DeclareTextCompositeCommand{\'}{PU}{\texteta}{\83\256} +\DeclareTextCompositeCommand{\'}{PU}{\textiota}{\83\257} +\DeclareTextCommand{\textupsilonacute}{PU}{\83\315} +\DeclareTextCompositeCommand{\"}{PU}{\textupsilonacute}{\83\260} +\DeclareTextCommand{\textalpha}{PU}{\83\261} +\DeclareTextCommand{\textbeta}{PU}{\83\262} +\DeclareTextCommand{\textgamma}{PU}{\83\263} +\DeclareTextCommand{\textdelta}{PU}{\83\264} +\DeclareTextCommand{\textepsilon}{PU}{\83\265} +\DeclareTextCommand{\textzeta}{PU}{\83\266} +\DeclareTextCommand{\texteta}{PU}{\83\267} +\DeclareTextCommand{\texttheta}{PU}{\83\270} +\DeclareTextCommand{\textiota}{PU}{\83\271} +\DeclareTextCommand{\textkappa}{PU}{\83\272} +\DeclareTextCommand{\textlambda}{PU}{\83\273} +\DeclareTextCommand{\textmu}{PU}{\83\274} +\DeclareTextCommand{\textnu}{PU}{\83\275} +\DeclareTextCommand{\textxi}{PU}{\83\276} +\DeclareTextCommand{\textomicron}{PU}{\83\277} +\DeclareTextCommand{\textpi}{PU}{\83\300} +\DeclareTextCommand{\textrho}{PU}{\83\301} +\DeclareTextCommand{\textvarsigma}{PU}{\83\302} +\DeclareTextCommand{\textsigma}{PU}{\83\303} +\DeclareTextCommand{\texttau}{PU}{\83\304} +\DeclareTextCommand{\textupsilon}{PU}{\83\305} +\DeclareTextCommand{\textphi}{PU}{\83\306} +\DeclareTextCommand{\textchi}{PU}{\83\307} +\DeclareTextCommand{\textpsi}{PU}{\83\310} +\DeclareTextCommand{\textomega}{PU}{\83\311} +\DeclareTextCompositeCommand{\"}{PU}{\textiota}{\83\312} +\DeclareTextCompositeCommand{\"}{PU}{\textupsilon}{\83\313} +\DeclareTextCompositeCommand{\'}{PU}{\textomicron}{\83\314} +\DeclareTextCompositeCommand{\'}{PU}{\textupsilon}{\83\315} +\DeclareTextCompositeCommand{\'}{PU}{\textomega}{\83\316} +%\DeclareTextCommand{\textvartheta}{PU}{\83\321} +%\DeclareTextCommand{\textvarphi}{PU}{\83\325} +%\DeclareTextCommand{\textvarpi}{PU}{\83\326} +%\DeclareTextCommand{\textdigamma}{PU}{\83\334} +%\DeclareTextCommand{\textvarkappa}{PU}{\83\360} +%\DeclareTextCommand{\textvarrho}{PU}{\83\361} +% \end{macrocode} +% +% \subsubsection{Cyrillic} +% Thanks to Vladimir Volovich (\Email{vvv@vvv.vsu.ru}) for +% the help with the Cyrillic glyph names. +% \begin{macrocode} +\DeclareTextCommand{\CYRYO}{PU}{\84\001}% IO +\DeclareTextCompositeCommand{\"}{PU}{\CYRE}{\84\001}% +\DeclareTextCommand{\CYRDJE}{PU}{\84\002}% DJE +\DeclareTextCompositeCommand{\'}{PU}{\CYRG}{\84\003}% GJE +\DeclareTextCommand{\CYRIE}{PU}{\84\004}% ukrainian IE +\DeclareTextCommand{\CYRDZE}{PU}{\84\005}% DZE +\DeclareTextCommand{\CYRII}{PU}{\84\006}% byelorussian-ukrainian I +\DeclareTextCommand{\CYRYI}{PU}{\84\007}% YI +\DeclareTextCommand{\CYRJE}{PU}{\84\010}% JE +\DeclareTextCommand{\CYRLJE}{PU}{\84\011}% LJE +\DeclareTextCommand{\CYRNJE}{PU}{\84\012}% NJE +\DeclareTextCommand{\CYRTSHE}{PU}{\84\013}% TSHE +\DeclareTextCompositeCommand{\'}{PU}{\CYRK}{\84\014}% KJE +\DeclareTextCommand{\CYRUSHRT}{PU}{\84\016}% short U +\DeclareTextCommand{\CYRDZHE}{PU}{\84\017}% DZHE +\DeclareTextCommand{\CYRA}{PU}{\84\020}% A +\DeclareTextCommand{\CYRB}{PU}{\84\021}% BE +\DeclareTextCommand{\CYRV}{PU}{\84\022}% VE +\DeclareTextCommand{\CYRG}{PU}{\84\023}% GHE +\DeclareTextCommand{\CYRD}{PU}{\84\024}% DE +\DeclareTextCommand{\CYRE}{PU}{\84\025}% IE +\DeclareTextCommand{\CYRZH}{PU}{\84\026}% ZHE +\DeclareTextCommand{\CYRZ}{PU}{\84\027}% ZE +\DeclareTextCommand{\CYRI}{PU}{\84\030}% I +\DeclareTextCommand{\CYRISHRT}{PU}{\84\031}% short I +\DeclareTextCompositeCommand{\U}{PU}{\CYRI}{\84\031}% +\DeclareTextCommand{\CYRK}{PU}{\84\032}% KA +\DeclareTextCommand{\CYRL}{PU}{\84\033}% EL +\DeclareTextCommand{\CYRM}{PU}{\84\034}% EM +\DeclareTextCommand{\CYRN}{PU}{\84\035}% EN +\DeclareTextCommand{\CYRO}{PU}{\84\036}% O +\DeclareTextCommand{\CYRP}{PU}{\84\037}% PE +\DeclareTextCommand{\CYRR}{PU}{\84\040}% ER +\DeclareTextCommand{\CYRS}{PU}{\84\041}% ES +\DeclareTextCommand{\CYRT}{PU}{\84\042}% TE +\DeclareTextCommand{\CYRU}{PU}{\84\043}% U +\DeclareTextCommand{\CYRF}{PU}{\84\044}% EF +\DeclareTextCommand{\CYRH}{PU}{\84\045}% HA +\DeclareTextCommand{\CYRC}{PU}{\84\046}% TSE +\DeclareTextCommand{\CYRCH}{PU}{\84\047}% CHE +\DeclareTextCommand{\CYRSH}{PU}{\84\050}% SHA +\DeclareTextCommand{\CYRSHCH}{PU}{\84\051}% SHCHA +\DeclareTextCommand{\CYRHRDSN}{PU}{\84\052}% HARD SIGN +\DeclareTextCommand{\CYRERY}{PU}{\84\053}% YERU +\DeclareTextCommand{\CYRSFTSN}{PU}{\84\054}% SOFT SIGN +\DeclareTextCommand{\CYREREV}{PU}{\84\055}% E +\DeclareTextCommand{\CYRYU}{PU}{\84\056}% YU +\DeclareTextCommand{\CYRYA}{PU}{\84\057}% YA +\DeclareTextCommand{\cyra}{PU}{\84\060}% a +\DeclareTextCommand{\cyrb}{PU}{\84\061}% be +\DeclareTextCommand{\cyrv}{PU}{\84\062}% ve +\DeclareTextCommand{\cyrg}{PU}{\84\063}% ghe +\DeclareTextCommand{\cyrd}{PU}{\84\064}% de +\DeclareTextCommand{\cyre}{PU}{\84\065}% ie +\DeclareTextCommand{\cyrzh}{PU}{\84\066}% zhe +\DeclareTextCommand{\cyrz}{PU}{\84\067}% ze +\DeclareTextCommand{\cyri}{PU}{\84\070}% i +\DeclareTextCommand{\cyrishrt}{PU}{\84\071}% short i +\DeclareTextCompositeCommand{\U}{PU}{\cyri}{\84\071}% +\DeclareTextCommand{\cyrk}{PU}{\84\072}% ka +\DeclareTextCommand{\cyrl}{PU}{\84\073}% el +\DeclareTextCommand{\cyrm}{PU}{\84\074}% em +\DeclareTextCommand{\cyrn}{PU}{\84\075}% en +\DeclareTextCommand{\cyro}{PU}{\84\076}% o +\DeclareTextCommand{\cyrp}{PU}{\84\077}% pe +\DeclareTextCommand{\cyrr}{PU}{\84\100}% er +\DeclareTextCommand{\cyrs}{PU}{\84\101}% es +\DeclareTextCommand{\cyrt}{PU}{\84\102}% te +\DeclareTextCommand{\cyru}{PU}{\84\103}% u +\DeclareTextCommand{\cyrf}{PU}{\84\104}% ef +\DeclareTextCommand{\cyrh}{PU}{\84\105}% ha +\DeclareTextCommand{\cyrc}{PU}{\84\106}% tse +\DeclareTextCommand{\cyrch}{PU}{\84\107}% che +\DeclareTextCommand{\cyrsh}{PU}{\84\110}% sha +\DeclareTextCommand{\cyrshch}{PU}{\84\111}% shcha +\DeclareTextCommand{\cyrhrdsn}{PU}{\84\112}% hard sign +\DeclareTextCommand{\cyrery}{PU}{\84\113}% yeru +\DeclareTextCommand{\cyrsftsn}{PU}{\84\114}% soft sign +\DeclareTextCommand{\cyrerev}{PU}{\84\115}% e +\DeclareTextCommand{\cyryu}{PU}{\84\116}% yu +\DeclareTextCommand{\cyrya}{PU}{\84\117}% ya +\DeclareTextCommand{\cyryo}{PU}{\84\121}% io +\DeclareTextCompositeCommand{\"}{PU}{\cyre}{\84\121}% +\DeclareTextCommand{\cyrdje}{PU}{\84\122}% dje +\DeclareTextCompositeCommand{\'}{PU}{\cyrg}{\84\123}% gje +\DeclareTextCommand{\cyrie}{PU}{\84\124}% ukrainian ie +\DeclareTextCommand{\cyrdze}{PU}{\84\125}% dze +\DeclareTextCommand{\cyrii}{PU}{\84\126}% byelorussian-ukrainian i +\DeclareTextCommand{\cyryi}{PU}{\84\127}% yi +\DeclareTextCommand{\cyrje}{PU}{\84\130}% je +\DeclareTextCommand{\cyrlje}{PU}{\84\131}% lje +\DeclareTextCommand{\cyrnje}{PU}{\84\132}% nje +\DeclareTextCommand{\cyrtshe}{PU}{\84\133}% tshe +\DeclareTextCompositeCommand{\'}{PU}{\cyrk}{\84\134}% kje +\DeclareTextCommand{\cyrushrt}{PU}{\84\136}% short u +\DeclareTextCommand{\cyrdzhe}{PU}{\84\137}% dzhe +\DeclareTextCommand{\CYROMEGA}{PU}{\84\140}% OMEGA +\DeclareTextCommand{\cyromega}{PU}{\84\141}% omega +\DeclareTextCommand{\CYRYAT}{PU}{\84\142}% YAT +\DeclareTextCommand{\cyryat}{PU}{\84\143}% yat +\DeclareTextCommand{\CYRIOTE}{PU}{\84\144}% iotified E +\DeclareTextCommand{\cyriote}{PU}{\84\145}% iotified e +\DeclareTextCommand{\CYRLYUS}{PU}{\84\146}% little YUS +\DeclareTextCommand{\cyrlyus}{PU}{\84\147}% little yus +\DeclareTextCommand{\CYRIOTLYUS}{PU}{\84\150}% iotified little YUS +\DeclareTextCommand{\cyriotlyus}{PU}{\84\151}% iotified little yus +\DeclareTextCommand{\CYRBYUS}{PU}{\84\152}% big YUS +\DeclareTextCommand{\cyrbyus}{PU}{\84\153}% big yus +\DeclareTextCommand{\CYRIOTBYUS}{PU}{\84\154}% iotified big YUS +\DeclareTextCommand{\cyriotbyus}{PU}{\84\155}% iotified big yus +\DeclareTextCommand{\CYRKSI}{PU}{\84\156}% KSI +\DeclareTextCommand{\cyrksi}{PU}{\84\157}% ksi +\DeclareTextCommand{\CYRPSI}{PU}{\84\160}% PSI +\DeclareTextCommand{\cyrpsi}{PU}{\84\161}% psi +\DeclareTextCommand{\CYRFITA}{PU}{\84\162}% FITA +\DeclareTextCommand{\cyrfita}{PU}{\84\163}% fita +\DeclareTextCommand{\CYRIZH}{PU}{\84\164}% IZHITSA +\DeclareTextCommand{\cyrizh}{PU}{\84\165}% izhitsa +\DeclareTextCompositeCommand{\C}{PU}{\CYRIZH}{\84\166}% IZHITSA double grave +\DeclareTextCompositeCommand{\C}{PU}{\cyrizh}{\84\167}% izhitsa double grave +\DeclareTextCommand{\CYRUK}{PU}{\84\170}% UK +\DeclareTextCommand{\cyruk}{PU}{\84\171}% uk +\DeclareTextCommand{\CYROMEGARND}{PU}{\84\172}% round OMEGA +\DeclareTextCommand{\cyromegarnd}{PU}{\84\173}% round omega +\DeclareTextCommand{\CYROMEGATITLO}{PU}{\84\174}% OMEGA titlo +\DeclareTextCommand{\cyromegatitlo}{PU}{\84\175}% omega titlo +\DeclareTextCommand{\CYROT}{PU}{\84\176}% OT +\DeclareTextCommand{\cyrot}{PU}{\84\177}% ot +\DeclareTextCommand{\CYRKOPPA}{PU}{\84\200}% KOPPA +\DeclareTextCommand{\cyrkoppa}{PU}{\84\201}% koppa +\DeclareTextCommand{\cyrthousands}{PU}{\84\202}% thousands sign +%\DeclareTextCommand{\COMBINING TITLO}{PU}{\84\203}% COMBINING TITLO +%\DeclareTextCommand{\COMBINING PALATALIZATION}{PU}{\84\204}% COMBINING PALATALIZATION +%\DeclareTextCommand{\COMBINING DASIA PNEUMATA}{PU}{\84\205}% COMBINING DASIA PNEUMATA +%\DeclareTextCommand{\COMBINING PSILI PNEUMATA}{PU}{\84\206}% COMBINING PSILI PNEUMATA +\DeclareTextCommand{\CYRGUP}{PU}{\84\220}% GHE upturn +\DeclareTextCommand{\cyrgup}{PU}{\84\221}% ghe upturn +\DeclareTextCommand{\CYRGHCRS}{PU}{\84\222}% GHE stroke +\DeclareTextCommand{\cyrghcrs}{PU}{\84\223}% ghe stroke +\DeclareTextCommand{\CYRGHK}{PU}{\84\224}% GHE middle hook +\DeclareTextCommand{\cyrghk}{PU}{\84\225}% ghe middle hook +\DeclareTextCommand{\CYRZHDSC}{PU}{\84\226}% ZHE descender +\DeclareTextCommand{\cyrzhdsc}{PU}{\84\227}% zhe descender +\DeclareTextCommand{\CYRZDSC}{PU}{\84\230}% ZE descender +\DeclareTextCommand{\cyrzdsc}{PU}{\84\231}% ze descender +\DeclareTextCommand{\CYRKDSC}{PU}{\84\232}% KA descender +\DeclareTextCommand{\cyrkdsc}{PU}{\84\233}% ka descender +\DeclareTextCommand{\CYRKVCRS}{PU}{\84\234}% KA vertical stroke +\DeclareTextCommand{\cyrkvcrs}{PU}{\84\235}% ka vertical stroke +\DeclareTextCommand{\CYRKHCRS}{PU}{\84\236}% KA stroke +\DeclareTextCommand{\cyrkhcrs}{PU}{\84\237}% ka stroke +\DeclareTextCommand{\CYRKBEAK}{PU}{\84\240}% bashkir KA +\DeclareTextCommand{\cyrkbeak}{PU}{\84\241}% bashkir ka +\DeclareTextCommand{\CYRNDSC}{PU}{\84\242}% EN descender +\DeclareTextCommand{\cyrndsc}{PU}{\84\243}% en descender +\DeclareTextCommand{\CYRNG}{PU}{\84\244}% ligature EN GHE +\DeclareTextCommand{\cyrng}{PU}{\84\245}% ligature en ghe +\DeclareTextCommand{\CYRPHK}{PU}{\84\246}% PE middle hook +\DeclareTextCommand{\cyrphk}{PU}{\84\247}% pe middle hook +\DeclareTextCommand{\CYRABHHA}{PU}{\84\250}% abkhasian HA +\DeclareTextCommand{\cyrabhha}{PU}{\84\251}% abkhasian ha +\DeclareTextCommand{\CYRSDSC}{PU}{\84\252}% ES descender +\DeclareTextCommand{\cyrsdsc}{PU}{\84\253}% es descender +\DeclareTextCommand{\CYRTDSC}{PU}{\84\254}% TE descender +\DeclareTextCommand{\cyrtdsc}{PU}{\84\255}% te descender +\DeclareTextCommand{\CYRY}{PU}{\84\256}% straight U +\DeclareTextCommand{\cyry}{PU}{\84\257}% straight u +\DeclareTextCommand{\CYRYHCRS}{PU}{\84\260}% straight U stroke +\DeclareTextCommand{\cyryhcrs}{PU}{\84\261}% straight u stroke +\DeclareTextCommand{\CYRHDSC}{PU}{\84\262}% HA descender +\DeclareTextCommand{\cyrhdsc}{PU}{\84\263}% ha descender +\DeclareTextCommand{\CYRTETSE}{PU}{\84\264}% ligature TE TSE +\DeclareTextCommand{\cyrtetse}{PU}{\84\265}% ligature te tse +\DeclareTextCommand{\CYRCHRDSC}{PU}{\84\266}% CHE descender +\DeclareTextCommand{\cyrchrdsc}{PU}{\84\267}% che descender +\DeclareTextCommand{\CYRCHVCRS}{PU}{\84\270}% CHE vertical stroke +\DeclareTextCommand{\cyrchvcrs}{PU}{\84\271}% che vertical stroke +\DeclareTextCommand{\CYRSHHA}{PU}{\84\272}% SHHA +\DeclareTextCommand{\cyrshha}{PU}{\84\273}% shha +\DeclareTextCommand{\CYRABHCH}{PU}{\84\274}% abkhasian CHE +\DeclareTextCommand{\cyrabhch}{PU}{\84\275}% abkhasian che +\DeclareTextCommand{\CYRABHCHDSC}{PU}{\84\276}% abkhasian CHE descender +\DeclareTextCommand{\cyrabhchdsc}{PU}{\84\277}% abkhasian che descender +\DeclareTextCommand{\CYRpalochka}{PU}{\84\300}% palochka +\DeclareTextCompositeCommand{\U}{PU}{\CYRZH}{\84\301}% ZHE breve +\DeclareTextCompositeCommand{\U}{PU}{\cyrzh}{\84\302}% zhe breve +\DeclareTextCommand{\CYRKHK}{PU}{\84\303}% KA hook +\DeclareTextCommand{\cyrkhk}{PU}{\84\304}% ka hook +\DeclareTextCommand{\CYRNHK}{PU}{\84\307}% EN hook +\DeclareTextCommand{\cyrnhk}{PU}{\84\310}% en hook +\DeclareTextCommand{\CYRCHLDSC}{PU}{\84\313}% khakassian CHE +\DeclareTextCommand{\cyrchldsc}{PU}{\84\314}% khakassian che +\DeclareTextCompositeCommand{\U}{PU}{\CYRA}{\84\320}% A breve +\DeclareTextCompositeCommand{\U}{PU}{\cyra}{\84\321}% a breve +\DeclareTextCompositeCommand{\"}{PU}{\CYRA}{\84\322}% A diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyra}{\84\323}% a diaeresis +\DeclareTextCommand{\CYRAE}{PU}{\84\324}% ligature A IE +\DeclareTextCommand{\cyrae}{PU}{\84\325}% ligature a ie +\DeclareTextCompositeCommand{\U}{PU}{\CYRE}{\84\326}% IE breve +\DeclareTextCompositeCommand{\U}{PU}{\cyre}{\84\327}% ie breve +\DeclareTextCommand{\CYRSCHWA}{PU}{\84\330}% SCHWA +\DeclareTextCommand{\cyrschwa}{PU}{\84\331}% schwa +\DeclareTextCompositeCommand{\"}{PU}{\CYRSCHWA}{\84\332}% SCHWA diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyrschwa}{\84\333}% schwa diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\CYRZH}{\84\334}% ZHE diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyrzh}{\84\335}% zhe diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\CYRZ}{\84\336}% ZE diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyrz}{\84\337}% ze diaeresis +\DeclareTextCommand{\CYRABHDZE}{PU}{\84\340}% abkhasian DZE +\DeclareTextCommand{\cyrabhdze}{PU}{\84\341}% abkhasian dze +\DeclareTextCompositeCommand{\=}{PU}{\CYRI}{\84\342}% I macron +\DeclareTextCompositeCommand{\=}{PU}{\cyri}{\84\343}% i macron +\DeclareTextCompositeCommand{\"}{PU}{\CYRI}{\84\344}% I diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyri}{\84\345}% i diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\CYRO}{\84\346}% O diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyro}{\84\347}% o diaeresis +\DeclareTextCommand{\CYROTLD}{PU}{\84\350}% barred O +\DeclareTextCommand{\cyrotld}{PU}{\84\351}% barred o +\DeclareTextCompositeCommand{\"}{PU}{\CYROTLD}{\84\352}% barred O diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyrotld}{\84\353}% barred o diaeresis +\DeclareTextCompositeCommand{\=}{PU}{\CYRU}{\84\356}% U macron +\DeclareTextCompositeCommand{\=}{PU}{\cyru}{\84\357}% u macron +\DeclareTextCompositeCommand{\"}{PU}{\CYRU}{\84\360}% U diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyru}{\84\361}% u diaeresis +\DeclareTextCompositeCommand{\H}{PU}{\CYRU}{\84\362}% U double acute +\DeclareTextCompositeCommand{\H}{PU}{\cyru}{\84\363}% u double acute +\DeclareTextCompositeCommand{\"}{PU}{\CYRCH}{\84\364}% CHE diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyrch}{\84\365}% che diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\CYRERY}{\84\370}% YERU diaeresis +\DeclareTextCompositeCommand{\"}{PU}{\cyrery}{\84\371}% yeru diaeresis +% \end{macrocode} +% \begin{macrocode} +\DeclareTextCommand{\texteuro}{PU}{\9040\254} % Euro +\DeclareTextCommand{\textnumero}{PU}{\9041\026} +%\DeclareTextCommand{\cyrlangle}{PU}{\9043\051} +%\DeclareTextCommand{\cyrrangle}{PU}{\9043\052} +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \section{End of file hycheck.tex} +% +% \begin{macrocode} +%<*check> +\typeout{} +\begin{document} +\end{document} +% +% \end{macrocode} +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/hyperref/hyperref.ins b/Master/texmf-dist/source/latex/hyperref/hyperref.ins new file mode 100644 index 00000000000..dabb4e901a4 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/hyperref.ins @@ -0,0 +1,88 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1995-1999 Sebastian Rahtz +%% 1999-2003 Sebastian Rahtz, Heiko Oberdiek +%% +%% This file is part of the `Hyperref Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% The list of all files belonging to the `Hyperref Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2003/03/20} +\def\batchfile{hyperref.ins} +\input docstrip + +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%\askonceonly +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\preamble +\endpreamble + +\generate{% + \file{hyperref.drv}{\from{hyperref.dtx}{driver}} + \file{hycheck.tex}{\from{hyperref.dtx}{check}} + \usedir{tex/latex/hyperref} + \file{backref.sty}{\from{backref.dtx}{package}} + \file{nameref.sty}{\from{nameref.dtx}{package}} + \file{hyperref.sty}{\from{hyperref.dtx}{package}} + \file{hypertex.def}{\from{hyperref.dtx}{hypertex}} + \file{pdfmark.def}{\from{hyperref.dtx}{pdfmark,pdfmarkbase,pdfform,outlines}} + \file{hvtexmrk.def}{\from{hyperref.dtx}{vtexpdfmark}} + \file{htexture.def}{\from{hyperref.dtx}{textures}} + \file{hdvipson.def}{\from{hyperref.dtx}{dvipsone}} + \file{hdvips.def}{\from{hyperref.dtx}{dvips}} + \file{hpdftex.def}{\from{hyperref.dtx}{pdftex,pdfform,outlines}} + %\file{hdvipdf.def}{\from{hyperref.dtx}{dvipdf,outlines}} + \file{hdviwind.def}{\from{hyperref.dtx}{dviwindo,pdfmarkbase}} + \file{htex4ht.def}{\from{hyperref.dtx}{tex4ht}} + \file{htex4ht.cfg}{\from{hyperref.dtx}{tex4htcfg}} + \file{hvtex.def}{\from{hyperref.dtx}{vtex,outlines}} + \file{hvtexhtm.def}{\from{hyperref.dtx}{vtexhtml}} + \file{hdvipdfm.def}{\from{hyperref.dtx}{dvipdfm,pdfform,outlines}} + \file{pd1enc.def}{\from{hyperref.dtx}{pd1enc}} + \file{puenc.def}{\from{hyperref.dtx}{puenc}} + \file{nohyperref.sty}{\from{hyperref.dtx}{nohyperref}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{* \space (TDS directory: texmf/tex/latex/hyperref/).} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/Master/texmf-dist/source/latex/hyperref/manual.css b/Master/texmf-dist/source/latex/hyperref/manual.css new file mode 100644 index 00000000000..4ce2a0d94c5 --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/manual.css @@ -0,0 +1,108 @@ + +/* start css.sty */ +.cmmi-10{font-style: italic;} +.cmsy-7{font-size:70%;} +.ecrm-1728{font-size:170%;} +.ecss-1728{font-size:170%; font-family: sans-serif;} +.ecrm-1200{font-size:120%;} +.ectt-1000{ font-family: monospace;} +.ecti-1000{ font-style: italic;} +.ecss-1000{ font-family: sans-serif;} +.ecbx-1000{ font-weight: bold;} +.htf-cmbx {font-weight: bold; font-style:normal;} +p.noindent { text-indent: 0em } +p.nopar { text-indent: 0em; } +p.indent{ text-indent: 1.5em } +a img { border-top: 0; border-left: 0; border-right: 0; } +center { margin-top:1em; margin-bottom:1em; } +td center { margin-top:0em; margin-bottom:0em; } +.Canvas { position:relative; } +img.math{vertical-align:middle;} +li p.indent { text-indent: 0em } +span.footnotetext{ font-size:80%; font-style:italic; } +.obeylines-h,.obeylines-v {white-space: nowrap; } +div.obeylines-v p { margin-top:0; margin-bottom:0; } +.overline{ text-decoration:overline; } +.overline img{ border-top: 1px solid black; } +td.displaylines {text-align:center; white-space:nowrap;} +.centerline {text-align:center;} +.rightline {text-align:right;} +div.verbatim {font-family: monospace; white-space: nowrap; } +span.fbox {padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } +table.minipage{width:100%;} +div.center, div.center div.center {text-align: center; margin-left:1em; margin-right:1em; margin-top:0.5em; margin-bottom:0.5em;} +div.center div {text-align: left;} +div.flushright, div.flushright div.flushright {text-align: right;} +div.flushright div {text-align: left;} +div.flushleft {text-align: left;} +.underline{ text-decoration:underline; } +.underline img{ border-bottom: 1px solid black; margin-bottom:1pt; } +.framebox-c, .framebox-l, .framebox-r { padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } +.framebox-c {text-align:center;} +.framebox-l {text-align:left;} +.framebox-r {text-align:right;} +div.array {text-align:center;} +div.tabular, div.center div.tabular {text-align: center; margin-top:0.5em; margin-bottom:0.5em;} +table.tabular td p{margin-top:0em;} +div.td00{ margin-left:0pt; margin-right:0pt; } +div.td01{ margin-left:0pt; margin-right:5pt; } +div.td10{ margin-left:5pt; margin-right:0pt; } +div.td11{ margin-left:5pt; margin-right:5pt; } +td.td00{ padding-left:0pt; padding-right:0pt; } +td.td01{ padding-left:0pt; padding-right:5pt; } +td.td10{ padding-left:5pt; padding-right:0pt; } +td.td11{ padding-left:5pt; padding-right:5pt; } +.hline hr, .cline hr{ height : 1px; } +.tabbing-right {text-align:right;} +div.newtheorem { margin-bottom: 2em; margin-top: 2em;} +span.TEX {letter-spacing: -0.125em; } +span.TEX span.E{ position:relative;top:0.5ex;left:-0.0417em;} +a span.TEX span.E {text-decoration: none; } +span.LATEX span.A{ position:relative; top:-0.5ex; left:-0.4em; font-size:85%;} +span.LATEX span.TEX{ position:relative; left: -0.4em; } +.marginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;} +.marginpar p{margin-top:0.4em; margin-bottom:0.4em;} +div.float {text-align:center;} +div.figure {text-align:center;} +.equation td{text-align:center; } +td.equation { margin-top:1em; margin-bottom:1em; } +td.eqnarray4 { width:5%; white-space: normal; } +td.eqnarray2 { width:5%; } +table.eqnarray-star, table.eqnarray {width:100%;} +div.eqnarray{text-align:center;} +div.pmatrix {text-align:center;} +span.pmatrix img{vertical-align:middle;} +div.pmatrix {text-align:center;} +img.cdots{vertical-align:middle;} +.partToc a, .partToc, .likepartToc a, .likepartToc {line-height: 200%; font-weight:bold; font-size:110%;} +.caption td.id{font-weight: bold; white-space: nowrap; } +table.caption {text-align:center;} +h1.partHead{text-align: center} +p.bibitem { text-indent: -2em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; } +p.bibitem-p { text-indent: 0em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; } +.paragraphHead, .likeparagraphHead { margin-top:2em; font-weight: bold;} +.subparagraphHead, .likesubparagraphHead { font-weight: bold;} +.quote {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; } +.verse{white-space:nowrap; margin-left:2em} +div.maketitle {text-align:center;} +h2.titleHead{text-align:center;} +div.maketitle{ margin-bottom: 2em; } +div.author, div.date {text-align:center;} +div.thanks{text-align:left; margin-left:10%; font-size:80%; font-style:italic; } +div.author{white-space: nowrap;} +.quotation {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; } +.abstract p {margin-left:5%; margin-right:5%;} +div.array {text-align:center;} +div.tabular, div.center div.tabular {text-align: center; margin-top:0.5em; margin-bottom:0.5em;} +table.tabular td p{margin-top:0em;} +div.td00{ margin-left:0pt; margin-right:0pt; } +div.td01{ margin-left:0pt; margin-right:5pt; } +div.td10{ margin-left:5pt; margin-right:0pt; } +div.td11{ margin-left:5pt; margin-right:5pt; } +td.td00{ padding-left:0pt; padding-right:0pt; } +td.td01{ padding-left:0pt; padding-right:5pt; } +td.td10{ padding-left:5pt; padding-right:0pt; } +td.td11{ padding-left:5pt; padding-right:5pt; } +.hline hr, .cline hr{ height : 1px; } +div.longtable{text-align:center;} +/* end css.sty */ diff --git a/Master/texmf-dist/source/latex/hyperref/nameref.dtx b/Master/texmf-dist/source/latex/hyperref/nameref.dtx new file mode 100644 index 00000000000..e2c7445b00f --- /dev/null +++ b/Master/texmf-dist/source/latex/hyperref/nameref.dtx @@ -0,0 +1,426 @@ +\def\filedate{2003/12/03} +\def\fileversion{2.21} +% +% \iffalse +% File: nameref.dtx +% Copyright (C) 1995-9 Sebastian Rahtz +% 2000-3 Sebastian Rahtz, Heiko Oberdiek +% +%% This file is part of the `Hyperref Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% The list of all files belonging to the `Hyperref Bundle' is +%% given in the file `manifest.txt'. +%<*driver> +\documentclass{ltxdoc} +\begin{document} + \title{% + Section name references in \LaTeX + \thanks{% + This file has version number \fileversion, + last revised \filedate.% + }% + } + \author{Sebastian Rahtz} + \date{\filedate} + \maketitle + \tableofcontents + \DocInput{nameref.dtx} +\end{document} +% +% \fi +% \CheckSum{463} +% \StopEventually{} +% \section{Introduction} +% Cross-referencing to include the \emph{name} of the section, rather than +% just the number or page. This works by redefining some of the inside +% \LaTeX\ macros, so it is vulnerable to future changes. +% \section{History} +% Sebastian Rahtz, for Lou Burnard, March 15th 1994; +% SPQR CERN July 1994; +% Last mod. Sept. 3th MG; +% Sept. 19th SPQR; +% April 11th 1995 SPQR (added section formatting hook); +% April 14th 1995 SPQR (compatibility with hyperref); +% June 22 1995 SPQR (removed typeout from Sectionformat); +% September 22 1997 added varioref hacks by Corey Minyard; +% September 28th changes by David Carlisle. +% \begin{macrocode} +%<*package> +\ProvidesPackage{nameref}[\filedate\space v\fileversion + \space Cross-referencing by name of section] +% \end{macrocode} +% +% We redefine |\label| so that it also writes the name of the +% current section to the .aux file; if the name ends in a dot, +% we zap it. To allow for the hyperref package, also write +% fourth and fifth fields (empty by default; +% used for cross-ref name, and file). +% \begin{macrocode} +\def\strip@period#1.\relax#2\@@@{#1} +% \end{macrocode} +% +% Here is tested, whether package showkeys is loaded. +% But if option final is used, the macros of showkeys +% are not defined, so we have to check an additional +% test. +% \begin{macrocode} +\newif\ifNR@showkeys +\NR@showkeysfalse +\@ifpackageloaded{showkeys}{% + \begingroup + \@ifundefined{SK@@label}{% + }{% + \global\NR@showkeystrue + }% + \endgroup +}{} +% \end{macrocode} +% \begin{macrocode} +\def\label#1{% + \@bsphack + \begingroup + \let\label\@gobble + \def\ref{\protect\ref}% + \edef\@currentlabstr{% + \expandafter\strip@prefix\meaning\@currentlabelname + }% + \protected@write\@auxout{}{% + \string\newlabel{#1}{% + {\@currentlabel}% + {\thepage}% + {\expandafter\strip@period\@currentlabstr\relax.\relax\@@@}% + {\@currentHref}{}% + }% + }% + \endgroup + \@esphack +}% +\ifNR@showkeys + \def\label#1{% + \@bsphack + \SK@\SK@@label{#1}% + \begingroup + \let\label\@gobble + \def\ref{\protect\ref}% + \edef\@currentlabstr{% + \expandafter\strip@prefix\meaning\@currentlabelname + }% + \protected@write\@auxout{}{% + \string\newlabel{#1}{% + {\@currentlabel}% + {\thepage}% + {\expandafter\strip@period\@currentlabstr\relax.\relax\@@@}% + {\@currentHref}{}% + }% + }% + \endgroup + \@esphack + }% +\fi +% \end{macrocode} +% \begin{macrocode} +\let\ltx@label\label +% \end{macrocode} +% Needed for the \emph{subeqnarray} package. +% \begin{macrocode} +\@ifundefined{slabel}{}{% + \def\slabel#1{% + \@bsphack + \if@filesw + {% + \let\label\@gobble + \def\ref{\protect\ref}% + \edef\@currentlabstr{% + \expandafter\strip@prefix\meaning\@currentlabelname + }% + \let\thepage\relax + \def\protect{\noexpand\noexpand\noexpand}% + \edef\@tempa{% + \write\@auxout{% + \string\newlabel{#1}{% + {\thesubequation}% + {\thepage}% + {\expandafter\strip@period + \@currentlabstr\relax.\relax\@@@}% + {\@currentHref}{}% + }% + }% + }% + \expandafter + }% + \@tempa + \if@nobreak\ifvmode\nobreak\fi\fi + \fi + \@esphack + }% +} +% \end{macrocode} +% Overload an AMS \LaTeX\ command, which uses |\newlabel|. Sigh! +% \begin{macrocode} +\def\@writetocindents@{% + \begingroup + \@for\@tempa:=-1,0,1,2,3\do{% + \immediate\write\@auxout{% + \string\newlabel{tocindent\@tempa}{% + \csname r@tocindent\@tempa\endcsname{}{}{}{}% + }% + }% + }% + \endgroup} +% \end{macrocode} +% Add to the underlying section heading macros so that they +% note the section name for use by label. +% +% If a section heading or the like has a |\label| in it, +% we need to extract it, or subsequent processing breaks. +% This is done by the label-writing routine. +% +% First the numbered sections. While we are about it, put in +% a useful section formatting macro. +% \begin{macrocode} +\let\NR@sect\@sect +\newcounter{section@level} +\def\@sect#1#2#3#4#5#6[#7]#8{% + \setcounter{section@level}{#2}% + \def\@currentlabelname{#7}% + \NR@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{\Sectionformat{#8}{#2}}% +} +% \end{macrocode} +% and now the unnumbered ones +% \begin{macrocode} +\let\NR@ssect\@ssect +\def\@ssect#1#2#3#4#5{% + \def\@currentlabelname{#5}% + \NR@ssect{#1}{#2}{#3}{#4}{\Sectionformat{#5}{#1}}% +} +% \end{macrocode} +% +% Parts and chapters are treated differently. sigh. +% +% \begin{macrocode} +\let\NR@part\@part +\def\@part[#1]#2{% + \def\@currentlabelname{#1}% + \NR@part[{#1}]{#2}% +} +\let\NR@chapter\@chapter +\def\@chapter[#1]#2{% + \def\@currentlabelname{#1}% + \NR@chapter[{#1}]{#2}% +} +\let\NR@schapter\@schapter +\def\@schapter#1{% + \def\@currentlabelname{#1}% + \NR@schapter{#1}% +} +% \end{macrocode} +% +% Compatibility for package titlesec. +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{titlesec}{% + \let\NRorg@ttl@sect@i\ttl@sect@i + \def\ttl@sect@i#1#2[#3]#4{% + \def\@currentlabelname{#4}% + \NRorg@ttl@sect@i{#1}{#2}[{#3}]{#4}% + }% + }{}% +} +% \end{macrocode} +% +% We default the label and hypertext reference to be empty. +% \begin{macrocode} +\def\@currentlabelname{} +\def\@currentHref{} +% \end{macrocode} +% Since the second part of the preserved reference now has five parts +% (number, page, name, hypertext reference and file), we need extra utility +% macros: +% \begin{macrocode} +\long\def\@firstoffive#1#2#3#4#5{#1} +\long\def\@secondoffive#1#2#3#4#5{#2} +\long\def\@thirdoffive#1#2#3#4#5{#3} +\long\def\@fourthoffive#1#2#3#4#5{#4} +\long\def\@fifthoffive#1#2#3#4#5{#5} +% \end{macrocode} +% We have to redefine |\ref| and |\pageref| to know about extra +% reference elements. Make them robust, and compatible with Babel. +% The Babel switch is mimicked if not already defined. +% Some support for package |showkeys| is implemented. If +% option |notref| of that package is set, |\SK@ref| has the +% meaning of |\@empty|. +% \begin{macrocode} +\providecommand*\@safe@activestrue{}% +\providecommand*\@safe@activesfalse{}% +\def\T@ref#1{% + \@safe@activestrue + \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}% + \@safe@activesfalse +}% +\def\T@pageref#1{% + \@safe@activestrue + \expandafter\@setref\csname r@#1\endcsname\@secondoffive{#1}% + \@safe@activesfalse +}% +\ifNR@showkeys + \ifx\SK@ref\@empty + \else + \def\T@ref#1{% + \@safe@activestrue + \SK@\SK@@ref{#1}% + \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}% + \@safe@activesfalse + }% + \def\T@pageref#1{% + \@safe@activestrue + \SK@\SK@@ref{#1}% + \expandafter\@setref\csname r@#1\endcsname\@secondoffive{#1}% + \@safe@activesfalse + }% + \fi +\fi +% \end{macrocode} +% Package |hyperref| uses its own definitions of |\ref| and +% |\pageref| because it extends the syntax by the star form. +% |\DeclareRobustCommand| is used by hyperref. +% Package |nameref| can be loaded before, after hyperref or after +% hyperref's definitions in |\AtBeginDocument|. +% \begin{macrocode} +\@ifpackageloaded{hyperref}{% +}{% + \DeclareRobustCommand{\ref}{\T@ref}% + \DeclareRobustCommand{\pageref}{\T@pageref}% +} +% \end{macrocode} +% \section{Usage and frontend} +% Access the (third) name part with |\nameref|; +% \begin{macrocode} +\def\T@nameref#1{% + \@safe@activestrue + \expandafter\@setref\csname r@#1\endcsname\@thirdoffive{#1}% + \@safe@activesfalse +}% +\ifNR@showkeys + \ifx\SK@ref\@empty + \else + \def\T@nameref#1{% + \@safe@activestrue + \SK@\SK@@ref{#1}% + \expandafter\@setref\csname r@#1\endcsname\@thirdoffive{#1}% + \@safe@activesfalse + }% + \fi +\fi +\def\nameref{\protect\T@nameref} +% \end{macrocode} +% An extended form which gives title and page number. +% \begin{macrocode} +\def\Nameref#1{`\nameref{#1}' on page~\pageref{#1}} +% \end{macrocode} +% +% The default for |\Sectionformat| +% \begin{macrocode} +\providecommand\Sectionformat[2]{#1} +% \end{macrocode} +% \subsection{Compatibility with varioref} +% [This section was derived by Corey Minyard \texttt{minyard@acm.org} +% from the varioref package] +% \begin{macrocode} +\ifx\csname @@vpageref\endcsname\relax +\else + \def\@@vpageref#1[#2]#3{% + \leavevmode\unskip + \global\advance\c@vrcnt\@ne + \@ifundefined{r@\the\c@vrcnt @vr}% + {\@namedef{r@\the\c@vrcnt @vr}{{??}{??}{??}{??}{??}}}{}% + \edef\@tempa{% + \expandafter\expandafter\expandafter + \@secondoffive\csname r@\the\c@vrcnt @vr\endcsname + }% + \@ifundefined{r@\the\c@vrcnt @xvr}% + {\@namedef{r@\the\c@vrcnt @xvr}{{??}{??}{??}{??}{??}}}{}% + \edef\@tempb{% + \expandafter\expandafter\expandafter + \@secondoffive\csname r@\the\c@vrcnt @xvr\endcsname + }% + {% + \let\@currentlabel\@empty + \expandafter\label\expandafter{\the\c@vrcnt @xvr}% + }% + \ifx\@tempa\@tempb + \else + \vref@err{% + \noexpand\vref at page boundary + \@tempb-\@tempa\space (may loop)% + }% + \fi + \@ifundefined{r@#3}{\@namedef{r@#3}{{??}{??}{??}{??}{??}}}{}% + \edef\@tempb{% + \expandafter\expandafter\expandafter + \@secondoffive\csname r@#3\endcsname + }% + \space + \ifx\@tempa\@tempb + #1% + \else + #2% + \is@pos@number\@tempb{% + \is@pos@number\@tempa{% + \@tempcnta\@tempa + \advance\@tempcnta\@ne + }{% + \@tempcnta\maxdimen + }% + \ifnum \@tempb =\@tempcnta + \ifodd\@tempcnta + \if@twoside + \reftextfaceafter + \else + \reftextafter + \fi + \else + \reftextafter + \fi + \else + \advance\@tempcnta-2 + \ifnum \@tempb =\@tempcnta + \ifodd\@tempcnta + \reftextbefore + \else + \if@twoside + \reftextfacebefore + \else + \reftextbefore + \fi + \fi + \else + \reftextfaraway{#3}% + \fi + \fi + }{% + \reftextfaraway{#3}% + }% + \fi + {% + \let\@currentlabel\@empty + \expandafter\label\expandafter{\the\c@vrcnt @vr}% + }% + }% + \DeclareRobustCommand\vnameref[1]{% + \unskip~\nameref{#1}% + \@vpageref[\unskip]{#1}% + } +\fi +% +% \end{macrocode} +% +% \Finale +\endinput -- cgit v1.2.3