summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-07-10 00:04:53 +0000
committerKarl Berry <karl@freefriends.org>2010-07-10 00:04:53 +0000
commit0062f2dde6fe9e690fe436bff55f7edb88c78403 (patch)
tree053762f1600f1fab0b70c7213b08d6983c129716 /Master/texmf-dist/source/latex
parent9659e12bf7d3574541e1192914bbe05d1fa6ddf2 (diff)
thmtools update (6jul10)
git-svn-id: svn://tug.org/texlive/trunk@19319 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/thmtools/thm-kv.dtx88
-rw-r--r--Master/texmf-dist/source/latex/thmtools/thm-llncs.dtx90
-rw-r--r--Master/texmf-dist/source/latex/thmtools/thm-patch.dtx13
-rw-r--r--Master/texmf-dist/source/latex/thmtools/thm-restate.dtx112
-rw-r--r--Master/texmf-dist/source/latex/thmtools/thmtools.dtx9
-rw-r--r--Master/texmf-dist/source/latex/thmtools/thmtools.ins1
6 files changed, 275 insertions, 38 deletions
diff --git a/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx b/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx
index fb1dc723eac..42ed3eabb79 100644
--- a/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx
+++ b/Master/texmf-dist/source/latex/thmtools/thm-kv.dtx
@@ -18,8 +18,59 @@
\let\@xa\expandafter
\let\@nx\noexpand
+
+\DeclareOption{lowercase}{%
+ \PackageInfo{thm-kv}{Theorem names will be lowercased}%
+ \global\let\thmt@modifycase\MakeLowercase}
+
+\DeclareOption{uppercase}{%
+ \PackageInfo{thm-kv}{Theorem names will be uppercased}%
+ \global\let\thmt@modifycase\MakeUppercase}
+
+\DeclareOption{anycase}{%
+ \PackageInfo{thm-kv}{Theorem names will be unchanged}%
+ \global\let\thmt@modifycase\@empty}
+
+\ExecuteOptions{uppercase}
+\ProcessOptions\relax
+
\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}%
+ \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
+ }
+}
+
% useful key handler defaults.
\newcommand\thmt@mkignoringkeyhandler[1]{%
\kv@set@family@handler{#1}{%
@@ -177,10 +228,13 @@
\thmt@mkextendingkeyhandler{thmdef}{thmdef}{\string\declaretheorem\space key}
+\let\thmt@newtheorem\newtheorem
+
\newcommand\declaretheorem[2][]{%
- \let\thmt@theoremdefiner\thmt@original@newtheorem
+ % why was that here?
+ %\let\thmt@theoremdefiner\thmt@original@newtheorem
\def\thmt@envname{#2}%
- \thmt@setthmname{\MakeUppercase #2}%
+ \thmt@setthmname{\thmt@modifycase #2}%
\thmt@setparent{}%
\thmt@setsibling{}%
\thmt@isnumberedtrue%
@@ -188,12 +242,14 @@
\kvsetkeys{thmdef0}{#1}%
\kvsetkeys{thmdef}{#1}%
\protected@edef\thmt@tmp{%
- \@nx\newtheorem
+ \@nx\thmt@newtheorem
\ifthmt@isnumbered\else *\fi
{#2}%
\ifx\thmt@sibling\@empty\else [\thmt@sibling]\fi
{\thmt@thmname}%
\ifx\thmt@parent\@empty\else [\thmt@parent]\fi
+ \relax% added so we can delimited-read everything later
+ % (recall newtheorem is patched)
}%\show\thmt@tmp
\thmt@tmp
% uniquely ugly kludge: some keys make only sense
@@ -275,6 +331,28 @@
\def\thmt@newoptarg{#1\@iden}%
}
+\providecommand\thmt@suspendcounter[2]{%
+ \@xa\protected@edef\csname the#1\endcsname{#2}%
+ \@xa\let\csname c@#1\endcsname\c@thmt@dummyctr
+}
+
+\providecommand\thmcontinues[1]{%
+ \ifcsname hyperref\endcsname
+ \hyperref[#1]{continuing}
+ \else
+ continuing
+ \fi
+ from p.\,\pageref{#1}%
+}
+
+\thmt@define@thmuse@key{continues}{%
+ \thmt@suspendcounter{\thmt@envname}{\thmt@trivialref{#1}{??}}%
+ \g@addto@macro\thmt@newoptarg{{, }%
+ \thmcontinues{#1}%
+ \@iden}%
+}
+
+
% \end{macrocode}
%
% Defining new theorem styles; keys are in opt-arg
@@ -297,8 +375,10 @@
\@onlypreamble\declaretheoremstyle
\kv@set@family@handler{thmstyle}{%
+ \@onelevel@sanitize\kv@value
+ \@onelevel@sanitize\kv@key
\PackageInfo{thmtools}{%
- Key `#1' (with value `#2')\MessageBreak
+ Key `\kv@key' (with value `\kv@value')\MessageBreak
is not a known style key.\MessageBreak
Will pass this to every \string\declaretheorem\MessageBreak
that uses `style=\thmt@style'%
diff --git a/Master/texmf-dist/source/latex/thmtools/thm-llncs.dtx b/Master/texmf-dist/source/latex/thmtools/thm-llncs.dtx
new file mode 100644
index 00000000000..5a3b480c2e1
--- /dev/null
+++ b/Master/texmf-dist/source/latex/thmtools/thm-llncs.dtx
@@ -0,0 +1,90 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2010 by Ulrich M. Schwarz
+% See file COPYING for more details.
+%\fi
+%
+%\iffalse (hide this from DocInput)
+%<*llncs>
+%\fi
+% \begin{macrocode}
+\@ifclasslater{llncs}{2010/04/15}{}{%
+ \PackageWarningNoLine{thmtools}{%
+ LLNCS.cls too old, not supported by thmtools
+ }%
+ \endinput}
+% Thank you very much, Springer, for having yet another bloody
+% system. Annoyingly, it makes \xdefs all over the place, so
+% they break \MakeUppercase and hence name=.
+\ifx\thmt@modifycase\@empty\else
+ \PackageWarningNoLine{thmtools}{%
+ LLNCS support disables automatic casing of theorem names
+ }%
+ \let\thmt@modifycase\@empty
+\fi
+%%
+% Usage:
+%
+% \spnewtheorem{env_nam}{caption}[within]{cap_font}{body_font}
+% or \spnewtheorem{env_nam}[numbered_like]{caption}{cap_font}{body_font}
+% or \spnewtheorem*{env_nam}{caption}{cap_font}{body_font}
+\providecommand\thmt@style@headfont{\normalfont\bfseries}
+\providecommand\thmt@style@bodyfont{\normalfont\itshape}
+
+\let\thmt@original@spnewtheorem\spnewtheorem
+\let\thmt@theoremdefiner\thmt@original@spnewtheorem
+
+% cf thm-patch.dtx
+\def\spnewtheorem{%
+ \thmt@isstarredfalse
+ \thmt@hassiblingfalse
+ \thmt@hasparentfalse
+ \parse{%
+ {\parseFlag*{\thmt@isstarredtrue}{}}%
+ {\parseMand{\def\thmt@envname{##1}}}%
+ {\parseOpt[]{\thmt@hassiblingtrue\def\thmt@sibling{##1}}{}}%
+ {\parseMand{%
+ \def\thmt@thmname{##1}%
+ }}%
+ {\parseOpt[]{\thmt@hasparenttrue\def\thmt@parent{##1}}{}}%
+ {\parseMand{\def\thmt@style@headfont{##1}}}%
+ {\parseMand{\def\thmt@style@bodyfont{##1}}}%
+ {\let\@parsecmd\thmt@spnewtheoremiv}%
+ }%
+}
+
+\newcommand\thmt@spnewtheoremiv{%
+ \thmt@newtheorem@predefinition
+ % whee, now reassemble the whole shebang.
+ \protected@edef\thmt@args{%
+ \@nx\thmt@theoremdefiner%
+ \ifthmt@isstarred *\fi
+ {\thmt@envname}%
+ \ifthmt@hassibling [\thmt@sibling]\fi
+ {\thmt@thmname}%
+ \ifthmt@hasparent [\thmt@parent]\fi
+ {\thmt@style@headfont}{\thmt@style@bodyfont}%
+ }
+ \thmt@args
+ \thmt@newtheorem@postdefinition
+}
+
+% for the keyval interface:
+\define@key{thmdef}{headfont}{%
+ \def\thmt@style@headfont{#1}%
+}
+\define@key{thmdef}{bodyfont}{%
+\def\thmt@style@bodyfont{#1}%
+}
+
+\def\thmt@almost@spnewtheorem#1\relax{%
+ \def\thm@tmpa{\spnewtheorem#1}%
+ \@xa\@xa\@xa\thm@tmpa
+ \@xa\@xa\@xa{\@xa\thmt@style@headfont\@xa}%
+ \@xa{\thmt@style@bodyfont}%
+}
+\let\thmt@newtheorem\thmt@almost@spnewtheorem
+% \end{macrocode}
+%\iffalse (hide this from DocInput)
+%</llncs>
+%\fi
diff --git a/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx b/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx
index 3cb6a6fcd1d..498f20f676a 100644
--- a/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx
+++ b/Master/texmf-dist/source/latex/thmtools/thm-patch.dtx
@@ -64,9 +64,16 @@
\thmt@local@preheadhook
\csname thmt@#1@preheadhook\endcsname
\thmt@generic@preheadhook
- \protected@edef\tmp@args{%
- \ifx\@empty\thmt@optarg\else [{\thmt@optarg}]\fi
- }%
+ % change following to \@xa-orgy at some point?
+ % forex, might have keyvals involving commands.
+ %\protected@edef\tmp@args{%
+ % \ifx\@empty\thmt@optarg\else [{\thmt@optarg}]\fi
+ %}%
+ \ifx\@empty\thmt@optarg
+ \def\tmp@args{}%
+ \else
+ \@xa\def\@xa\tmp@args\@xa{\@xa[\@xa{\thmt@optarg}]}%
+ \fi
\csname thmt@original@#1\@xa\endcsname\tmp@args
%%moved down: \thmt@local@postheadhook
%% (give postheadhooks a chance to re-set nameref data)
diff --git a/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx b/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx
index 1abbee30f6c..8faec5f2fd4 100644
--- a/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx
+++ b/Master/texmf-dist/source/latex/thmtools/thm-restate.dtx
@@ -101,21 +101,42 @@
\@xa\@firstoftwo% this is the end of the environment.
\else
\@xa\@secondoftwo% go on collecting
- \fi{%
+ \fi{% this is the end, my friend, drop the \end.
+ % and call #1 with the collected body.
\@xa#1\@xa{\the\thmt@toks}%
- }{%
+ }{% go on collecting
\@xa\thmt@toks\@xa{\the\thmt@toks\end{#3}}%
\thmt@collect@body{#1}%
}%
}
-
+% \end{macrocode}
+% A totally ignorant version of |\ref|, defaulting to \#2 if label not
+% known yet. Otherwise, return the formatted number.
+% \begin{macrocode}
\def\thmt@trivialref#1#2{%
\ifcsname r@#1\endcsname
\@xa\@xa\@xa\thmt@trivi@lr@f\csname r@#1\endcsname\relax\@nil
\else #2\fi
}
\def\thmt@trivi@lr@f#1#2\@nil{#1}
-
+% \end{macrocode}
+%
+% Counter safeties: some counters' values should be stored, such as
+% equation, so we don't get a new number. (We cannot reference it anyway.)
+% We cannot store everything, though, think page counter or section number!
+% There is one problem here: we have to remove all references to other
+% counters from |\theequation|, otherwise your equation could get a number
+% like (3.1) in one place and (4.1) in another section.
+%
+% The best solution I can come up with is to override the usual macros
+% that counter display goes through, to check if their argument is one
+% that should be fully-expanded away or retained.
+%
+% The following should only be called from within a group, and the sanitized
+% |\thectr| must not be called from within that group, since it needs the
+% original |\@arabic| et al.
+%
+% \begin{macrocode}
\def\thmt@innercounters{%
equation}
\def\thmt@counterformatters{%
@@ -140,10 +161,38 @@
\fi
}
+\def\thmt@rst@storecounters#1{%
+ \bgroup
+ % ugly hack: save chapter,..subsection numbers
+ % for equation numbers.
+ \refstepcounter{thmt@dummyctr}% why is this here?
+ \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{%
+ (restate \protect\theHthmt@dummyctr)\csname theH\ctr\endcsname}%
+ \fi
+ \protect\setcounter{\ctr}{\number\csname c@\ctr\endcsname}%
+ }%
+ }%
+ \label{thmt@@#1@data}%
+ \egroup
+}%
+% \end{macrocode}
+%
+% Now, the main business.
+%
+% \begin{macrocode}
\newif\ifthmt@thisistheone
\newenvironment{thmt@restatable}[3][]{%
- \thmt@toks{}%
- \stepcounter{thmt@dummyctr}%
+ \thmt@toks{}% will hold body
+%
+ \stepcounter{thmt@dummyctr}% used for data storage label.
+%
\long\def\thmrst@store##1{%
\@xa\gdef\csname #3\endcsname{%
\@ifstar{%
@@ -155,57 +204,58 @@
\@xa\long\@xa\gdef\csname thmt@stored@#3\@xa\endcsname\@xa{%
\begingroup
\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{%
- (restate \protect\theHthmt@dummyctr)\csname theH\ctr\endcsname}%
- \fi
- \protect\setcounter{\ctr}{\number\csname c@\ctr\endcsname}%
- }%
- }%
- \label{thmt@@#3@data}%
- \egroup
+ % these are the valid numbers, store them for the other
+ % occasions.
+ \thmt@rst@storecounters{#3}%
\else
+ % this one should use other numbers...
+ % first, fake the theorem number.
\@xa\protected@edef\csname the#2\endcsname{%
\thmt@trivialref{thmt@@#3}{??}}%
+ % if the number wasn't there, have a "re-run to get labels right"
+ % warning.
\ifcsname r@thmt@@#3\endcsname\else
\G@refundefinedtrue
\fi
+ % prevent stepcountering the theorem number,
+ % but still, have some number for hyperref, just in case.
\@xa\let\csname c@#2\endcsname=\c@thmt@dummyctr
\@xa\let\csname theH#2\endcsname=\theHthmt@dummyctr
+ % disable labeling.
\let\label=\@gobble
\let\ltx@label=\@gobble% amsmath needs this
+ % We shall need to restore the counters at the end
+ % of the environment, so we get
+ % (4.2) [(3.1 from restate)] (4.3)
\def\thmt@restorecounters{}%
\@for\ctr:=\thmt@innercounters\do{%
\protected@edef\thmt@restorecounters{%
\thmt@restorecounters
- \protect\setcounter{equation}{\arabic{equation}}%
+ \protect\setcounter{\ctr}{\arabic{\ctr}}%
}%
- }
+ }%
+ % pull the new semi-static definition of \theequation et al.
+ % from the aux file.
\thmt@trivialref{thmt@@#3@data}{}%
\fi
- %\def\@currenvir{#2}%
- \csname #2\@xa\endcsname\ifx\@nx#1\@nx\else[#1]\fi
+ % call the proper begin-env code, possibly with optional argument
+ \csname #2\@xa\endcsname\ifx\@nx#1\@nx\else[{#1}]\fi
\ifthmt@thisistheone
+ % store a label so we can pick up the number later.
\label{thmt@@#3}%
\fi
+ % this will be the collected body.
##1
\csname end#2\endcsname
+ % if we faked the counter values, restore originals now.
\ifthmt@thisistheone\else\thmt@restorecounters\fi
\endgroup
- }%
+ }% thmt@stored@#3
+ % in either case, now call the just-created macro,
\csname #3\@xa\endcsname\ifthmt@thisistheone\else*\fi
+ % and artificially close the current environment.
\@xa\end\@xa{\@currenvir}
- }%
+ }% thm@rst@store
\thmt@collect@body\thmrst@store
}{%
%% now empty, just used as a marker.
diff --git a/Master/texmf-dist/source/latex/thmtools/thmtools.dtx b/Master/texmf-dist/source/latex/thmtools/thmtools.dtx
index 80782f0fb76..b480838ffec 100644
--- a/Master/texmf-dist/source/latex/thmtools/thmtools.dtx
+++ b/Master/texmf-dist/source/latex/thmtools/thmtools.dtx
@@ -38,6 +38,12 @@
\def\thmt@quark{\thmt@quark}
\newtoks\thmt@toks
+\@for\opt:=lowercase,uppercase,anycase\do{%
+ \@xa\DeclareOption\@xa{\opt}{%
+ \@xa\PassOptionsToPackage\@xa{\CurrentOption}{thm-kv}%
+ }%
+}
+
\ProcessOptions\relax
% a scratch counter, mostly for fake hyperlinks
@@ -74,6 +80,9 @@
\@ifclassloaded{beamer}{%
\RequirePackage{thm-beamer}
}{}
+\@ifclassloaded{llncs}{%
+ \RequirePackage{thm-llncs}
+}{}
% \end{macrocode}
%\iffalse
diff --git a/Master/texmf-dist/source/latex/thmtools/thmtools.ins b/Master/texmf-dist/source/latex/thmtools/thmtools.ins
index 852d3e3358f..45016df995d 100644
--- a/Master/texmf-dist/source/latex/thmtools/thmtools.ins
+++ b/Master/texmf-dist/source/latex/thmtools/thmtools.ins
@@ -37,6 +37,7 @@ http://www.latex-project.org/lppl/lppl-1-3a.txt
\file{thm-amsthm.sty}{\from{thm-amsthm.dtx}{amsthm}}
\file{thm-ntheorem.sty}{\from{thm-ntheorem.dtx}{ntheorem}}
\file{thm-beamer.sty}{\from{thm-beamer.dtx}{beamer}}
+ \file{thm-llncs.sty}{\from{thm-llncs.dtx}{llncs}}
\file{thmdef-shaded.sty}{\from{thmdef-shaded.dtx}{shaded}}
\file{thmdef-thmbox.sty}{\from{thmdef-thmbox.dtx}{thmbox}}
}