diff options
Diffstat (limited to 'macros/latex/contrib/thmtools/source/thm-ntheorem.dtx')
-rw-r--r-- | macros/latex/contrib/thmtools/source/thm-ntheorem.dtx | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/macros/latex/contrib/thmtools/source/thm-ntheorem.dtx b/macros/latex/contrib/thmtools/source/thm-ntheorem.dtx new file mode 100644 index 0000000000..ef29870931 --- /dev/null +++ b/macros/latex/contrib/thmtools/source/thm-ntheorem.dtx @@ -0,0 +1,138 @@ +% \iffalse meta-comment +% +% Copyright (C) 2010-2014 by Ulrich M. Schwarz +% Copyright (C) 2019 by Frank Mittelbach +% Copyright (C) 2020- by Yukai Chou +% +% This file may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c. +% The license can be obtained from +% http://www.latex-project.org/lppl/lppl-1-3c.txt +% +%\fi +% +%\iffalse (hide this from DocInput) +%<*ntheorem> +%\fi +% \begin{macrocode} + +\providecommand\thmt@space{ } + +% actually, ntheorem's so-called style is nothing like a style at all... +\def\thmt@declaretheoremstyle@setup{} +\def\thmt@declaretheoremstyle#1{% + \ifcsname th@#1\endcsname\else + \@xa\let\csname th@#1\endcsname\th@plain + \fi +} + +\def\thmt@notsupported#1#2{% + \PackageWarning{thmtools}{Key `#2' not supported by #1}{}% +} + +\define@key{thmstyle}{spaceabove}{% + \setlength\theorempreskipamount{#1}% +} +\define@key{thmstyle}{spacebelow}{% + \setlength\theorempostskipamount{#1}% +} +\define@key{thmstyle}{headfont}{% + \theoremheaderfont{#1}% +} +\define@key{thmstyle}{bodyfont}{% + \theorembodyfont{#1}% +} +% not supported in ntheorem. +\define@key{thmstyle}{notefont}{% + \thmt@notsupported{ntheorem}{notefont}% +} +\define@key{thmstyle}{headpunct}{% + \theoremseparator{#1}% +} +% not supported in ntheorem. +\define@key{thmstyle}{notebraces}{% + \thmt@notsupported{ntheorem}{notebraces}% +} +\define@key{thmstyle}{break}{% + \theoremstyle{break}% +} +% not supported in ntheorem... +\define@key{thmstyle}{postheadspace}{% + %\def\thmt@style@postheadspace{#1}% + \@xa\g@addto@macro\csname thmt@style \thmt@style @defaultkeys\endcsname{% + postheadhook={\hspace{-\labelsep}\hspace*{#1}},% + }% +} + +% not supported in ntheorem +\define@key{thmstyle}{headindent}{% + \thmt@notsupported{ntheorem}{headindent}% +} +% sorry, only style, not def with ntheorem. +\define@key{thmstyle}{qed}[\qedsymbol]{% + \@ifpackagewith{ntheorem}{thmmarks}{% + \theoremsymbol{#1}% + }{% + \thmt@notsupported + {ntheorem without thmmarks option}% + {headindent}% + }% +} + +\let\@upn=\textup +\define@key{thmstyle}{headformat}[]{% + \def\thmt@tmp{#1}% + \@onelevel@sanitize\thmt@tmp + %\tracingall + \ifcsname thmt@headstyle@\thmt@tmp\endcsname + \newtheoremstyle{\thmt@style}{% + \item[\hskip\labelsep\theorem@headerfont% + \def\NAME{\theorem@headerfont ####1}% + \def\NUMBER{\bgroup\@upn{####2}\egroup}% + \def\NOTE{}% + \csname thmt@headstyle@#1\endcsname + \theorem@separator + ] + }{% + \item[\hskip\labelsep\theorem@headerfont% + \def\NAME{\theorem@headerfont ####1}% + \def\NUMBER{\bgroup\@upn{####2}\egroup}% + \def\NOTE{\if=####3=\else\bgroup\thmt@space(####3)\egroup\fi}% + \csname thmt@headstyle@#1\endcsname + \theorem@separator + ] + } + \else + \newtheoremstyle{\thmt@style}{% + \item[\hskip\labelsep\theorem@headerfont% + \def\NAME{\the\thm@headfont ####1}% + \def\NUMBER{\bgroup\@upn{####2}\egroup}% + \def\NOTE{}% + #1% + \theorem@separator + ] + }{% + \item[\hskip\labelsep\theorem@headerfont% + \def\NAME{\the\thm@headfont ####1}% + \def\NUMBER{\bgroup\@upn{####2}\egroup}% + \def\NOTE{\if=####3=\else\bgroup\thmt@space(####3)\egroup\fi}% + #1% + \theorem@separator + ] + } + \fi +} + +\def\thmt@headstyle@margin{% + \makebox[0pt][r]{\NUMBER\ }\NAME\NOTE +} +\def\thmt@headstyle@swapnumber{% + \NUMBER\ \NAME\NOTE +} + + + +% \end{macrocode} +%\iffalse (hide this from DocInput) +%</ntheorem> +%\fi |