From 63c4f21a5716ebbed11926d0bfbb26d656a766ea Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sat, 18 Jul 2020 03:01:08 +0000
Subject: CTAN sync 202007180301

---
 .../latex/contrib/thmtools/source/thm-amsthm.dtx   | 169 +++++++++++++++++++++
 1 file changed, 169 insertions(+)
 create mode 100644 macros/latex/contrib/thmtools/source/thm-amsthm.dtx

(limited to 'macros/latex/contrib/thmtools/source/thm-amsthm.dtx')

diff --git a/macros/latex/contrib/thmtools/source/thm-amsthm.dtx b/macros/latex/contrib/thmtools/source/thm-amsthm.dtx
new file mode 100644
index 0000000000..b45a6c276e
--- /dev/null
+++ b/macros/latex/contrib/thmtools/source/thm-amsthm.dtx
@@ -0,0 +1,169 @@
+% \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)
+%<*amsthm>
+%\fi
+%    \begin{macrocode}
+\providecommand\thmt@space{ }
+
+\define@key{thmstyle}{spaceabove}{%
+  \def\thmt@style@spaceabove{#1}%
+}
+\define@key{thmstyle}{spacebelow}{%
+  \def\thmt@style@spacebelow{#1}%
+}
+\define@key{thmstyle}{headfont}{%
+  \def\thmt@style@headfont{#1}%
+}
+\define@key{thmstyle}{bodyfont}{%
+  \def\thmt@style@bodyfont{#1}%
+}
+\define@key{thmstyle}{notefont}{%
+  \def\thmt@style@notefont{#1}%
+}
+\define@key{thmstyle}{headpunct}{%
+  \def\thmt@style@headpunct{#1}%
+}
+\define@key{thmstyle}{notebraces}{%
+  \def\thmt@style@notebraces{\thmt@embrace#1}%
+}
+\define@key{thmstyle}{break}[]{%
+  \def\thmt@style@postheadspace{\newline}%
+}
+\define@key{thmstyle}{postheadspace}{%
+  \def\thmt@style@postheadspace{#1}%
+}
+\define@key{thmstyle}{headindent}{%
+  \def\thmt@style@headindent{#1}%
+}
+
+\newtoks\thmt@style@headstyle
+\define@key{thmstyle}{headformat}[]{%
+  \thmt@setheadstyle{#1}%
+}
+\define@key{thmstyle}{headstyle}[]{%
+  \thmt@setheadstyle{#1}%
+}
+\def\thmt@setheadstyle#1{%
+  \thmt@style@headstyle{%
+    \def\NAME{\the\thm@headfont ##1}%
+    \def\NUMBER{\bgroup\@upn{##2}\egroup}%
+    \def\NOTE{\if=##3=\else\bgroup\thmt@space\the\thm@notefont(##3)\egroup\fi}%
+  }%
+  \def\thmt@tmp{#1}%
+  \@onelevel@sanitize\thmt@tmp
+  %\tracingall
+  \ifcsname thmt@headstyle@\thmt@tmp\endcsname
+    \thmt@style@headstyle\@xa{%
+      \the\thmt@style@headstyle
+      \csname thmt@headstyle@#1\endcsname
+    }%
+  \else
+    \thmt@style@headstyle\@xa{%
+      \the\thmt@style@headstyle
+      #1%
+    }%
+  \fi
+  %\showthe\thmt@style@headstyle
+}
+% examples:
+\def\thmt@headstyle@margin{%
+  \makebox[0pt][r]{\NUMBER\ }\NAME\NOTE
+}
+\def\thmt@headstyle@swapnumber{%
+  \NUMBER\ \NAME\NOTE
+}
+
+
+
+\def\thmt@embrace#1#2(#3){#1#3#2}
+
+\def\thmt@declaretheoremstyle@setup{%
+  \let\thmt@style@notebraces\@empty%
+  \thmt@style@headstyle{}%
+  \kvsetkeys{thmstyle}{%
+    spaceabove=3pt,
+    spacebelow=3pt,
+    headfont=\bfseries,
+    bodyfont=\normalfont,
+    headpunct={.},
+    postheadspace={ },
+    headindent={},
+    notefont={\fontseries\mddefault\upshape}
+  }%
+}
+\def\thmt@declaretheoremstyle#1{%
+  %\show\thmt@style@spaceabove
+  \thmt@toks{\newtheoremstyle{#1}}%
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@spaceabove}}%
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@spacebelow}}%
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@bodyfont}}%
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headindent}}% indent1 FIXME
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headfont}}%  
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headpunct}}%
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@postheadspace}}%
+  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\the\thmt@style@headstyle}}% headspec FIXME
+  \the\thmt@toks
+  %1 Indent amount: empty = no indent, \parindent = normal paragraph indent
+  %2 Space after theorem head: { } = normal interword space; \newline = linebreak
+  %% BUGFIX: amsthm ignores notefont setting altogether:
+  \thmt@toks\@xa\@xa\@xa{\csname th@#1\endcsname}%
+  \thmt@toks
+  \@xa\@xa\@xa\@xa\@xa\@xa\@xa{%
+  \@xa\@xa\@xa\@xa\@xa\@xa\@xa\thm@notefont
+  \@xa\@xa\@xa\@xa\@xa\@xa\@xa{%
+  \@xa\@xa\@xa\thmt@style@notefont
+  \@xa\thmt@style@notebraces
+  \@xa}\the\thmt@toks}%
+  \@xa\def\csname th@#1\@xa\endcsname\@xa{\the\thmt@toks}%
+%  \@xa\def\csname th@#1\@xa\@xa\@xa\@xa\@xa\@xa\@xa\endcsname
+%    \@xa\@xa\@xa\@xa\@xa\@xa\@xa{%
+%    \@xa\@xa\@xa\@xa\@xa\@xa\@xa\thm@notefont
+%    \@xa\@xa\@xa\@xa\@xa\@xa\@xa{%
+%    \@xa\@xa\@xa\thmt@style@notefont
+%    \@xa\@xa\@xa\thmt@style@notebraces
+%    \@xa\@xa\@xa}\csname th@#1\endcsname
+%  }
+}
+
+\define@key{thmdef}{qed}[\qedsymbol]{%
+  \thmt@trytwice{}{%
+    \addtotheorempostheadhook[\thmt@envname]{%
+      \protected@edef\qedsymbol{#1}%
+      \pushQED{\qed}%
+    }%
+    \addtotheoremprefoothook[\thmt@envname]{%
+      \protected@edef\qedsymbol{#1}%
+      \popQED
+    }%
+  }%
+}
+
+\def\thmt@amsthmlistbreakhack{%
+  \leavevmode
+  \vspace{-\baselineskip}%
+  \par
+  \everypar{\setbox\z@\lastbox\everypar{}}%
+}
+
+\define@key{thmuse}{listhack}[\relax]{%
+  \addtotheorempostheadhook[local]{%
+    \thmt@amsthmlistbreakhack
+  }%
+}
+
+%    \end{macrocode}
+%\iffalse (hide this from DocInput)
+%</amsthm>
+%\fi
-- 
cgit v1.2.3

