]> AND Private Git Repository - these_qian.git/blob - tlhypref.sty
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Import initial
[these_qian.git] / tlhypref.sty
1 %
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.
7 %
8 % Versions:
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 
16 %
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}}
23 \ProcessOptions
24 \RequirePackage{hyperref}
25
26 % We cancel modifications from hyperref (in hpdftex.def and pdftex.def).
27
28 \let\@sect\H@old@sect
29 \let\@schapter\H@old@schapter
30 \let\@spart\H@old@spart   
31
32 \let\refstepcounter\H@refstepcounter
33
34 % Now, \@part, \@chapter, \@sect and \refstepcounter have the good values
35 % of thloria.
36
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}
42
43 % These definitions are for the purpose of comparisons in \refstepcounter:
44 \def\@partcountername{part}
45 \def\@chaptercountername{chapter}
46 \def\@annexcountername{annex}
47
48 % \refstepcounter is redefined so that \@currentHref is uptodate
49 % in each chapter, section, etc.
50 \def\refstepcounter#1{%
51   \H@refstepcounter{#1}%
52   \edef\This@name{#1}%
53   \ifx\This@name\name@of@slide
54   \else
55     \if@skiphyperref
56     \else
57       \if@hyper@item
58         \stepcounter{Item}%
59         \hyper@refstepcounter{Item}%
60       \else
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
66         \else
67           \ifx\@countername\@chaptercountername
68           \else
69             \ifx\@countername\@annexcountername
70             \else
71               \hyper@refstepcounter{#1}%
72             \fi
73           \fi
74         \fi
75       \fi
76     \fi
77   \fi
78 }
79
80
81 % We add \hyper@refstepcounter{division} to the division counter hook
82
83 \let\@old@division@inc@hook\@division@inc@hook
84 \renewcommand{\@division@inc@hook}{%
85   \@old@division@inc@hook
86   \hyper@refstepcounter{division}
87   }
88
89 \newcommand\theHdivision  {\arabic{division}}
90 \renewcommand\theHfigure  {\theHdivision.\arabic{figure}}
91 \renewcommand\theHtable   {\theHdivision.\arabic{table}}
92 \renewcommand\theHsection {\theHdivision.\arabic{section}}
93
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(*).
97
98 \newif\if@top@bookm@rk
99 \@top@bookm@rkfalse
100 \newcommand{\TLtopbookmark}{\@top@bookm@rktrue}
101
102 % We input the file \jobname.flg in order to get the value of
103 % `@there@were@p@rts':
104 \InputIfFileExists{\jobname.flg}{}{}%
105
106 % Numerical equivalent of `@there@were@p@rts':
107
108 \if@there@were@p@rts
109   \newcommand{\TL@topbookmarkpos}{-1}
110 \else
111   \newcommand{\TL@topbookmarkpos}{0}
112 \fi
113
114 \newcommand{\TL@bookmarkpos}{0}
115
116 % needed by \addcontentsline :
117 \newcommand{\toclevel@tlstarchapter}{0}
118 \newcommand{\toclevel@starpart}{-1}
119 \newcommand{\toclevel@spsection}{\TL@topbookmarkpos}
120
121 % Changes of various hooks in thloria:
122
123 \renewcommand{\@tlann@hook}[1]{%
124   \@division@inc@hook
125   \if@top@bookm@rk
126     \renewcommand{\toclevel@tlstarchapter}{\TL@topbookmarkpos}
127   \fi
128   }
129
130 \renewcommand{\@tlann@lasthook}[1]{\renewcommand{\toclevel@tlstarchapter}{0}}
131
132 \renewcommand\@generic@schapter@hook[2]{%
133   \if@top@bookm@rk
134     \renewcommand{\toclevel@tlstarchapter}{\TL@topbookmarkpos}%
135   \fi
136   }
137
138 \renewcommand\@generic@schapter@lasthook[2]{%
139   \renewcommand{\toclevel@tlstarchapter}{0}%
140   }
141
142 \renewcommand\@generic@chapter@hook[3]{%
143     \@generic@schapter@hook{#1}{#2}%
144   }
145
146 \renewcommand\@generic@chapter@lasthook[3]{%
147     \@generic@schapter@lasthook{#1}{#2}%
148   }
149
150 \renewcommand{\@acknowledgment@hook}{%
151      \@division@inc@hook
152      \pdfbookmark[\TL@topbookmarkpos]{\AcknowledgmentName}%
153               {acknowledgment.\theHdivision}%
154   }
155 \newcommand{\DedicationName}{D\'edicace}
156 \renewcommand{\@dedication@hook}{%
157    \@division@inc@hook
158    \pdfbookmark[\TL@topbookmarkpos]{\DedicationName}{dedication.\theHdivision}%
159   }
160
161 \renewcommand{\@abstract@hook}[1]{%
162    \@division@inc@hook
163    \pdfbookmark[\TL@topbookmarkpos]{#1}{abstract.\theHdivision}%
164   }
165
166 \newcommand{\CoverName}{Couverture}
167 \renewcommand{\@cover@hook}{%
168    \@division@inc@hook
169    \pdfbookmark[\TL@topbookmarkpos]{\CoverName}{cover.\theHdivision}%
170   }
171
172 \renewcommand{\@toc@hook}{%
173    \pdfbookmark[\TL@topbookmarkpos]{\contentsname}{}%
174   }
175
176 \endinput
177 % end of file tlhypref.sty
178