summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/thmtools/thm-restate.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/thmtools/thm-restate.sty')
-rw-r--r--Master/texmf-dist/tex/latex/thmtools/thm-restate.sty65
1 files changed, 62 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/latex/thmtools/thm-restate.sty b/Master/texmf-dist/tex/latex/thmtools/thm-restate.sty
index 7d88dd8091a..a66e063ee1e 100644
--- a/Master/texmf-dist/tex/latex/thmtools/thm-restate.sty
+++ b/Master/texmf-dist/tex/latex/thmtools/thm-restate.sty
@@ -19,7 +19,7 @@
%% http://www.latex-project.org/lppl/lppl-1-3a.txt
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{thm-restate}[2008/03/09 v0.1beta2 thm-restate (ulmi)]
+\ProvidesPackage{thm-restate}[2010/04/05 v0.1beta13 thm-restate (ulmi)]
\let\@xa\expandafter
\let\@nx\noexpand
@@ -44,6 +44,35 @@
}%
}
+\def\thmt@trivialref#1{%
+ \@xa\@xa\@xa\thmt@trivi@lr@f\csname r@#1\endcsname\@nil
+}
+\def\thmt@trivi@lr@f#1#2\@nil{#1}
+
+\def\thmt@innercounters{%
+ equation}
+\def\thmt@counterformatters{%
+ @alph,@Alph,@arabic,@roman,@Roman,@fnsymbol}
+
+\@for\displ:=\thmt@counterformatters\do{%
+ \@xa\let\csname thmt@\displ\@xa\endcsname\csname \displ\endcsname
+}%
+\def\thmt@sanitizethe#1{%
+ \@for\displ:=\thmt@counterformatters\do{%
+ \@xa\protected@edef\csname\displ\endcsname##1{%
+ \@nx\ifx\@xa\@nx\csname c@#1\endcsname ##1%
+ \@xa\protect\csname \displ\endcsname{##1}%
+ \@nx\else
+ \@nx\csname thmt@\displ\endcsname{##1}%
+ \@nx\fi
+ }%
+ }%
+ \expandafter\protected@edef\csname the#1\endcsname{\csname the#1\endcsname}%
+ \ifcsname theH#1\endcsname
+ \expandafter\protected@edef\csname theH#1\endcsname{\csname theH#1\endcsname}%
+ \fi
+}
+
\newif\ifthmt@thisistheone
\newenvironment{thmt@restatable}[3][]{%
\long\def\thmrst@store##1{%
@@ -56,12 +85,40 @@
}%
\@xa\long\@xa\gdef\csname thmt@stored@#3\@xa\endcsname\@xa{%
\begingroup
- \ifthmt@thisistheone\else
+ \ifthmt@thisistheone
+ \bgroup
+ % ugly hack: save chapter,..subsection numbers
+ % for equation numbers.
+ \refstepcounter{thmt@dummyctr}%
+ \def\@currentlabel{}%
+ \@for\ctr:=\thmt@innercounters\do{%
+ \thmt@sanitizethe{\ctr}%
+ \protected@edef\@currentlabel{%
+ \@currentlabel
+ \protect\def\@xa\protect\csname the\ctr\endcsname{\csname the\ctr\endcsname}%
+ \ifcsname theH\ctr\endcsname
+ \protect\def\@xa\protect\csname theH\ctr\endcsname{\csname theH\ctr\endcsname}%
+ \fi
+ \protect\setcounter{\ctr}{\number\csname c@\ctr\endcsname}%
+ }%
+ }%
+ \label{thmt@@#3@data}%
+ \egroup
+ \else
\@xa\protected@edef\csname the#2\endcsname{%
- \ifx\@refstar\@undefined\@xa\ref\else\@xa\@refstar\fi{thmt@@#3}}%
+ \thmt@trivialref{thmt@@#3}}%
\@xa\let\csname c@#2\endcsname=\c@thmt@dummyctr
\@xa\let\csname theH#2\endcsname=\theHthmt@dummyctr
\let\label=\@gobble
+ \let\ltx@label=\@gobble% amsmath needs this
+ \def\thmt@restorecounters{}%
+ \@for\ctr:=\thmt@innercounters\do{%
+ \protected@edef\thmt@restorecounters{%
+ \thmt@restorecounters
+ \protect\setcounter{equation}{\arabic{equation}}%
+ }%
+ }
+ \thmt@trivialref{thmt@@#3@data}%
\fi
%\def\@currenvir{#2}%
\csname #2\@xa\endcsname\ifx\@nx#1\@nx\else[#1]\fi
@@ -70,6 +127,7 @@
\fi
##1
\csname end#2\endcsname
+ \ifthmt@thisistheone\else\thmt@restorecounters\fi
\endgroup
}%
\csname #3\@xa\endcsname\ifthmt@thisistheone\else*\fi
@@ -79,6 +137,7 @@
}{%
%% now empty, just used as a marker.
}
+
\newenvironment{restatable}{%
\thmt@thisistheonetrue\thmt@restatable
}{%