diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-05 23:25:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-05 23:25:35 +0000 |
commit | 65b584b13375549113c4bd25b14116a013ef08f2 (patch) | |
tree | 5125a63f0400489093497a18646cc5cd2c0acc15 /Master/texmf-dist/tex/latex/thmtools/thm-restate.sty | |
parent | c8341d201aa8f8dfccefe14289a4c9031ae066e4 (diff) |
thmtools update (5apr10)
git-svn-id: svn://tug.org/texlive/trunk@17726 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/thmtools/thm-restate.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/thmtools/thm-restate.sty | 65 |
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 }{% |