texlive[72470] Master/texmf-dist: keytheorems (5oct24)
commits+karl at tug.org
commits+karl at tug.org
Sat Oct 5 21:36:35 CEST 2024
Revision: 72470
https://tug.org/svn/texlive?view=revision&revision=72470
Author: karl
Date: 2024-10-05 21:36:34 +0200 (Sat, 05 Oct 2024)
Log Message:
-----------
keytheorems (5oct24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/keytheorems/README.md
trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.pdf
trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex
trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsart-support.tex
trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsbook-support.tex
trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsproc-support.tex
trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-memoir-support.tex
trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty
Added Paths:
-----------
trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-beamer-support.tex
Modified: trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md 2024-10-05 19:36:34 UTC (rev 72470)
@@ -1,5 +1,10 @@
# Changelog for keytheorems package
+## [v0.1.6]
+- add `\renewkeytheorem`, `\providekeytheorem`, and `\declarekeytheorem`
+- tcolorbox theorems no longer error with beamer
+- add support for beamer action spec
+
## [v0.1.5]
- add `format-code` list key
- can now use `\thmname`, `\thmnumber`, `\thmnote` in `headformat`
@@ -31,6 +36,7 @@
## 0.1.0 - 2024-09-04
- First release
+[v0.1.6]: https://github.com/mbertucci47/keytheorems/compare/v0.1.5...v0.1.6
[v0.1.5]: https://github.com/mbertucci47/keytheorems/compare/v0.1.4...v0.1.5
[v0.1.4]: https://github.com/mbertucci47/keytheorems/compare/v0.1.3...v0.1.4
[v0.1.3]: https://github.com/mbertucci47/keytheorems/compare/v0.1.2...v0.1.3
Modified: trunk/Master/texmf-dist/doc/latex/keytheorems/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keytheorems/README.md 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/README.md 2024-10-05 19:36:34 UTC (rev 72470)
@@ -1,9 +1,9 @@
# keytheorems
A LaTeX package to use [`amsthm`](https://www.ctan.org/pkg/amsthm)
-with a key-value interface. Meant to emulate most of the functionality of
-[`thmtools`](https://www.ctan.org/pkg/thmtools) but written in expl3. If you
-find a bug please open an issue or pull request.
+with a key-value interface.
+Provides most of the functionality of [`thmtools`](https://www.ctan.org/pkg/thmtools) (and a bit more!) but written in expl3.
+If you find a bug please open an issue or pull request.
The package is maintained by Matthew Bertucci.
@@ -454,15 +454,6 @@
\end{document}
```
-
-## Things to do
-
-- Clean up the code. Things are out of order, poorly named, etc.
-- Add more error messages.
-- thmtools features not yet implemented
- - real [`beamer`](https://ctan.org/pkg/beamer) support
- - certainly more
-- For a complete list, see [`keytheorems-ideas.md`](https://github.com/mbertucci47/keytheorems/blob/main/keytheorems-ideas.md)
## Notes/issues on thmtools, not on Github
@@ -608,5 +599,11 @@
\end{document}
```
+
+## Things to do
+
+- Clean up the code. Things are out of order, poorly named, etc.
+- For a complete list, see [`keytheorems-ideas.md`](https://github.com/mbertucci47/keytheorems/blob/main/keytheorems-ideas.md)
+
## License
Released under the LaTeX Project Public License v1.3c or later. See https://www.latex-project.org/lppl.txt.
\ No newline at end of file
Modified: trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex 2024-10-05 19:36:34 UTC (rev 72470)
@@ -3,10 +3,9 @@
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass{ltxdoc}
\usepackage{geometry}
-\geometry{margin=1in}
+\geometry{margin=1.5in}
\usepackage{tcolorbox}
-\PassOptionsToPackage{highlightmode=immediate}{minted}
-\tcbuselibrary{documentation,minted}
+\tcbuselibrary{documentation,minted,breakable,hooks}
\tcbset{
listing engine=minted,
minted language=latex,
@@ -23,7 +22,7 @@
\usepackage{keytheorems}
\usepackage{cleveref}
-\def\version{0.1.5}
+\def\version{0.1.6}
\title{%
\pkg{keytheorems} package \\[1ex]
@@ -85,6 +84,7 @@
\newcommand{\bracks}[1]{\texttt{[#1]}}
\newcommand{\ttbraces}[1]{\braces{\texttt{#1}}}
%\tcbset{index gather commands=false}
+\colorlet{ExampleBack}{yellow!10}
\tcbset{
color command=BrickRed,
color key=Fuchsia,
@@ -93,6 +93,7 @@
\setlength{\parindent}{15pt}
\noindent
},
+ docexample/.append style={boxrule=0pt,arc=0pt,after app={\noindent}}
}
\tcbset{
withpreamble/.style = {
@@ -108,20 +109,19 @@
\NewTCBListing{keythmscode}{ O{} }
{
- colback=yellow!10!white,
- colframe=blue!50!black,
- boxrule=0.4pt,
- listing side text,
+ colback=ExampleBack,
+ arc=0pt,
+ boxrule=0pt,
+% listing side text,
+% lower separated=false,
+ skin=bicolor,
+ colbacklower=yellow!25,
+ breakable,
+% enhanced,
+% segmentation engine=path,
+% segmentation style={solid,gray},
#1
}
-
-\NewTCBListing{keycode}{ }
- {
- colback=yellow!10!white,
- colframe=blue!50!black,
- boxrule=0.4pt,
- listing side text,
- }
\newtcolorbox{notebox}[1][]{enhanced,
before skip balanced=2mm,after skip balanced=4mm,
boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
@@ -162,7 +162,8 @@
\section{Dependencies}
-Without using the \refKey{tcolorbox} or \refKey{tcolorbox-no-titlebar} options, the package loads the \pkg{aliascnt}, \pkg{amsthm}, \pkg{refcount}, \pkg{translations}, and \pkg{unique} packages.
+The package depends on the \pkg{aliascnt}, \pkg{amsthm}, \pkg{refcount}, \pkg{translations} packages.
+The \refKey{tcolorbox} and \refKey{tcolorbox-no-titlebar} keys require \pkg{tcolorbox}, and the \refKey[numbered=unless-unique]{numbered} key requires the \pkg{unique} package.
A \LaTeX{} kernel no older than 2023-06-01 is required; if older than 2024-06-01, \pkg{nameref} is required.
\section{Global options}
@@ -169,7 +170,7 @@
\begin{docCommand}{keytheoremset}
{\marg{options}}
-Every key in this section can be given as a package option with \cs{usepackage}\bracks{\meta{options}}\ttbraces{keytheorems} or in \cs{keytheoremset}\marg{options}, with the exception that \refKey{continues-code} can only be used in the latter.
+Every key in this section can be given as an option to \cs{usepackage} or in \cs{keytheoremset}, with the exception that \refKey{continues-code} can only be used in the latter.
\end{docCommand}
\subsection{Compatibility options}
@@ -185,7 +186,11 @@
{}
{initially unset}
For compatibility with \pkg{thmtools} syntax.
-For most documents, \cs{usepackage}\bracks{thmtools-compat}\ttbraces{keytheorems} should be a drop-in replacement for \cs{usepackage}\ttbraces{amsthm,thmtools}.
+For most documents,
+\begin{dispListing}
+\usepackage[thmtools-compat]{keytheorems}
+\end{dispListing}
+should be a drop-in replacement for \cs{usepackage}\ttbraces{amsthm,thmtools}.
The option defines the commands in the left column below.
The right column lists the corresponding \pkg{keytheorems} replacement that should be used in new documents.
\begin{center}
@@ -214,13 +219,13 @@
\begin{docKey}{auto-translate}
{\colOpt{=true\textbar false}}
{default |true|, initially |true|}
-If |false|, \pkg{keytheorems} does not automatically translate the title text for \refCom{listofkeytheorems} and the note produced by the \refKey{continues} key.
+If |false|, \pkg{keytheorems} does not automatically translate the title text used for \refCom{listofkeytheorems} and the note produced by the \refKey{continues} key.
These texts can be manually customized with the \refKey{title} and \refKey{continues-code} keys, respectively.
\end{docKey}
\begin{docKey}{continues-code}
{=\meta{code with \textup{\texttt{\#1}}}}
- {initially \cs{GetTranslation}\ttbraces{keythms\string_continues}\cs{pageref}\ttbraces{\#1}}
+ {initially\\ \cs{GetTranslation}\ttbraces{keythms\string_continues}\cs{pageref}\ttbraces{\#1}}
The code used to typeset the note produced by the \refKey{continues} key.
If English or an unknown language is used, defaults to \texttt{continuing from p.}\cs{,}\cs{pageref}\ttbraces{\#1}.
Currently (likely inaccurate!) translations exist for French, German, Italian, Portuguese, and Spanish.
@@ -257,12 +262,14 @@
\begin{docCommand}{newkeytheorem}
{\marg{env name}\oarg{options}}
Defines a theorem environment \meta{env name} which itself takes a few options (see \autoref{in-doc-keys}).
-You can also declare multiple theorems at once by replacing \meta{env name} with a comma-list of names, e.g. \cs{newkeytheorem}\ttbraces{theorem,lemma,proposition}\bracks{\meta{options}}.
+You can also declare multiple theorems at once by replacing \meta{env name} with a comma-list of names, e.g.
+\begin{center}
+\cs{newkeytheorem}\ttbraces{theorem,lemma,proposition}\bracks{\meta{options}}.
+\end{center}
By default, the theorem's printed name is a title-cased \meta{env name}.
This can be changed with the \refKey{thm/name} key.
All \meta{options} are described in subsections \ref{thm-thmtools-keys} and \ref{thm-added-keys}.
-\end{docCommand}
\begin{tcbwritetemp}
\newkeytheorem{theorem}
@@ -274,6 +281,19 @@
\end{theorem}
\end{keythmscode}
+\end{docCommand}
+
+\begin{docCommands}[
+ doc parameter=\marg{env name}\oarg{options}
+ ]
+ {
+ {doc name = renewkeytheorem},
+ {doc name = providekeytheorem},
+ {doc name = declarekeytheorem},
+ }
+Sometimes a package or class defines theorems that need to be overwritten by the user. For this case, \pkg{keytheorems} provides \cs{renewkeytheorem} which redefines \meta{env name} or errors if it is not defined. For completeness, also provided are \cs{providekeytheorem} and \cs{declarekeytheorem}. The former only defines \meta{env name} if it is not already defined; the latter always overwrites \meta{env name}.
+\end{docCommands}
+
\subsection{Keys available to theorem environments} \label{in-doc-keys}
As in \pkg{amsthm}, theorems can take an optional argument that contains a note or heading.
@@ -294,9 +314,6 @@
This syntax, however, allows the argument to contain other keys.
\begin{keythmscode}[]
-\begin{theorem}[some heading]
-Some text
-\end{theorem}
\begin{theorem}[note=another heading]
Some more text
\end{theorem}
@@ -308,7 +325,7 @@
{=\meta{text}}
{initially unset}
Alias \docAuxKey{short-name}.
-This replaces the value of \refKey{note} when displayed in \refCom{listofkeytheorems}.
+This replaces the value of \refKey{note} when displayed in the list of theorems (\refCom{listofkeytheorems}).
\end{docKey}
\begin{docKey}{label}
@@ -462,9 +479,7 @@
For compatibility with \pkg{thmtools}, also accepts the values \docValue*{yes}, \docValue*{no}, and \docValue*{unless unique}.
\begin{tcbwritetemp}
-\newkeytheorem{theorem*}[
- name=Theorem, numbered=false
- ]
+\newkeytheorem{theorem*}[name=Theorem, numbered=false]
\end{tcbwritetemp}
\begin{keythmscode}[withpreamble]
@@ -501,8 +516,7 @@
\begin{keythmscode}[withpreamble]
\begin{lemma}
-This shares its counter with
-\texttt{theorem}.
+This shares its counter with \texttt{theorem}.
\end{lemma}
\end{keythmscode}
@@ -556,9 +570,9 @@
\begin{docKey}{qed}
{\colOpt{=\meta{symbol}}}
- {default \cs{openbox}, initially unset}
+ {default \cs{qedsymbol}, initially unset}
Adds \colOpt{\meta{symbol}} to the end of the theorem body.
-If no value is given, the symbol \openbox\ is used.
+If no value is given, the symbol \qedsymbol{} is used.
\begin{tcbwritetemp}
\newkeytheorem{example}[qed]
@@ -606,8 +620,7 @@
Some more text
\end{prop}
\begin{theorem}
-Consider \cref{abc,def}.
-\Autoref{abc} \dots
+Consider \cref{abc,def}. \Autoref{abc} \dots
\end{theorem}
\end{keythmscode}
@@ -630,10 +643,7 @@
},
}
\newkeytheorem{corollary}[tcolorbox]
-\newkeytheorem{definition}[
- style=definition,
- tcolorbox={defstyle}
- ]
+\newkeytheorem{definition}[style=definition, tcolorbox={defstyle}]
\end{tcbwritetemp}
\begin{keythmscode}[withpreamble]
@@ -654,10 +664,8 @@
\begin{tcbwritetemp}
\newkeytheorem{boxcor}[
- tcolorbox-no-titlebar={
- colback=red!10
- },
- name=Corollary,sibling=corollary
+ tcolorbox-no-titlebar={colback=red!10},
+ name=Corollary, sibling=corollary
]
\end{tcbwritetemp}
@@ -700,11 +708,11 @@
\begin{docCommand}{newkeytheoremstyle}
{\marg{name}\marg{options}}
-This is \pkg{keytheorems}' version of \pkg{thmtools}' \cs{declaretheoremstyle}\bracks{\meta{options}}\marg{name}.
+This is \pkg{keytheorems}' version of \pkg{thmtools}' \cs{declaretheoremstyle}.
Since it makes little sense to define a style with no keys, we've made the \meta{options} argument mandatory.
Note that unlike \pkg{amsthm}'s \cs{newtheoremstyle}, this command will error if a style has already been defined.
To overwrite an existing style, there is the analogous \docAuxCommand{renewkeytheoremstyle}.
-For completeness, there is also \docAuxCommand{declarekeytheoremstyle} and \docAuxCommand{providekeytheoremstyle}.
+For completeness, there are also \docAuxCommand{providekeytheoremstyle} and \docAuxCommand{declarekeytheoremstyle}.
The defined style can be used with either the \refKey{style} key or the traditional \cs{theoremstyle}.
\end{docCommand}
@@ -936,7 +944,10 @@
{initially \cs{GetTranslation}\ttbraces{keythms\string_listof\string_title}}
Defaults to ``List of Theorems'' if English or an unknown language is used.
Currently French, German, Italian, Portuguese, and Spanish have (likely inaccurate!) translations.
-A translation can be added with a GitHub pull request or manually with \cs{DeclareTranslation}\marg{lang}\ttbraces{keythms\string_listof\string_title}\marg{text}.
+A translation can be added with a GitHub pull request or manually with
+\begin{center}
+\cs{DeclareTranslation}\marg{lang}\ttbraces{keythms\string_listof\string_title}\marg{text}.
+\end{center}
\end{docKey}
\subsection{Keys added by \pkg{keytheorems}}
@@ -983,7 +994,7 @@
\begin{keythmscode}[]
\keytheoremlistset{ignoreall}
\listofkeytheorems[show=example]
-\listofkeytheorems[show=solution,no-title]
+\listofkeytheorems[show=solution, no-title]
\end{keythmscode}
\end{docKey}
@@ -1055,11 +1066,12 @@
As in \pkg{thmtools}, the order of hooks is as follows:
\begin{center}
+ \small
\tcbset{
nobeforeafter,
tikznode,
tcbox width=forced center,
- width=2cm,
+ width=1.85cm,
tcbox raise=-0.4cm,
size=fbox,
after=\;$\rightarrow$
@@ -1066,21 +1078,21 @@
}
\tcbox{\meta{env name}\\ \hook{prehead}}
\tcbox{generic\\ \hook{prehead}}
- \tcbox[width=3.5cm,tcbox raise=-0.2cm]{\cs{begin}\brackets{\meta{env name}}}
+ \tcbox[width=3.25cm,tcbox raise=-0.2cm]{\cs{begin}\brackets{\meta{env name}}}
\tcbox{\meta{env name}\\ \hook{posthead}}
\tcbox[after={}]{generic\\ \hook{posthead}}
\\[2ex]
\tcbset{before=$\rightarrow$\;}
- \tcbox[width=2.5cm,tcbox raise=-0.2cm]{\meta{theorem body}}
+ \tcbox[width=2.25cm,tcbox raise=-0.2cm]{\meta{theorem body}}
\\[2ex]
\tcbset{after={}}
\tcbox[before={}]{generic\\ \hook{prefoot}}
\tcbox{\meta{env name}\\ \hook{prefoot}}
- \tcbox[width=3.5cm,tcbox raise=-0.2cm]{\cs{end}\brackets{\meta{env name}}}
+ \tcbox[width=3.25cm,tcbox raise=-0.2cm]{\cs{end}\brackets{\meta{env name}}}
\tcbox{generic\\ \hook{postfoot}}
\tcbox{\meta{env name}\\ \hook{postfoot}}
\end{center}
-The \hook{restated} hook is applied at the start of theorems retrieved with \cs{getkeytheorem}, before the \hook{prehead} hook.
+The \hook{restated} hook is applied at the start of theorems retrieved with the command \cs{getkeytheorem}, before the \hook{prehead} hook.
This can be useful for disabling commands such as \cs{footnote} in the restated theorems, e.g.
\begin{dispListing}
\addtotheoremhook{restated}{\renewcommand\footnote[2][]{}}
@@ -1101,14 +1113,37 @@
results in |AB| after the theorem.
This is the behavior of the \LaTeX{} kernel hooks that \pkg{keytheorems} uses under the hood.
-Right now, code added using the hook keys \refKey{preheadhook}, etc. is outermost, meaning executed first in \hook{prehead} and \hook{posthead} and last in \hook{prefoot} and \hook{postfoot}.
-This may change if I think of good reasons to do so\dots
+Code added using the hook keys \refKey{preheadhook}, etc. is outermost, meaning executed first in \hook{prehead} and \hook{posthead} and last in \hook{prefoot} and \hook{postfoot}.
\end{docCommand}
-\section{Miscellaneous notes for the ambitious}
+\section{Miscellaneous notes}
-Inside theorem environments, as well as in all of the theorem hooks, you have access to the theorem's environment and counter name in the token list variable |\l_keythms_thmuse_envname_tl|.
+\subsection{\cls{beamer} support}
+The package contains some \emph{highly experimental} code to support theorems with \cls{beamer}, including overlays.
+Most style keys are disabled by the |default| \cls{beamer} theorem template.
+More become functional by setting
+\begin{dispListing}
+\setbeamertemplate{theorems}[ams style]
+\end{dispListing}
+in the preamble.
+Alternatively, you have full control of theorems by setting the class option |noamsthm|.
+
+Note that by default \cls{beamer} defines a set of theorems when the class is loaded.
+These can be overwritten with \refCom{renewkeytheorem} or disabled entirely with the |notheorems| class option.
+
+Due to complications with overlays, writing contents of theorems to the |thlist| file is disabled. This means theorems can only be restated \emph{after} their original statement. Furthermore, \refCom{listofkeytheorems} is disabled and a warning issued if used.
+
+User feedback is necessary to make this code fully compatible. Please report issues on the \href{https://github.com/mbertucci47/keytheorems/issues}{Github page}!
+
+\subsection{Public coding interfaces}
+
+\begin{itemize}
+ \item |\l_keythms_thmuse_envname_tl|
+
+ Inside theorem environments, as well as in all of the theorem hooks, you have access to the theorem's environment and counter name in this token list variable.
+\end{itemize}
+
\section{Further examples}
More examples will be added soon -- rather, eventually\dots{}
Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsart-support.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsart-support.tex 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsart-support.tex 2024-10-05 19:36:34 UTC (rev 72470)
@@ -1,7 +1,7 @@
% Maintained by Matthew Bertucci, 2024-present
% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
-\ProvidesExplFile{keythms-amsart-support}{2024-09-30}{0.1.5}
+\ProvidesExplFile{keythms-amsart-support}{2024-10-05}{0.1.6}
{keytheorems~support~for~the~amsart~class}
\__keythms_support_AMSshared_code:
@@ -34,8 +34,8 @@
{
\prop_gput_from_keyval:Nn \g__keythms_thmstyle_defaultkeys_prop
{
- spaceabove = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
- spacebelow = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+ spaceabove = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+ spacebelow = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
}
}
@@ -46,4 +46,6 @@
bodyfont = \normalfont,
headfont = \itshape,
}
- }
\ No newline at end of file
+ }
+
+\file_input_stop:
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsbook-support.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsbook-support.tex 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsbook-support.tex 2024-10-05 19:36:34 UTC (rev 72470)
@@ -1,7 +1,7 @@
% Maintained by Matthew Bertucci, 2024-present
% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
-\ProvidesExplFile{keythms-amsbook-support}{2024-09-30}{0.1.5}
+\ProvidesExplFile{keythms-amsbook-support}{2024-10-05}{0.1.6}
{keytheorems~support~for~the~amsbook~class}
\__keythms_support_AMSshared_code:
@@ -8,10 +8,10 @@
\prop_gput_from_keyval:Nn \g__keythms_thmstyle_defaultkeys_prop
{
- headfont = \scshape,
- headindent = \parindent,
- spaceabove = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
- spacebelow = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+ headfont = \scshape,
+ headindent = \parindent,
+ spaceabove = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+ spacebelow = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
}
\keys_define:nn { keytheorems/thmstyle }
@@ -20,4 +20,6 @@
{
bodyfont = \normalfont,
},
- }
\ No newline at end of file
+ }
+
+\file_input_stop:
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsproc-support.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsproc-support.tex 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsproc-support.tex 2024-10-05 19:36:34 UTC (rev 72470)
@@ -1,7 +1,7 @@
% Maintained by Matthew Bertucci, 2024-present
% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
-\ProvidesExplFile{keythms-amsproc-support}{2024-09-30}{0.1.5}
+\ProvidesExplFile{keythms-amsproc-support}{2024-10-05}{0.1.6}
{keytheorems~support~for~the~amsproc~class}
\__keythms_support_AMSshared_code:
@@ -8,10 +8,10 @@
\prop_gput_from_keyval:Nn \g__keythms_thmstyle_defaultkeys_prop
{
- headfont = \scshape,
- headindent = \parindent,
- spaceabove = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
- spacebelow = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+ headfont = \scshape,
+ headindent = \parindent,
+ spaceabove = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+ spacebelow = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
}
\keys_define:nn { keytheorems/thmstyle }
@@ -20,4 +20,6 @@
{
bodyfont = \normalfont,
},
- }
\ No newline at end of file
+ }
+
+\file_input_stop:
\ No newline at end of file
Added: trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-beamer-support.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-beamer-support.tex (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-beamer-support.tex 2024-10-05 19:36:34 UTC (rev 72470)
@@ -0,0 +1,313 @@
+% Maintained by Matthew Bertucci, 2024-present
+% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
+% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
+\ProvidesExplFile{keythms-beamer-support}{2024-10-05}{0.1.6}
+ {keytheorems~support~for~the~beamer~class}
+
+% do nothing if noamsthm loaded
+\IfClassLoadedWithOptionsT{ beamer }{ noamsthm }{ \file_input_stop: }
+
+\keys_define:nn { keytheorems/thmstyle }
+ {
+ inherit-style / example .meta:n =
+ {
+ bodyfont=\normalfont,
+ preheadhook=\def\inserttheoremblockenv{exampleblock},
+ }
+ }
+\keys_define:nn { keytheorems/thm }
+ { % redefine key to include \thm at headsep
+ tcolorbox-no-titlebar .meta:n =
+ {
+ tcolorbox={
+ notitle,
+ before~upper={
+ \group_begin:
+ \usebeamerfont*{block title}
+ \__keythms_thm_tcboxtemphead:
+ \hskip\thm at headsep
+ \group_end:
+ },
+ #1
+ }
+ },
+ }
+\cs_set_protected:Npn \__keythms_thm_tcboxcode:nn #1#2
+ { % #1 = name, #2 = tcolorbox keys
+ \RequirePackage{tcolorbox}
+ \tcbset
+ {
+ keythms_tcbox_#1/.style =
+ {
+ savedelimiter=#1,
+ #2
+ }
+ }
+ \tl_gput_left:cn { g__keythms_thm_preheadfromkeys_#1_tl }
+ {
+ \cs_set_protected:Npn \thm at space@setup { \thm at preskip=0pt \thm at postskip=0pt }
+ \cs_set:Npn \inserttheoremblockenv { keythms_beamer_tcbox }
+ }
+ }
+\NewDocumentEnvironment{ keythms_beamer_tcbox }{ m d<> }
+ {
+ \cs_set:Npn \__keythms_thm_tcboxtemphead: { #1 } % for tcolorbox-no-titlebar
+ \tl_if_novalue:nF { #2 } { \begin{onlyenv}<#2> }
+ \begin{tcolorbox}[
+ title={\usebeamerfont*{block title} #1},
+ keythms_tcbox_\l_keythms_thmuse_envname_tl
+ ]
+ }
+ {
+ \end{tcolorbox}
+ \tl_if_novalue:nF { #2 } { \end{onlyenv} }
+ }
+
+\cs_set_protected:Npn \keythms_keyify_theorem:n #1
+ { % #1 = theorem name
+ \DeclareEnvironmentCopy { keythms_orig_#1 } { #1 }
+ \DeclareDocumentEnvironment { keythms_beamer_grab_#1 } { m m m +b }
+ { % ##1 = keys, ##2 = note, ##3 = action spec, ##4 = theorem body
+ \__keythms_thm_prehead_code:n { #1 }
+ \tl_if_empty:nTF { ##3 }
+ { \begin{keythms_orig_#1}[{##2}] }
+ { \begin{keythms_orig_#1}[{##2}]<##3> }
+ \clist_map_inline:Nn \g__keythms_restatecounters_clist
+ {
+ \prop_gput:Nne \g__keythms_thmuse_othercounters_prop { ####1 }
+ { \the\value{####1} }
+ }
+ \__keythms_thm_posthead_code:n { #1 }
+ % below needs to come after posthead so that correct \@currentHref
+ % is stored for tcolorbox theorems
+ \__keythms_thm_addcontentsdata:nnnn { #1 }
+ { \prop_to_keyval:N \g__keythms_thmuse_othercounters_prop }
+ { ##1 } { ##4 }
+ \__keythms_thm_tempstorerestatedata:nnn { #1 } { ##1 } { ##4 }
+ ##4
+ \__keythms_thm_prefoot_code:n { #1 }
+ \end{keythms_orig_#1}
+ \__keythms_thm_postfoot_code:n { #1 }
+ }
+ {}
+ \DeclareDocumentEnvironment { keythms_beamer_grabreversed_#1 } { m m m +b }
+ { % ##1 = keys, ##2 = note, ##3 = action spec, ##4 = theorem body
+ \tl_if_exist:cTF
+ { c__keythms_storeatbegin_ \l__keythms_thmuse_storereversed_tl _restatecounters_tl }
+ {
+ \bool_set_true:N \l__keythms_thmuse_restating_bool
+ \exp_args:NNe \prop_set_from_keyval:Nn \l__keythms_restate_counters_prop
+ { \tl_use:c { c__keythms_storeatbegin_ \l__keythms_thmuse_storereversed_tl _restatecounters_tl } }
+ \prop_map_inline:Nn \l__keythms_restate_counters_prop
+ {
+ \tl_set:ce { l_keythms_restate_current_####1_tl }
+ { \the\value{####1} }
+ \setcounter { ####1 } { ####2 }
+ % ^ FIX: what if eq's numbered by section, theorem, etc.? The
+ % thmtools code is opaque.... Or maybe should be up to the
+ % user to say "restate-counters={section,chapter,...}".
+ \cs_set:cpn { theH ####1 }
+ { \use:c { the ####1 } . \theHkeythms_restate_dummyctr }
+ }
+ \tl_if_empty:cTF
+ { c__keythms_storeatbegin_ \l__keythms_thmuse_storereversed_tl _label_tl }
+ { \refstepcounter{keythms_restate_dummyctr} } % for unnumbered theorems
+ {
+ \cs_set:cpn { the #1 }
+ { \tl_use:c { c__keythms_storeatbegin_ \l__keythms_thmuse_storereversed_tl _label_tl } }
+ \cs_set_eq:cN { c@ #1 } \c at keythms_restate_dummyctr
+ \cs_set_eq:cN { theH #1 } \theHkeythms_restate_dummyctr
+ % ^ why are the last two lines here? We shouldn't be referencing
+ % restated theorems. Think it's a remnant of thmtools
+ % WRONG: needed to make numbering correct after restated theorem.
+ % not sure about theH. <- this is needed to prevent duplicate anchors
+ }
+ }
+ {
+ \msg_warning:nne { keytheorems } { store-reversed-not-got }
+ { \l__keythms_thmuse_storereversed_tl }
+ }
+ \renewcommand\label[2][]{} % disable \label (opt arg in case cleveref loaded)
+ \cs_set_eq:NN \ltx at label \use_none:n % disable \ltx at label
+ \cs_set_eq:NN \property_record:nn \use_none:nn % disable \RecordProperties
+ \cs_set_eq:NN \setuniqmark \use_none:n % work with numbered=unless-unique
+ % QUESTION: also disable \hyper@@anchor? \MakeLinkTarget?
+ \hook_use:n { keytheorems/#1/restated }
+ \hook_use:n { keytheorems/allthms/restated }
+ \__keythms_thm_prehead_code:n { #1 }
+ \tl_if_empty:nTF { ##3 }
+ { \begin{keythms_orig_#1}[{##2}] }
+ { \begin{keythms_orig_#1}[{##2}]<##3> }
+ \__keythms_thm_posthead_code:n { #1 }
+ % below needs to come after posthead so that correct \@currentHref
+ % is stored for tcolorbox theorems
+ \__keythms_thm_addstoredreverseddata:nnn { #1 } { ##1 } { ##4 }
+ \__keythms_thm_tempstorerestatedatareversed:nnn { #1 } { ##1 } { ##4 }
+ ##4
+ \__keythms_thm_prefoot_code:n { #1 }
+ \end{keythms_orig_#1}
+ \__keythms_thm_postfoot_code:n { #1 }
+ \prop_map_inline:Nn \l__keythms_restate_counters_prop
+ {
+ \exp_args:Nnc \setcounter { ####1 }
+ { l_keythms_restate_current_####1_tl }
+ }
+ }
+ { }
+ % NOTE: have to do a lot of shenanigans to make sure the begin/end of grabbed
+ % theorem env captures only the body and no package code.
+ % This is the price of on-the-fly redefining the env to grab body
+ \RenewDocumentEnvironment { #1 } { D<>{} ={note} O{} D<>{} }
+ {
+ \keys_set:nn { keytheorems/thmuse } { ##2 }
+ \tl_if_empty:NF \l__keythms_thmuse_store_tl
+ {
+ % \bool_gset_true:N \g__keythms_listof_writefile_bool % disable writing to file
+ \cs_set_eq:NN \__keythms_beamer_withhooks_begin:nnnn \__keythms_beamer_grab_begin:nnnn
+ \cs_set_eq:NN \__keythms_beamer_withhooks_begin:nnVn \__keythms_beamer_grab_begin:nnVn
+ \cs_set_eq:NN \__keythms_beamer_withhooks_end:n \__keythms_beamer_grab_end:n
+ }
+ \tl_if_empty:NF \l__keythms_thmuse_storereversed_tl
+ {
+ % \bool_gset_true:N \g__keythms_listof_writefile_bool % disable writing to file
+ \cs_set_eq:NN \__keythms_beamer_withhooks_begin:nnnn \__keythms_beamer_grabreversed_begin:nnnn
+ \cs_set_eq:NN \__keythms_beamer_withhooks_begin:nnVn \__keythms_beamer_grabreversed_begin:nnVn
+ \cs_set_eq:NN \__keythms_beamer_withhooks_end:n \__keythms_beamer_grabreversed_end:n
+ }
+ \__keythms_thm_prehead_continues_code:n { #1 }
+ \tl_if_empty:nTF { ##3 }
+ { % if ##3 empty, just pass ##1 and withhooks_begin will check if empty
+ \__keythms_beamer_withhooks_begin:nnVn { #1 } { ##2 }
+ \l__keythms_thmuse_note_tl { ##1 }
+ }
+ { % if ##3 nonempty, always use it (beamer defaults to second <> if both given)
+ \__keythms_beamer_withhooks_begin:nnVn { #1 } { ##2 }
+ \l__keythms_thmuse_note_tl { ##3 }
+ }
+ }
+ {
+ \__keythms_beamer_withhooks_end:n { #1 }
+ \tl_if_empty:NF \l__keythms_thmuse_store_tl
+ {
+ \cs_if_exist:cF
+ { __keythms_getthm_ \l__keythms_thmuse_store_tl _theorem }
+ {
+ \cs_new:cpe
+ { __keythms_getthm_ \l__keythms_thmuse_store_tl _theorem }
+ {
+ \exp_not:N \__keythms_getthm_theorem:nnnnn
+ \exp_not:o { \g__keythms_thmuse_temprestatedata_tl }
+ }
+ \cs_new:cpe
+ { __keythms_getthm_ \l__keythms_thmuse_store_tl _body }
+ {
+ \exp_not:N \__keythms_getthm_body:nn
+ \exp_args:No \exp_not:o
+ {
+ \exp_after:wN \__keythms_use_iii_v_braced:nnnnn
+ \g__keythms_thmuse_temprestatedata_tl
+ }
+ }
+ }
+ }
+ \tl_if_empty:NF \l__keythms_thmuse_storereversed_tl
+ {
+ \cs_if_exist:cF
+ { __keythms_getthm_ \l__keythms_thmuse_storereversed_tl _theorem }
+ {
+ \cs_new:cpe
+ { __keythms_getthm_ \l__keythms_thmuse_storereversed_tl _theorem }
+ {
+ \exp_not:N \__keythms_getthmreversed_theorem:nnn
+ \exp_not:o { \g__keythms_thmuse_temprestatedatareversed_tl }
+ }
+ \cs_new:cpn
+ { __keythms_getthm_ \l__keythms_thmuse_storereversed_tl _body }
+ {
+ \textbf{??}
+ \msg_warning:nnn { keytheorems } { restate-body-never-got }
+ { #1 }
+ }
+ }
+ }
+ }
+ }
+
+\cs_new_protected:Npn \__keythms_beamer_withhooks_begin:nnnn #1#2#3#4
+ { % #1 = theorem name, #2 = keys, #3 = note, #4 = action spec
+ \__keythms_thm_prehead_code:n { #1 }
+ \tl_if_empty:nTF { #4 }
+ { \begin{keythms_orig_#1}[{#3}] }
+ { \begin{keythms_orig_#1}[{#3}]<#4> }
+ \__keythms_thm_posthead_code:n { #1 }
+ \__keythms_thm_addcontentsdata:nnnn { #1 } { } { #2 } { }
+ \ignorespaces % I hope this is alright
+ }
+\cs_generate_variant:Nn \__keythms_beamer_withhooks_begin:nnnn { nnV }
+\cs_new_eq:NN \__keythms_beamer_withhooks_end:n \__keythms_withhooks_end:n
+
+\cs_new_protected:Npn \__keythms_beamer_grab_begin:nnnn #1#2#3#4
+ { % #1 = theorem name, #2 = keys, #3 = note
+ \begin{keythms_beamer_grab_#1}{#2}{#3}{#4}
+ }
+\cs_generate_variant:Nn \__keythms_beamer_grab_begin:nnnn { nnV }
+\cs_new_protected:Npn \__keythms_beamer_grab_end:n #1 { \end{keythms_beamer_grab_#1} }
+
+\cs_new_protected:Npn \__keythms_beamer_grabreversed_begin:nnnn #1#2#3#4
+ { % #1 = theorem name, #2 = keys, #3 = note
+ \begin{keythms_beamer_grabreversed_#1}{#2}{#3}{#4}
+ }
+\cs_generate_variant:Nn \__keythms_beamer_grabreversed_begin:nnnn { nnV }
+\cs_new_protected:Npn \__keythms_beamer_grabreversed_end:n #1
+ { \end{keythms_beamer_grabreversed_#1} }
+
+% for now, just disable writing to file
+\cs_set_eq:NN \__keythms_thm_addcontentsdata:nnnn \use_none:nnnn
+\cs_set_eq:NN \__keythms_thm_addstoredreverseddata:nnn \use_none:nnn
+
+% disable \listofkeytheorems, add warning
+\msg_new:nnn { keytheorems } { beamer-listof }
+ {
+ \protect\listofkeytheorems\space not~supported~with~beamer
+ }
+\RenewDocumentCommand \listofkeytheorems { o }
+ {
+ \msg_warning:nn { keytheorems } { beamer-listof }
+ }
+
+% restatable and restatable* environments need redefinition
+\bool_if:NT \g__keythms_thmtoolscompat_bool
+ {
+ \RenewDocumentEnvironment { restatable } { O{} m m }
+ {
+ % set store outside [] so keyless note is recognized
+ \keys_set:nn { keytheorems/thmuse } { store=#3 }
+ \begin{#2}[#1]
+ }
+ {
+ \end{#2}
+ \cs_gset_protected:cpn { #3 }
+ { % make \foo and \foo* identical
+ \peek_meaning_remove:NTF *
+ { \getkeytheorem{ #3 } }
+ { \getkeytheorem{ #3 } }
+ }
+ }
+ \RenewDocumentEnvironment { restatable* } { O{} m m }
+ {
+ % set store* outside [] so keyless note is recognized
+ \keys_set:nn { keytheorems/thmuse } { store*=#3 }
+ \begin{#2}[#1]
+ }
+ {
+ \end{#2}
+ \cs_gset_protected:cpn { #3 }
+ { % make \foo and \foo* identical
+ \peek_meaning_remove:NTF *
+ { \getkeytheorem{ #3 } }
+ { \getkeytheorem{ #3 } }
+ }
+ }
+ }
+
+\file_input_stop:
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-beamer-support.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-memoir-support.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-memoir-support.tex 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-memoir-support.tex 2024-10-05 19:36:34 UTC (rev 72470)
@@ -1,7 +1,7 @@
% Maintained by Matthew Bertucci, 2024-present
% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
-\ProvidesExplFile{keythms-memoir-support}{2024-09-30}{0.1.5}
+\ProvidesExplFile{keythms-memoir-support}{2024-10-05}{0.1.6}
{keytheorems~support~for~the~memoir~class}
\bool_new:N \l__keythms_support_titlecode_bool
@@ -46,4 +46,6 @@
{ \keythms_support_memoir_listof:w }
}
\group_end:
- }
\ No newline at end of file
+ }
+
+\file_input_stop:
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty 2024-10-05 19:35:50 UTC (rev 72469)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty 2024-10-05 19:36:34 UTC (rev 72470)
@@ -2,7 +2,7 @@
% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
\NeedsTeXFormat{LaTeX2e}[2023-06-01]
-\ProvidesExplPackage{keytheorems}{2024-09-30}{0.1.5}{l3keys interface to amsthm}
+\ProvidesExplPackage{keytheorems}{2024-10-05}{0.1.6}{l3keys interface to amsthm}
\IfFormatAtLeastTF { 2024-06-01 } { }
{
@@ -18,6 +18,8 @@
{ \IfPackageLoadedTF{#1}{ }{#2} }
\ProvideDocumentCommand \IfClassLoadedT { m m }
{ \IfClassLoadedTF{#1}{#2}{ } }
+ \ProvideDocumentCommand \IfClassLoadedWithOptionsT { m m m }
+ { \IfClassLoadedWithOptionsTF{#1}{#2}{#3}{ } }
}
\RequirePackage{aliascnt}
\RequirePackage{amsthm} % ams classes have way of ignoring this
@@ -91,6 +93,11 @@
Theorem~style~'#1'~already~defined.~
Use~\protect\renewkeytheoremstyle\space instead.
}
+\msg_new:nnn { keytheorems } { thm-undefined }
+ {
+ Command~\c_backslash_str #1~undefined.~
+ Use~\protect\newkeytheorem\space instead.
+ }
\msg_new:nnn { keytheorems } { title-code-with-AMS }
{
The~'title-code'~key~has~no~effect~with~an~AMS~class.
@@ -154,7 +161,7 @@
{ unnumbered.\arabic{keythms_unnumbered_dummyctr} }
\cs_gset:Npn \thekeythms_unnumbered_dummyctr { }
-\cs_generate_variant:Nn \hook_gput_code:nnn { nnV }
+\cs_generate_variant:Nn \hook_gput_code:nnn { nnv }
\cs_generate_variant:Nn \keys_precompile:nnN { nv, nVc, nnc, ne }
%%%%%%%%%%%%%%
@@ -197,11 +204,12 @@
headstyle / margin .code:n =
{
\cs_set:Nn \keythms_thmstyle_headcmd:nnn
- { \makebox[0pt][r]{\NUMBER\ }\NAME\NOTE }
+ { \makebox[0pt][r]{\thmnumber{ ##2 ~ }}\NAME\NOTE }
},
headstyle / swapnumber .code:n =
{
- \cs_set:Nn \keythms_thmstyle_headcmd:nnn { \NUMBER\ \NAME\NOTE }
+ \cs_set:Nn \keythms_thmstyle_headcmd:nnn
+ { \thmnumber{ ##2 ~ }\NAME\NOTE }
},
headstyle / unknown .cs_set:Np = \keythms_thmstyle_headcmd:nnn #1#2#3,
inherit-style .choice:,
@@ -504,7 +512,25 @@
\clist_map_inline:nn { #1 } % define multiple theorems at once
{ \keythms_thm_newkeythm:nn { ##1 } { #2 } }
}
+\NewDocumentCommand \renewkeytheorem { m O{} }
+ { % #1 = name, #2 = keys
+ \clist_map_inline:nn { #1 }
+ { \keythms_thm_renewkeythm:nn { ##1 } { #2 } }
+ }
+\NewDocumentCommand \providekeytheorem { m O{} }
+ { % #1 = name, #2 = keys
+ \clist_map_inline:nn { #1 }
+ { \keythms_thm_providekeythm:nn { ##1 } { #2 } }
+ }
+\NewDocumentCommand \declarekeytheorem { m O{} }
+ { % #1 = name, #2 = keys
+ \clist_map_inline:nn { #1 }
+ { \keythms_thm_declarekeythm:nn { ##1 } { #2 } }
+ }
\@onlypreamble \newkeytheorem
+\@onlypreamble \renewkeytheorem
+\@onlypreamble \providekeytheorem
+\@onlypreamble \declarekeytheorem
% to prevent error when plain, remark, or definition style used
\tl_new:N \l__keythms_thmstyle_plain_savedthmkeys_tl
@@ -515,6 +541,12 @@
{ % #1 = name, #2 = keys
% Store envname
\tl_set:Nn \l__keythms_thm_envname_tl { #1 }
+ % Set up tl's for hooks; hooks will be created and added to at begindocument
+ \tl_gclear_new:c { g__keythms_thm_preheadfromkeys_#1_tl }
+ \tl_gclear_new:c { g__keythms_thm_postheadfromkeys_#1_tl }
+ \tl_gclear_new:c { g__keythms_thm_prefootfromkeys_#1_tl }
+ \tl_gclear_new:c { g__keythms_thm_postfootfromkeys_#1_tl }
+ \tl_gclear_new:c { g__keythms_thm_tcbpatch_#1_tl }
% Make unless-unique false by default (can't precompile this)
\bool_set_false:N \l__keythms_thm_unlessunique_bool
% Set default keys
@@ -538,30 +570,11 @@
}
% Set env-specific keys
\keys_set:nn { keytheorems/thm } { #2 }
- % Set up env-specific hooks
- \__keythms_thm_makethmhooks:n { #1 }
- % Add to env-specific hooks (use label so code given in keys is outermost)
- % NOTE: faster to check if empty than add empty code to hook
- \tl_if_empty:NF \l__keythms_thm_preheadhook_tl
- {
- \hook_gput_code:nnV { keytheorems/#1/prehead }
- { keythms_hook_keys } \l__keythms_thm_preheadhook_tl
- }
- \tl_if_empty:NF \l__keythms_thm_postheadhook_tl
- {
- \hook_gput_code:nnV { keytheorems/#1/posthead }
- { keythms_hook_keys } \l__keythms_thm_postheadhook_tl
- }
- \tl_if_empty:NF \l__keythms_thm_prefoothook_tl
- {
- \hook_gput_code:nnV { keytheorems/#1/prefoot }
- { keythms_hook_keys } \l__keythms_thm_prefoothook_tl
- }
- \tl_if_empty:NF \l__keythms_thm_postfoothook_tl
- {
- \hook_gput_code:nnV { keytheorems/#1/postfoot }
- { keythms_hook_keys } \l__keythms_thm_postfoothook_tl
- }
+ % Build tl for env-specific hooks; will be added to hooks at begindocument
+ \tl_gput_right:cV { g__keythms_thm_preheadfromkeys_#1_tl } \l__keythms_thm_preheadhook_tl
+ \tl_gput_right:cV { g__keythms_thm_postheadfromkeys_#1_tl } \l__keythms_thm_postheadhook_tl
+ \tl_gput_right:cV { g__keythms_thm_prefootfromkeys_#1_tl } \l__keythms_thm_prefoothook_tl
+ \tl_gput_right:cV { g__keythms_thm_postfootfromkeys_#1_tl } \l__keythms_thm_postfoothook_tl
% Set name if none given
\quark_if_no_value:NT \l__keythms_thm_name_tl % use quark so name={} is valid
{
@@ -580,8 +593,8 @@
\RequirePackage[unq]{unique}
\tl_if_empty:NTF \l__keythms_thm_parent_tl
{
- \hook_gput_code:nnn { keytheorems/#1/prehead }
- { keythms_hook_keys } { \setuniqmark { #1 } }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_#1_tl }
+ { \setuniqmark { #1 } }
\ifuniq{ #1 }
{ \bool_set_false:N \l__keythms_thm_numbered_bool }
{ \bool_set_true:N \l__keythms_thm_numbered_bool }
@@ -600,7 +613,7 @@
}
{
\__keythms_thm_new_unnumbered:nV { #1 } \l__keythms_thm_name_tl
- \hook_gput_code:nnn { keytheorems/#1/prehead } { keythms_hook_keys }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_#1_tl }
{
\keythms_if_restating:F
{ \refstepcounter{ keythms_unnumbered_dummyctr } }
@@ -635,7 +648,7 @@
}
{
\__keythms_thm_new_unnumbered:nV { #1 } \l__keythms_thm_name_tl
- \hook_gput_code:nnn { keytheorems/#1/prehead } { keythms_hook_keys }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_#1_tl }
{
\keythms_if_restating:F
{ \refstepcounter{ keythms_unnumbered_dummyctr } }
@@ -672,11 +685,27 @@
{ \__keythms_theoremstyle:V \l__keythms_thm_currentthmstyle_tl }
}
+\hook_gput_code:nnn { begindocument } { . }
+ {
+ \prop_map_inline:Nn \g__keythms_thmnames_prop
+ {
+ \__keythms_thm_makethmhooks:n { #1 }
+ \clist_map_inline:nn { prehead, posthead, prefoot, postfoot }
+ {
+ \tl_if_empty:cF { g__keythms_thm_##1fromkeys_#1_tl }
+ {
+ \hook_gput_code:nnv { keytheorems/#1/##1 } { keythms_hook_keys }
+ { g__keythms_thm_##1fromkeys_#1_tl }
+ }
+ }
+ \tl_use:c { g__keythms_thm_tcbpatch_#1_tl }
+ }
+ }
+
\cs_new_protected:Npn \__keythms_thm_tcboxcode:nn #1#2
- {
+ { % #1 = name, #2 = tcolorbox keys
\RequirePackage{tcolorbox}
- \hook_gput_code:nnn { keytheorems/#1/prehead }
- { keythms_tcbox }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_#1_tl }
{
\cs_set_eq:NN \deferred at thm@head \__keythms_thm_storedeferredthmhead:n
\cs_set_eq:NN \Hy at theorem@makelinktarget \use_none:n
@@ -686,12 +715,6 @@
\cs_set_protected:Npn \thm at space@setup { \thm at preskip=0pt \thm at postskip=0pt }
% ^ to match tcolorbox defaults; shouldn't interfere with user styles
}
- \hook_gset_rule:nnnn { keytheorems/#1/posthead }
- { keythms_tcbox } { before } { keythms_hook_keys }
- \hook_gset_rule:nnnn { keytheorems/#1/prefoot }
- { keythms_tcbox } { after } { keythms_hook_keys }
- \hook_gset_rule:nnnn { keytheorems/#1/prefoot }
- { keythms_tcbox } { after } { keythms_qed }
\tcbset
{
keythms_tcbox_#1/.style =
@@ -698,11 +721,12 @@
{
savedelimiter=#1,
title={ \__keythms_thm_tcboxtemphead: },
+ #2
}
}
\bool_if:NT \l__keythms_thm_numbered_bool
{
- \hook_gput_code:nnn { begindocument } { . }
+ \tl_gset:cn { g__keythms_thm_tcbpatch_#1_tl }
{
\IfPackageLoadedF{cleveref}
{ % hyperref doesn't patch \@thm if cleveref loaded
@@ -714,21 +738,19 @@
}
}
}
- \hook_gput_code:nnn { keytheorems/#1/posthead } { keythms_tcbox }
- { \begin{tcolorbox}[keythms_tcbox_#1,#2] }
- \hook_gput_code:nnn { keytheorems/#1/prefoot } { keythms_tcbox }
+ \tl_gput_left:cn { g__keythms_thm_postheadfromkeys_#1_tl }
+ { \begin{tcolorbox}[keythms_tcbox_#1] }
+ \tl_gput_right:cn { g__keythms_thm_prefootfromkeys_#1_tl }
{ \end{tcolorbox} }
}
\cs_new_protected:Npn \__keythms_thm_qedcode:nn #1#2
- {
- \hook_gput_code:nnn { keytheorems/#1/posthead }
- { keythms_qed }
+ { % #1 = name, #2 = symbol
+ \tl_gput_right:cn { g__keythms_thm_postheadfromkeys_#1_tl }
{
\exp_args:No \tl_if_novalue:nF { #2 } { \protected at edef\qedsymbol{#2} }
\pushQED{\qed}
}
- \hook_gput_code:nnn { keytheorems/#1/prefoot }
- { keythms_qed }
+ \tl_gput_left:cn { g__keythms_thm_prefootfromkeys_#1_tl }
{
\exp_args:No \tl_if_novalue:nF { #2 } { \protected at edef\qedsymbol{#2} }
\popQED
@@ -735,6 +757,50 @@
}
}
+\cs_new_protected:Npn \__keythms_nocheck_removefromreset:nn #1#2
+ { % need to fake @ckpt counter
+ \group_begin:
+ \cs_if_exist:cF { c@#2 } { \cs_set:cpn { c@#2 } { } }
+ \@removefromreset{#1}{#2}
+ \group_end:
+ }
+
+\cs_new_protected:Npn \keythms_thm_renewkeythm:nn #1#2
+ { % #1 = name, #2 = keys
+ \cs_if_exist:cTF { #1 }
+ {
+ \cs_undefine:c { #1 }
+ \cs_undefine:c { c@ #1 }
+ \cs_undefine:c { the #1 }
+ \tl_if_exist:cT { g__keythms_thm_#1_parent_tl }
+ { % remove parent counter binding
+ \exp_args:Nnv \@removefromreset { #1 } { g__keythms_thm_#1_parent_tl }
+ }
+ \__keythms_nocheck_removefromreset:nn { #1 } { @ckpt }
+ \keythms_thm_newkeythm:nn { #1 } { #2 }
+ }
+ { \msg_error:nnn { keytheorems } { thm-undefined} { #1 } }
+ }
+\cs_new_protected:Npn \keythms_thm_providekeythm:nn #1#2
+ { % #1 = name, #2 = keys
+ \cs_if_free:cT { #1 }
+ {
+ \keythms_thm_newkeythm:nn { #1 } { #2 }
+ }
+ }
+\cs_new_protected:Npn \keythms_thm_declarekeythm:nn #1#2
+ { % #1 = name, #2 = keys
+ \cs_undefine:c { #1 }
+ \cs_undefine:c { c@ #1 }
+ \cs_undefine:c { the #1 }
+ \tl_if_exist:cT { g__keythms_thm_#1_parent_tl }
+ { % remove parent counter binding
+ \exp_args:Nnv \@removefromreset { #1 } { g__keythms_thm_#1_parent_tl }
+ }
+ \__keythms_nocheck_removefromreset:nn { #1 } { @ckpt }
+ \keythms_thm_newkeythm:nn { #1 } { #2 }
+ }
+
\cs_new_eq:NN \__keythms_theoremstyle:n \theoremstyle
\cs_generate_variant:Nn \__keythms_theoremstyle:n { V }
@@ -749,7 +815,12 @@
\cs_generate_variant:Nn \__keythms_thm_new_unnumbered:nn { nV }
\cs_new_protected:Npn \__keythms_thm_new_parent:nnn #1#2#3
- { \__keythms_thm_new:w { #1 } { #2 } [ #3 ] }
+ {
+ % for \renewkeytheorem need to know parent key if set
+ \tl_gclear_new:c { g__keythms_thm_#1_parent_tl }
+ \tl_gset:cn { g__keythms_thm_#1_parent_tl } { #3 }
+ \__keythms_thm_new:w { #1 } { #2 } [ #3 ]
+ }
\cs_generate_variant:Nn \__keythms_thm_new_parent:nnn { nVV }
\cs_new_protected:Npn \__keythms_thm_new_sibling:nnn #1#2#3
@@ -769,6 +840,9 @@
{
\keythms_if_restating:F
{ \refstepcounter{ keythms_unnumbered_dummyctr } }
+ \IfPackageLoadedT { tcolorbox }
+ { \tcbset{keythms_tcbox_#1/.append~style=nophantom} }
+ % ^ otherwise we try to set two identical anchors
\begin{keythms_orig_nonumber_#1}
}
{
@@ -1000,7 +1074,7 @@
{ #1 }
}
}
- }
+ }
}
}
\cs_new:Npn \__keythms_use_iii_v_braced:nnnnn #1#2#3#4#5 { {#3}{#5} }
@@ -1110,7 +1184,7 @@
}
}
\cs_new_protected:Npn \__keythms_thm_addstoredreverseddata:nnn #1#2#3
- {
+ { % #1 = theorem name, #2 = keys, #3 = body
\iow_shipout:Ne \@auxout
{
\exp_not:N \@writefile { thlist }
@@ -1927,7 +2001,7 @@
\ProvideDocumentEnvironment { restatable } { O{} m m }
{ % need to redefine this to add store to thlist since we set it outside env
\cs_set_protected:Npn \__keythms_thm_addcontentsdata:nnnn ####1####2####3####4
- { % #1 = theorem name, #2 = stored counters, #3 = keys, #4 = body
+ { % ####1 = theorem name, ####2 = stored counters, ####3 = keys, ####4 = body
\keythms_listof_chaptervspacehack:
\iow_shipout:Ne \@auxout
{
@@ -1959,7 +2033,7 @@
\ProvideDocumentEnvironment { restatable* } { O{} m m }
{ % need to redefine this to add store* to thlist since we set it outside env
\cs_set_protected:Npn \__keythms_thm_addstoredreverseddata:nnn ####1####2####3
- {
+ { % ####1 = theorem name, ####2 = keys, ####3 = body
\iow_shipout:Ne \@auxout
{
\exp_not:N \@writefile { thlist }
@@ -2063,32 +2137,27 @@
nocut .meta:n = { cut=false },
thickness .code:n =
{ % could also add keys to clist with changed dimens; which is better?
- \hook_gput_code:nnn { keytheorems/\l__keythms_thm_envname_tl/prehead }
- { keythms_tcbox }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_ \l__keythms_thm_envname_tl _tl }
{ \dim_set:Nn \l_keythms_tcbthmbox_thickness_dim { ##1 } }
},
leftmargin .code:n =
{
- \hook_gput_code:nnn { keytheorems/\l__keythms_thm_envname_tl/prehead }
- { keythms_tcbox }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_ \l__keythms_thm_envname_tl _tl }
{ \dim_set:Nn \l_keythms_tcbthmbox_leftmargin_dim { ##1 } }
},
rightmargin .code:n =
{
- \hook_gput_code:nnn { keytheorems/\l__keythms_thm_envname_tl/prehead }
- { keythms_tcbox }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_ \l__keythms_thm_envname_tl _tl }
{ \dim_set:Nn \l_keythms_tcbthmbox_rightmargin_dim { ##1 } }
},
hskip .code:n =
{
- \hook_gput_code:nnn { keytheorems/\l__keythms_thm_envname_tl/prehead }
- { keythms_tcbox }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_ \l__keythms_thm_envname_tl _tl }
{ \dim_set:Nn \l_keythms_tcbthmbox_hskip_dim { ##1 } }
},
vskip .code:n =
{
- \hook_gput_code:nnn { keytheorems/\l__keythms_thm_envname_tl/prehead }
- { keythms_tcbox }
+ \tl_gput_right:cn { g__keythms_thm_preheadfromkeys_ \l__keythms_thm_envname_tl _tl }
{ \dim_set:Nn \l_keythms_tcbthmbox_vskip_dim { ##1 } }
},
}
@@ -2297,8 +2366,9 @@
}
\keys_define:nn { keytheorems/thmstyle }
{
- shaded .code:n = \keythms_thmstyle_savethmkey_optval:n { ##1 },
- thmbox .code:n = \keythms_thmstyle_savethmkey_optval:n { ##1 },
+ shaded .code:n = \keythms_thmstyle_savethmkey_optval:n { ##1 },
+ thmbox .code:n = \keythms_thmstyle_savethmkey_optval:n { ##1 },
+ mdframed .code:n = \msg_error:nn { keytheorems } { mdframed-undefined },
}
}
@@ -2390,6 +2460,7 @@
\keythms_support_check:n { amsart }
\keythms_support_check:n { amsbook }
\keythms_support_check:n { amsproc }
+\keythms_support_check:n { beamer }
\keythms_support_check:n { memoir }
\file_input_stop:
\ No newline at end of file
More information about the tex-live-commits
mailing list.