summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-19 23:24:59 +0000
committerKarl Berry <karl@freefriends.org>2010-05-19 23:24:59 +0000
commit37692430a0ed6d4bc09b544c26cbc8ba41255965 (patch)
treefce78f8c376af10afb0d10fd1ffcd90f8b2d39bc /Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty
parentfb8881a67bb8f860de4fed71bbdb2b2b7c39ac89 (diff)
thmtools 24 (18may10)
git-svn-id: svn://tug.org/texlive/trunk@18359 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty')
-rw-r--r--Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty67
1 files changed, 63 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty b/Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty
index 663fd9001b9..73a682d4e39 100644
--- a/Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty
+++ b/Master/texmf-dist/tex/latex/thmtools/thm-autoref.sty
@@ -11,17 +11,18 @@
%% The `thmtools' package has the LPPL maintenance status: maintained.
%% Current Maintainer is Ulrich M. Schwarz, ulmi@absatzen.de
%%
-%% Copyright (C) 2008 by Ulrich M. Schwarz.
+%% Copyright (C) 2008-2010 by Ulrich M. Schwarz.
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, version 1.3a.
%% This version is obtainable at
%% http://www.latex-project.org/lppl/lppl-1-3a.txt
%%
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{thm-autoref}[2008/03/09 v0.1beta2 thm-autoref (ulmi)]
+%%
+\NeedsTeXFormat {LaTeX2e}
+\ProvidesPackage {thm-autoref}[2010/05/18 v24]
-\RequirePackage{thm-patch, aliasctr}
+\RequirePackage{thm-patch, aliasctr, parseargs, keyval}
\let\@xa=\expandafter
\let\@nx=\noexpand
@@ -40,6 +41,64 @@
}
\g@addto@macro\thmt@newtheorem@predefinition{\thmt@autorefsetup}%
\g@addto@macro\thmt@newtheorem@postdefinition{\csname thmt@autoreffix\endcsname}%
+
+\def\thmt@refnamewithcomma #1#2#3,#4,#5\@nil{%
+ \@xa\def\csname\thmt@envname #1utorefname\endcsname{#3}%
+ \ifcsname #2refname\endcsname
+ \csname #2refname\endcsname{\thmt@envname}{#3}{#4}%
+ \fi
+}
+\define@key{thmdef}{refname}{\thmt@trytwice{}{%
+ \thmt@refnamewithcomma{a}{c}#1,\textbf{?? (pl. #1)},\@nil
+}}
+\define@key{thmdef}{Refname}{\thmt@trytwice{}{%
+ \thmt@refnamewithcomma{A}{C}#1,\textbf{?? (pl. #1)},\@nil
+}}
+
+\ifcsname Autoref\endcsname\else
+\let\thmt@HyRef@testreftype\HyRef@testreftype
+\def\HyRef@Testreftype#1.#2\\{%
+ \ltx@IfUndefined{#1Autorefname}{%
+ \thmt@HyRef@testreftype#1.#2\\%
+ }{%
+ \edef\HyRef@currentHtag{%
+ \expandafter\noexpand\csname#1Autorefname\endcsname
+ \noexpand~%
+ }%
+ }%
+}
+
+\let\thmt@HyPsd@@autorefname\HyPsd@@autorefname
+\def\HyPsd@@Autorefname#1.#2\@nil{%
+ \tracingall
+ \ltx@IfUndefined{#1Autorefname}{%
+ \thmt@HyPsd@@autorefname#1.#2\@nil
+ }{%
+ \csname#1Autorefname\endcsname\space
+ }%
+}%
+\def\Autoref{%
+ \parse{%
+ {\parseFlag*{\def\thmt@autorefstar{*}}{\let\thmt@autorefstar\@empty}}%
+ {\parseMand{%
+ \bgroup
+ \let\HyRef@testreftype\HyRef@Testreftype
+ \let\HyPsd@@autorefname\HyPsd@@Autorefname
+ \@xa\autoref\thmt@autorefstar{##1}%
+ \egroup
+ \let\@parsecmd\@empty
+ }}%
+ }%
+}
+\fi % ifcsname Autoref
+
+\AtBeginDocument{%
+ \@ifpackageloaded{nameref}{%
+ \addtotheorempostheadhook{%
+ \expandafter\NR@gettitle\expandafter{\thmt@optarg}%
+ }}{}
+}
+
\endinput
%%
%% End of file `thm-autoref.sty'.