%% %% 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 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. %% Memoir will automatically load the package after hyperref, no %% interaction needed %% %% Version 1.24 2025/09/16 %% Version 1.23 2025/03/06 %% Version 1.22 2023/09/10 %% Version 1.21 2023/07/28 %% Version 1.21 2023/07/28 %% Version 1.20 2022/11/17 %% 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}[2025/09/16 v1.24 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 %% 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{% \Hy@MakeCurrentHrefAuto{book*}% \Hy@raisedlink{% \hyper@anchorstart{\@currentHref}\hyper@anchorend }% \H@old@sbook{#1} } \ExplSyntaxOn \cs_new_protected:Npn \_memoir_append_bookautorefname:nn #1#2 { \@ifundefined{HyLang@#1}{}{% \ExpandArgs{c}\g@addto@macro{HyLang@#1}{\def\bookautorefname{#2}}} } \clist_set:Nn \l_tmpa_clist { {afrikaans}{Boek}, {english}{Book}, {french}{Livre}, {german}{Buch}, {italian}{Libro}, {magyar}{K\"onyv}, {portuges}{Livro}, {russian}{\CYRK\cyrn\cyri\cyrg\cyrr\cyra}, {spanish}{Libro}, {catalan}{Llibre}, {vietnamese}{T\d{\^{a}}p s\'{a}ch}, {greek}{\textBeta\textiota\textbeta\textlambda\'\textiota\textomicron}, {dutch}{Boek}, {norsk}{Bok}, {danish}{Bog}, {swedish}{Bok}, } \clist_map_inline:Nn \l_tmpa_clist { \_memoir_append_bookautorefname:nn #1 } \ExplSyntaxOff \providecommand{\bookautorefname}{Book} \providecommand{\subfigureautorefname}{Subfigure} \@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} \xpretocmd\caption{\donemaincaptiontrue} {}{\typeout{Preto patch for \string\caption\space failed}} \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} \renewcommand*\sidecaption@refstepcounter[2]{% \H@refstepcounter{#1}% \hyper@makecurrent{#2}% } % \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} \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 \ifHy@hyperfootnotes \let\m@m@pnwrite@fourtharg\m@m@pnwrite@fourtharg@hyperref \let\pagenoteanchor\pagenotehyperanchor \newcounter{mem@Hpagenote} \@namedef{mem@pnmm@start@hook}{% \stepcounter{mem@Hpagenote}% \global\let\Hy@saved@currentHref\@currentHref \hyper@makecurrent{mem@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'.