diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/thmtools/thm-patch.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/thmtools/thm-patch.sty | 50 |
1 files changed, 46 insertions, 4 deletions
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'. |