diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperref/nameref.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/hyperref/nameref.dtx | 108 |
1 files changed, 102 insertions, 6 deletions
diff --git a/Master/texmf-dist/source/latex/hyperref/nameref.dtx b/Master/texmf-dist/source/latex/hyperref/nameref.dtx index 9a73dd7b8e2..c8e9eb72bb6 100644 --- a/Master/texmf-dist/source/latex/hyperref/nameref.dtx +++ b/Master/texmf-dist/source/latex/hyperref/nameref.dtx @@ -30,9 +30,9 @@ %<driver>\ProvidesFile{nameref.drv} % \fi % \ProvidesFile{nameref.dtx} - [2010/01/25 v2.36 Cross-referencing by name of section]% + [2010/04/17 v2.39 Cross-referencing by name of section]% % -% \CheckSum{580} +% \CheckSum{691} % % \iffalse %<*driver> @@ -114,6 +114,7 @@ % \begin{macrocode} \RequirePackage{refcount}[2006/02/12] \RequirePackage{gettitlestring}[2009/12/18] +\RequirePackage{ltxcmds}[2009/12/12] % \end{macrocode} % % We redefine |\label| so that it also writes the name of the @@ -269,19 +270,71 @@ } % \end{macrocode} % +% Support for class memoir. +% +% \begin{macrocode} +\ltx@IfUndefined{ifheadnameref}{% +}{% + \ltx@IfUndefined{M@sect}{% + }{% + \let\NRorg@M@sect\M@sect + \def\M@sect#1#2#3#4#5#6[#7][#8]{% + \ifheadnameref + \NR@gettitle{#8}% + \else + \NR@gettitle{#7}% + \fi + \NRorg@M@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]% + }% + }% +} +% \end{macrocode} +% % Parts and chapters are treated differently. sigh. +% \cs{@part} and \cs{@spart} are \cs{long} because of class memoir. % % \begin{macrocode} \let\NR@part\@part -\def\@part[#1]#2{% +\long\def\@part[#1]#2{% \NR@gettitle{#1}% \NR@part[{#1}]{#2}% } +\let\NR@spart\@spart +\long\def\@spart#1{% + \NR@gettitle{#1}% + \NR@spart{#1}% +} \let\NR@chapter\@chapter \def\@chapter[#1]#2{% \NR@gettitle{#1}% \NR@chapter[{#1}]{#2}% } +\@ifclassloaded{memoir}{% + \ltx@IfUndefined{ifheadnameref}{% + }{% + \def\@chapter[#1]#2{% + \ltx@IfUndefined{ch@pt@c}{% + \NR@gettitle{#1}% + }{% + \ifx\ch@pt@c\ltx@empty + \NR@gettitle{#2}% + \else + \def\NR@temp{#1}% + \ifx\NR@temp\ltx@empty + \expandafter\NR@gettitle\expandafter{\ch@pt@c}% + \else + \ifheadnameref + \NR@gettitle{#1}% + \else + \expandafter\NR@gettitle\expandafter{\ch@pt@c}% + \fi + \fi + \fi + }% + \NR@chapter[{#1}]{#2}% + }% + }% +}{} \let\NR@schapter\@schapter \def\@schapter#1{% \NR@gettitle{#1}% @@ -359,12 +412,42 @@ }{} % \end{macrocode} % +% \subsubsection{Theorems} +% +% \begin{macrocode} +\ltx@IfUndefined{@opargbegintheorem}{}{% + \let\NRorg@opargbegintheorem\@opargbegintheorem + \def\@opargbegintheorem#1#2#3{% + \NR@gettitle{#3}% + \NRorg@opargbegintheorem{#1}{#2}{#3}% + }% +} +\AtBeginDocument{% + \@ifpackageloaded{amsthm}{% + \let\NRorg@begintheorem\@begintheorem + \begingroup + \edef\x{macro:\string#1\string#2[\string#3]}% + \@onelevel@sanitize\x + \def\y#1->#2\@nil{#1}% + \edef\z{\expandafter\y\meaning\@begintheorem->\@nil}% + \@onelevel@sanitize\z + \expandafter\endgroup + \ifx\x\z + \def\@begintheorem#1#2[#3]{% + \NR@gettitle{#3}% + \NRorg@begintheorem{#1}{#2}[{#3}]% + }% + \fi + }{}% +} +% \end{macrocode} +% % \subsection{Referencing stuff} % % We default the label and hypertext reference to be empty. % \begin{macrocode} -\def\@currentlabelname{} -\def\@currentHref{} +\providecommand*{\@currentlabelname}{} +\providecommand*{\@currentHref}{} % \end{macrocode} % Since the second part of the preserved reference now has five parts % (number, page, name, hypertext reference and file), we need extra utility @@ -458,7 +541,20 @@ }% \fi \fi -\def\nameref{\protect\T@nameref} +%\@ifclassloaded{memoir}{% +% \ltx@IfUndefined{@mem@titlerefnolink}\ltx@secondoftwo{% +% \ltx@IfUndefined{@mem@titleref}\ltx@secondoftwo\ltx@firstoftwo +% }% +%}\ltx@secondoftwo +%{% +% \DeclareRobustCommand*{\nameref}{% +% \@ifstar\@mem@titlerefnolink\@mem@titleref +% }% +%}{% + \DeclareRobustCommand*{\nameref}{% + \@ifstar\T@nameref\T@nameref + }% +%} % \end{macrocode} % An extended form which gives title and page number. % \begin{macrocode} |