diff options
author | Karl Berry <karl@freefriends.org> | 2006-08-27 22:38:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-08-27 22:38:54 +0000 |
commit | 2607d53137ede06e9780342b225218743e100bb4 (patch) | |
tree | c6c88c805dd21a5bbb6ad6f26d3d53c517f4b866 /Master/texmf-dist/tex/latex/oberdiek/hypdoc.sty | |
parent | fb0d58de45c0fc32bab09a839c186de46f75628e (diff) |
oberdiek update from tds zip (28aug06)
git-svn-id: svn://tug.org/texlive/trunk@2054 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/oberdiek/hypdoc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/oberdiek/hypdoc.sty | 495 |
1 files changed, 495 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/oberdiek/hypdoc.sty b/Master/texmf-dist/tex/latex/oberdiek/hypdoc.sty new file mode 100644 index 00000000000..2bcb1b5fd6a --- /dev/null +++ b/Master/texmf-dist/tex/latex/oberdiek/hypdoc.sty @@ -0,0 +1,495 @@ +%% +%% This is file `hypdoc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% hypdoc.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2002, 2006 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 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.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Heiko Oberdiek. +%% +%% This work consists of the main source file hypdoc.dtx +%% and the derived files +%% hypdoc.sty, hypdoc.pdf, hypdoc.ins, hypdoc.drv. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{hypdoc}% + [2006/06/02 v1.4 Hyper extensions for doc.sty (HO)] +\newif\ifHD@numbered +\DeclareOption{numbered}{\HD@numberedtrue} +\ProcessOptions*\relax + +\RequirePackage{doc} + +\ifx\numexpr\@undefined + \RequirePackage{calc} +\fi +\RequirePackage[% + hyperindex=false,% + pdfusetitle,% + colorlinks,% + pdfpagelabels,% +]{hyperref}[2002/05/09]% +\hypersetup{% + plainpages=false,% + bookmarksopen,% + bookmarksnumbered,% + bookmarksopenlevel=0,% + pdfstartview={FitBH \hypercalcbp{% + \paperheight-\topmargin-1in-\headheight-\headsep + }},% +} +\RequirePackage{thumbpdf} + +\newcounter{HD@unique} +\renewcommand{\theHD@unique}{% + \number\value{HD@unique}% +} + +\g@addto@macro\Hy@UseMaketitleInfos{% + \@ifundefined{fileinfo}{}{% + \ifx\@pdfsubject\@empty + \hypersetup{pdfsubject={\fileinfo}}% + \fi + }% +} + +\pdfstringdefDisableCommands{% + \let\thanks\@gobble + \let\footnote\@gobble + \def\cs#1{\textbackslash #1}% + \let\normalfont\@empty + \let\scshape\@empty + \def\and{and }% +} + +%%% Bookmarks + +\def\HD@sectionpatch{% + \ifHD@numbered + \HD@@sectionpatch{section}% + \HD@@sectionpatch{chapter}% + \else + \let\Hy@writebookmark\HD@disable@writebookmark + \fi +} +\def\HD@@sectionpatch#1{% + \expandafter\let\csname HDorg@@#1\expandafter\endcsname + \csname #1\endcsname + \@namedef{#1}{% + \@ifstar{\@nameuse{HDorg@@#1}}{\@nameuse{HDorg@@#1}}% + }% +} +\def\HD@disable@writebookmark#1#2#3#4#5{} + +\def\HD@guesstoclevel#1{% + \expandafter\HD@@guesstoclevel#1\section\HD@end +} +\def\HD@@guesstoclevel#1#2\HD@end{% + \@ifundefined{toclevel@\expandafter\@gobble\string#1\@empty}{% + 1% + }{% + \@nameuse{toclevel@\expandafter\@gobble\string#1\@empty}% + }% +} + +\let\HDorg@tableofcontents\tableofcontents +\def\tableofcontents{% + % As first section the table of contents shouldn't + % go into the toc itself. Also a number looks too funny then. + % Just a bookmark is enough in this case. + \begingroup + \@ifundefined{c@section}{% + \def\c@section{0}% + }{}% + \expandafter\endgroup + \ifcase\c@section + \stepcounter{HD@unique}% + \pdfbookmark[\HD@guesstoclevel{\HDorg@tableofcontents}] + {\contentsname}{toc\theHD@unique}% + \HDorg@tableofcontents + \else + \ifHD@numbered + \else + \stepcounter{HD@unique}% + \pdfbookmark[\HD@guesstoclevel{\HDorg@tableofcontents}] + {\contentsname}{toc\theHD@unique}% + \fi + \begingroup + \HD@sectionpatch + \HDorg@tableofcontents + \endgroup + \fi +} + +\let\HDorg@listoffigures\listoffigures +\def\listoffigures{% + \ifHD@numbered + \else + \stepcounter{HD@unique}% + \pdfbookmark[\HD@guesstoclevel{\HDorg@listoffigures}] + {\contentsname}{toc\theHd@unique}% + \fi + \begingroup + \HD@sectionpatch + \HDorg@listoffigures + \endgroup +} + +\let\HDorg@listoftables\listoftables +\def\listoftables{% + \ifHD@numbered + \else + \stepcounter{HD@unique}% + \pdfbookmark[\HD@guesstoclevel{\HDorg@listoftables}] + {\contentsname}{toc\theHD@unique}% + \fi + \begingroup + \HD@sectionpatch + \HDorg@listoftables + \endgroup +} + +\let\HDorg@thebibliography\thebibliography +\def\thebibliography{% + \ifHD@numbered + \else + \stepcounter{HD@unique}% + \pdfbookmark[\HD@guesstoclevel{\HDorg@thebibliography}] + {\@ifundefined{chapter}{\refname}{\bibname}}{bib\theHD@unique}% + \fi + \HD@sectionpatch + \HDorg@thebibliography +} + +\let\HDorg@theindex\theindex +\def\theindex{% + \let\HDorg@index@prologue\index@prologue + \let\HDorg@writebookmark\Hy@writebookmark + \HD@sectionpatch + \g@addto@macro\IndexParms{% + \ifHD@numbered + \else + \let\Hy@writebookmark\HDorg@writebookmark + \fi + \let\bfseries\HD@bfseries + }% + \edef\HD@toclevel@index{\HD@guesstoclevel{\index@prologue}}% + \begingroup + \count@=\HD@toclevel@index\relax + \advance\count@ by 1 % + \xdef\HD@toclevel@subindex{\the\count@}% + \endgroup + \def\index@prologue{% + \ifHD@numbered + \else + \begingroup + \stepcounter{HD@unique}% + \let\Hy@writebookmark\HDorg@writebookmark + \pdfbookmark[\HD@toclevel@index]% + {\indexname}{index\theHD@unique}% + \endgroup + \fi + \HDorg@index@prologue + }% + \HDorg@theindex +} +\let\HDorg@bfseries\bfseries +\def\HD@bfseries{\futurelet\HD@hfil\HD@@bfseries}% +\def\HD@@bfseries{% + \HDorg@bfseries + \ifx\HD@hfil\hfil + \expandafter\HD@@@bfseries + \fi +}% +\def\HD@@@bfseries\hfil#1\hfil{% + \ifx\\#1\\% + \else + \raisebox{\baselineskip}[0pt]{% + \kern-\HD@margin\relax + \pdfbookmark[\HD@toclevel@subindex]{#1}{HD.#1}% + \kern\HD@margin\relax + }% + \fi + \hfil#1\hfil +}% +\def\HD@margin{1mm} + +\let\HDorg@theglossary\theglossary +\def\theglossary{% + \let\HDorg@glossary@prologue\glossary@prologue + \let\HDorg@writebookmark\Hy@writebookmark + \HD@sectionpatch + \def\glossary@prologue{% + \ifHD@numbered + \else + \begingroup + \let\Hy@writebookmark\HDorg@writebookmark + \stepcounter{HD@unique}% + \pdfbookmark[\HD@guesstoclevel{\HDorg@glossary@prologue}] + {\glossaryname}{glossary\theHD@unique}% + \endgroup + \fi + \HDorg@glossary@prologue + }% + \HDorg@theglossary +} +\providecommand*{\glossaryname}{Change History} + +%%% Index stuff + +\newcounter{HD@hypercount} +\newlength{\HD@helplength} +\newif\ifHD@savedest +\HD@savedesttrue +\AtBeginDocument{% + \HD@savedest@init +} +\begingroup + \catcode`\^^M=\active +\@firstofone{\endgroup + \def\HD@savedest@init{% + \ifHD@savedest + \let\HDorg@tilde~% + \let~\HD@savedest@entry + \edef\HDorg@catcodeM{\the\catcode`\^^M}% + \catcode`\^^M=\active + \def^^M{}% + \InputIfFileExists{\jobname.hd}{}{}% + \let~\HDorg@tilde + \catcode`\^^M=\HDorg@catcodeM\relax + \newwrite\HD@savedest@out + \immediate\openout\HD@savedest@out=\jobname.hd\relax + \AtEndDocument{\immediate\closeout\HD@savedest@out}% + \else + \let\HD@savedest@add\@gobble + \fi + }% + \def\HD@savedest@entry#1^^M{% + \@namedef{HD.#1}{}% + }% +} +\def\HD@savedest@add#1{% + \immediate\write\HD@savedest@out{\string~#1}% +} + +\newif\ifHD@targetraise +\HD@targetraisetrue + +\def\HD@target{% + \ifHD@targetraise + \ifhmode + \settoheight{\HD@helplength}{[H]}% + \addtolength{\HD@helplength}{0.4ex}% + \raisebox{\HD@helplength}{% + \HD@maketarget + }% + \else + \HD@maketarget + \fi + \else + \HD@maketarget + \fi +} +\def\HD@maketarget{% + \stepcounter{HD@hypercount}% + \def\HD@next{% + \llap{\hypertarget{HD.\the\c@HD@hypercount}{}\,}% + }% + \ifHD@savedest + \expandafter\ifx\csname HD.\the\c@HD@hypercount\endcsname\@empty + \else + \let\HD@next\relax + \fi + \fi + \HD@next +} + +\g@addto@macro\CodelineIndex{% + \let\special@index\HD@codeline@wrindex +} +\g@addto@macro\PageIndex{% + \let\special@index\HD@page@wrindex +} + +\def\HD@codeline@wrindex#1{% + \begingroup + \let\HDorg@encapchar\encapchar + \def\encapchar##1\encapchar##2\@nil{% + \HDorg@encapchar + hdclindex{\the\c@HD@hypercount}{##1}% + }% + \codeline@wrindex{% + #1\encapchar\encapchar\@nil + }% + \endgroup +} +\def\HD@page@wrindex#1{% + \begingroup + \let\HDorg@encapchar\encapchar + \def\encapchar##1\encapchar##2\@nil{% + \HDorg@encapchar + hdpindex{##1}% + }% + \HDorg@index{#1\encapchar\encapchar\@nil}% + \endgroup +} + +\def\hdclindex#1#2#3{% + \csname\ifx\\#2\\relax\else#2\fi\endcsname{% + \hyperlink{HD.#1}{#3}% + \HD@savedest@add{#1}% + }% +} +\def\hdpindex#1#2{% + \csname\ifx\\#1\\relax\else#1\fi\endcsname{% + \hyperpage{#2}% + }% +} + +\let\HDorg@PrintDescribeMacro\PrintDescribeMacro +\renewcommand\PrintDescribeMacro[1]{% + \begingroup + \let\HDorg@MacroFont\MacroFont + \def\MacroFont{% + \HD@target + \HDorg@MacroFont + }% + \HDorg@PrintDescribeMacro{#1}% + \endgroup +} + +\let\HDorg@PrintMacroName\PrintMacroName +\renewcommand\PrintMacroName[1]{% + \begingroup + \let\HDorg@MacroFont\MacroFont + \def\MacroFont{% + \HD@target + \HDorg@MacroFont + }% + \HDorg@PrintMacroName{#1}% + \endgroup +} + +\let\HDorg@theCodelineNo\theCodelineNo +\renewcommand*\theCodelineNo{% + \settowidth{\HD@helplength}{\HDorg@theCodelineNo\ }% + \ifdim\HD@helplength<\MacroIndent + \addtolength{\HD@helplength}{-\MacroIndent}% + \llap{% + \begingroup\HD@target\endgroup + \hspace*{-\HD@helplength}% + }% + \else + \HD@target + \fi + \HDorg@theCodelineNo +} + +\AtBeginDocument{% + \let\HDorg@index\index +} + +\let\HDorg@SpecialUsageIndex\SpecialUsageIndex +\renewcommand*\SpecialUsageIndex[1]{% + \@bsphack + \begingroup + \HD@target + \let\index\HDorg@index + \let\HDorg@encapchar\encapchar + \edef\encapchar usage{% + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% + }% + \HDorg@SpecialUsageIndex{#1}% + \endgroup + \@esphack +} + +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname autoindex\endcsname\relax +\else + \let\HDorg@autoindex\autoindex + \renewcommand*\autoindex[1]{% + \@bsphack + \begingroup + \HD@target + \let\index\HDorg@index + \let\HDorg@encapchar\encapchar + \edef\encapchar usage{% + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% + }% + \HDorg@autoindex{#1}% + \endgroup + \@esphack + } +\fi + +\let\HDorg@SpecialEnvIndex\SpecialEnvIndex +\renewcommand*\SpecialEnvIndex[1]{% + \@bsphack + \begingroup + \HD@target + \let\HDorg@encapchar\encapchar + \edef\encapchar usage{% + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% + }% + \HDorg@SpecialEnvIndex{#1}% + \endgroup + \@esphack +} + +\let\HDorg@SortIndex\SortIndex +\renewcommand*{\SortIndex}[2]{% + \@bsphack + \begingroup + \let\index\HD@page@wrindex + \HDorg@SortIndex{#1}{#2}% + \endgroup + \@esphack +} + +%%% glossary stuff + +\let\HDorg@wrglossary\@wrglossary +\def\@wrglossary#1{% + \let\HDorg@encapchar\encapchar + \def\encapchar##1\encapchar##2\@nil{% + \HDorg@encapchar + hdpindex{##1}% + }% + \HDorg@wrglossary{#1\encapchar\encapchar\@nil}% +} + +%%% \MacroIndent automatically calculated + +\AtEndDocument{% + \if@filesw + \immediate\write\@auxout{% + \noexpand\HD@SetMacroIndent{\number\value{CodelineNo}}% + }% + \fi +} +\def\HD@SetMacroIndent#1{% + \begingroup + \value{CodelineNo}=#1\relax + \settowidth{\MacroIndent}{\HDorg@theCodelineNo\ }% + \global\MacroIndent\MacroIndent + \endgroup +} +\endinput +%% +%% End of file `hypdoc.sty'. |