From 66916111abcb055475dec91a00495559d341472a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 6 Sep 2012 22:19:15 +0000 Subject: ntheorem (6sep12) git-svn-id: svn://tug.org/texlive/trunk@27609 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/ntheorem/ntheorem.drv | 7 +- .../texmf-dist/source/latex/ntheorem/ntheorem.dtx | 663 ++++++++++++++++----- 2 files changed, 515 insertions(+), 155 deletions(-) (limited to 'Master/texmf-dist/source/latex/ntheorem') diff --git a/Master/texmf-dist/source/latex/ntheorem/ntheorem.drv b/Master/texmf-dist/source/latex/ntheorem/ntheorem.drv index 2aa2a5b0fc1..922ee6dc02d 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{2011/02/16} -\def\docdate{2011/02/16} -\def\fileversion{1.31} +\def\filedate{2011/08/15} +\def\docdate{2011/08/15} +\def\fileversion{1.33} \def\basename{ntheorem} %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.2 @@ -46,6 +46,7 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} + \documentclass{ltxdoc} \usepackage{latexsym} \usepackage{framed} \usepackage{pstricks} \usepackage[thmmarks,thref,noconfig,framed]{ntheorem} \parindent0pt\hfuzz2pt diff --git a/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx b/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx index 0c2db714e27..6362cdc3691 100644 --- a/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx +++ b/Master/texmf-dist/source/latex/ntheorem/ntheorem.dtx @@ -1,6 +1,6 @@ -\def\filedate{2011/02/16} -\def\docdate{2011/02/16} -\def\fileversion{1.31} +\def\filedate{2011/08/15} +\def\docdate{2011/08/15} +\def\fileversion{1.33} \def\basename{ntheorem} % \iffalse % @@ -33,7 +33,7 @@ % % \fi % -% \CheckSum{2654} +% \CheckSum{2850} %% \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 @@ -80,6 +80,7 @@ % moved option thref before amsmath (amsmath needs redefinition of % `label') (WM)} % \changes{v1.21}{2002/12/30}{added theoremprework and postwork (WM)} +% \changes{v1.32}{2011/02/28}{implemented new theorem skip scheme (WM)} % % \MakeShortVerb{\|} % \def\envfont{\normalfont\ttfamily} @@ -320,20 +321,8 @@ % The layout of a theorem set is defined with the values of the switches % at the time |\newtheorem| is called. % -% \subsubsection{Common Parameters for all Theorem Sets} -% -% \DescribeMacro\theorempreskipamount -% \DescribeMacro\theorempostskipamount -% These additional parameters affect the vertical space around -% theorem environments: -% |\theorempreskipamount| and |\theorempostskipamount| define, -% respectively, the spacing before and after such an environment. -% These parameters apply for all theorem sets and can be manipulated -% with the ordinary length macros. They are rubber lengths, -% (`\textsf{skips}'), and therefore can contain \texttt{plus} and -% \texttt{minus} parts. -% % \subsubsection{Parameters for Individual Sets} +% \label{se-new-skips} % % The layout of individual theorem sets can be further determined % by switches controlling the appearance of the headers and the @@ -360,6 +349,16 @@ % \DescribeMacro\theorembodyfont % |\theorembodyfont{|\meta{fontcmds}|}|: The theorem body is set % in the font specified by \meta{fontcmds}. +% \item +% \DescribeMacro\theoremnumbering +% |\theoremnumbering{|\meta{style}|}| specifies the appearance of +% the numbering of the theorem set. Possible \meta{styles} are +% |arabic| (default), |alph|, |Alph|, |roman|, +% |Roman|, |greek|, |Greek|, and |fnsymbol|. +% +% Clearly, if a theorem-environment uses the counter of another +% environment type, also the numbering style of that environment +% is used. % \item % \DescribeMacro\theoremseparator % |\theoremseparator{|\meta{thing}|}|: \meta{thing} separates the @@ -367,6 +366,44 @@ % E.g., \meta{thing} can be % ``:'' or ``.''. % \item +% \DescribeMacro\theorempreskip +% \DescribeMacro\theorempostskip +% |\theorempreskip{|\meta{skip}|}| and +% |\theorempostskip{|\meta{skip}|}| can be used to specify the +% vertical space before/after the theorem environment (note that +% Section~\ref{sec-framed} that allows framed and shaded theorems +% also defines additional skip parameters). +% The arguments are rubber lengths, +% (`\textsf{skips}'), and therefore can contain \texttt{plus} and +% \texttt{minus} parts. +% (Note that these parameters changed with version 1.32; see +% Section~\ref{sec-old-skips}.) +% \item +% \DescribeMacro\theoremindent +% |\theoremindent|\meta{dimen} can be used to indent the theorem wrt.\ +% the surrounding text (note that |\theoremindent| is specified +% without |{|\ldots|}|). +% +% \DANGER It's a `\textsf(dimen)', so the user shouldn't try to specify a +% \texttt{plus} or \texttt{minus} part, because this leads to an error. +% \item +% \DescribeMacro\theoremsymbol +% |\theoremsymbol{|\meta{thing}|}|: This is only active if +% |ntheorem.sty| is loaded with option |[thmmarks]|. +% \meta{thing} is set as an endmark at the end of every instance +% of the environment. +% If no symbol should appear, say |\theoremsymbol{}|. +% \end{itemize} +% +% The above properties carry over to all subsequent |\newtheorem| +% statements until they are set differently. Initially, they have +% default values. +% +% The following two properties apply only to the very next |\newtheorem| +% and are then automatically reset: +% +% \begin{itemize} +% \item % \DescribeMacro\theoremprework % \changes{v1.30}{2010/08/14}{`theoremprework': added comment on % `leavevmode' to documentation (WM)} @@ -381,30 +418,6 @@ % |\theorempostwork{|\meta{thing}|}|: \meta{thing} is performed % after finishing the theorem structure. % E.g., \meta{thing} can be |\hrule|. -% \item -% \DescribeMacro\theoremindent -% |\theoremindent{|\meta{dimen}|}| can be used to indent the theorem wrt.\ -% the surrounding text. -% -% \DANGER It's a `\textsf(dimen)', so the user shouldn't try to specify a -% \texttt{plus} or \texttt{minus} part, because this leads to an error. -% \item -% \DescribeMacro\theoremnumbering -% |\theoremnumbering{|\meta{style}|}| specifies the appearance of -% the numbering of the theorem set. Possible \meta{styles} are -% |arabic| (default), |alph|, |Alph|, |roman|, -% |Roman|, |greek|, |Greek|, and |fnsymbol|. -% -% Clearly, if a theorem-environment uses the counter of another -% environment type, also the numbering style of that environment -% is used. -% \item -% \DescribeMacro\theoremsymbol -% |\theoremsymbol{|\meta{thing}|}|: This is only active if -% |ntheorem.sty| is loaded with option |[thmmarks]|. -% \meta{thing} is set as an endmark at the end of every instance -% of the environment. -% If no symbol should appear, say |\theoremsymbol{}|. % \end{itemize} % % The flexibility provided by these command should relieve the @@ -473,6 +486,9 @@ % |\theoremheaderfont{\normalfont\bfseries}| and\\ % |\theorembodyfont{\itshape}|,\\ % |\theoremseparator{}|,\\ +% |\theorempreskip{\topsep}|, \\ +% |\theorempostskip{\topsep}|, where |\topsep| refers to the space +% that \LaTeX\ inserts above and below lists, \\ % |\theoremindent0cm|,\\ % |\theoremnumbering{arabic}|, \\ % |\theoremsymbol{}|. @@ -481,6 +497,29 @@ % the same layout as in standard \LaTeX. % % +% \subsubsection{Deprecated: Skips until Version 1.32} +% \label{sec-old-skips} +% +% \DescribeMacro\theorempreskipamount +% \DescribeMacro\theorempostskipamount +% Until version 1.31, there was only a simplified handling +% of vertical space before/after theorems that did not consider +% framed and shaded theorems (that have been introduced with v1.21). +% |\theorempreskipamount|\meta{skip} and +% |\theorempostskipamount|\meta{skip} defined, +% respectively, the spacing before and after such an environment +% (note that both are specified without |{|\ldots|}|). +% These parameters applied for all theorem sets and can be manipulated +% with the ordinary length macros. They are rubber lengths, +% (`\textsf{skips}'), and therefore can contain \texttt{plus} and +% \texttt{minus} parts. +% +% Unchanged, older \LaTeX\ sources that used these commands yield the +% same output as before since the new skip scheme described in +% Section~\ref{se-new-skips} is only activated if one of its commands +% is used. Otherwise, the old scheme is applied. +% +% % \subsubsection{A Standard Set of Theorems}\label{sec:standard} % % A standard configuration of theorem sets is provided within @@ -561,15 +600,44 @@ % |\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. +% \paragraph{Vertical Spacing of Framed Theorems} +% +% The New Skip Scheme introduced with version 1.32 allows +% a detailed specification of vertical space also for framed +% theorems (specified individually for each theorem class): + +% \begin{itemize} +% \item |\theorempreskip{|\meta{skip}|}| and +% |\theorempostskip{|\meta{skip}|}| have no effect for +% framed theorems. +% \item +% \DescribeMacro\theoremframepreskip +% \DescribeMacro\theoremframepostskip +% |\theoremframepreskip{|\meta{skip}|}| and +% |\theoremframepostskip{|\meta{skip}|}| can be used to specify the +% vertical space before/after the frame/box. +% \item +% \DescribeMacro\theoreminframepreskip +% \DescribeMacro\theoreminframepostskip +% |\theoreminframepreskip{|\meta{skip}|}| and +% |\theoreminframepostskip{|\meta{skip}|}| can be used to specify the +% vertical space around the theorem text \emph{inside} the +% frame/box. +% \item The arguments of the above commands are rubber lengths, +% (`\textsf{skips}'), and therefore can contain \texttt{plus} and +% \texttt{minus} parts. +% \item the default values of all above skips is |\topsep|, i.e., +% the space \LaTeX\ normally inserts before/after lists. +% \end{itemize} % +% +% Old Skip Scheme (until v 1.31): +% |\theorempreskipamount| and |\theorempostskipamount| are +% applied \emph{inside} the frame/box. % 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.) +% frame/box in versions 1.30--v.1.31, |\theoremframepreskipamount| and +% |\theoremframepostskipamount| could be used (both defined by default to +% 0pt) analogously (i.e., they are also common to all theorem types.) % % \subsubsection{Customization and Local Settings} % @@ -955,6 +1023,16 @@ % (see Section~\ref{sec:listtypes}) isn't yet working with % the |hyperref|-package. % +% \subsection{Mathtools and Empheq}\label{sec:mathtools} +% +% The |mathtools| and |empheq| packages should be loaded \emph{before} +% |ntheorem| as follows: +% \begin{verbatim} +% \usepackage[ntheorem]{empheq} % this loads amsmath as well +% \usepackage[thmmarks,amsmath]{ntheorem} \end{verbatim} +% Note that |empheq| provides an enhanced vertical placement +% of the endmarks (see the paragraph on |ntheorem| in the +% documentation of the |empheq| package) in math environments. % % \section{Examples}\label{sec:examples} % @@ -995,8 +1073,9 @@ % \theoremprework{\bigskip\hrule} % \theorempostwork{\hrule\bigskip} % \newtheorem{Definition}{Definition}\end{verbatim} -% \item For Proofs (note that |theoremprework| and |theorempostwork| -% are reset -- proofs do not have lines above and below): +% \item For Proofs (note that |\theoremprework| and +% |\theorempostwork| are automatically reset with the next +% |\newtheorem| -- proofs do not have lines above and below): % \begin{verbatim} % \theoremheaderfont{\sc}\theorembodyfont{\upshape} % \theoremstyle{nonumberplain} @@ -1347,6 +1426,7 @@ % seems to be algorithmically easy, but tedious.}. % % \subsection{Framed and Shaded Theorems} +% \label{sec-framed} % % Framed theorem classes are defined as follows: % \begin{quote} @@ -1369,8 +1449,11 @@ % |\end{importantTheorem}| % \end{quote} % \begin{importantTheorem}[Important Theorem] -% This is an important theorem. \\ +% This is an important theorem. % \end{importantTheorem} +% +% Note that all skips have their default values (e.g.\ +% |\theoreminframepreskip| is |\topsep|). % More important theorems are shaded -- by default in grey: % % \begin{quote} @@ -1388,11 +1471,17 @@ % This is a more important theorem. % \end{moreImportantTheorem} % -% Even more important theorems are shaded in red: +% Even more important theorems are shaded in red, with 1/2cm +% space inside the frame before and 1 cm space after the text, +% but no additional space before/after the frame: % % \begin{quote} % |\theoremclass{Theorem}| \\ % |\theoremstyle{break}| \\ +% |\theoreminframepreskip{0.5cm}| \\ +% |\theoreminframepostskip{1cm}| \\ +% |\theoremframepreskip{0cm}| \\ +% |\theoremframepostskip{0cm}| \\ % |\shadecolor{red}| \\ % |\newshadedtheorem{evenMoreImportantTheorem}[Theorem]{Theorem}| \\ % |\begin{evenMoreImportantTheorem}[Even More Important Theorem]| \\ @@ -1401,19 +1490,28 @@ % \end{quote} % \theoremclass{Theorem} % \theoremstyle{break} +% \theoreminframepreskip{0.5cm} +% \theoreminframepostskip{1cm} +% \theoremframepreskip{0cm} +% \theoremframepostskip{0cm} % \shadecolor{red} % \newshadedtheorem{evenMoreImportantTheorem}[Theorem]{Theorem} % \begin{evenMoreImportantTheorem}[Even More Important Theorem] % This is an even more important theorem. % \end{evenMoreImportantTheorem} % -% Most important theorems get a framed, blue colored box with a shadow. +% Most important theorems get a framed, blue colored box with a shadow, +% no space inside the frame, and 1cm before and after the frame. % Here, |\def\theoremframecommand| is used: % % \begin{quote} % |\theoremclass{Theorem}| \\ % |\theoremstyle{break}| \\ -% |\shadecolor{red}| \\ +% |\theoreminframepreskip{0pt}| \\ +% |\theoreminframepostskip{0pt}| \\ +% |\theoremframepreskip{1cm}| \\ +% |\theoremframepostskip{1cm}| \\ +% |\theoremstyle{break}| \\ % |\def\theoremframecommand{%| \\ % | \psshadowbox[fillstyle=solid,fillcolor=blue,linecolor=black]}| \\ % |\newshadedtheorem{MostImportantTheorem}[Theorem]{Theorem}| \\ @@ -1422,8 +1520,11 @@ % |\end{MostImportantTheorem}| % \end{quote} % \theoremclass{Theorem} +% \theoreminframepreskip{0pt} +% \theoreminframepostskip{0pt} +% \theoremframepreskip{1cm} +% \theoremframepostskip{1cm} % \theoremstyle{break} -% \shadecolor{red} % \def\theoremframecommand{% % \psshadowbox[fillstyle=solid,fillcolor=blue,linecolor=black]} % \newshadedtheorem{MostImportantTheorem}[Theorem]{Theorem} @@ -1793,6 +1894,7 @@ \RequirePackage{ifthen}% \newif\if@thmmarks\@thmmarksfalse \newif\if@thref\@threffalse +\newif\ifthm@inframe\thm@inframefalse \newif\ifthm@tempif % \end{macrocode} % @@ -2186,15 +2288,22 @@ % \begin{macro}{\PotEndMark} % Handling a potential endmark position: % +% \changes{v1.32}{2011/24/02}{added optional argument (WM)} % \begin{macrocode} -\gdef\PotEndMark#1{\SetEndMark{\InTheoType}{#1}}% +\gdef\PotEndMark#1{ + \@ifnextchar[%] + {\PotEndMark@opt{#1}}{\SetEndMark{\InTheoType}{#1}{\relax}}}% +\gdef\PotEndMark@opt#1[#2]{\SetEndMark{\InTheoType}{#1}{#2}}% % \end{macrocode} % -% Argument: \meta{cmd\_seq}:=|#1| is a command sequence to be +% Arguments: \meta{cmd\_seq}:=|#1| is a command sequence to be % executed when setting the endmark. \\ +% \meta{else\_cmd\_seq}= |#2|: a command sequence that is executed +% when no end mark is set (default is |\relax|; differs only in +% amsmath equation*). \\ % It adds the current theorem type \env\ to the parameters, and % calls \\ -% |\PotEndMark{|\env|}{|\meta{cmd\_seq}|}|. +% |\SetEndMark{|\env|}{|\meta{cmd\_seq}|}{|\meta{else\_cmd\_seq}|}|. % \end{macro} % % \begin{macro}{\SetEndMark} @@ -2203,12 +2312,13 @@ % \changes{v1.16}{1999/08/05}{extended for handling right indents (quote) (WM)} % \changes{v1.16}{2001/11/28}{removed tilde in hbox (WM)} % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)} +% \changes{v1.32}{2011/24/02}{added third argument (WM)} % \Codelabel{SetEndMark} % \begin{macrocode} -\gdef\SetEndMark#1#2{% +\gdef\SetEndMark#1#2#3{% \stepcounter{end#1ctr}% \@ifundefined{mark\thm@romannum{curr#1ctr}#1\thm@romannum{end#1ctr}}% - {\relax}% + {#3}% {#2{\csname mark\thm@romannum{curr#1ctr}#1\thm@romannum{end#1ctr}\endcsname \ifdim\rightmargin>\z@\hskip-\rightmargin\fi \hbox to 0cm{}}}}% @@ -2217,7 +2327,10 @@ % Arguments: \\ % \env:=|#1|: current theorem-environment. \\ % \meta{cmd\_seq}:= |#2|: is a command sequence to be executed when setting -% the endmark. Both arguments are transmitted from by |\PotEndMark|. \\ +% the endmark. \\ +% \meta{else\_cmd\_seq}= |#3|: a command sequence that is executed +% when no end mark is set (usually |\relax|; differs only in amsmath tags). \\ +% All three arguments are transmitted by |\PotEndMark|. \\ % \begin{packeddescr} % \item[Line \Coderef{SetEndMark}{2}:] % increments |end|\env|ctr| for preparing the next situation @@ -2230,7 +2343,7 @@ % \end{quote} % is undefined % -- which is the case iff at this position no endmark has to be set --, -% nothing is done, +% \meta{else\_cmd\_seq} is executed, % \item[Line \Coderef{SetEndMark}{5}:] % otherwise, \meta{cmd\_seq} and then % \begin{quote} @@ -2243,11 +2356,11 @@ % argument of \meta{cmd\_seq} as needed for |\endeqnarray|. % \item[Line \Coderef{SetEndMark}{6}:] % By |\hskip-\rightmargin\hbox to 0cm{}|, a negative hspace of -% amount |\rightmargin| is added \emph{after} the end symbol -- thus, -% the symbol is set as there were no right margin (this concerns, -% e.g., |\quote| environments). \\ -% (applied only if |\rightmargin| is more than 0 -- otherwise bug -% if preceding line ends with hyphenation.) +% amount |\rightmargin| is added \emph{after} the end symbol -- thus, +% the symbol is set as there were no right margin (this concerns, +% e.g., |\quote| environments). \\ +% (applied only if |\rightmargin| is more than 0 -- otherwise bug +% if preceding line ends with hyphenation.) % \end{packeddescr} % \changes{v1.20}{2001/12/30}{apply negative hskip only if more than 0 (WM)} %\end{macro} @@ -2565,7 +2678,7 @@ % \item[Line \Coderef{newlabel}{9}:] if an optional argument % follows (containing the environment-type), continue with % |\set@label@type|, otherwise return (the original behavior). -% \item[Lines \Coderef{newlabel}{11},\Coderef{newlabel}{12}:] +% \item[Lines \Coderef{newlabel}{11}, \Coderef{newlabel}{12}:] % set |\r@|\meta{labelname}|@type| to the type of the % respective environment. % \end{packeddescr} @@ -2583,12 +2696,12 @@ \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% + \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}:] +% \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 @@ -2600,7 +2713,7 @@ % \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)} +% 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). @@ -2736,7 +2849,7 @@ % \end{macro} % \begin{macrocode} \fi -% end of option amsmath/thref ****************************************** +% end of if-thref in option amsmath ****************************************** \if@thmmarks \PackageInfo{\basename}{option `amsmath' handling for `thmmarks' loaded}% \newdimen\thm@amstmpdepth @@ -2775,6 +2888,8 @@ % \end{macro} % % \begin{macro}{\SetOnlyEndMark} +% \changes{v1.32}{2011/24/02}{added second argument to call of +% PotEndMark in else case (WM, reported by Rolf Theunissen)} % \Codelabel{OnlyEnd} % \begin{macrocode} \gdef\SetOnlyEndMark{% @@ -2783,7 +2898,7 @@ \gdef\df@tag{\hbox to \displaywidth{\hss\PotEndMark{\maketag@@@}}}% \else - \gdef\df@tag{\PotEndMark{\maketag@@@}}% + \gdef\df@tag{\PotEndMark{\maketag@@@}[\ifhmode\else\hbox to .1pt{}\fi]}% \fi} % \end{macrocode} % Set only an end mark: @@ -2791,13 +2906,16 @@ % \begin{packeddescr} % \item[Line \Coderef{OnlyEnd}{2}:] % force setting the end mark as a tag: -% \item[Lines \Coderef{OnlyEnd}{4},\Coderef{OnlyEnd}{5}:] +% \item[Lines \Coderef{OnlyEnd}{4}, \Coderef{OnlyEnd}{5}:] % if tags are set to the left, the tag consists of a % |\hbox| over the whole displaywidth, with the (potential) endmark % at its right. % \item[Line \Coderef{OnlyEnd}{7}:] % if tags are set to the right, the tag consists only of the -% (potential) endmark. +% (potential) endmark. If no endmark is set and \TeX\ is not in hmode, +% an empty hbox is output (otherwise |\abovedisplayskip| will be +% ignored in |equation*|; this is executed in |endmathdisplay@a| when +% it comes to |\veqno\alt@tag\df@tag|). % \end{packeddescr} % \end{macro} % @@ -2827,7 +2945,7 @@ % if tags are set to the left, build a box of the whole % displaywidth and put the original tag on the left, and the (potential) % endmark at the right. Put this box with width 0 and continue. -% \item[Lines \Coderef{TagPlus}{8},\Coderef{TagPlus}{9}:] +% \item[Lines \Coderef{TagPlus}{8}, \Coderef{TagPlus}{9}:] % if the tags are set to the right, the (potential) end % mark is put below it. % \end{packeddescr} @@ -2836,15 +2954,21 @@ % % \begin{macro}{\tagform@} % \begin{packeddescr} -% \item |\maketag@@@| is also used via |\tagform@| in |eqref| that may be +% \item |\maketag@@@| is also used via |\tagform@| in |\eqref| that may be % called inside an environment. There, the original functionality must -% be used. +% be used. The (small) commands |\th@ams@tagopen{(}| and +% |\th@ams@tagopen{(}| are provided as a hook for the |empheq| package. % \end{packeddescr} % \changes{v1.30}{2010/08/16}{added (WM), bug reported by Martin Schulze} +% \changes{v1.32}{2011/03/10}{revised (WM), bug reported by Lars Madsen} % \begin{macrocode} -\let\ams@@maketag@@@\maketag@@@ -\gdef\tagform@#1{% - \ams@@maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} +\let\th@ams@@maketag@@@\maketag@@@ +\gdef\th@ams@tagopen{(} +\gdef\th@ams@tagclose{)} +\gdef\th@ams@tagform@#1{% + \th@ams@@maketag@@@{\th@ams@tagopen\ignorespaces#1% + \unskip\@@italiccorr\th@ams@tagclose}} +\gdef\eqref#1{\textup{\th@ams@tagform@{\ref{#1}}}} % \end{macrocode} % \end{macro} % @@ -2857,7 +2981,7 @@ % \end{macrocode} % % \begin{packeddescr} -% \item[Lines \Coderef{RestoreTags}{2},\Coderef{RestoreTags}{3}:] +% \item[Lines \Coderef{RestoreTags}{2}, \Coderef{RestoreTags}{3}:] % restore the original macros. % \end{packeddescr}\end{macro} % @@ -3026,22 +3150,25 @@ % % \begin{macro}{equation} % \changes{v1.19}{2001/01/12}{adapted to amsmath-2.0 (WM)} +% \changes{v1.32}{2011/02/24}{adapted to amsmath-2.13 (WM)} % \begin{macrocode} \renewenvironment{equation}{% - \edef\reset@equation{% - \@nx\setcounter{equation}{\number\c@equation}}% - \refstepcounter{equation}% + \incr@eqnum + \mathdisplay@push \st@rredfalse \global\@eqnswtrue \mathdisplay{equation}% }{% \endmathdisplay{equation}% + \mathdisplay@pop \ignorespacesafterend } \renewenvironment{equation*}{% + \mathdisplay@push \st@rredtrue \global\@eqnswfalse \mathdisplay{equation*}% }{% \endmathdisplay{equation*}% + \mathdisplay@pop \ignorespacesafterend } % \end{macrocode} @@ -3265,26 +3392,78 @@ \global\theoremnumbering{arabic} % \end{macrocode}\end{macro} % -% \begin{macro}{\theorempreskipamount} -% \begin{macro}{\theorempostskipamount} +% \begin{macro}{theoremskips} +% \changes{v0.94}{1997/03/20}{'theorem...skip' fixed (WM)} +% \changes{v1.32}{2011/02/28}{implemented new skip scheme (WM)} % \begin{macrocode} \newskip\theorempreskipamount \newskip\theorempostskipamount \newskip\theoremframepreskipamount \newskip\theoremframepostskipamount +\newskip\theoreminframepreskipamount +\newskip\theoreminframepostskipamount \global\theorempreskipamount\topsep \global\theorempostskipamount\topsep -\global\theoremframepreskipamount0pt -\global\theoremframepostskipamount0pt -% \end{macrocode}\end{macro} -% \changes{v0.94}{1997/03/20}{'theorem...skip' fixed (WM)} +\global\theoremframepreskipamount\topsep +\global\theoremframepostskipamount\topsep +\global\theoreminframepreskipamount\topsep +\global\theoreminframepostskipamount\topsep +% \end{macrocode} +% \changes{v1.32}{2011/02/28}{implemented new skip scheme (WM)} +% \Codelabel{thmskips} +% \begin{macrocode} +\newif\ifuse@newframeskips\global\use@newframeskipsfalse +\newtoks\theorem@preskip +\global\theorem@preskip{\topsep} +\def\theorempreskip#1{% + \theorem@preskip{#1}\global\use@newframeskipstrue} +\newtoks\theorem@postskip +\global\theorem@postskip{\topsep} +\def\theorempostskip#1{% + \theorem@postskip{#1}\global\use@newframeskipstrue} +\newtoks\theorem@framepreskip +\global\theorem@framepreskip{\topsep} +\def\theoremframepreskip#1{% + \theorem@framepreskip{#1}\global\use@newframeskipstrue} +\newtoks\theorem@framepostskip +\global\theorem@framepostskip{\topsep} +\def\theoremframepostskip#1{% + \theorem@framepostskip{#1}\global\use@newframeskipstrue} +\newtoks\theorem@inframepreskip +\global\theorem@inframepreskip{\topsep} +\def\theoreminframepreskip#1{% + \theorem@inframepreskip{#1}\global\use@newframeskipstrue} +\newtoks\theorem@inframepostskip +\global\theorem@inframepostskip{\topsep} +\def\theoreminframepostskip#1{% + \theorem@inframepostskip{#1}\global\use@newframeskipstrue} +% \end{macrocode} % \end{macro} +% \begin{packeddescr} +% \item[Line \Coderef{thmskips}{1}:] +% switch whether new skip scheme is used (default for compatibility, +% with old versions: no) +% \item[Line \Coderef{thmskips}{2}, \Coderef{thmskips}{3}:] +% define and initialize internal token (not a skip, just a token), +% \item[Line \Coderef{thmskips}{4}, \Coderef{thmskips}{5}:] +% define command to assign argument to token, and activate use +% of new skip scheme, +% \item[Line \Coderef{thmskips}{6}--\Coderef{thmskips}{25}:] +% analogously for the other skips. +% \end{packeddescr} + +% The new theoremskip scheme is automatically activated if one +% of the above commands is invoked (for that, they are not directly +% implemented as |\newtoks|, but as complex commands). % % \begin{macro}{\theoremindent} % \begin{macrocode} \newdimen\theoremindent \global\theoremindent0cm \newdimen\theorem@indent +\newdimen\theoremrightindent +\global\theoremrightindent0cm +\newdimen\theorem@rightindent % \end{macrocode}\end{macro} % % \begin{macro}{\theoremheaderfont} @@ -3333,22 +3512,33 @@ % \begin{macro}{\theoremclass} % \changes{v1.16}{1999/08/07}{introduced 'theoremclass' and % defined 'th@class@LaTeX' (WM)} +% \changes{v1.32}{2011/02/28}{adapted to new skip scheme (WM)} % \begin{macrocode} \gdef\theoremclass#1{% \csname th@class@#1\endcsname} \gdef\th@class@LaTeX{% - \theoremstyle{plain} - \theoremheaderfont{\normalfont\bfseries} - \theorembodyfont{\itshape} - \theoremseparator{} - \theoremprework{\relax} - \theorempostwork{\relax} + \theoremstyle{plain}% + \theoremheaderfont{\normalfont\bfseries}% + \theorembodyfont{\itshape}% + \theoremseparator{}% + \theoremprework{\relax}% + \theorempostwork{\relax}% + \ifuse@newframeskips + \theorempreskip{0cm}% + \theorempostskip{0cm}% + \theoremframepreskip{0cm}% + \theoremframepostskip{0cm}% + \theoreminframepreskip{0cm}% + \theoreminframepostskip{0cm}% + \fi \theoremindent0cm - \theoremnumbering{arabic} + \theoremrightindent0cm + \theoremnumbering{arabic}% \theoremsymbol{}} % \end{macrocode}\end{macro} % Calling |\theoremclass{|\env|}| calls |\th@class@|\env\ (which is -% defined in |\@newtheorem| in Lines \Coderef{atnewthm}{31--45}). +% defined in |\@newtheorem| in Lines +% \Coderef{atnewthm}{31}--\Coderef{atnewthm}{45}). % |\th@class@|\env\ restores all style parameters to their values % given for \env. % Especially, |\th@class@LaTeX| restores the standard LaTeX parameters. @@ -3382,13 +3572,14 @@ \def\@opargbegintheorem##1##2##3{% \item[\hskip\labelsep \theorem@headerfont ##1\ (##3).]}} \gdef\th@definition{% - \th@plain\def\theorem@headerfont{\normalfont\bfseries}\itshape} + \th@plain\def\theorem@headerfont{\normalfont\bfseries}\normalfont} \gdef\th@nonumberdefinition{% - \th@nonumberplain\def\theorem@headerfont{\normalfont\bfseries}\itshape} + \th@nonumberplain\def\theorem@headerfont{\normalfont\bfseries}\normalfont} \gdef\th@remark{% \th@plain\def\theorem@headerfont{\itshape}\normalfont} \gdef\th@nonumberremark{% \th@nonumberplain\def\theorem@headerfont{\itshape}\normalfont} +%%% TODO skips initialisieren \newcounter{proof}% \if@thmmarks \newcounter{currproofctr}% @@ -3420,10 +3611,11 @@ % Original: ltthm.dtx % % \begin{macrocode} +\newskip\thm@topsep \newskip\thm@topsepadd % \end{macrocode} % -% An auxiliary variable. +% Two auxiliary variables. % % \paragraph{Defining New Theorem-Environments.} % @@ -3496,6 +3688,7 @@ % \changes{v1.21}{2002/12/30}{added handling of 'theoremprework' and % 'theorempostwork' (WM)} % \changes{v1.24}{2004/09/20}{debugged: reset theorempre/postwork (WM)} +% \changes{v1.32}{2011/02/28}{adapted to new skip scheme (WM)} % \begin{macrocode} \gdef\@newtheorem#1{% \thm@tempiffalse @@ -3527,8 +3720,18 @@ {\the\theoremseparator}% \noexpand \def \noexpand \theorem@prework {\the\theoremprework}% + \noexpand\ifuse@newframeskips + \noexpand \theorempreskipamount \the\theorem@preskip + \noexpand \theoremframepreskipamount \the\theorem@framepreskip + \noexpand \theoreminframepreskipamount \the\theorem@inframepreskip + \noexpand \theorempostskipamount \the\theorem@postskip + \noexpand \theoremframepostskipamount \the\theorem@framepostskip + \noexpand \theoreminframepostskipamount \the\theorem@inframepostskip + \noexpand\fi \noexpand \def \noexpand \theorem@indent {\the\theoremindent}% + \noexpand \def \noexpand \theorem@rightindent + {\the\theoremrightindent}% \the \theorembodyfont \noexpand\csname th@\the \theorem@@style \endcsname}% \expandafter\xdef\csname th@class@#1\endcsname @@ -3538,7 +3741,16 @@ \noexpand\theoremseparator{\the\theoremseparator}% \noexpand\theoremprework{\the\theoremprework}% \noexpand\theorempostwork{\the\theorempostwork}% + \noexpand\ifuse@newframeskips + \noexpand\theorempreskip {\the\theorem@preskip}% + \noexpand\theoremframepreskip {\the\theorem@framepreskip}% + \noexpand\theoreminframepreskip {\the\theorem@inframepreskip}% + \noexpand\theorempostskip {\the\theorem@postskip}% + \noexpand\theoremframepostskip {\the\theorem@framepostskip}% + \noexpand\theoreminframepostskip {\the\theorem@inframepostskip}% + \noexpand\fi \noexpand\theoremindent\the\theoremindent% + \noexpand\theoremrightindent\the\theoremrightindent% \noexpand\theoremnumbering{\the\theoremnumbering}% \noexpand\theoremsymbol{\the\theoremsymbol}}% }}% @@ -3558,7 +3770,7 @@ % |\thm@tempif=true| iff \env\ and \env * are not yet defined. % \item[Line \Coderef{atnewthm}{6}:] % Initialize theorem list handling for \env. -% \item[Lines \Coderef{atnewthm}{8}--\Coderef{atnewthm}{11}:] +% \item[Lines \Coderef{atnewthm}{7}--\Coderef{atnewthm}{12}:] % if |thmmarks| is active and the counters are not yet defined, % for every theorem-like, define \\ % |curr|\env|ctr|: in the $i$th environment of type \env, @@ -3568,54 +3780,60 @@ % mark in this environment, $|end|\env|ctr|=j$. % (if the counters are already defined, \env\ is redefined, % and these internal counters have to be continued). -% \item[Lines \Coderef{atnewthm}{13}--\Coderef{atnewthm}{30}:] +% \item[Lines \Coderef{atnewthm}{13}--\Coderef{atnewthm}{61}:] % define several commands: % (|\xdef| expands the definition at the time it is called and % makes it global): % \item[Line \Coderef{atnewthm}{13}:] -% store the current value of |\theoremsymbol| -% (|\edef|: expand |\the\theoremsymbol| now) as \env|Symbol|. -% \item[Line \Coderef{atnewthm}{14}:] -% store the current value of |\theorempostwork| -% (|\edef|: expand |\the\theorempostwork| now) as \env|postwork|. -% \item[Lines \Coderef{atnewthm}{15}--\Coderef{atnewthm}{17}, -% \Coderef{atnewthm}{18}--\Coderef{atnewthm}{20}:] +% store the current value of |\theoremsymbol| as |\|\env|Symbol|. +% \item[Line \Coderef{atnewthm}{14}, \Coderef{atnewthm}{15}:] +% store the current value of |\theorempostwork| as |\|\env|postwork|. +% \item[Lines \Coderef{atnewthm}{16}--\Coderef{atnewthm}{18}, +% \Coderef{atnewthm}{19}--\Coderef{atnewthm}{21}:] % Define the commands |\env| and |\env*| to set the header -% of |\env|. +% of \env\ by calling |\mkheader@|\env. % (using a switch |\thm@starredenv|: |\relax| iff starred). -% \item[Lines \Coderef{atnewthm}{21}, \Coderef{atnewthm}{22}:] +% \item[Lines \Coderef{atnewthm}{22}, \Coderef{atnewthm}{23}:] % Set |\end|\env|*| to |\end|\env. -% \item[Lines \Coderef{atnewthm}{23}--\Coderef{atnewthm}{33}:] +% \item[Lines \Coderef{atnewthm}{24}--\Coderef{atnewthm}{42}:] % define |\setparms@|\env\ to set the style parameters of the % header for every \env\ environment (in the sequel, % \emph{current} means, at the moment |\@newtheorem| is called): -% \item[Lines \Coderef{atnewthm}{24}, \Coderef{atnewthm}{25}:] +% \item[Lines \Coderef{atnewthm}{25}, \Coderef{atnewthm}{26}:] % setting |\theorem@headerfont| to the \emph{current} % value of |\theoremheaderfont|, followed by a check if % it is a bold style, -% \item[Lines \Coderef{atnewthm}{26}, \Coderef{atnewthm}{27}:] +% \item[Lines \Coderef{atnewthm}{27}, \Coderef{atnewthm}{28}:] % setting |\theorem@separator| to the \emph{current} % value of |\theoremseparator|, -% \item[Lines \Coderef{atnewthm}{28}, \Coderef{atnewthm}{29}:] +% \item[Lines \Coderef{atnewthm}{29}, \Coderef{atnewthm}{30}:] % setting |\theorem@prework| to the \emph{current} % value of |\theoremprework|, -% \item[Lines \Coderef{atnewthm}{30}, \Coderef{atnewthm}{31}:] +% \item[Lines \Coderef{atnewthm}{31}--\Coderef{atnewthm}{38}:] +% if new skip schema is used: setting the skips to the +% \emph{current} values hold in the respective tokens, +% \item[Line \Coderef{atnewthm}{39}, \Coderef{atnewthm}{40}:] % setting |\theorem@indent| to the \emph{current} % value of |\theoremindent|, -% \item[Line \Coderef{atnewthm}{32}:] +% \item[Line \Coderef{atnewthm}{41}:] % executing the command sequence currently stored in % |\theorembodyfont|, and -% \item[Line \Coderef{atnewthm}{33}:] +% \item[Line \Coderef{atnewthm}{42}:] % calling |th@\the\theorem@@style| (which initializes % |\@begintheorem| and |\@opargbegintheorem| according to the % \emph{current} value of |\theoremstyle| by calling % |th@\the\theorem@@style|). -% \item [Line \Coderef{atnewthm}{34}--\Coderef{atnewthm}{48}:] +% \item [Line \Coderef{atnewthm}{43}--\Coderef{atnewthm}{60}:] % define |\th@class@|\env\ to initialize all style % parameters as they are set for the \env\ environment. -% \item[Note,] that the |\@ifdefinable| from line \Coderef{atnewthm}{3} -% ends after line \Coderef{atnewthm}{48}. -% \item[Line \Coderef{atnewthm}{49}:] +% (call skip-initializing commands only if new skip scheme +% is activated). +% \item[Note,] that the |\@ifdefinable| from lines +% \Coderef{atnewthm}{3}/\Coderef{atnewthm}{4} +% end in line \Coderef{atnewthm}{59}. +% \item[Line \Coderef{atnewthm}{62}, \Coderef{atnewthm}{63}:] +% reset |\@theoremprework/postwork|. +% \item[Line \Coderef{atnewthm}{64}:] % According to the next character, call |\@othm{|\env|}| % (if another counter is used) or |\@nthm{|\env|}|. % \end{packeddescr} @@ -3630,7 +3848,7 @@ % \begin{quote} % |\setparms@|\env| == \def\theorem@headerfont{\bf\theorem@checkbold}| \\ % | \def\theorem@separator{:}| \\ -% | \def\theorem@indent{0cm}| \\ +% | \def\theorem@indent{1cm}| \\ % | \upshape| \\ % | \th@plain| % \end{quote} @@ -3640,11 +3858,11 @@ % | \def\theoremheaderfont{\bf}| \\ % | \def\theorembodyfont{\upshape}| \\ % | \def\theoremseparator{:}| \\ -% | \def\theoremindent{0cm}| \\ +% | \def\theoremindent{1cm}| \\ % | \def\theoremnumbering{arabic}| \\ % | \def\theoremsymbol{\Box}| % \end{quote} -% Note, that line \Coderef{atnewthm}{32} must not be inside +% Note, that line \Coderef{atnewthm}{64} must not be inside % \emph{any} |\if...\fi| construct. % \end{macro} % @@ -3808,7 +4026,7 @@ % \begin{packeddescr} % \item[Lines \Coderef{xnthm}{3}--\Coderef{xnthm}{12}] % happen only if \env\ is not yet defined or gets redefined: -% \item[Lines \Coderef{xnthm}{3},\Coderef{xnthm}{4}:] +% \item[Lines \Coderef{xnthm}{3}, \Coderef{xnthm}{4}:] % in not yet defined, define \env- counter (otherwise, \env\ % is redefined). % \item[Line \Coderef{xnthm}{6}:] @@ -3863,12 +4081,84 @@ % |\@ynthm| works analogous to |\@xnthm|. % \end{macro} % +% \paragraph{Notes on vertical spacing} +% +% In \LaTeX\ and in |ntheorem|, theorems are organized as +% |\trivlist|s, using the following skips: +% +% \begin{packeddescr} +% \item[$\bullet$] |\@topsep|: above, +% \item[$\bullet$] |\@topsepadd|: below (the name is misleading). +% \end{packeddescr} +% +% In \LaTeX (cf.\ |latex.ltx| and its sources), the handling is as follows: +% +% \begin{packeddescr} +% \item[$\bullet$] |\@begintheorem|: calls |\trivlist| and afterwards |\item|. +% \item[$\bullet$] |\trivlist|: calls |\@trivlist|. +% \item[$\bullet$] |\@trivlist|: sets +% |\@topsepadd := \topsep + ifvmode: \partopsep|, \\ +% |\@topsep := \@topsepadd|, and +% |\@topsep += \parskip| -- this latter will be undone later in |\@item|! +% \item[$\bullet$] |\item|: calls |\@item|. +% \item[$\bullet$] |\@item|: does |\addvspace\@topsep| and |\addvspace{-\parskip}|. +% \item[$\Rightarrow$] only |\@topsep| must be set to \meta{value}+|\parskip| +% before the actual text is output by |\@item| +% \item[$\bullet$] |\@endtheorem|: calls |\endtrivlist|. +% \item[$\bullet$] |\endtrivlist|: note |\@noparlist| is only true if list is +% itself at the beginning of a list item -- this is (usually) not the case +% for theorems. \\ +% The |\ifdim\lastskip ...| part actually leaves skips unchanged in +% default cases (|\@outerparskip := \parskip| in |\@trivlist|). \\ +% Afterwards, it calls |\@endparenv| +% \item[$\bullet$] |\@endparenv|: does |\addvspace\@topsepadd|. +% \end{packeddescr} +% +% In |ntheorem|, |\|\env is used instead of a common |\@begintheorem| +% (defined by |\newtheorem| in Lines +% \Coderef{atnewthm}{16}--\Coderef{atnewthm}{18}, +% \Coderef{atnewthm}{19}--\Coderef{atnewthm}{21}) that +% call |\mkheader@|\env. +% The actual definition of |\mkheader@|\env\ is done in |\@othm|, +% |\@xnthm|, or |\@ynthm| as |\mkheader@|\env\ == +% |\setparms@|\env|\@thm{...}{...}{...}|. \\ +% Amongst this, |\@thm{...}{...}{...}|, whose code is given next, +% \begin{packeddescr} +% \item[$\bullet$] generates the actual output of the theorem header +% (via |\@xthm|/|\@begintheorem| or |\@ythm|/|\@opargbegintheorem|) +% where |\@begintheorem| and |\@opargbegintheorem| are redefined +% by |ntheorem|: +% \item[$\bullet$] |\@begintheorem| and |\@opargbegintheorem| +% do \emph{not} contain the |\trivlist| command, but only set the +% |\item| (internally |\@item| that adds space |\@topsep-\parskip|). +% \item[$\bullet$] the |\trivlist| command itself is contained in +% |\@thm|, recall that as described above, it is not concerned +% with skips at all. +% \item[$\Rightarrow$] |\@thm| has to set +% |\@topsep := |\meta{value}|+\parskip| for the space \emph{above} +% the theorem. +% \item[$\bullet$] |\end|\env is defined in |\@othm|, |\@xnthm|, or |\@ynthm| +% as |\@endtheorem| which is defined in Lines +% \Coderef{atendtheorem}{0} (thmmarks active) and +% \Coderef{atendtheorem-without}{0} (thmmarks off). +% \item[$\bullet$] |\@endtheorem| with thmmarks on calls +% ntheorem's |\@endtrivlist| (Line \Coderef{atendtrivlist}{0}) +% which calls |\@endparenv|. +% \item[$\bullet$] |\@endtheorem| with thmmarks off calls +% the original |\endtrivlist| which calls the original +% |\@endtrivlist| which calls |\@endparenv|. +% \item[$\Rightarrow$] |\@topsepadd| is used for the vertical space +% after the theorem as usual. +% \end{packeddescr} +% % \paragraph{Handling Instances of Theorem-Environments.} % +% % \begin{macro}{\@thm} % |\@thm| is called by |\@|\env\ (which is defined by % |\@othm|/|\@xnthm|/|\@ynthm|). % \changes{v1.21}{2002/12/30}{added handling of 'theoremprework' (WM)} +% \changes{v1.32}{2011/02/28}{adapted to new skip scheme (WM)} % \Codelabel{atthm} % \begin{macrocode} \gdef\@thm#1#2#3{% @@ -3882,12 +4172,24 @@ \fi \refstepcounter{#2}% \theorem@prework - \thm@topsepadd \theorempostskipamount % cf. latex.ltx: \@trivlist - \ifvmode \advance\thm@topsepadd\partopsep\fi - \trivlist - \@topsep \theorempreskipamount - \@topsepadd \thm@topsepadd % used by \@endparenv + \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged + \ifuse@newframeskips % cf. latex.ltx for topsepadd: \@trivlist + \ifthm@inframe + \thm@topsep\theoreminframepreskipamount + \thm@topsepadd\theoreminframepostskipamount + \else + \thm@topsep\theorempreskipamount + \thm@topsepadd\theorempostskipamount + \fi + \else% oldframeskips + \thm@topsep\theorempreskipamount + \thm@topsepadd \theorempostskipamount + \ifvmode\advance\thm@topsepadd\partopsep\fi + \fi + \@topsep\thm@topsep + \@topsepadd\thm@topsepadd \advance\linewidth -\theorem@indent + \advance\linewidth -\theorem@rightindent \advance\@totalleftmargin \theorem@indent \parshape \@ne \@totalleftmargin \linewidth \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}} @@ -3915,16 +4217,27 @@ % adapted from latex.ltx: increment the corresponding counter. % \item[Line \Coderef{atthm}{11}:] % perform |prework| (before theorem structure is generated). -% \item[Lines \Coderef{atthm}{12}--\Coderef{atthm}{16}:] -% handle |\theorempreskipamount| and |\theorempostskipamount| -% (if in |vmode|, there is additional space, -% cf.\ |\trivlist| and |\@trivlist| in latex.ltx). -% \item[Lines \Coderef{atthm}{17}--\Coderef{atthm}{19}:] +% \item[Line \Coderef{atthm}{12}:] +% call \LaTeX's original |\trivlist|. It does just organizational +% things, no actual skips! The skip is added later when the first +% |\item| is typeset. +% \item[Lines \Coderef{atthm}{13}--\Coderef{atthm}{25}:] +% handle |\theorempreskipamount|, |\theorempostskipamount|, \\ +% |\theoreminframepreskipamount|, and +% |\theoreminframepostskipamount| +% (old skip schema: if in |vmode|, there is additional space, +% cf.\ |\trivlist| and |\@trivlist| in latex.ltx). +% \item[Lines \Coderef{atthm}{26}--\Coderef{atthm}{27}:] +% initialize |\@topsep| (the space before the first item) and +% |\@topsepadd| (the space after the first item). (see explanation +% of spacing in the note preceding this macro.) +% \item[Lines \Coderef{atthm}{28}--\Coderef{atthm}{30}:] % handle |\theoremindent|. -% \item[Line \Coderef{atthm}{20}:] -% if there is an optional argument, call -% |\@ythm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|, otherwise -% call |\@xthm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|. +% \item[Line \Coderef{atthm}{31}:] +% if there is an optional argument, call \\ +% |\@ythm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|, +% otherwise call \\ +% |\@xthm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|. % \end{packeddescr}\end{macro} % % \begin{macro}{\@xthm} @@ -3958,7 +4271,7 @@ \expandafter\global\expandafter\def\csname#1name\endcsname{#4}% \@opargbegintheorem{#3}{\csname the#2\endcsname}{#4}% \ifx\thm@starredenv\@undefined - \thm@thmcaption{#1}{{#3}{\csname the#2\endcsname}{#4}}\fi% + \thm@thmcaption{#1}{{#3}{\csname the#2\endcsname}{#4}}\fi \ignorespaces} % \end{macrocode} % @@ -3998,6 +4311,7 @@ % |\InTheoType| gives the innermost theorem-like environment, % i.e.\ the one to be ended: % +% \Codelabel{atendtheorem-without} % \begin{macrocode} \gdef\@endtheorem{% \endtrivlist @@ -4023,11 +4337,39 @@ % \end{macro} % % \begin{macro}{\newshadedtheorem} -% \changes{v1.21}{2002/12/30}{added (WM)} % \changes{v1.30}{2010/08/15}{added `theoremframepre/postskipamount' (WM)} +% \changes{v1.32}{2011/02/23}{consider lastskip in `theoremprework' (WM)} +% \changes{v1.32}{2011/02/23}{consider lastskip in `theorempostwork' (WM)} +% \changes{v1.32}{2011/02/28}{added thm@inframe (WM)} +% \changes{v1.32}{2011/03/15}{separated `thm@framedprework' and `thm@framedpostwork' (WM)} +% \begin{macrocode} +\def\thm@framedprework{% + \ifdim\lastskip <\theoremframepreskipamount + \vskip -\lastskip + \vskip\theoremframepreskipamount + \fi + \ifuse@newframeskips\vspace{-\topsep}\fi + \thm@inframetrue + \framed}% +\def\thm@framedpostwork{% + \endframed + \ifuse@newframeskips\unskip\fi + \vskip\theoremframepostskipamount}% +% \end{macrocode} +% \end{macro} +% +% Note: since |framed.sty| adds |\topsep| before and after a frame, +% |\vspace{-\topsep}| and |\unskip| are used to remove it. For compatibility +% with previous versions, this is only done if the new skip schema is used. +% +% \begin{macro}{\newshadedtheorem} +% \changes{v1.21}{2002/12/30}{added (WM)} +% \changes{v1.32}{2011/03/15}{use `thm@framedprework' and `thm@framedpostwork' (WM)} +% \changes{v1.33}{2011/08/15}{have user-defines `thm@pre/postwork' and shading/framing +% together (cf.\ `newshadedtheorem') (WM)} % \begin{macrocode} \def\newshadedtheorem#1{% - \expandafter\global\expandafter\xdef\csname#1@shadecolor\endcsname{% + \expandafter\xdef\csname#1@shadecolor\endcsname{% \the\shadecolor}% \ifx\theoremframecommand\relax \expandafter\global\expandafter\xdef\csname#1@framecommand\endcsname{% @@ -4038,20 +4380,35 @@ \expandafter\global\expandafter\let\csname#1@framecommand\endcsname% \theoremframecommand% \fi + \expandafter\xdef\csname#1@@prework\endcsname{% + \the\theoremprework}% \theoremprework{% + \csname#1@@prework\endcsname \def\FrameCommand{\csname#1@framecommand\endcsname}% - \vskip\theoremframepreskipamount\framed}% - \theorempostwork{\endframed\vskip\theoremframepostskipamount}% + \thm@framedprework}% + \expandafter\xdef\csname#1@@postwork\endcsname{% + \the\theorempostwork}% + \theorempostwork{% + \thm@framedpostwork + \csname#1@@postwork\endcsname}% \newtheorem@i{#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\newframedtheorem} +% \changes{v1.32}{2011/03/15}{use `thm@framedprework' and `thm@framedpostwork', +% cf.\ `newshadedtheorem' (WM)} +% \changes{v1.33}{2011/08/15}{have user-defined `thm@pre/postwork' and shading/framing +% together (cf.\ `newshadedtheorem') (WM)} % \begin{macrocode} \def\newframedtheorem#1{% - \theoremprework{\vskip\theoremframepreskipamount\framed}% - \theorempostwork{\endframed\vskip\theoremframepostskipamount}% + \expandafter\xdef\csname#1@@prework\endcsname{% + \the\theoremprework}% + \theoremprework{\csname#1@@prework\endcsname\thm@framedprework}% + \expandafter\xdef\csname#1@@postwork\endcsname{% + \the\theorempostwork}% + \theorempostwork{\thm@framedpostwork\csname#1@@postwork\endcsname}% \newtheorem@i{#1}% } }% end of option framed ********************************************** @@ -4061,6 +4418,7 @@ % \subsubsection{Generation of Theorem Lists}\label{sec:CodeLists} % % The generation of lists of theorems, definitions, etc.\ is based +% on the |.thm| file. % % The following macros are are needed for the generation of theorem-lists. % We will document it for the theorem @@ -4102,13 +4460,13 @@ % text argument in the header. % % \begin{packeddescr} -% \item[Lines \Coderef{thmcaption}{1},\Coderef{thmcaption}{2}:] +% \item[Lines \Coderef{thmcaption}{1}, \Coderef{thmcaption}{2}:] % the command sequence for the output keyword is prepared by % |\thm@parseforwriting| (which returns |\thm@tmpii|) and then % stored in |\thm@tmpii|. % \item[Line \Coderef{thmcaption}{3}:] % the optional text is also prepared by |\thm@parseforwriting| -% \item[Lines \Coderef{thmcaption}{4},\Coderef{thmcaption}{5}:] +% \item[Lines \Coderef{thmcaption}{4}, \Coderef{thmcaption}{5}:] % The output is collected and written into the |.aux| file, % which will forward it to the theorem-file. % \end{packeddescr} @@ -4589,7 +4947,8 @@ % 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)} +% \changes{v1.31}{2011/02/15}{added for fixing problems (WM, reported by +% Gunner Gewiss)} % \Codelabel{hyperthref} % \begin{macrocode} \if@thref -- cgit v1.2.3