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/doc/latex/thmtools/TODO | 1 + Master/texmf-dist/doc/latex/thmtools/thmtools.pdf | Bin 93344 -> 98208 bytes .../texmf-dist/source/latex/thmtools/parseargs.dtx | 4 +- Master/texmf-dist/source/latex/thmtools/thm-kv.dtx | 61 ++++++++++++- .../source/latex/thmtools/thm-listof.dtx | 97 +++++++++++++++++++-- .../texmf-dist/source/latex/thmtools/thm-patch.dtx | 57 ++++++++++-- .../source/latex/thmtools/thm-restate.dtx | 82 +++++++++++++++-- .../texmf-dist/source/latex/thmtools/thmtools.dtx | 10 ++- 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 +- 14 files changed, 469 insertions(+), 43 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/thmtools/TODO b/Master/texmf-dist/doc/latex/thmtools/TODO index 8e7fd1d08e9..52e6a7de939 100644 --- a/Master/texmf-dist/doc/latex/thmtools/TODO +++ b/Master/texmf-dist/doc/latex/thmtools/TODO @@ -1,6 +1,7 @@ - maybe store more counters in thm-restate? currently, you cannot re-use equation numbers, for example. Those all need to be carried around via \label or equivalent. + FIXED in beta13 - when using framed, restated version has different vertical spacing. Oh dear oh dear, might be some addvspace artifact? diff --git a/Master/texmf-dist/doc/latex/thmtools/thmtools.pdf b/Master/texmf-dist/doc/latex/thmtools/thmtools.pdf index 4ca96448127..d7885b402c1 100644 Binary files a/Master/texmf-dist/doc/latex/thmtools/thmtools.pdf and b/Master/texmf-dist/doc/latex/thmtools/thmtools.pdf differ diff --git a/Master/texmf-dist/source/latex/thmtools/parseargs.dtx b/Master/texmf-dist/source/latex/thmtools/parseargs.dtx index 2ce98271bf4..bf89eaefde1 100644 --- a/Master/texmf-dist/source/latex/thmtools/parseargs.dtx +++ b/Master/texmf-dist/source/latex/thmtools/parseargs.dtx @@ -30,7 +30,7 @@ \newcommand\ParseArgs{\textsf{ParseArgs}} \title{The \ParseArgs\ package\thanks{% This file documents version~\fileversion\ of~\filedate, - RCS ${}$Id: parseargs.dtx,v 1.2 2008/06/22 12:09:33 ulmi Exp ulmi ${}$. + RCS ${}$Id: parseargs.dtx,v 1.3 2008/08/03 13:10:16 ulmi Exp ulmi ${}$. }} \author{Ulrich M. Schwarz\thanks{ulmi@absatzen.de}} @@ -125,7 +125,7 @@ %\parseOpt{openchar}{closechar}{yes}{no} % \typeout{attemping #1#2...}% \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/source/latex/thmtools/thm-kv.dtx b/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx index a24ef9beefc..d731d62f1ea 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx @@ -19,8 +19,14 @@ \usepackage[scaled]{luximono} \usepackage{amsmath, amsthm} -\usepackage{thm-kv} +\usepackage{thm-kv, thm-patch} \newtheorem{lemma}{Lemma} +\declaretheorem[sibling=lemma, shaded, name={Rule of Thumb}]{ruleofthumb} +\usepackage{color} +\declaretheorem[shaded={bgcolor={rgb}{1,0,0},rulecolor={rgb}{0,1,0},rulewidth=2em, + margin=1em, textwidth=5cm}]{eyesore} + + \GetFileInfo{thm-kv.sty} \providecommand\pkg{\textsf} \EnableCrossrefs @@ -107,15 +113,63 @@ % Note that currently, no care is taken to prevent this from becoming the % default style for subsequent theorems. %\end{description} +% +% \subsection{Examples} +% In many cases, you'll just get by with +% \begin{verbatim} +% \declaretheorem{lemma} +% \end{verbatim} +% which creates the environment `lemma', which will be labeled `Lemma' and +% numbered consecutively throughout: +%\begin{lemma} +% This is what it looks like. +%\end{lemma} +% If you have more environments, you +% might want +% \begin{verbatim} +% \declaretheorem[sibling=lemma]{theorem} +% \end{verbatim} +% which will make the theorems share the numbering with the lemmas. If you +% had wanted per-chapter numbering for everything, you would have said +%\begin{verbatim} +% \declaretheorem[parent=chapter]{lemma} +%\end{verbatim} +% without need to change subsequent declarations. A very fancy declaration +% using the shadethm and thm-patch package would look like this: +%\begin{verbatim} +% \declaretheorem[sibling=theorem, shaded, name={Rule of Thumb}]{ruleofthumb} +%\end{verbatim} +% +%\begin{ruleofthumb} +% If all else fails, read the manual. Usually all else fails because you +% didn't. +% \end{ruleofthumb} +% +% You can customize the colors and border like this: +%\begin{verbatim} +%\declaretheorem[shaded={bgcolor={rgb}{1,0,0},rulecolor={rgb}{0,1,0},rulewidth=2em, +% margin=1em, textwidth=5cm}]{eyesore} +%\end{verbatim} +%\begin{eyesore} +% But doing that is strongly discouraged. +%\end{eyesore} +% +% There is also an interface to the thmbox package: you can use |thmbox=X|, +% where X is one of the styles L, M, S as defined by that package. +% (Actually, the parameter you give here is just passed on as optional +% argument to |\newboxtheorem|, so the other parameters like headstyle are valid as well.) +% The +% redefinition of proof and example is suppressed unless you load the thmbox +% package manually before you load thmtools. % %\StopEventually{} %\section{Implementation} % \begin{macrocode} \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}} @@ -189,6 +243,7 @@ % \begin{macrocode} \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/source/latex/thmtools/thm-listof.dtx b/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx index 9c5f33d7f7d..5b025bc4039 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx @@ -31,7 +31,7 @@ \newcommand\thmlistof{\textsf{thm-listof}} \title{The \thmlistof\ package\thanks{% This file documents version~\fileversion\ of~\filedate, - RCS ${}$Id: thm-listof.dtx,v 1.8 2008/05/10 15:34:06 ulmi Exp ${}$. + RCS ${}$Id: thm-listof.dtx,v 1.11 2009/03/22 18:05:57 ulmi Exp ulmi ${}$. }} \author{Ulrich M. Schwarz\thanks{ulmi@absatzen.de}} @@ -77,6 +77,25 @@ % |\listoftheorems| will generate, well, a list of all theorems, lemmas, % etc. in your document. This list is hyperlinked if you use \pkg{hyperref}, % and it will list the optional argument to the theorem. +% +% Currently, some options can be given as an optional argument keyval list: +% \begin{description} +% \item[numwidth] The width allocated for the numbers, default 2.3em. Since +% you are more likely to have by-section numbering than with figures, this +% needs to be accessible. +% \item[ignore=foo,bar] A last-second call to |\ignoretheorems|, see below. +% \item[onlynamed=foo,bar] Only list those foo and bar environments that +% had an optional title. This weeds out unimportant definitions, for +% example. If no argument is given, this applies to all environments +% defined by |\newtheorem| and |\declaretheorem|. +% \item[show=foo,bar] Undo a previous |\ignoretheorems| and restore default +% formatting for these environments. Useful in combination with +% ignoreall. +% \item[ignoreall] +% \item[showall] Like applying ignore or show with a list of all theorems +% you have defined. +% \end{description} +% % \DescribeMacro{\listtheoremname} % The heading name is stored in the macro |\listtheoremname| and is % ``List of Theorems'' by default. All other formatting aspects are taken @@ -95,7 +114,7 @@ %\section{Implementation} % \begin{macrocode} \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} @@ -113,32 +132,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]{% @@ -146,6 +201,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}% + }% + }% +} % \end{macrocode} %\iffalse % diff --git a/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx b/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx index babae96b14f..ccd9ba16397 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx @@ -31,7 +31,7 @@ \newcommand\thmpatch{\textsf{thm-patch}} \title{The \thmpatch\ package\thanks{% This file documents version~\fileversion\ of~\filedate, - RCS ${}$Id: thm-patch.dtx,v 1.12 2008/06/22 12:11:29 ulmi Exp ulmi ${}$. + RCS ${}$Id: thm-patch.dtx,v 1.15 2008/09/02 19:33:09 ulmi Exp ulmi ${}$. }} \author{Ulrich M. Schwarz\thanks{ulmi@absatzen.de}} @@ -107,7 +107,7 @@ %\section{Implementation} % \begin{macrocode} \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} @@ -165,6 +165,8 @@ } \let\thmt@original@newtheorem\newtheorem +\let\thmt@theoremdefiner\thmt@original@newtheorem + \def\newtheorem{% \thmt@isstarredfalse \thmt@hassiblingfalse @@ -203,7 +205,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 }% @@ -212,7 +214,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 @@ -223,7 +225,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}{}% @@ -254,6 +256,51 @@ \expandafter\g@prependto@macro\csname thmt@#1@postfoothook\endcsname% } +% \end{macrocode} +% Since rev1.16, we add hooks to the proof environment as well, if it exists. +% If it doesn't exist at this point, we're probably using ntheorem as +% backend, where it goes through the regular theorem mechanism anyway. +% \begin{macrocode} +\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 % \end{macrocode} %\iffalse % diff --git a/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx b/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx index cc42229c1a7..2f7a4ec1e6b 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx @@ -31,7 +31,7 @@ \newcommand\thmrestate{\textsf{thm-restate}} \title{The \thmrestate\ package\thanks{% This file documents version~\fileversion\ of~\filedate, - RCS ${}$Id: thm-restate.dtx,v 1.12 2008/03/09 20:06:09 ulmi Exp ${}$. + RCS ${}$Id: thm-restate.dtx,v 1.16 2010/04/05 18:02:27 ulmi Exp ulmi ${}$. }} \author{Ulrich M. Schwarz\thanks{ulmi@absatzen.de}} @@ -126,7 +126,20 @@ % % \subsection{Restrictions} % The only counter that is saved is the one for the theorem number. So, -% putting floats inside a restatable is not advised. You cannot nest +% putting floats inside a restatable is not advised: they will appear in the +% LoF several times with new numbers. +% Equations should work, but the code handling them might turn out to be +% brittle, in particular when you add/remove hyperref. +% %In the same vein, numbered equations +% %within the statement appear again and are numbered again, with new +% %numbers. (This is vaguely non-trivial to do correctly if equations are not +% %numbered consecutively, but per-chapter, or there are multiple numbered +% %equations.) +% Note that you cannot successfully reference the equations +% since all labels are disabled in the starred appearance. (The reference +% will point at the unstarred occurence.) +% +% You cannot nest % restatables either. You \emph{can} use the |\restatable|\dots|\endrestatable| % version, but everything up to the next matching |\end{...}| is scooped up. % I've also probably missed many border cases. @@ -136,7 +149,7 @@ %\section{Implementation} % \begin{macrocode} \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 @@ -161,6 +174,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{% @@ -173,12 +215,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 @@ -187,6 +257,7 @@ \fi ##1 \csname end#2\endcsname + \ifthmt@thisistheone\else\thmt@restorecounters\fi \endgroup }% \csname #3\@xa\endcsname\ifthmt@thisistheone\else*\fi @@ -196,6 +267,7 @@ }{% %% now empty, just used as a marker. } + \newenvironment{restatable}{% \thmt@thisistheonetrue\thmt@restatable }{% diff --git a/Master/texmf-dist/source/latex/thmtools/thmtools.dtx b/Master/texmf-dist/source/latex/thmtools/thmtools.dtx index 4869e8da834..67106b76f21 100644 --- a/Master/texmf-dist/source/latex/thmtools/thmtools.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thmtools.dtx @@ -15,7 +15,7 @@ \let\pkg\textsf \def\thmtools{\pkg{thmtools}} -\def\thmversion{2008/06/22 v0.1beta6} +\def\thmversion{2010/04/05 v0.1beta13} \usepackage[T1]{fontenc} \usepackage[widespace]{fourier} @@ -26,6 +26,12 @@ \usepackage{thm-patch, thm-kv, thm-autoref, thm-listof, thm-restate} \declaretheorem{remark} \declaretheorem{lemma} +\declaretheorem[sibling=lemma, shaded, name={Rule of Thumb}]{ruleofthumb} +\usepackage{color} +\declaretheorem[shaded={bgcolor={rgb}{1,0,0},rulecolor={rgb}{0,1,0},rulewidth=2em, + margin=1em, textwidth=5cm}]{eyesore} + + \EnableCrossrefs \CodelineIndex \RecordChanges @@ -75,7 +81,7 @@ %<*thmtools> %\fi \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} %\iffalse % 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