summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/memoir/mempatch.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-19 22:50:53 +0000
committerKarl Berry <karl@freefriends.org>2010-04-19 22:50:53 +0000
commit6f50f6bd304c69abef2c051ee1aa83b602027143 (patch)
tree27c73e4e2125099424a4a235e1d37cfd2c050c33 /Master/texmf-dist/source/latex/memoir/mempatch.dtx
parent8c448ca8b31770f9afca1e77a4b6d2e91404488e (diff)
memoir 3.6 (18apr10)
git-svn-id: svn://tug.org/texlive/trunk@17927 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/memoir/mempatch.dtx')
-rw-r--r--Master/texmf-dist/source/latex/memoir/mempatch.dtx103
1 files changed, 55 insertions, 48 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.dtx b/Master/texmf-dist/source/latex/memoir/mempatch.dtx
index 0c4d371aa89..10c1e2558d4 100644
--- a/Master/texmf-dist/source/latex/memoir/mempatch.dtx
+++ b/Master/texmf-dist/source/latex/memoir/mempatch.dtx
@@ -19,7 +19,7 @@
%
%
% \fi
-% \CheckSum{501}
+% \CheckSum{496}
%
% \def\dtxfile{\texttt{mempatch.dtx}}
% \def\fileversion{v1.0} \def\filedate{2003/10/04}
@@ -69,6 +69,7 @@
% \def\fileversion{v6.0d} \def\filedate{2009/07/12}
% \def\fileversion{v6.0e} \def\filedate{2009/07/21}
% \def\fileversion{v6.0f} \def\filedate{2009/07/24}
+% \def\fileversion{v6.0g} \def\filedate{2010/04/19}
%
% \title{The LaTeX \Lpack{memoir} class for configurable book
% typesetting: Code patches\thanks{This
@@ -307,6 +308,7 @@
%% With thanks to Heiko Oberdiek, if you use hyperref dated 2006/11/15
%% or later, memhfixc will be automatically loaded after hyperref.
%%
+%% Version 1.13 2010/04/19
%% Version 1.12 2009/02/06
%% Version 1.11 2009/01/18
%% Version 1.10 2008/08/23
@@ -325,7 +327,7 @@
%
%
% \begin{macrocode}
-\ProvidesPackage{memhfixc}[2009/02/06 v1.12 nameref/hyperref package fixes for memoir class]
+\ProvidesPackage{memhfixc}[2010/04/19 v1.13 nameref/hyperref package fixes for memoir class]
% \end{macrocode}
%
% \begin{macro}{\M@hfixcfinish}
@@ -342,65 +344,68 @@
%
% \subsection{Patches for nameref}
%
+% \changes{v1.13}{2010/04/19}{Rewritten to help fix a race condition}
+%
+% The nameref package changes \cs{@sect} and \cs{label} so we bring
+% back the memoir stuff. We have earlier been using
+% \verb?\AtBeginDocument? plus \verb?\@ifpackageloaded{nameref}? to
+% add our changes to \Lpack{nameref}. But this is not a good solution,
+% as \Lpack{hyperref} can delay \Lpack{nameref} loading using
+% \verb?\AtBeginDocument{\usepackage{nameref}}? \emph{and} add thiis
+% \emph{after} \Lpack{memhfixc} is loaded. A better solution is to use
+% \verb?\AtEndPackage?, then it does not matter how far after
+% \Lpack{memhfixc} \Lpack{nameref} is loaded.
+%
+% \changes{v1.13}{2010/04/19}{Code in the next part have been changed
+% to match \cs{AtEndPackage}}
+% \begin{macrocode}
+\AtEndPackage{nameref}{%
+% \end{macrocode}
+
% \begin{macro}{\M@sect}
% \begin{macro}{\NR@sectm@m}
% The \Lpack{nameref} package~\cite{NAMEREF} fiddles with \cs{@sect} (which memoir replaces
-% by \cs{M@sect}). Note that the \Lpack{hyperref} package may call
-% \Lpack{nameref} via:
-% \verb?\AtBeginDocument{\usepackage{nameref}}?
-% \begin{macrocode}
-\AtBeginDocument{%
- \@ifpackageloaded{nameref}{% nameref loaded
- \@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
- }
+% by \cs{M@sect}).
+% \begin{macrocode}
+ \@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
}%
- {% no nameref
- }
-} % end of \AtBeginDocument
-
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
+%
% \begin{macro}{\label}
% \begin{macro}{\MNR@label}
% The \Lpack{nameref} package replaces \cs{label}, which (which memoir has added to).
% Make the memoir addition again.
%
% \begin{macrocode}
-\AtBeginDocument{%
- \@ifpackageloaded{nameref}{% nameref loaded
- \@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}%
- }%
+ \@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
- }
}%
- {% no nameref
- }
-} % end of \AtBeginDocument
-
+ {% \MNR@label has already been defined
+ }%
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -410,13 +415,15 @@
% \cs{nameref}, so as not to confuse users, we let \cs{nameref} be
% an alias for \cs{titleref}.
% \begin{macrocode}
-\AtBeginDocument{%
- \@ifpackageloaded{nameref}{\let\nameref\titleref}{}%
-}
-
+\DeclareRobustCommand\nameref{\@ifstar{\@mem@titlerefnolink}{\@mem@titleref}}
% \end{macrocode}
% \end{macro}
%
+% \begin{macrocode}
+}% end of AtEndPackage
+% \end{macrocode}
+
+
%
% We are done unless the \Lpack{hyperref} package has been loaded
% \begin{macrocode}