blob: 72a4e2590cfa57fc3bc2011d82aa494e4bc9fe81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
%%
%% This is file `memhfixc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mempatch.dtx (with options: `hyper')
%%
%% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
%% Copyright 2001 --- 2010 Peter R. Wilson
%% Copyright 2011 --- 2013 Peter R. Wilson
%% Copyright 2013 --- Lars Madsen
%% Maintainer: Lars Madsen (daleif at math dot au dot dk)
%%
%% 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 the license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2003/06/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This work consists of the files listed in the README file.
%%
%%
%% The memhfixc package provides hyperref related temporary
%% fixes and extensions for versions v1.618 and later of the memoir class.
%% o hyperref fix for part and chapter entries in the ToC (v1.0)
%% o Other fixes as and when
%%
%% Only use this package in conjunction with the hyperref package.
%% Call the package without options after the hyperref package as:
%% \documentclass[...]{memoir}
%% ...
%% \usepackage[...]{hyperref}
%% \usepackage{memhfixc}
%%
%% With thanks to Heiko Oberdiek, if you use hyperref dated 2006/11/15
%% or later, memhfixc will be automatically loaded after hyperref.
%%
%% Version 1.19 2021/06/16
%% Version 1.18 2019/10/24
%% Version 1.17 2013/05/30
%% Version 1.16 2013/05/16
%% Version 1.15 2010/08/17
%% Version 1.14 2010/06/10
%% Version 1.13 2010/04/19
%% Version 1.12 2009/02/06
%% Version 1.11 2009/01/18
%% Version 1.10 2008/08/23
%% Version 1.9 2006/11/22
%% Version 1.8 2006/01/21
%% Version 1.7 2005/11/15
%% Version 1.6 2004/05/13
%% Version 1.5 2003/10/14
%% Version 1.4 2003/09/26
%% Version 1.3 2003/02/20
%% Version 1.2 2003/02/02
%% Version 1.1 2003/01/22
%% Version 1.0 2002/10/22
%%
\ProvidesPackage{memhfixc}[2021/06/16 v1.19 nameref/hyperref package fixes for memoir class]
\let\M@hfixcfinish\relax
\@ifclassloaded{memoir}{}%
{\let\M@hfixcfinish\endinput
\typeout{No memoir class: memhfixc does nothing}}
\M@hfixcfinish
\AtEndPackage{nameref}{%
\@ifundefined{NR@sectm@m}{% haven't fiddled with \M@sect
\typeout{Redoing nameref's sectioning}
\let\NR@sectm@m\M@sect
\def\M@sect##1##2##3##4##5##6[##7][##8]##9{%
\setcounter{section@level}{##2}%
\def\@currentlabelname{##7}%
\NR@sectm@m{##1}{##2}{##3}{##4}{##5}{##6}[{##7}][{##8}]{\Sectionformat{##9}{##2}}}%
}%
{% \NR@sectm@m has already been defined
}%
\@ifundefined{MNR@label}{% haven't fiddled with \label
\typeout{Redoing nameref's label}
\let\MNR@label\label
\def\label##1{\@bsphack\begingroup
\protected@edef\@currentlabel{\protect\M@TitleReference
{\@currentlabel}{\M@currentTitle}}%
\MNR@label{##1}%
\endgroup \@esphack}%
\let\MNR@old@caption\@caption
\long\def\@caption##1[##2]##3{%
\MNR@old@caption{##1}[{##2}]{##3}%
\def\@currentlabelname{##2}%
\M@gettitle{##2}%
}%
}%
{% \MNR@label has already been defined
}%
\DeclareRobustCommand\nameref{\@ifstar{\@mem@titlerefnolink}{\@mem@titleref}}
}% end of AtEndPackage
%% We are done unless the hyperref package has been loaded
\@ifpackageloaded{hyperref}{}{\let\M@hfixcfinish\endinput}
\M@hfixcfinish
\let\H@old@sbook\@sbook
\def\@sbook#1{%
\H@old@sbook{#1}%
\Hy@GlobalStepCount\Hy@linkcounter
\xdef\@currentHref{book*.\the\Hy@linkcounter}%
\Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}%
}
\@ifundefined{Hy@captionsenglish}{}{%
\g@addto@macro{\Hy@captionsenglish}{\def\bookautorefname{Book}}}
\@ifundefined{HyLang@english}{}{%
\g@addto@macro{\HyLang@english}{\def\bookautorefname{Book}}}
\@ifundefined{Hy@captionsgerman}{}{%
\g@addto@macro{\Hy@captionsgerman}{\def\bookautorefname{Buch}}}
\@ifundefined{HyLang@german}{}{%
\g@addto@macro{\HyLang@german}{\def\bookautorefname{Buch}}}
\@ifundefined{Hy@captionsportuges}{}{%
\g@addto@macro{\Hy@captionsportuges}{\def\bookautorefname{Livro}}}
\@ifundefined{HyLang@portuges}{}{%
\g@addto@macro{\HyLang@portuges}{\def\bookautorefname{Livro}}}
\@ifundefined{Hy@captionsspanish}{}{%
\g@addto@macro{\Hy@captionsspanish}{\def\bookautorefname{Libro}}}
\@ifundefined{HyLang@spanish}{}{%
\g@addto@macro{\HyLang@spanish}{\def\bookautorefname{Libro}}}
\@ifundefined{Hy@captionsafrikaans}{}{%
\g@addto@macro{\Hy@captionsafrikaans}{\def\bookautorefname{Boek}}}
\@ifundefined{HyLang@afrikaans}{}{%
\g@addto@macro{\HyLang@afrikaans}{\def\bookautorefname{Boek}}}
\providecommand{\bookautorefname}{Book}
\@ifpackagelater{hyperref}{2006/11/15}{%
}{%
\def\@@writetorep#1#2#3#4#5{%
\begingroup
\def\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
\let\booknumberline\Hy@numberline % <- added
\let\partnumberline\Hy@numberline % <- added
\let\chapternumberline\Hy@numberline % <- added
\else
\let\numberline\@gobble
\let\booknumberline\@gobble % <- added
\let\partnumberline\@gobble % <- added
\let\chapternumberline\@gobble % <- added
\fi
\pdfstringdef\Hy@tempa{#2}%
\protected@write\@outlinefile{}{%
\protect\BOOKMARK
[\Hy@level][\@bookmarkopenstatus{\Hy@level}]{#3}%
{\Hy@tempa}{\Hy@tempb}%
}%
\fi
\endgroup}
}
\@ifundefined{H@old@sectm@m}{% haven't fiddled with \M@sect
\let\H@old@sectm@m\M@sect
\def\M@sect#1#2#3#4#5#6[#7][#8]#9{%
\ifnum #2>\c@secnumdepth%
\expandafter\@firstoftwo%
\else%
\expandafter\@secondoftwo%
\fi%
{%
\Hy@MakeCurrentHrefAuto{section*}%
\setlength{\Hy@SectionHShift}{#3}%
\begingroup
\toks@{\H@old@sectm@m{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]}%
\toks\tw@\expandafter{%
\expandafter\Hy@SectionAnchorHref\expandafter{\@currentHref}%
#9%
}%
\edef\x{\endgroup%
\the\toks@{\the\toks\tw@}%
}\x%
}{%
\H@old@sectm@m{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]{#9}%
}%
}%
}%
{% already fiddled \M@sect
}
\renewcommand{\cftaddtitleline}[4]{%
\addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}{\@currentHref}}}
\renewcommand{\cftaddnumtitleline}[5]{\addtocontents{#1}{%
\protect\contentsline{#2}{\protect\numberline{#3}#4}{#5}{\@currentHref}}}
\let\m@moldhypcaption\caption
\renewcommand{\caption}{\donemaincaptiontrue\m@moldhypcaption}
\newcounter{memhycontfloat}
\renewcommand*{\thememhycontfloat}{\arabic{memhycontfloat}}
\providecommand*{\theHmemhycontfloat}{}
\renewcommand*{\theHmemhycontfloat}{\arabic{memhycontfloat}}
\setcounter{memhycontfloat}{0}
\renewcommand{\contcaption}{%
\par%
\refstepcounter{memhycontfloat}%
\addtocounter{\@captype}{\m@ne}\H@refstepcounter{\@captype}%
\@contcaption\@captype}
\def\endsidecaption{%
\m@mscapend@fbox
\H@refstepcounter{\@captype}%
\hyper@makecurrent{\@captype}%
\m@mscaplabel
\m@mscapcheckside %<--- added 2013/05/30
\begin{lrbox}{\m@mscap@capbox}%
\begin{minipage}[c]{\sidecapwidth}%
\sidecapstyle
\@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}%
\end{minipage}%
\end{lrbox}%
\m@mscapopboxes}
\renewcommand*{\sidecontcaption}{%
\refstepcounter{memhycontfloat}%
\@sidecontcaption}
\def\endsidecontcaption{%
\m@mscapend@fbox
\addtocounter{\@captype}{\m@ne}\H@refstepcounter{\@captype}%
\hyper@makecurrent{memhycontfloat}%
\m@mscaplabel
\m@mscapcheckside %<--- added 2013/05/30
\begin{lrbox}{\m@mscap@capbox}%
\begin{minipage}[c]{\sidecapwidth}%
\sidecapstyle
\@contcaption\@captype{\m@mscap@forcap}%
\end{minipage}%
\end{lrbox}%
\m@mscapopboxes}
\def\@mem@titlerefnolink#1{\begingroup \let\numberline\@gobble
\let\M@TitleReference\@mem@theTR % interrupt recursion of \ref
\ref*{#1}\endgroup}
\AtBeginDocument{%
\let\printpageinnotes\printpageinnoteshyperref%
}
\ifHy@hyperfootnotes
\def\@footnotemark{%
\leavevmode
\ifhmode\edef\@x@sf{\the\spacefactor}%
\m@mmf@check% <--- added
\nobreak\fi
\stepcounter{Hfootnote}%
\global\let\Hy@saved@currentHref\@currentHref
\hyper@makecurrent{Hfootnote}%
\global\let\Hy@footnote@currentHref\@currentHref
\global\let\@currentHref\Hy@saved@currentHref
\hyper@linkstart{link}{\Hy@footnote@currentHref}%
\@makefnmark
\hyper@linkend
\m@mmf@prepare% <--- added
\ifhmode\spacefactor\@x@sf\fi
\relax
}%
\fi
\Hy@AtBeginDocument{%
\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
\AtEndDocument{%
\expandafter\ifx\csname tf@#1\endcsname\relax
\expandafter\newwrite\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
\fi
}
\fi
\@nobreakfalse
\endgroup
}%
\fi
}
\ifHy@hyperfootnotes
\let\m@m@pnwrite@fourtharg\m@m@pnwrite@fourtharg@hyperref
\let\pagenoteanchor\pagenotehyperanchor
\newcounter{Hpagenote}
\@namedef{mem@pnmm@start@hook}{%
\stepcounter{Hpagenote}%
\global\let\Hy@saved@currentHref\@currentHref
\hyper@makecurrent{Hpagenote}%
\global\let\Hy@pagenote@currentHref\@currentHref
\global\let\@currentHref\Hy@saved@currentHref
\hyper@linkstart{link}{\Hy@pagenote@currentHref}%
}
\@namedef{mem@pnmm@end@hook}{\hyper@linkend}
\fi
\AtEndPackage{hypcap}{%
\long\def\@@contcaption##1##2{%
\par
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\global\@capstartfalse% added
\normalsize
\@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##2}\par
\endgroup}
}
\endinput
%%
%% End of file `memhfixc.sty'.
|