From 65b584b13375549113c4bd25b14116a013ef08f2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 5 Apr 2010 23:25:35 +0000 Subject: thmtools update (5apr10) git-svn-id: svn://tug.org/texlive/trunk@17726 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/thmtools/parseargs.sty | 2 +- Master/texmf-dist/tex/latex/thmtools/thm-kv.sty | 5 +- .../texmf-dist/tex/latex/thmtools/thm-listof.sty | 76 ++++++++++++++++++++-- Master/texmf-dist/tex/latex/thmtools/thm-patch.sty | 50 ++++++++++++-- .../texmf-dist/tex/latex/thmtools/thm-restate.sty | 65 +++++++++++++++++- Master/texmf-dist/tex/latex/thmtools/thmtools.sty | 2 +- 6 files changed, 182 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/thmtools/parseargs.sty b/Master/texmf-dist/tex/latex/thmtools/parseargs.sty index 6e4d5f79ccf..b08ac01f3ed 100644 --- a/Master/texmf-dist/tex/latex/thmtools/parseargs.sty +++ b/Master/texmf-dist/tex/latex/thmtools/parseargs.sty @@ -48,7 +48,7 @@ \newcommand\parseOpt[4]{% %\parseOpt{openchar}{closechar}{yes}{no} \def\@parsecmd{% - \@ifnextchar#1{\@@reallyparse}{#4\@parse} + \@ifnextchar#1{\@@reallyparse}{#4\@parse}% }% \def\@@reallyparse#1##1#2{% #3\@parse diff --git a/Master/texmf-dist/tex/latex/thmtools/thm-kv.sty b/Master/texmf-dist/tex/latex/thmtools/thm-kv.sty index 534135a8316..fec5a0051ba 100644 --- a/Master/texmf-dist/tex/latex/thmtools/thm-kv.sty +++ b/Master/texmf-dist/tex/latex/thmtools/thm-kv.sty @@ -19,10 +19,10 @@ %% http://www.latex-project.org/lppl/lppl-1-3a.txt %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{thm-kv}[2008/06/22 v0.1beta6 thm-kv interface (ulmi)] +\ProvidesPackage{thm-kv}[2009/07/30 v0.1beta11 thm-kv interface (ulmi)] \let\@xa\expandafter \let\@nx\noexpand -\usepackage{keyval} +\RequirePackage{keyval} \define@key{thmt}{parent}{\thmt@setparent{#1}} \define@key{thmt}{numberwithin}{\thmt@setparent{#1}} @@ -88,6 +88,7 @@ } \define@key{thmt}{shaded}[{}]{% \RequirePackage{shadethm}% + \RequirePackage{thm-patch}% \addtotheorempreheadhook[\thmt@envname]{% \setlength\shadedtextwidth{\linewidth}% \setkeys{thmt@shade}{#1}\begin{shadebox}}% diff --git a/Master/texmf-dist/tex/latex/thmtools/thm-listof.sty b/Master/texmf-dist/tex/latex/thmtools/thm-listof.sty index ffcf87aa17b..b97353af4da 100644 --- a/Master/texmf-dist/tex/latex/thmtools/thm-listof.sty +++ b/Master/texmf-dist/tex/latex/thmtools/thm-listof.sty @@ -19,7 +19,7 @@ %% http://www.latex-project.org/lppl/lppl-1-3a.txt %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{thm-listof}[2008/05/10 v0.1beta3 thm-listof (ulmi)] +\ProvidesPackage{thm-listof}[2010/04/05 v0.1beta13 thm-listof (ulmi)] \let\@xa=\expandafter \let\@nx=\noexpand \RequirePackage{thm-patch} @@ -37,32 +37,68 @@ } \providecommand\listtheoremname{List of Theorems} -\newcommand\listoftheorems{% +\newcommand\listoftheorems[1][]{% %% much hacking here to pick up the definition from the class %% without oodles of conditionals. \bgroup + \setlisttheoremstyle{#1}% \let\listfigurename\listtheoremname \let\thref@starttoc\@starttoc \def\@starttoc##1{\thref@starttoc{loe}}% + % new hack: to allow multiple calls, we defer the opening of the + % loe file to AtEndDocument time. This is before the aux file is + % read back again, that is early enough. + % TODO: is it? crosscheck include/includeonly! + \@fileswfalse + \AtEndDocument{% + \if@filesw + \@ifundefined{tf@loe}{% + \expandafter\newwrite\csname tf@loe\endcsname + \immediate\openout \csname tf@loe\endcsname \jobname.loe\relax + }{}% + \fi + }% \expandafter\listoffigures \egroup } +\newcommand\setlisttheoremstyle[1]{% + \setkeys{thmt-listof}{#1}% +} +\define@key{thmt-listof}{numwidth}{\def\thmt@listnumwidth{#1}} +\define@key{thmt-listof}{ignore}[\thmt@allenvs]{\ignoretheorems{#1}} +\define@key{thmt-listof}{onlynamed}[\thmt@allenvs]{\onlynamedtheorems{#1}} +\define@key{thmt-listof}{show}[\thmt@allenvs]{\showtheorems{#1}} +\define@key{thmt-listof}{ignoreall}[true]{\ignoretheorems{\thmt@allenvs}} +\define@key{thmt-listof}{showall}[true]{\showtheorems{\thmt@allenvs}} + +\providecommand\thmt@listnumwidth{2.3em} + +\providecommand\thmtformatoptarg[1]{ (#1)} + \newcommand\thmt@mklistcmd{% - \@xa\protected@edef\csname l@\thmt@envname\endcsname{% - \@nx\@dottedtocline{1}{1.5em}{2.3em}% + \@xa\protected@edef\csname l@\thmt@envname\endcsname{% CHECK: why p@edef? + \@nx\@dottedtocline{1}{1.5em}{\@nx\thmt@listnumwidth}% + }% + \@xa\def\csname ll@\thmt@envname\endcsname{% + \protect\numberline{\csname the\thmt@envname\endcsname}% + \thmt@thmname + \ifx\@empty\thmt@optarg\else\protect\thmtformatoptarg{\thmt@optarg}\fi }% } +\def\thmt@allenvs{\@gobble} +\newcommand\thmt@recordenvname{% + \edef\thmt@allenvs{\thmt@allenvs,\thmt@envname}% +} \g@addto@macro\thmt@newtheorem@predefinition{% \thmt@mklistcmd + \thmt@recordenvname } \addtotheorempostheadhook{% \thmtlo@chaptervspacehack \addcontentsline{loe}{\thmt@envname}{% - \numberline{\csname the\thmt@envname\endcsname}% - \thmt@thmname - \ifx\@empty\thmt@optarg\else\protect\space(\thmt@optarg)\fi + \csname ll@\thmt@envname\endcsname }% } \newcommand\ignoretheorems[1]{% @@ -70,6 +106,32 @@ \@xa\let\csname l@\thm\endcsname=\@gobbletwo }% } +\newcommand\onlynamedtheorems[1]{% + \@for\thm:=#1\do{% + \@xa\let\csname l@\thm\endcsname=\thmt@showifnamedtheorem + }% +} +\def\thmt@showifnamedtheorem#1#2{% + % check for \thmtformatoptarg on top level of first argument. + \thmt@sh@wifnamedtheorem#1\thmtformatoptarg\@nil{% + \@dottedtocline{1}{1.5em}{\thmt@listnumwidth}{#1}{#2}% + }{}% +} +\def\thmt@sh@wifnamedtheorem#1\thmtformatoptarg#2\@nil{% + \ifx\@nil#2\@nil + \@xa\@secondoftwo + \else + \@xa\@firstoftwo + \fi +} + +\newcommand\showtheorems[1]{% + \@for\thm:=#1\do{% + \@xa\protected@edef\csname l@\thm\endcsname{% CHECK: why p@edef? + \@nx\@dottedtocline{1}{1.5em}{\@nx\thmt@listnumwidth}% + }% + }% +} \endinput %% %% End of file `thm-listof.sty'. diff --git a/Master/texmf-dist/tex/latex/thmtools/thm-patch.sty b/Master/texmf-dist/tex/latex/thmtools/thm-patch.sty index bc8d171a2c4..d46a47a97d0 100644 --- a/Master/texmf-dist/tex/latex/thmtools/thm-patch.sty +++ b/Master/texmf-dist/tex/latex/thmtools/thm-patch.sty @@ -19,7 +19,7 @@ %% http://www.latex-project.org/lppl/lppl-1-3a.txt %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{thm-patch}[2008/06/22 v0.1beta6 thm-patch (ulmi)] +\ProvidesPackage{thm-patch}[2008/09/02 v0.1beta6b thm-patch (ulmi)] \let\@xa=\expandafter \let\@nx=\noexpand \RequirePackage{parseargs} @@ -77,6 +77,8 @@ } \let\thmt@original@newtheorem\newtheorem +\let\thmt@theoremdefiner\thmt@original@newtheorem + \def\newtheorem{% \thmt@isstarredfalse \thmt@hassiblingfalse @@ -115,7 +117,7 @@ \protected@edef\thmt@tmp{% \def\@nx\thmt@envname{\thmt@envname}% \def\@nx\thmt@thmname{\thmt@thmname}% - } + }% \@xa\addtotheorempreheadhook\@xa[\@xa\thmt@envname\@xa]\@xa{% \thmt@tmp }% @@ -124,7 +126,7 @@ % this adds two command calls to the newly-defined theorem. \@xa\let\csname thmt@original@#1\@xa\endcsname \csname#1\endcsname - \@xa\renewcommand\csname #1\endcsname{ + \@xa\renewcommand\csname #1\endcsname{% \thmt@parsetheoremargs{#1}% }% \@xa\let\csname thmt@original@end#1\@xa\endcsname\csname end#1\endcsname @@ -135,7 +137,7 @@ \csname thmt@original@end#1\endcsname \csname thmt@generic@postfoothook\endcsname \csname thmt@#1@postfoothook\endcsname - } + }% \@namedef{thmt@#1@preheadhook}{}% \@namedef{thmt@#1@postheadhook}{}% \@namedef{thmt@#1@prefoothook}{}% @@ -166,6 +168,46 @@ \expandafter\g@prependto@macro\csname thmt@#1@postfoothook\endcsname% } +\ifx\proof\endproof\else% yup, that's a quaint way of doing it :) + % FIXME: this assumes proof has the syntax of theorems, which + % usually happens to be true (optarg overrides "Proof" string). + % FIXME: refactor into thmt@addtheoremhook, but we really don't want to + % call the generic-hook... + \let\thmt@original@proof=\proof + \renewcommand\proof{% + \thmt@parseproofargs% + }% + \def\thmt@parseproofargs{% + \parse{% + {\parseOpt[]{\def\thmt@optarg{##1}}{\let\thmt@optarg\@empty}}% + {% + \thmt@proof@preheadhook + %\thmt@generic@preheadhook + \protected@edef\tmp@args{% + \ifx\@empty\thmt@optarg\else [\thmt@optarg]\fi + }% + \csname thmt@original@proof\@xa\endcsname\tmp@args + \thmt@proof@postheadhook + %\thmt@generic@postheadhook + \let\@parsecmd\@empty + }% + }% + }% + + \let\thmt@original@endproof=\endproof + \def\endproof{% + % these need to be in opposite order of headhooks. + %\csname thmtgeneric@prefoothook\endcsname + \thmt@proof@prefoothook + \thmt@original@endproof + %\csname thmt@generic@postfoothook\endcsname + \thmt@proof@postfoothook + }% + \@namedef{thmt@proof@preheadhook}{}% + \@namedef{thmt@proof@postheadhook}{}% + \@namedef{thmt@proof@prefoothook}{}% + \@namedef{thmt@proof@postfoothook}{}% +\fi \endinput %% %% End of file `thm-patch.sty'. 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 }{% diff --git a/Master/texmf-dist/tex/latex/thmtools/thmtools.sty b/Master/texmf-dist/tex/latex/thmtools/thmtools.sty index 82c5e760aa8..d62d9ad86dc 100644 --- a/Master/texmf-dist/tex/latex/thmtools/thmtools.sty +++ b/Master/texmf-dist/tex/latex/thmtools/thmtools.sty @@ -19,7 +19,7 @@ %% http://www.latex-project.org/lppl/lppl-1-3a.txt %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{thmtools}[2008/06/22 v0.1beta6 Tools for theorem typesetting (ulmi)] +\ProvidesPackage{thmtools}[2008/07/05 v0.1beta7 Tools for theorem typesetting (ulmi)] \RequirePackage{thm-kv, thm-autoref, thm-listof} \endinput %% -- cgit v1.2.3