2 % This package complements the thloria class and is aimed to replace
3 % the hyperref package in this context. The hyperref package does not
4 % address the intricacies of thloria and this is what we are doing here.
5 % This package load hyperref and passes its options so that one can write
6 % \usepackage[pdftex]{tlhypref} or whatever.
9 % 0.92 (1999/04/08): added a fourth parameter to \@writetorep to make it
10 % again compatible with hyperref.sty.
11 % Needs hyperref 6.53 or later.
12 % 0.93 (1999/07/13): again compatible with hyperref 6.63;
13 % use of higher-level commands.
14 % \TLpdfbookmark removed (use \texorpdfstring)
15 % 0.94 (1999/07/15): \@toc@hook added
17 \def\fileversion{0.94}
18 \def\filedate{1999/07/15}
19 \NeedsTeXFormat{LaTeX2e}
20 \ProvidesPackage{tlhypref}[\filedate\space\fileversion\space
21 thloria wrapper for hyperref package (D. Roegel)]
22 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{hyperref}}
24 \RequirePackage{hyperref}
26 % We cancel modifications from hyperref (in hpdftex.def and pdftex.def).
29 \let\@schapter\H@old@schapter
30 \let\@spart\H@old@spart
32 \let\refstepcounter\H@refstepcounter
34 % Now, \@part, \@chapter, \@sect and \refstepcounter have the good values
37 % Addition of \TLtopbookmark in front of \tableofcontents
38 % in order to make sure that the bookmark entry for the table of contents
39 % is at the top level. Works with the chapter hook.
40 \let\@old@tableofcontents\tableofcontents
41 \def\tableofcontents{\TLtopbookmark\@old@tableofcontents}
43 % These definitions are for the purpose of comparisons in \refstepcounter:
44 \def\@partcountername{part}
45 \def\@chaptercountername{chapter}
46 \def\@annexcountername{annex}
48 % \refstepcounter is redefined so that \@currentHref is uptodate
49 % in each chapter, section, etc.
50 \def\refstepcounter#1{%
51 \H@refstepcounter{#1}%
53 \ifx\This@name\name@of@slide
59 \hyper@refstepcounter{Item}%
61 % \hyper@refstepcounter is only performed when it is neither a part,
62 % nor a chapter/annex; the \hyper@refstepcounter is done
63 % in the hook of thloria with \hyper@refstepcounter{division}.
64 \def\@countername{#1}%
65 \ifx\@countername\@partcountername
67 \ifx\@countername\@chaptercountername
69 \ifx\@countername\@annexcountername
71 \hyper@refstepcounter{#1}%
81 % We add \hyper@refstepcounter{division} to the division counter hook
83 \let\@old@division@inc@hook\@division@inc@hook
84 \renewcommand{\@division@inc@hook}{%
85 \@old@division@inc@hook
86 \hyper@refstepcounter{division}
89 \newcommand\theHdivision {\arabic{division}}
90 \renewcommand\theHfigure {\theHdivision.\arabic{figure}}
91 \renewcommand\theHtable {\theHdivision.\arabic{table}}
92 \renewcommand\theHsection {\theHdivision.\arabic{section}}
94 % This boolean forces a bookmark to be at the topmost level;
95 % it is only taken into account at the level of chapters (\chapter & \chapter*)
96 % and it will thus act on the next \chapter(*).
98 \newif\if@top@bookm@rk
100 \newcommand{\TLtopbookmark}{\@top@bookm@rktrue}
102 % We input the file \jobname.flg in order to get the value of
103 % `@there@were@p@rts':
104 \InputIfFileExists{\jobname.flg}{}{}%
106 % Numerical equivalent of `@there@were@p@rts':
109 \newcommand{\TL@topbookmarkpos}{-1}
111 \newcommand{\TL@topbookmarkpos}{0}
114 \newcommand{\TL@bookmarkpos}{0}
116 % needed by \addcontentsline :
117 \newcommand{\toclevel@tlstarchapter}{0}
118 \newcommand{\toclevel@starpart}{-1}
119 \newcommand{\toclevel@spsection}{\TL@topbookmarkpos}
121 % Changes of various hooks in thloria:
123 \renewcommand{\@tlann@hook}[1]{%
126 \renewcommand{\toclevel@tlstarchapter}{\TL@topbookmarkpos}
130 \renewcommand{\@tlann@lasthook}[1]{\renewcommand{\toclevel@tlstarchapter}{0}}
132 \renewcommand\@generic@schapter@hook[2]{%
134 \renewcommand{\toclevel@tlstarchapter}{\TL@topbookmarkpos}%
138 \renewcommand\@generic@schapter@lasthook[2]{%
139 \renewcommand{\toclevel@tlstarchapter}{0}%
142 \renewcommand\@generic@chapter@hook[3]{%
143 \@generic@schapter@hook{#1}{#2}%
146 \renewcommand\@generic@chapter@lasthook[3]{%
147 \@generic@schapter@lasthook{#1}{#2}%
150 \renewcommand{\@acknowledgment@hook}{%
152 \pdfbookmark[\TL@topbookmarkpos]{\AcknowledgmentName}%
153 {acknowledgment.\theHdivision}%
155 \newcommand{\DedicationName}{D\'edicace}
156 \renewcommand{\@dedication@hook}{%
158 \pdfbookmark[\TL@topbookmarkpos]{\DedicationName}{dedication.\theHdivision}%
161 \renewcommand{\@abstract@hook}[1]{%
163 \pdfbookmark[\TL@topbookmarkpos]{#1}{abstract.\theHdivision}%
166 \newcommand{\CoverName}{Couverture}
167 \renewcommand{\@cover@hook}{%
169 \pdfbookmark[\TL@topbookmarkpos]{\CoverName}{cover.\theHdivision}%
172 \renewcommand{\@toc@hook}{%
173 \pdfbookmark[\TL@topbookmarkpos]{\contentsname}{}%
177 % end of file tlhypref.sty