summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hyperref/nameref.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-06-01 16:58:52 +0000
committerKarl Berry <karl@freefriends.org>2007-06-01 16:58:52 +0000
commit4d027ddb699c57025992eccbdd3cef0ec2836ee1 (patch)
tree7c9a8e252aa5133aa4c986aa37af12b8484ec44b /Master/texmf-dist/tex/latex/hyperref/nameref.sty
parentab8a652a0280de02179bbbdd79296f2bbd4073f7 (diff)
hyperref update (30may07)
git-svn-id: svn://tug.org/texlive/trunk@4399 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hyperref/nameref.sty')
-rw-r--r--Master/texmf-dist/tex/latex/hyperref/nameref.sty225
1 files changed, 152 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperref/nameref.sty b/Master/texmf-dist/tex/latex/hyperref/nameref.sty
index d878781e7fe..b6cadb0937c 100644
--- a/Master/texmf-dist/tex/latex/hyperref/nameref.sty
+++ b/Master/texmf-dist/tex/latex/hyperref/nameref.sty
@@ -20,7 +20,7 @@
%% given in the file `manifest.txt'.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nameref}
- [2006/12/27 v2.28 Cross-referencing by name of section]
+ [2007/05/29 v2.31 Cross-referencing by name of section]%
\RequirePackage{refcount}[2006/02/12]
\def\strip@period#1.\relax#2\@@@{#1}
\newif\ifNR@showkeys
@@ -111,7 +111,8 @@
}%
}%
}%
- \endgroup}
+ \endgroup
+}
\let\NR@sect\@sect
\newcounter{section@level}
\def\@sect#1#2#3#4#5#6[#7]#8{%
@@ -145,6 +146,19 @@
\NR@@caption{#1}[{#2}]%
}
\AtBeginDocument{%
+ \@ifpackageloaded{longtable}{%
+ \let\NRorg@LT@c@ption\LT@c@ption
+ \def\LT@c@ption#1[#2]#3{%
+ \NRorg@LT@c@ption{#1}[{#2}]{#3}%
+ \def\@tempa{#2}%
+ \ifx\@tempa\@empty
+ \else
+ \def\@currentlabelname{#2}%
+ \fi
+ }%
+ }{}%
+}
+\AtBeginDocument{%
\@ifpackageloaded{titlesec}{%
\let\NRorg@ttl@sect@i\ttl@sect@i
\def\ttl@sect@i#1#2[#3]#4{%
@@ -153,6 +167,23 @@
}%
}{}%
}
+\@ifclassloaded{beamer}{%
+ \def\NR@PatchBeamer#1{%
+ \expandafter\let\csname NRorg@beamer@#1\expandafter\endcsname
+ \csname beamer@#1\endcsname
+ \begingroup
+ \edef\x{\endgroup
+ \long\def\expandafter\noexpand\csname beamer@#1\endcsname[####1]{%
+ \def\noexpand\@currentlabelname{####1}%
+ \expandafter\noexpand\csname NRorg@beamer@#1\endcsname[{####1}]%
+ }%
+ }%
+ \x
+ }%
+ \NR@PatchBeamer{section}%
+ \NR@PatchBeamer{subsection}%
+ \NR@PatchBeamer{subsubsection}%
+}{}
\def\@currentlabelname{}
\def\@currentHref{}
\long\def\@firstoffive#1#2#3#4#5{#1}
@@ -240,91 +271,139 @@
\def\pageref##1{\getrefbykeydefault{##1}{page}{0}}%
}%
}{}
-\ifx\csname @@vpageref\endcsname\relax
-\else
- \def\@@vpageref#1[#2]#3{%
- \leavevmode\unskip
- \global\advance\c@vrcnt\@ne
- \@ifundefined{r@\the\c@vrcnt @vr}%
- {\@namedef{r@\the\c@vrcnt @vr}{{??}{??}{??}{??}{??}}}{}%
- \edef\@tempa{%
- \expandafter\expandafter\expandafter
- \@secondoffive\csname r@\the\c@vrcnt @vr\endcsname
- }%
- \@ifundefined{r@\the\c@vrcnt @xvr}%
- {\@namedef{r@\the\c@vrcnt @xvr}{{??}{??}{??}{??}{??}}}{}%
- \edef\@tempb{%
- \expandafter\expandafter\expandafter
- \@secondoffive\csname r@\the\c@vrcnt @xvr\endcsname
- }%
- {%
- \let\@currentlabel\@empty
- \expandafter\label\expandafter{\the\c@vrcnt @xvr}%
+\AtBeginDocument{%
+ \ifx\csname @@vpageref\endcsname\relax
+ \else
+ \def\@@vpageref#1[#2]#3{%
+ \begingroup
+ \csname @safe@activestrue\endcsname
+ \edef\x{#3}%
+ \@onelevel@sanitize\x
+ \toks@{%
+ \NR@@vpageref{#1}[{#2}]%
+ }%
+ \edef\x{\endgroup
+ \the\toks@{\x}%
+ }%
+ \x
}%
- \ifx\@tempa\@tempb
- \else
- \vref@err{%
- \noexpand\vref at page boundary
- \@tempb-\@tempa\space (may loop)%
+ \def\NR@@vpageref#1[#2]#3{%
+ \leavevmode\unskip
+ \global\advance\c@vrcnt\@ne
+ \@ifundefined{r@\the\c@vrcnt @vr}%
+ {\@namedef{r@\the\c@vrcnt @vr}{{??}{??}{}{}{}}}{}%
+ \edef\@tempa{%
+ \expandafter\expandafter\expandafter
+ \@secondoffive\csname r@\the\c@vrcnt @vr\endcsname
}%
- \fi
- \@ifundefined{r@#3}{\@namedef{r@#3}{{??}{??}{??}{??}{??}}}{}%
- \edef\@tempb{%
- \expandafter\expandafter\expandafter
- \@secondoffive\csname r@#3\endcsname
- }%
- \space
- \ifx\@tempa\@tempb
- #1%
- \else
- #2%
- \is@pos@number\@tempb{%
- \is@pos@number\@tempa{%
- \@tempcnta\@tempa
- \advance\@tempcnta\@ne
- }{%
- \@tempcnta\maxdimen
+ \@ifundefined{r@\the\c@vrcnt @xvr}%
+ {\@namedef{r@\the\c@vrcnt @xvr}{{??}{??}{}{}{}}}{}%
+ \edef\@tempb{%
+ \expandafter\expandafter\expandafter
+ \@secondoffive\csname r@\the\c@vrcnt @xvr\endcsname
+ }%
+ {%
+ \let\@currentlabel\@empty
+ \expandafter\label\expandafter{\the\c@vrcnt @xvr}%
+ }%
+ \ifx\@tempa\@tempb
+ \else
+ \vref@err{%
+ \noexpand\vref at page boundary %
+ \@tempb-\@tempa\space (may loop)%
}%
- \ifnum \@tempb =\@tempcnta
- \ifodd\@tempcnta
- \if@twoside
- \reftextfaceafter
+ \fi
+ \@ifundefined{r@#3}{\@namedef{r@#3}{{??}{??}{}{}{}}}{}%
+ \edef\thevpagerefnum{%
+ \expandafter\expandafter\expandafter
+ \@secondoffive\csname r@#3\endcsname
+ }%
+ \ifx\vref@space\@undefined
+ \space
+ \else
+ \vref@space
+ \fi
+ \ifx\@tempa\thevpagerefnum
+ #1%
+ \else
+ #2%
+ \is@pos@number\thevpagerefnum{%
+ \is@pos@number\@tempa{%
+ \@tempcnta\@tempa
+ \advance\@tempcnta\@ne
+ }{%
+ \@tempcnta\maxdimen
+ }%
+ \ifnum \thevpagerefnum =\@tempcnta
+ \ifodd\@tempcnta
+ \if@twoside
+ \reftextfaceafter
+ \else
+ \reftextafter
+ \fi
\else
\reftextafter
\fi
\else
- \reftextafter
- \fi
- \else
- \advance\@tempcnta-2
- \ifnum \@tempb =\@tempcnta
- \ifodd\@tempcnta
- \reftextbefore
- \else
- \if@twoside
- \reftextfacebefore
- \else
+ \advance\@tempcnta-2 %
+ \ifnum \thevpagerefnum =\@tempcnta
+ \ifodd\@tempcnta
\reftextbefore
+ \else
+ \if@twoside
+ \reftextfacebefore
+ \else
+ \reftextbefore
+ \fi
\fi
+ \else
+ \reftextfaraway{#3}%
\fi
- \else
- \reftextfaraway{#3}%
\fi
- \fi
- }{%
- \reftextfaraway{#3}%
+ }{%
+ \reftextfaraway{#3}%
+ }%
+ \fi
+ {%
+ \let\@currentlabel\@empty
+ \expandafter\label\expandafter{\the\c@vrcnt @vr}%
}%
- \fi
- {%
- \let\@currentlabel\@empty
- \expandafter\label\expandafter{\the\c@vrcnt @vr}%
}%
+ \DeclareRobustCommand\vnameref[1]{%
+ \unskip~\nameref{#1}%
+ \@vpageref[\unskip]{#1}%
+ }%
+ \fi
+}
+\@ifundefined{@Refstar}{%
+ \def\T@Ref#1{%
+ \NR@setref{#1}\NR@MakeUppercaseFirstOfFive{#1}%
}%
- \DeclareRobustCommand\vnameref[1]{%
- \unskip~\nameref{#1}%
- \@vpageref[\unskip]{#1}%
- }
-\fi
+ \def\NR@MakeUppercaseFirstOfFive#1#2#3#4#5{%
+ \MakeUppercase#1%
+ }%
+}{}%
+\AtBeginDocument{%
+ \@ifpackageloaded{varioref}{%
+ \@ifundefined{@Refstar}{%
+ \DeclareRobustCommand*{\Ref}[1]{%
+ \T@Ref{#1}%
+ }%
+ }{}%
+ }{}%
+}%
+\AtBeginDocument{%
+ \@ifpackageloaded{listings}{%
+ \let\NROrg@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption{%
+ \ifx\lst@label\@empty
+ \else
+ \let\@currentlabelname\lst@@caption
+ \fi
+ \NROrg@lst@MakeCaption
+ }%
+ }{}%
+}
\endinput
%%
%% End of file `nameref.sty'.