summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-18 00:17:44 +0000
committerKarl Berry <karl@freefriends.org>2011-02-18 00:17:44 +0000
commitdfd632c523a341604c836463c70224b297208fe6 (patch)
tree09185943d210d0ba972d4eac2112272f1f3032cd
parent7111ff10fd573d433de26c290c4b0b557f82d822 (diff)
ntheorem (17feb11)
git-svn-id: svn://tug.org/texlive/trunk@21446 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/source/latex/ntheorem/ntheorem.drv6
-rw-r--r--Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx493
-rw-r--r--Master/texmf-dist/tex/latex/ntheorem/ntheorem.std6
-rw-r--r--Master/texmf-dist/tex/latex/ntheorem/ntheorem.sty198
4 files changed, 445 insertions, 258 deletions
diff --git a/Master/texmf-dist/source/latex/ntheorem/ntheorem.drv b/Master/texmf-dist/source/latex/ntheorem/ntheorem.drv
index ea50b558047..2aa2a5b0fc1 100644
--- a/Master/texmf-dist/source/latex/ntheorem/ntheorem.drv
+++ b/Master/texmf-dist/source/latex/ntheorem/ntheorem.drv
@@ -20,9 +20,9 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-\def\filedate{2009/07/01}
-\def\docdate{2009/07/01}
-\def\fileversion{1.28}
+\def\filedate{2011/02/16}
+\def\docdate{2011/02/16}
+\def\fileversion{1.31}
\def\basename{ntheorem}
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
diff --git a/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx b/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx
index 26e50a89e1f..0c2db714e27 100644
--- a/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx
+++ b/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx
@@ -1,11 +1,11 @@
-\def\filedate{2009/07/01}
-\def\docdate{2009/07/01}
-\def\fileversion{1.28}
+\def\filedate{2011/02/16}
+\def\docdate{2011/02/16}
+\def\fileversion{1.31}
\def\basename{ntheorem}
% \iffalse
%
% Package 'ntheorem' to use with LaTeX2e
-% Copyright 1997 - 2009 by Wolfgang May and Andreas Schedler.
+% Copyright 1997 - 2011 by Wolfgang May and Andreas Schedler.
%
% Written and maintained by
% Wolfgang May (Uni Goettingen, formerly Uni Freiburg)
@@ -33,7 +33,7 @@
%
% \fi
%
-% \CheckSum{2591}
+% \CheckSum{2654}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -168,7 +168,7 @@
% Universit\"at G\"ottingen \\
% Germany
% \and
-% Andreas Schedler\thanks{\texttt{ntheorem@andreas-schedler.de}}\\
+% Andreas Schedler\thanks{\texttt{ntheorem@andreas-schedler.net}}\\
% }
% \date{\filedate}
% \maketitle
@@ -272,9 +272,11 @@
% commands of the |amsthm|-package (see Section~\ref{sec:amslatex}).
% \item[Compatibility with hyperref:] option [hyperref] provides
% compability with the |hyperref|-package
-% (see section~\ref{sec:hyperref}).
+% (see Section~\ref{sec:hyperref}).
% \end{description}
%
+% The package itself loads |ifthen.sty|.
+%
% \subsection{Defining New Theorem Sets}
%
% \DescribeMacro\newtheorem
@@ -366,9 +368,14 @@
% ``:'' or ``.''.
% \item
% \DescribeMacro\theoremprework
+% \changes{v1.30}{2010/08/14}{`theoremprework': added comment on
+% `leavevmode' to documentation (WM)}
% |\theoremprework{|\meta{thing}|}|: \meta{thing} is performed
% before starting the theorem structure.
-% E.g., \meta{thing} can be |\hrule|.
+% E.g., \meta{thing} can be |\bigskip\hrule\leavevmode|.
+% If the vertical space after your theoremprework does not look as
+% intended, try to put |\leavevmode| at its end (as in the above
+% example).
% \item
% \DescribeMacro\theorempostwork
% |\theorempostwork{|\meta{thing}|}|: \meta{thing} is performed
@@ -522,7 +529,10 @@
% \end{quote}
% with the same parameters as usually for |\newtheorem|.
% Note that the use of the |framed| package also allows to have longer
-% theorems across a page break framed.
+% theorems across a page break framed (in this case, by default, there
+% are horizontal lines before and after the page break; this can
+% even be circumvented by combining with \texttt{mdframed} package
+% (since 2010)).
%
% \DescribeMacro\newshadedtheorem
%
@@ -547,6 +557,20 @@
% before declaring the theorem type (for examples, the
% user is referred to section \ref{sec:examples}).
%
+% For using pdflatex (where pstricks is not available), e.g.
+% |\usepackage{color}| and
+% |\theoremframecommand{\colorbox[rgb]{1,.9,.9}}| can be used.
+%
+% Note that |\theorempreskipamount| and |\theorempostskipamount| are
+% applied integrated with the structure of the theorem itself. Thus,
+% for framed and shaded theorems, they are applied
+% \emph{inside} the frame/shade.
+%
+% To obtain vertical space \emph{before} and \emph{after} the
+% shade or frame, |\theoremframepreskipamount| and
+% |\theoremframepostskipamount| can be used (both defined by default to
+% 0pt) analogously. (i.e., they are also common to all theorem types.)
+%
% \subsubsection{Customization and Local Settings}
%
% Since the user should not change |ntheorem.std|,
@@ -589,6 +613,11 @@
% via |\newtheorem|, the user is informed that a list is generated,
% but there will be no typeset output at all.
%
+% Note that in contrast to similar \LaTeX\ commands like
+% |\listoffigures| etc.\, there is no automatically created
+% heading. Users have to write it themselves -- but are free
+% to choose what they want to have.
+%
% \subsubsection{Defining the List Layout}
%
% \DescribeMacro\theoremlisttype
@@ -882,7 +911,7 @@
% have been incorporated into option |[amsthm]| which has
% to be used \emph{instead of} |\usepackage{amsthm}|.
%
-% The Option provides theoremstyles |plain|, |definition|, and
+% The option provides theoremstyles |plain|, |definition|, and
% |remark|, and a |proof| environment as in |amsthm.sty|.
%
% The |\newtheorem*| command is defined even without this
@@ -911,10 +940,16 @@
%
% \subsection{Hyperref}\label{sec:hyperref}
%
-% Since |hyperref| redefines the \LaTeX\ |\contentsline|-command, it breaks
-% with |ntheorem| below version 1.17. Since version 1.17, the option
-% |[hyperref]| makes |ntheorem| work with |hyperref|.
-% Theoremlists will then get linked list.
+% Since |hyperref| redefines the \LaTeX\ |\contentsline|-command, it
+% breaks with |ntheorem| below version 1.17. Since version 1.17, the
+% option |[hyperref]| makes |ntheorem| work with |hyperref|.
+% The entries of theoremlists then act as hyperlinks to the actual
+% theorems. Version 1.31 incorporated some bugfixes wrt.\ hyperref
+% for theorem lists and for the |thref| option. One should always
+% load |\usepackage{hyperref}| \emph{before} the first use of
+% |\newtheorem| to obtain correct handling and referencing of
+% counters.
+% \medskip
%
% WARNING: The definition and redefinition of Theorem List Layouts
% (see Section~\ref{sec:listtypes}) isn't yet working with
@@ -1047,7 +1082,6 @@
% From the predefined styles, this is exactly the case for the break-styles.
% That's no bug, it's \LaTeX-immanent.
%
-% \noindent
% The example goes on with an |eqnarray|:
% \begin{eqnarray}
% f(z) &=&
@@ -1076,7 +1110,7 @@
%
%
% If there are some environments in the same thm-environment,
-% the last gets the endmark:
+% the last one gets the endmark:
% \begin{Definition}[With a list]
% \begin{equation}
% \int_{\gamma} f(z)\, dz := \int_a^b f(\gamma (t)) \gamma'(t) \, dt
@@ -1756,12 +1790,13 @@
% \begin{macrocode}
\typeout{Style `\basename', Version \fileversion\space <\filedate>}
\ProvidesPackage{ntheorem}[\filedate \space\fileversion]
+\RequirePackage{ifthen}%
\newif\if@thmmarks\@thmmarksfalse
\newif\if@thref\@threffalse
\newif\ifthm@tempif
% \end{macrocode}
%
-% general setup.
+% general setup. \medskip
%
% \subsubsection{Thmmarks-Related Stuff}
%
@@ -1785,8 +1820,8 @@
%
%
% \begin{macro}{\thm@romannum}
-% \changes{v1.28}{2009/07/02}{duplicate latex's definition (WM,
-% reported by Ch. Garcia Duarte)}
+% \changes{v1.28}{2009/07/02}{duplicate latex's definition (WM),
+% reported by Ch. Garcia Duarte}
% The functionality of |latex.ltx|'s |\roman| command converts
% numbers into strings, e.g., 17 into xvii. It is used to put
% notes into the |.aux| file. It must be
@@ -2420,7 +2455,7 @@
\@threftrue
% \end{macrocode}
%
-% Option ``thref'' needs a special handling when combined with amsmath.
+% Option |thref| needs a special handling when combined with amsmath.
% This is also a reason why it is handled first.
%
% \begin{macro}{\bbsphack(2)}
@@ -2441,11 +2476,20 @@
% thmmarks option. Change both if you change them.
% \end{macro}
%
+% \paragraph{Communication of theorem types for references.}
+%
+% The |thref| functionality needs to know the respective theorem type
+% of the referenced
+% labels. This is incorporated as additional arguments in |label| and
+% |newlabel/@newl@abel|. Note that if the |hyperref| package is used,
+% the handling is different (see Option |hyperref|).
+%
% \begin{macro}{\label}
% \changes{v1.1}{1998/08/30}{added optional argument to 'label'. (WM)}
% \changes{v1.18}{1999/12/25}{Adapted for complex keywords (WM)}
% The original |\label| macro is extended (cf.\ ltxref.dtx) with an
-% optional argument, containing the type of the labeled construct:
+% optional argument, containing the type of the labeled construct.
+% (when option |hyperref| is used, )
% \Codelabel{label}
% \begin{macrocode}
\def\label#1{%
@@ -2528,8 +2572,35 @@
% \end{macro}
+% \begin{macro}{\thref}
+% \changes{v1.1}{1998/08/30}{added macro 'thref'. (WM)}
+% \changes{v1.13}{1998/12/01}{made 'thref' an option. (WM)}
+%
+% |\thref| is an adaptation of |\ref|:
+% \Codelabel{thref}
+% \begin{macrocode}
+\def\thref#1{%
+ \expandafter\ifx\csname r@#1@type\endcsname\None
+ \PackageWarning{\basename}{thref: Reference Type of `#1' on page
+ \thepage \space undefined}\G@refundefinedtrue
+ \else\csname r@#1@type\endcsname~\fi%
+ \expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
+% \end{macrocode}
+%
+% \begin{packeddescr}
+% \item[Lines \Coderef{thref}{1},\Coderef{thref}{6}:]
+% similar to |\ref|.
+% \item[Line \Coderef{newlabel}{2}:] if a legal theorem type
+% is given, then output
+% |\r@|\meta{labelname}|@type| and avoid linebreaking
+% between the type and the number.
+% \end{packeddescr}
+% \end{macro}
+
% \begin{macro}{\testdef}
% \changes{v1.19}{2001/01/12}{added (HO/WM, reported by Hans-Christoph Wirth)}
+% \changes{v1.31}{2011/02/08}{changed '@gobbleopt' into 'thm@gobbleopt' after
+% nameclash with hyperref) (AS/WM)}
% A problem occurred, when about 250 labels to theorem-like
% environments have been defined: after the end of a document,
% the .aux file is read once more (to check if references changed).
@@ -2537,7 +2608,7 @@
% \LaTeX\ does not know that ntheorem's |\label| has an additional
% optional argument. Thus, the argument values are not processed,
% but are output as normal text. Normally, this did not matter
-% since output has already benn finished by a |\clearpage| in
+% since output has already been finished by a |\clearpage| in
% |\end{document}|. For so many labels, a page gets filled
% and the output routine is called.
%
@@ -2547,10 +2618,10 @@
\let\org@testdef\@testdef
\def\@testdef#1#2#3{%
\org@testdef{#1}{#2}{#3}%
- \@ifnextchar[{\@gobbleopt}{}%
+ \@ifnextchar[{\thm@gobbleopt}{}%
}
-\newcommand\@gobbleopt{}
-\long\def\@gobbleopt[#1]{}
+\newcommand\thm@gobbleopt{}
+\long\def\thm@gobbleopt[#1]{}
% \end{macrocode}
% \begin{packeddescr}
% \item[Line \Coderef{testdef}{4}:]
@@ -2558,30 +2629,6 @@
% \end{packeddescr}
% \end{macro}
%
-% \begin{macro}{\thref}
-% \changes{v1.1}{1998/08/30}{added macro 'thref'. (WM)}
-% \changes{v1.13}{1998/12/01}{made 'thref' an option. (WM)}
-%
-% |\thref| is an adaptation of |\ref|:
-% \Codelabel{thref}
-% \begin{macrocode}
-\def\thref#1{%
- \expandafter\ifx\csname r@#1@type\endcsname\None
- \PackageWarning{\basename}{thref: Reference Type of `#1' on page
- \thepage \space undefined}\G@refundefinedtrue
- \else\csname r@#1@type\endcsname~\fi%
- \expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
-% \end{macrocode}
-%
-% \begin{packeddescr}
-% \item[Lines \Coderef{thref}{1},\Coderef{thref}{6}:]
-% similar to |\ref|.
-% \item[Line \Coderef{newlabel}{2}:] if a legal theorem type
-% is given, then output
-% |\r@|\meta{labelname}|@type| and avoid linebreaking
-% between the type and the number.
-% \end{packeddescr}
-% \end{macro}
% \begin{macrocode}
}% end of option thref ************************************************
% \end{macrocode}
@@ -2641,7 +2688,7 @@
\if@fleqn \@xp\endmathdisplay@fleqn
\else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi
\ifx\df@label\@empty \else
- \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}
+ \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
\else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
\fi
\fi
@@ -2663,7 +2710,7 @@
\ifmeasuring@
\else
\ifx\df@label\@empty\else
- \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}
+ \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
\else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
\global\let\df@label\@empty
\fi
@@ -2675,7 +2722,7 @@
\ifx\@empty\df@tag
\else
\setbox4\hbox{\df@tag
- \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}
+ \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
\else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
}%
\fi
@@ -2684,6 +2731,8 @@
\endcsname
}
% \end{macrocode}
+% \changes{v1.29}{2010/06/24}{fixed endmathdisplay@fleqn, make@display@tag,
+% endmathdisplay@fleqn (WM, reported by Claas Hemig)}
% \end{macro}
% \begin{macrocode}
\fi
@@ -2785,6 +2834,20 @@
% \changes{v1.20}{2001/12/29}{added hss if tags left (GD/WM)}
% \end{macro}
%
+% \begin{macro}{\tagform@}
+% \begin{packeddescr}
+% \item |\maketag@@@| is also used via |\tagform@| in |eqref| that may be
+% called inside an environment. There, the original functionality must
+% be used.
+% \end{packeddescr}
+% \changes{v1.30}{2010/08/16}{added (WM), bug reported by Martin Schulze}
+% \begin{macrocode}
+\let\ams@@maketag@@@\maketag@@@
+\gdef\tagform@#1{%
+ \ams@@maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\RestoreTags}
% \Codelabel{RestoreTags}
% \begin{macrocode}
@@ -3207,8 +3270,12 @@
% \begin{macrocode}
\newskip\theorempreskipamount
\newskip\theorempostskipamount
+\newskip\theoremframepreskipamount
+\newskip\theoremframepostskipamount
\global\theorempreskipamount\topsep
\global\theorempostskipamount\topsep
+\global\theoremframepreskipamount0pt
+\global\theoremframepostskipamount0pt
% \end{macrocode}\end{macro}
% \changes{v0.94}{1997/03/20}{'theorem...skip' fixed (WM)}
% \end{macro}
@@ -3362,9 +3429,9 @@
%
% \begin{macro}{\newtheorem}
% \changes{v1.18}{1999/12/23}{debugged starred version of 'newtheorem' (WM)}
-% \changes{v1.23}{2004/06/13}{moved normal 'newtheorem' into 'ntheorem@i' (WM)}
+% \changes{v1.23}{2004/06/13}{moved normal 'newtheorem' into 'newtheorem@i' (WM)}
% \changes{v1.23}{2004/06/13}{normal 'newtheorem': reset theoremprework and
-% theorempostwork, then call 'ntheorem@i' (WM, reported by Christoph Kluss)}
+% theorempostwork, then call 'newtheorem@i' (WM, reported by Christoph Kluss)}
% \changes{v1.24}{2004/09/20}{debugged: reset after call, moved downwards (WM)}
% \begin{macrocode}
\gdef\newtheorem{%
@@ -3955,8 +4022,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{newshadedtheorem}
+% \begin{macro}{\newshadedtheorem}
% \changes{v1.21}{2002/12/30}{added (WM)}
+% \changes{v1.30}{2010/08/15}{added `theoremframepre/postskipamount' (WM)}
% \begin{macrocode}
\def\newshadedtheorem#1{%
\expandafter\global\expandafter\xdef\csname#1@shadecolor\endcsname{%
@@ -3971,18 +4039,19 @@
\theoremframecommand%
\fi
\theoremprework{%
- \def\FrameCommand{\csname#1@framecommand\endcsname}\framed}%
- \theorempostwork{\endframed}%
+ \def\FrameCommand{\csname#1@framecommand\endcsname}%
+ \vskip\theoremframepreskipamount\framed}%
+ \theorempostwork{\endframed\vskip\theoremframepostskipamount}%
\newtheorem@i{#1}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{newframedtheorem}
+% \begin{macro}{\newframedtheorem}
% \begin{macrocode}
\def\newframedtheorem#1{%
- \theoremprework{\framed}%
- \theorempostwork{\endframed}%
+ \theoremprework{\vskip\theoremframepreskipamount\framed}%
+ \theorempostwork{\endframed\vskip\theoremframepostskipamount}%
\newtheorem@i{#1}%
}
}% end of option framed **********************************************
@@ -3991,6 +4060,8 @@
%
% \subsubsection{Generation of Theorem Lists}\label{sec:CodeLists}
%
+% The generation of lists of theorems, definitions, etc.\ is based
+%
% The following macros are are needed for the generation of theorem-lists.
% We will document it for the theorem
% |\begin{definition}[optional]|, which we assume to be the first
@@ -4018,7 +4089,7 @@
% \begin{macrocode}
\def\thm@@thmcaption#1#2#3#4{%
\thm@parseforwriting{#2}%
- \let\thm@tmpii\thm@tmp%
+ \let\thm@tmpii\thm@tmp
\thm@parseforwriting{#4}%
\edef\thm@t{{\thm@tmpii}{#3}{\thm@tmp}}%
\addcontentsline{thm}{#1}{\thm@t}}
@@ -4081,10 +4152,13 @@
% \end{macro}
%
% \begin{macro}{\thm@lgobble}
-% The next macro is used to ignore all theorem-sets, which should not
-% be listed.
+% \changes{v1.31}{2011/02/14}{split 'thm@lgobble' into 'thm@lgobble@entry'
+% and 'thm@lgobble@freetext' (WM)}
+% The following macros are used to ignore entries for theorem sets, that
+% should not occur in a given list:
% \begin{macrocode}
-\long\def\thm@lgobble#1#2{\ignorespaces}
+\long\def\thm@lgobble@entry#1#2{\ignorespaces}
+\long\def\thm@lgobble@freetext#1#2{\ignorespaces}
% \end{macrocode}
% \end{macro}
%
@@ -4146,83 +4220,6 @@
% \end{macrocode}
% \end{macro}
%
-% \paragraph{Theoremlists and Hyperref}
-%
-% Since the |hyperref|-package redefines |\contentsline|, we must
-% redefine some commands to handle this:
-% \begin{enumerate}
-% \item Let the different versions of |\thm@@thmline@..| take a 5th
-% argument, the one provided by |hyperref|.
-% \item Don't use hyperref's contentsline: restore the normal
-% definition at the beginning of |\thm@processlist| (see there).
-% \item Let |\thm@lgobble| take one more argument,
-% the one provided by hyperref.
-% \item Do the hyperlinks manually in the different versions of
-% |\thm@@thmline| as defined by the theoremtypes.
-% \end{enumerate}
-%
-% \changes{v1.17}{1999/09/07}{added 'hyperref' option
-% (AS, based on a proposal by Didier Verna)}
-% \begin{macro}{hyperref}
-% \begin{macrocode}
-\DeclareOption{hyperref}{% **********************************************
- \def\thm@@thmline@noname#1#2#3#4#5{%
- \ifx\\#5\\%
- \@dottedtocline{-2}{0em}{2.3em}%
- {\protect\numberline{#2}#3}%
- {#4}%
- \else
- \ifHy@linktocpage\relax\relax
- \@dottedtocline{-2}{0em}{2.3em}%
- {\protect\numberline{#2}#3}%
- {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}
- \else
- \@dottedtocline{-2}{0em}{2.3em}%
- {\hyper@linkstart{link}{#5}{\protect\numberline{#2}#3}%
- \hyper@linkend}%
- {#4}%
- \fi
- \fi}%
- \def\thm@@thmline@name#1#2#3#4#5{%
- \ifx\\#5\\%
- \@dottedtocline{-2}{0em}{2.3em}%
- {#1 \protect\numberline{#2}#3}%
- {#4}
- \else
- \ifHy@linktocpage\relax\relax
- \@dottedtocline{-2}{0em}{2.3em}%
- {#1 \protect\numberline{#2}#3}%
- {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
- \else
- \@dottedtocline{-2}{0em}{2.3em}%
- {\hyper@linkstart{link}{#5}%
- {#1 \protect\numberline{#2}#3}\hyper@linkend}%
- {#4}%
- \fi
- \fi}
- \def\thm@thmline#1#2#3{\thm@@thmline#1{#2}{#3}}
- \long\def\thm@lgobble#1#2#3{\ignorespaces}
- \def\theoremlistoptional{%
- \let\thm@@thmlstart=\relax
- \let\thm@@thmlend=\relax
- \def\thm@@thmline##1##2##3##4##5{%
- \ifx\empty ##3%
- \else%
- \thm@@thmline@noname{##1}{##2}{##3}{##4}{##5}%
- \fi}}
- \def\theoremlistoptname{%
- \let\thm@@thmlstart=\relax
- \let\thm@@thmlend=\relax
- \def\thm@@thmline##1##2##3##4##5{%
- \ifx\empty ##3%
- \else%
- \thm@@thmline@name{##1}{##2}{##3}{##4}{##5}%
- \fi}}
-}% end of option hyperref *********************************************
-% \end{macrocode}
-% \changes{v1.20}{2002/01/07}{replaced ifhy by ifHy (AS, reported by J.J.Bataille)}
-% \end{macro}
-%
% \begin{macro}{\theoremlisttype}
% \changes{v0.92}{1997/03/03}{added error-handling (AS)}
% The next one is the user-interface for selecting the list-type. It simply
@@ -4234,7 +4231,7 @@
{\csname thm@thml@#1\endcsname}}
% \end{macrocode}
% \end{macro}
-% Now, here is a the code, which maps the types -- selected by
+% Now, here is the code, which maps the types -- selected by
% |\theoremlisttype| -- to the defined macros.
% \begin{macrocode}
\def\thm@thml@all{\theoremlistall}
@@ -4276,22 +4273,28 @@
%
%
% \begin{macro}{\thm@definelthm}
-% For each theorem-set, we need to setup two commands. Thus, the next
-% macro is called by |\newtheorem|. It defines the command |\l@|\meta{theorem-set}
-% and |\thm@listdo|\meta{theorem-set}, which initially discard the input by
-% calling |\thm@lgobble|.
-% The first one is called for each theorem when you
-% are generating lists. The second one is called, if you've added something
-% with |\addtotheoremfile|.
+% For each theorem-set, we need to initialize two commands:
+% \begin{itemize}
+% \item how to typeset entries in the list, |\l@|\meta{theorem-set}.
+% it is called for each theorem when the list is generated.
+% \item how to typeset additional text in the list,
+% |\thm@listdo|\meta{theorem-set}. It is called, when something is
+% to a list with |\addtotheoremfile|.
+% \end{itemize}
+% These macros are initially defined by |\newtheorem| to
+% discard the input by calling |\thm@lgobble@entry| (for actual
+% entries) and |\thm@lgobble@freetext| (for free text added by the user).
+% These macros must be adapted if a package uses another format for
+% |\contentsline| entries in the |.aux| file (e.g., |hyperref|).
% \begin{macrocode}
\def\thm@definelthm#1{%
- \expandafter\gdef\csname l@#1\endcsname{\thm@lgobble}%
- \expandafter\gdef\csname thm@listdo#1\endcsname{\thm@lgobble}}
+ \expandafter\gdef\csname l@#1\endcsname{\thm@lgobble@entry}%
+ \expandafter\gdef\csname thm@listdo#1\endcsname{\thm@lgobble@freetext}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\thm@inlistdo}
-% If in some case, you've written additional text into the theorem-file
-% by |\addtotheoremfile|, this one is called internally. It simply discards
+% When additional text is added to a theorem list via |\addtotheoremfile|,
+% this is typeset by the following is macro. It simply discards
% the first argument and strips of the outer brackets from the second one.
% \begin{macrocode}
\long\def\thm@inlistdo#1#2{#2}%
@@ -4302,29 +4305,38 @@
% \changes{v0.89}{1997/02/18}{fixed a bug for lists (AS)}
% \changes{v0.92}{1997/03/02}{made commands global in order to handle
% tabular-lists (AS)}
-% Now we need the user-interface for generating lists. This is done by the next
-% macro. We set the |tocdepth| to $-2$ to assure that the predefined list-types
-% work. After storing the names of the theorem-sets, we call |\thm@processlist|,
-% which actually generates the list.
+% The following macro provides the user interface:
+% \Codelabel{listtheorems}
% \begin{macrocode}
\def\listtheorems#1{\begingroup
\c@tocdepth=-2%
\def\thm@list{#1}\thm@processlist
\endgroup}
% \end{macrocode}
+%
+% \begin{packeddescr}
+% \item[Line \Coderef{listtheorems}{1}:]
+% |#1| is a list of theorem sets, i.e., of the form |Theorem| or
+% |Theorem, Definition, ...|.
+% \item[Line \Coderef{listtheorems}{2}:] set |tocdepth| to $-2$ to assure
+% that the predefined list-types work.
+% \item[Line \Coderef{listtheorems}{3}:] store the list of names in |thm@list|
+% and call |\thm@processlist|, which actually generates the list.
+% \end{packeddescr}
% \end{macro}
% \begin{macro}{\thm@processlist}
%
-% \changes{v1.17}{1999/09/06}{Switch to normal contentsline-behaviour for lists (hyperref) (AS)}
+% \changes{v1.17}{1999/09/06}{Switch to normal contentsline-behaviour for
+% lists (hyperref) (AS)}
% \changes{v1.19}{2001/01/13}{check for yet undefined theoremsets (WM)}
% The file \meta{jobname}|.thm| contains commands of the form \\
% \hspace*{0.5cm}
-% |\contentsline{|\meta{theoremset}|}{{|\meta{header}|}{|\meta{number}|}}{|\meta{page}|}|.\\
+% |\contentsline{|\meta{list-of-theoremsets}|}{{|\meta{header}|}{|\meta{number}|}}{|\meta{page}|}|.\\
% Thus, dependent on which theoremsets should be listed,
% |\contentsline| must be defined to evaluate the first argument and then
% to output all arguments, or to discard the second and third one.
%
-% This is done the following way:
+% This is done as follows:
% The commands |\l@|\meta{theorem-set} and |\thm@listdo|\meta{theorem-set}
% (which initially were set to ignore everything by |\newtheorem|)
% are redefined for the theorem sets which should be listed to
@@ -4339,31 +4351,38 @@
%
% Then, the |.thm| file is processed, evaluating the |\contentsline|
% commands.
-% After processing the theorem-file, the mentioned commands are
+% After processing the |.thm| file, the mentioned commands are
% again redefined to discard everything. We need to define the macros
% globally for dealing with complex, user-defined, list-types.
%
+% \changes{v1.31}{2011/02/14}{split 'thm@lgobble' into 'thm@lgobble@entry'
+% and 'thm@lgobble@freetext' (WM, reported by Barbara Santa)}
% \begin{macrocode}
\def\thm@processlist{%
\begingroup
\typeout{** Generating table of \thm@list}%
\def\contentsline##1{%
- \expandafter\@ifundefined{l@##1}{\thm@lgobble}{\csname l@##1\endcsname}}%
+ \expandafter\@ifundefined{l@##1}%
+ {\thm@lgobble@entry}{\csname l@##1\endcsname}}%
\thm@@thmlstart
- \@for\thm@currentlist:=\thm@list\do{%
+ \@for\thm@currentlist:=\thm@list
+ \do{%
\ifx\thm@currentlist\@empty\else
\expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@thmline}%
\expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@inlistdo}%
\fi
- }%
+ }%
\@input{\jobname .thm}%
\thm@@thmlend
- \@for\thm@currentlist:=\thm@list\do{%
+ \@for\thm@currentlist:=\thm@list
+ \do{%
\ifx\thm@currentlist\@empty\else
- \expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@lgobble}%
- \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@lgobble}%
+ \expandafter\gdef\csname l@\thm@currentlist\endcsname
+ {\thm@lgobble@entry}%
+ \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname
+ {\thm@lgobble@freetext}%
\fi
- }%
+ }%
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -4478,9 +4497,145 @@
\AtEndDocument{\thm@enablelistoftheorems}
% \end{macrocode}
%
+% \paragraph{Theoremlists and Hyperref}
+%
+% Since the |hyperref|-package redefines |\contentsline|, some
+% commands are redefined:
+% \begin{enumerate}
+% \item Let the different versions of |\thm@@thmline@..| take a 5th
+% argument, the one provided by |hyperref|.
+% \item handle contentsline: restore the normal
+% definition at the beginning of |\thm@processlist| (see there),
+% that calls |l@|\meta{theorem-set} that in turn calls the
+% adapted commands for typestting the entries (see below). .
+% \item Let |\thm@lgobble@entry| take one more argument,
+% the one provided by hyperref.
+% \item Do the hyperlinks manually in the different versions of
+% |\thm@@thmline| as defined by the theoremtypes.
+% \end{enumerate}
+%
+% \begin{macro}{hyperref}
+% \changes{v1.17}{1999/09/07}{added 'hyperref' option
+% (AS, based on a proposal by Didier Verna)}
+% \begin{macrocode}
+\DeclareOption{hyperref}{% **********************************************
+ \def\thm@@thmline@noname#1#2#3#4#5{%
+ \ifx\\#5\\%
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\protect\numberline{#2}#3}%
+ {#4}%
+ \else
+ \ifHy@linktocpage\relax\relax
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\protect\numberline{#2}#3}%
+ {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}
+ \else
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\hyper@linkstart{link}{#5}{\protect\numberline{#2}#3}%
+ \hyper@linkend}%
+ {#4}%
+ \fi
+ \fi}%
+ \def\thm@@thmline@name#1#2#3#4#5{%
+ \ifx\\#5\\%
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {#1 \protect\numberline{#2}#3}%
+ {#4}
+ \else
+ \ifHy@linktocpage\relax\relax
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {#1 \protect\numberline{#2}#3}%
+ {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
+ \else
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\hyper@linkstart{link}{#5}%
+ {#1 \protect\numberline{#2}#3}\hyper@linkend}%
+ {#4}%
+ \fi
+ \fi}
+ \def\thm@thmline#1#2#3{\thm@@thmline#1{#2}{#3}}
+ \long\def\thm@lgobble@entry#1#2#3{\ignorespaces}
+ \def\theoremlistoptional{%
+ \let\thm@@thmlstart=\relax
+ \let\thm@@thmlend=\relax
+ \def\thm@@thmline##1##2##3##4##5{%
+ \ifx\empty ##3%
+ \else%
+ \thm@@thmline@noname{##1}{##2}{##3}{##4}{##5}%
+ \fi}}
+ \def\theoremlistoptname{%
+ \let\thm@@thmlstart=\relax
+ \let\thm@@thmlend=\relax
+ \def\thm@@thmline##1##2##3##4##5{%
+ \ifx\empty ##3%
+ \else%
+ \thm@@thmline@name{##1}{##2}{##3}{##4}{##5}%
+ \fi}}
+% \end{macrocode}
+% \changes{v1.20}{2002/01/07}{replaced ifhy by ifHy (AS, reported by J.J.Bataille)}
+% \end{macro}
+%
+% \paragraph{Theorem References and Hyperref}
+%
+% \begin{macro}{hyperref-thref}
+% When |hyperref| is active, the handling of |thref| described above via
+% the |.aux| file redefinition of |\@newl@bel| is not possible (|hyperref|
+% forces its definitions at |\AtBeginDocument|). Instead, an internal
+% identifier of the form |Theorem.1.1| is used in the |.aux| file for
+% the hypertarget (using the type of the counter; thus when a theorem type
+% uses another counter, this does not give the theorem type itself).
+% The same id is stored in the |.thm| file for
+% the respective theorem. by this, given the id from the |\newlabel| in
+% the |.aux| file, the |.thm| file can be searched for the actual type
+% information.
+%
+% \changes{v1.31}{2011/02/15}{(WM, reported by Gunner Gewiss)}
+% \Codelabel{hyperthref}
+% \begin{macrocode}
+\if@thref
+\def\@firstofthree#1#2#3{#1}%
+\def\getKeywordOf#1{%
+ \let\thm@oldcontentsline\contentsline
+ \def\contentsline##1##2##3##4{%
+ \ifthenelse{\equal{#1}{##4}}{\@firstofthree##2}{}%
+ \ignorespaces}%
+ \@input{\jobname .thm}%
+ \let\contentsline\thm@oldcontentsline
+}
+\def\thm@fmt@hyplabel@i#1#2#3#4#5{%
+ \getKeywordOf{#4}~\thm@fmt@hyplabel@ii#4}
+\def\thm@fmt@hyplabel@ii#1.#2{#2}%
+\def\thref#1{%
+ \expandafter\@setref\csname r@#1\endcsname\thm@fmt@hyplabel@i{#1}}%
+\fi % end of \if@thref
+}% end of option hyperref *********************************************
+% \end{macrocode}
+% \begin{packeddescr}
+% \item[Lines \Coderef{hyperthref}{2}-\Coderef{hyperthref}{10}:]
+% given an id |#1| of the form |Theorem.1.1|, scan the |.thm| file
+% for a |\contentsline| whose 4th argument equals the id. If found,
+% the third component of its second argument gives its theorem type.
+% \item[Lines \Coderef{hyperthref}{11}-\Coderef{hyperthref}{13}:]
+% this command must have 5 arguments because it is applied to
+% the information stored with |\newlabel| in the |.aux| file. The
+% 4th argument is the id |#4| of the form |Theorem.1.1|. \\
+% Get the correct keyword by |\getKeywordOf{#4}| and its number
+% (which is the part following the first ``.'').
+% \item[Lines \Coderef{hyperthref}{14}-\Coderef{hyperthref}{15}:]
+% create a hyperlink via |\@setref| (see |hyperref.sty|): |\@setref|
+% takes three arguments: |r@|\meta{label} := $arg_1$ is the information
+% from |\newlabel| in the |.aux| file (consisting of 5 components).
+% The 2nd argument $arg_2$ must be a command that uses 5 arguments,
+% here |\thm@fmt@hyplabel@i{#1}| as defined in Lines
+% \Coderef{hyperthref}{11}-\Coderef{hyperthref}{13}. The
+% 3rd one is the label, and is only used for error messages.
+% |\@setref| then --roughly-- applies $arg_2$ on $arg_1$.
+% \end{packeddescr}
+% \end{macro}
+%
% \subsubsection{Auxiliary macros}
%
-% For generating theorem-lists, we need to write informations into
+% For generating theorem-lists, we need to write information into
% a separate file. Beause we don't want to expand this information,
% we parse it specially for writing.
% \begin{macrocode}
diff --git a/Master/texmf-dist/tex/latex/ntheorem/ntheorem.std b/Master/texmf-dist/tex/latex/ntheorem/ntheorem.std
index 41826472fe1..43da68568db 100644
--- a/Master/texmf-dist/tex/latex/ntheorem/ntheorem.std
+++ b/Master/texmf-dist/tex/latex/ntheorem/ntheorem.std
@@ -20,9 +20,9 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-\def\filedate{2009/07/01}
-\def\docdate{2009/07/01}
-\def\fileversion{1.28}
+\def\filedate{2011/02/16}
+\def\docdate{2011/02/16}
+\def\fileversion{1.31}
\def\basename{ntheorem}
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
diff --git a/Master/texmf-dist/tex/latex/ntheorem/ntheorem.sty b/Master/texmf-dist/tex/latex/ntheorem/ntheorem.sty
index 94624fae86a..4f60c1f3320 100644
--- a/Master/texmf-dist/tex/latex/ntheorem/ntheorem.sty
+++ b/Master/texmf-dist/tex/latex/ntheorem/ntheorem.sty
@@ -20,9 +20,9 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-\def\filedate{2009/07/01}
-\def\docdate{2009/07/01}
-\def\fileversion{1.28}
+\def\filedate{2011/02/16}
+\def\docdate{2011/02/16}
+\def\fileversion{1.31}
\def\basename{ntheorem}
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
@@ -48,6 +48,7 @@
%% Right brace \} Tilde \~}
\typeout{Style `\basename', Version \fileversion\space <\filedate>}
\ProvidesPackage{ntheorem}[\filedate \space\fileversion]
+\RequirePackage{ifthen}%
\newif\if@thmmarks\@thmmarksfalse
\newif\if@thref\@threffalse
\newif\ifthm@tempif
@@ -276,20 +277,21 @@
\def\set@label@type#1#2[#3]{%
\global\@namedef{#1@#2@type}{#3}}
-\newcommand\org@testdef{}
-\let\org@testdef\@testdef
-\def\@testdef#1#2#3{%
- \org@testdef{#1}{#2}{#3}%
- \@ifnextchar[{\@gobbleopt}{}%
-}
-\newcommand\@gobbleopt{}
-\long\def\@gobbleopt[#1]{}
\def\thref#1{%
\expandafter\ifx\csname r@#1@type\endcsname\None
\PackageWarning{\basename}{thref: Reference Type of `#1' on page
\thepage \space undefined}\G@refundefinedtrue
\else\csname r@#1@type\endcsname~\fi%
\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
+
+\newcommand\org@testdef{}
+\let\org@testdef\@testdef
+\def\@testdef#1#2#3{%
+ \org@testdef{#1}{#2}{#3}%
+ \@ifnextchar[{\thm@gobbleopt}{}%
+}
+\newcommand\thm@gobbleopt{}
+\long\def\thm@gobbleopt[#1]{}
}% end of option thref ************************************************
\DeclareOption{amsmath}{% ***************************************************
\if@thref
@@ -315,7 +317,7 @@
\if@fleqn \@xp\endmathdisplay@fleqn
\else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi
\ifx\df@label\@empty \else
- \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}
+ \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
\else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
\fi
\fi
@@ -337,7 +339,7 @@
\ifmeasuring@
\else
\ifx\df@label\@empty\else
- \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}
+ \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
\else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
\global\let\df@label\@empty
\fi
@@ -349,7 +351,7 @@
\ifx\@empty\df@tag
\else
\setbox4\hbox{\df@tag
- \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}
+ \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
\else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
}%
\fi
@@ -390,6 +392,9 @@
\gdef\maketag@@@##1{\hbox{\m@th\normalfont##1%
\llap{\hss\PotEndMark{\raisebox{-1.3em}}}}}%
\fi}
+\let\ams@@maketag@@@\maketag@@@
+\gdef\tagform@#1{%
+ \ams@@maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
\gdef\RestoreTags{%
\global\let\maketag@@@=\Old@maketag@@@
\global\let\df@tag=\Old@df@tag}
@@ -567,8 +572,12 @@
\global\theoremnumbering{arabic}
\newskip\theorempreskipamount
\newskip\theorempostskipamount
+\newskip\theoremframepreskipamount
+\newskip\theoremframepostskipamount
\global\theorempreskipamount\topsep
\global\theorempostskipamount\topsep
+\global\theoremframepreskipamount0pt
+\global\theoremframepostskipamount0pt
\newdimen\theoremindent
\global\theoremindent0cm
\newdimen\theorem@indent
@@ -827,20 +836,21 @@
\theoremframecommand%
\fi
\theoremprework{%
- \def\FrameCommand{\csname#1@framecommand\endcsname}\framed}%
- \theorempostwork{\endframed}%
+ \def\FrameCommand{\csname#1@framecommand\endcsname}%
+ \vskip\theoremframepreskipamount\framed}%
+ \theorempostwork{\endframed\vskip\theoremframepostskipamount}%
\newtheorem@i{#1}%
}
\def\newframedtheorem#1{%
- \theoremprework{\framed}%
- \theorempostwork{\endframed}%
+ \theoremprework{\vskip\theoremframepreskipamount\framed}%
+ \theorempostwork{\endframed\vskip\theoremframepostskipamount}%
\newtheorem@i{#1}%
}
}% end of option framed **********************************************
\def\thm@thmcaption#1#2{\thm@@thmcaption{#1}#2}
\def\thm@@thmcaption#1#2#3#4{%
\thm@parseforwriting{#2}%
- \let\thm@tmpii\thm@tmp%
+ \let\thm@tmpii\thm@tmp
\thm@parseforwriting{#4}%
\edef\thm@t{{\thm@tmpii}{#3}{\thm@tmp}}%
\addcontentsline{thm}{#1}{\thm@t}}
@@ -853,7 +863,8 @@
{#1 \protect\numberline{#2}#3}%
{#4}}
\def\thm@thmline#1#2{\thm@@thmline#1{#2}}
-\long\def\thm@lgobble#1#2{\ignorespaces}
+\long\def\thm@lgobble@entry#1#2{\ignorespaces}
+\long\def\thm@lgobble@freetext#1#2{\ignorespaces}
\def\theoremlistall{%
\let\thm@@thmlstart=\relax
\let\thm@@thmlend=\relax
@@ -878,60 +889,6 @@
\else%
\thm@@thmline@name{##1}{##2}{##3}{##4}%
\fi}}
-\DeclareOption{hyperref}{% **********************************************
- \def\thm@@thmline@noname#1#2#3#4#5{%
- \ifx\\#5\\%
- \@dottedtocline{-2}{0em}{2.3em}%
- {\protect\numberline{#2}#3}%
- {#4}%
- \else
- \ifHy@linktocpage\relax\relax
- \@dottedtocline{-2}{0em}{2.3em}%
- {\protect\numberline{#2}#3}%
- {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}
- \else
- \@dottedtocline{-2}{0em}{2.3em}%
- {\hyper@linkstart{link}{#5}{\protect\numberline{#2}#3}%
- \hyper@linkend}%
- {#4}%
- \fi
- \fi}%
- \def\thm@@thmline@name#1#2#3#4#5{%
- \ifx\\#5\\%
- \@dottedtocline{-2}{0em}{2.3em}%
- {#1 \protect\numberline{#2}#3}%
- {#4}
- \else
- \ifHy@linktocpage\relax\relax
- \@dottedtocline{-2}{0em}{2.3em}%
- {#1 \protect\numberline{#2}#3}%
- {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
- \else
- \@dottedtocline{-2}{0em}{2.3em}%
- {\hyper@linkstart{link}{#5}%
- {#1 \protect\numberline{#2}#3}\hyper@linkend}%
- {#4}%
- \fi
- \fi}
- \def\thm@thmline#1#2#3{\thm@@thmline#1{#2}{#3}}
- \long\def\thm@lgobble#1#2#3{\ignorespaces}
- \def\theoremlistoptional{%
- \let\thm@@thmlstart=\relax
- \let\thm@@thmlend=\relax
- \def\thm@@thmline##1##2##3##4##5{%
- \ifx\empty ##3%
- \else%
- \thm@@thmline@noname{##1}{##2}{##3}{##4}{##5}%
- \fi}}
- \def\theoremlistoptname{%
- \let\thm@@thmlstart=\relax
- \let\thm@@thmlend=\relax
- \def\thm@@thmline##1##2##3##4##5{%
- \ifx\empty ##3%
- \else%
- \thm@@thmline@name{##1}{##2}{##3}{##4}{##5}%
- \fi}}
-}% end of option hyperref *********************************************
\def\theoremlisttype#1{%
\@ifundefined{thm@thml@#1}%
{\PackageError{\basename}{Listtype #1 not defined}\@eha}%
@@ -953,8 +910,8 @@
\expandafter\let\csname thm@thml@#1\endcsname\relax
\newtheoremlisttype{#1}{#2}{#3}{#4}}
\def\thm@definelthm#1{%
- \expandafter\gdef\csname l@#1\endcsname{\thm@lgobble}%
- \expandafter\gdef\csname thm@listdo#1\endcsname{\thm@lgobble}}
+ \expandafter\gdef\csname l@#1\endcsname{\thm@lgobble@entry}%
+ \expandafter\gdef\csname thm@listdo#1\endcsname{\thm@lgobble@freetext}}
\long\def\thm@inlistdo#1#2{#2}%
\def\listtheorems#1{\begingroup
\c@tocdepth=-2%
@@ -964,22 +921,27 @@
\begingroup
\typeout{** Generating table of \thm@list}%
\def\contentsline##1{%
- \expandafter\@ifundefined{l@##1}{\thm@lgobble}{\csname l@##1\endcsname}}%
+ \expandafter\@ifundefined{l@##1}%
+ {\thm@lgobble@entry}{\csname l@##1\endcsname}}%
\thm@@thmlstart
- \@for\thm@currentlist:=\thm@list\do{%
+ \@for\thm@currentlist:=\thm@list
+ \do{%
\ifx\thm@currentlist\@empty\else
\expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@thmline}%
\expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@inlistdo}%
\fi
- }%
+ }%
\@input{\jobname .thm}%
\thm@@thmlend
- \@for\thm@currentlist:=\thm@list\do{%
+ \@for\thm@currentlist:=\thm@list
+ \do{%
\ifx\thm@currentlist\@empty\else
- \expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@lgobble}%
- \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@lgobble}%
+ \expandafter\gdef\csname l@\thm@currentlist\endcsname
+ {\thm@lgobble@entry}%
+ \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname
+ {\thm@lgobble@freetext}%
\fi
- }%
+ }%
\endgroup}
\def\thm@enablelistoftheorems{%
\begingroup
@@ -1014,6 +976,76 @@
\long\def\theoremlistdo#1#2{\expandafter\@ifundefined{thm@listdo#1}%
\relax{\csname thm@listdo#1\endcsname{#1}{#2}}}
\AtEndDocument{\thm@enablelistoftheorems}
+\DeclareOption{hyperref}{% **********************************************
+ \def\thm@@thmline@noname#1#2#3#4#5{%
+ \ifx\\#5\\%
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\protect\numberline{#2}#3}%
+ {#4}%
+ \else
+ \ifHy@linktocpage\relax\relax
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\protect\numberline{#2}#3}%
+ {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}
+ \else
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\hyper@linkstart{link}{#5}{\protect\numberline{#2}#3}%
+ \hyper@linkend}%
+ {#4}%
+ \fi
+ \fi}%
+ \def\thm@@thmline@name#1#2#3#4#5{%
+ \ifx\\#5\\%
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {#1 \protect\numberline{#2}#3}%
+ {#4}
+ \else
+ \ifHy@linktocpage\relax\relax
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {#1 \protect\numberline{#2}#3}%
+ {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
+ \else
+ \@dottedtocline{-2}{0em}{2.3em}%
+ {\hyper@linkstart{link}{#5}%
+ {#1 \protect\numberline{#2}#3}\hyper@linkend}%
+ {#4}%
+ \fi
+ \fi}
+ \def\thm@thmline#1#2#3{\thm@@thmline#1{#2}{#3}}
+ \long\def\thm@lgobble@entry#1#2#3{\ignorespaces}
+ \def\theoremlistoptional{%
+ \let\thm@@thmlstart=\relax
+ \let\thm@@thmlend=\relax
+ \def\thm@@thmline##1##2##3##4##5{%
+ \ifx\empty ##3%
+ \else%
+ \thm@@thmline@noname{##1}{##2}{##3}{##4}{##5}%
+ \fi}}
+ \def\theoremlistoptname{%
+ \let\thm@@thmlstart=\relax
+ \let\thm@@thmlend=\relax
+ \def\thm@@thmline##1##2##3##4##5{%
+ \ifx\empty ##3%
+ \else%
+ \thm@@thmline@name{##1}{##2}{##3}{##4}{##5}%
+ \fi}}
+\if@thref
+\def\@firstofthree#1#2#3{#1}%
+\def\getKeywordOf#1{%
+ \let\thm@oldcontentsline\contentsline
+ \def\contentsline##1##2##3##4{%
+ \ifthenelse{\equal{#1}{##4}}{\@firstofthree##2}{}%
+ \ignorespaces}%
+ \@input{\jobname .thm}%
+ \let\contentsline\thm@oldcontentsline
+}
+\def\thm@fmt@hyplabel@i#1#2#3#4#5{%
+ \getKeywordOf{#4}~\thm@fmt@hyplabel@ii#4}
+\def\thm@fmt@hyplabel@ii#1.#2{#2}%
+\def\thref#1{%
+ \expandafter\@setref\csname r@#1\endcsname\thm@fmt@hyplabel@i{#1}}%
+\fi % end of \if@thref
+}% end of option hyperref *********************************************
\def\thm@meaning#1->#2\relax{#2}% remove "macro: ->"
\long\def\thm@parseforwriting#1{%
\def\thm@tmp{#1}%