diff options
author | Karl Berry <karl@freefriends.org> | 2011-08-23 16:25:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-08-23 16:25:16 +0000 |
commit | 95f44e6aaa9707ee94a8dfa04153274ce05396ac (patch) | |
tree | 56bd92a8ce774691f853b353e17f59fe54dcd5aa /Master/texmf-dist/source/latex/thmtools | |
parent | 4731222142fb8eb709e5f954db3231ea1283eb63 (diff) |
thmtools 61 (22aug11)
git-svn-id: svn://tug.org/texlive/trunk@23659 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/thmtools')
6 files changed, 115 insertions, 39 deletions
diff --git a/Master/texmf-dist/source/latex/thmtools/thm-amsthm.dtx b/Master/texmf-dist/source/latex/thmtools/thm-amsthm.dtx index 52a667a966d..31a2397f478 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-amsthm.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-amsthm.dtx @@ -8,6 +8,8 @@ %<*amsthm> %\fi % \begin{macrocode} +\providecommand\thmt@space{ } + \define@key{thmstyle}{spaceabove}{% \def\thmt@style@spaceabove{#1}% } @@ -41,10 +43,16 @@ \newtoks\thmt@style@headstyle \define@key{thmstyle}{headformat}[]{% + \thmt@setheadstyle{#1}% +} +\define@key{thmstyle}{headstyle}[]{% + \thmt@setheadstyle{#1}% +} +\def\thmt@setheadstyle#1{% \thmt@style@headstyle{% \def\NAME{\the\thm@headfont ##1}% \def\NUMBER{\bgroup\@upn{##2}\egroup}% - \def\NOTE{\if=##3=\else\bgroup\ \the\thm@notefont(##3)\egroup\fi}% + \def\NOTE{\if=##3=\else\bgroup\thmt@space\the\thm@notefont(##3)\egroup\fi}% }% \def\thmt@tmp{#1}% \@onelevel@sanitize\thmt@tmp @@ -57,7 +65,7 @@ \else \thmt@style@headstyle\@xa{% \the\thmt@style@headstyle - #1 + #1% }% \fi %\showthe\thmt@style@headstyle diff --git a/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx b/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx index 02f81e1932f..2dc6e484486 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx @@ -36,39 +36,77 @@ \RequirePackage{keyval,kvsetkeys,thm-patch} -\@ifpackagelater{kvsetkeys}{2010/07/02}{% - % assume Heiko goes along with my patch... -}{% - \RequirePackage{etex} - \PackageInfo{thm-kv}{kvsetkeys patch applied}% - \long\def\kv@processor@default#1#2#3{% - \protected@edef\kvsu@fam{#1}% new - \@onelevel@sanitize\kvsu@fam% new - \protected@edef\kvsu@key{#2}% new - \@onelevel@sanitize\kvsu@key% new - \unless\ifcsname KV@#1@\kvsu@key\endcsname - \unless\ifcsname KVS@#1@handler\endcsname - \kv@error@unknownkey{#1}{\kvsu@key}% +\long\def\thmt@kv@processor@default#1#2#3{% + \def\kvsu@fam{#1}% new + \@onelevel@sanitize\kvsu@fam% new + \def\kvsu@key{#2}% new + \@onelevel@sanitize\kvsu@key% new + \unless\ifcsname KV@#1@\kvsu@key\endcsname + \unless\ifcsname KVS@#1@handler\endcsname + \kv@error@unknownkey{#1}{\kvsu@key}% + \else + \csname KVS@#1@handler\endcsname{#2}{#3}% + % still using #2 #3 here is intentional: handler might + % be used for strange stuff like implementing key names + % that contain strange characters or other strange things. + \relax + \fi + \else + \ifx\kv@value\relax + \unless\ifcsname KV@#1@\kvsu@key @default\endcsname + \kv@error@novalue{#1}{\kvsu@key}% + \else + \csname KV@#1@\kvsu@key @default\endcsname + \relax + \fi + \else + \csname KV@#1@\kvsu@key\endcsname{#3}% + \fi + \fi +} + +\@ifpackagelater{kvsetkeys}{2011/04/06}{% + % Patch has disappeared somewhere... thanksalot. + \PackageInfo{thm-kv}{kvsetkeys patch (v1.13 or later)} + \long\def\tmp@KVS@PD#1#2#3{% no non-etex-support here... + \unless\ifcsname KV@#1@#2\endcsname + \unless\ifcsname KVS@#1@handler\endcsname + \kv@error@unknownkey{#1}{#2}% \else \csname KVS@#1@handler\endcsname{#2}{#3}% - % still using #2 #3 here is intentional: handler might - % be used for strange stuff like implementing key names - % that contain strange characters or other strange things. \relax \fi \else \ifx\kv@value\relax - \unless\ifcsname KV@#1@\kvsu@key @default\endcsname - \kv@error@novalue{#1}{\kvsu@key}% + \unless\ifcsname KV@#1@#2@default\endcsname + \kv@error@novalue{#1}{#2}% \else - \csname KV@#1@\kvsu@key @default\endcsname + \csname KV@#1@#2@default\endcsname \relax \fi \else - \csname KV@#1@\kvsu@key\endcsname{#3}% + \csname KV@#1@#2\endcsname{#3}% \fi \fi + }% + \ifx\tmp@KVS@PD\KVS@ProcessorDefault + \let\KVS@ProcessorDefault\thmt@kv@processor@default + \def\kv@processor@default#1#2{% + \begingroup + \csname @safe@activestrue\endcsname + \let\ifincsname\iftrue + \edef\KVS@temp{\endgroup + \noexpand\KVS@ProcessorDefault{#1}{\unexpanded{#2}}% + }% + \KVS@temp } + \else + \PackageError{thm-kv}{kvsetkeys patch failed, try kvsetkeys v1.13 or earlier} + \fi +}{% + \RequirePackage{etex} + \PackageInfo{thm-kv}{kvsetkeys patch applied (pre-1.13)}% + \let\kv@processor@default\thmt@kv@processor@default } % useful key handler defaults. @@ -279,6 +317,7 @@ \thmt@thmuse@iskvfalse \def\thmt@newoptarg{\@gobble}% \def\thmt@newoptargextra{}% + \let\thmt@shortoptarg\@empty \def\thmt@warn@unusedkeys{}% \@for\thmt@fam:=\thmt@thmuse@families\do{% \kvsetkeys{\thmt@fam}{#1}% @@ -288,7 +327,9 @@ \@xa\thmt@newoptarg \thmt@newoptargextra\@empty }% - \protected@edef\thmt@shortoptarg{\thmt@newoptarg\@empty}% + \ifx\thmt@shortoptarg\@empty + \protected@edef\thmt@shortoptarg{\thmt@newoptarg\@empty}% + \fi \thmt@warn@unusedkeys \else \def\thmt@optarg{#1}% @@ -328,8 +369,13 @@ \addtotheorempostheadhook[local]{\label{#1}}% } \thmt@define@thmuse@key{name}{% - \def\thmt@newoptarg{#1\@iden}% + \thmt@setnewoptarg #1\@iden% +} +\newcommand\thmt@setnewoptarg[1][]{% + \def\thmt@shortoptarg{#1}\thmt@setnewlongoptarg } +\def\thmt@setnewlongoptarg #1\@iden{% + \def\thmt@newoptarg{#1\@iden}} \providecommand\thmt@suspendcounter[2]{% \@xa\protected@edef\csname the#1\endcsname{#2}% diff --git a/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx b/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx index ff216fe5f8b..6eb4921020f 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-listof.dtx @@ -60,14 +60,17 @@ \def\thmtlo@oldchapter{0}% \newcommand\thmtlo@chaptervspacehack{} \ifcsname c@chapter\endcsname - \def\thmtlo@chaptervspacehack{% - \ifnum \value{chapter}>\thmtlo@oldchapter\relax - % new chapter, add vspace to loe. - \addtocontents{loe}{\protect\addvspace{10\p@}}% - \xdef\thmtlo@oldchapter{\arabic{chapter}}% - \fi - }% + \ifx\c@chapter\relax\else + \def\thmtlo@chaptervspacehack{% + \ifnum \value{chapter}>\thmtlo@oldchapter\relax + % new chapter, add vspace to loe. + \addtocontents{loe}{\protect\addvspace{10\p@}}% + \xdef\thmtlo@oldchapter{\arabic{chapter}}% + \fi + }% + \fi \fi + \providecommand\listtheoremname{List of Theorems} \newcommand\listoftheorems[1][]{% diff --git a/Master/texmf-dist/source/latex/thmtools/thm-ntheorem.dtx b/Master/texmf-dist/source/latex/thmtools/thm-ntheorem.dtx index 09f528cb001..ccd12dc30d8 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-ntheorem.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-ntheorem.dtx @@ -9,6 +9,8 @@ %\fi % \begin{macrocode} +\providecommand\thmt@space{ } + % actually, ntheorem's so-called style is nothing like a style at all... \def\thmt@declaretheoremstyle@setup{} \def\thmt@declaretheoremstyle#1{% @@ -88,7 +90,7 @@ \item[\hskip\labelsep\theorem@headerfont% \def\NAME{\theorem@headerfont ####1}% \def\NUMBER{\bgroup\@upn{####2}\egroup}% - \def\NOTE{\if=####3=\else\bgroup\ (####3)\egroup\fi}% + \def\NOTE{\if=####3=\else\bgroup\thmt@space(####3)\egroup\fi}% \csname thmt@headstyle@#1\endcsname \theorem@separator ] @@ -106,7 +108,7 @@ \item[\hskip\labelsep\theorem@headerfont% \def\NAME{\the\thm@headfont ####1}% \def\NUMBER{\bgroup\@upn{####2}\egroup}% - \def\NOTE{\if=####3=\else\bgroup\ (####3)\egroup\fi}% + \def\NOTE{\if=####3=\else\bgroup\thmt@space(####3)\egroup\fi}% #1% \theorem@separator ] diff --git a/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx b/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx index 58d840b1d41..033a48254e7 100644 --- a/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx @@ -252,7 +252,7 @@ \label{thmt@@#3}% \fi % this will be the collected body. - ##1 + ##1% \csname end#2\endcsname % if we faked the counter values, restore originals now. \ifthmt@thisistheone\else\thmt@restorecounters\fi @@ -285,17 +285,27 @@ ,restate phase 1% ,restate phase 2% } +\newcommand\thmt@splitrestateargs[1][]{% + \g@addto@macro\thmt@storedoptargs{,#1}% + \def\tmp@a##1\@{\def\thmt@storename{##1}}% + \tmp@a +} \newif\ifthmt@restatethis \define@key{restate phase 1}{restate}{% - \thmt@debug{we will restate as #1}% + \thmt@thmuse@iskvtrue + \def\thmt@storedoptargs{}% discard the first time around + \thmt@splitrestateargs #1\@ + \def\thmt@storedoptargs{}% discard the first time around + %\def\thmt@storename{#1}% + \thmt@debug{we will restate as `\thmt@storename' with more args + `\thmt@storedoptargs'}% \@namedef{thmt@unusedkey@restate}{}% % spurious "unused key" fixes itself once we are after tracknames... \thmt@restatethistrue - \def\thmt@storedoptargs{}% - \def\thmt@storename{#1}% \protected@edef\tmp@a{% \@nx\thmt@thisistheonetrue + \@nx\def\@nx\@currenvir{\thmt@envname}% \@nx\@xa\@nx\thmt@restatable\@nx\@xa[\@nx\thmt@storedoptargs]% {\thmt@envname}{\thmt@storename}% }% @@ -308,11 +318,15 @@ \define@key{restate phase 2}{restate}{% % do not store restate as a key for repetition: % infinite loop. + % instead, retain the added keyvals + % overwriting thmt@storename should be safe here, it's been + % xdefd into the postheadhook + \thmt@splitrestateargs #1\@ } \kv@set@family@handler{restate phase 2}{% \ifthmt@restatethis - \@xa\@xa\@xa\g@addto@macro\@xa\@xa\@xa\thmt@storedoptargs\@xa\@xa\@xa{% - \@xa\kv@key\@xa=\kv@value,}% + \@xa\@xa\@xa\g@addto@macro\@xa\@xa\@xa\thmt@storedoptargs\@xa\@xa\@xa{\@xa\@xa\@xa,% + \@xa\kv@key\@xa=\kv@value}% \fi } diff --git a/Master/texmf-dist/source/latex/thmtools/thmdef-shaded.dtx b/Master/texmf-dist/source/latex/thmtools/thmdef-shaded.dtx index f7f78050673..6377182c3e6 100644 --- a/Master/texmf-dist/source/latex/thmtools/thmdef-shaded.dtx +++ b/Master/texmf-dist/source/latex/thmtools/thmdef-shaded.dtx @@ -49,6 +49,9 @@ \define@key{thmt@shade}{rulecolor}{\thmt@definecolor{shaderulecolor}{#1}} \define@key{thmt@shade}{rulewidth}{\setlength\shadeboxrule{#1}} \define@key{thmt@shade}{margin}{\setlength\shadeboxsep{#1}} +\define@key{thmt@shade}{padding}{\setlength\shadeboxsep{#1}} +\define@key{thmt@shade}{leftmargin}{\setlength\shadeleftshift{#1}} +\define@key{thmt@shade}{rightmargin}{\setlength\shaderightshift{#1}} % \end{macrocode} % % What follows is wizardry you don't have to understand. In essence, |