texlive[72443] Master/texmf-dist: keytheorems (1oct24)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 1 21:51:14 CEST 2024


Revision: 72443
          https://tug.org/svn/texlive?view=revision&revision=72443
Author:   karl
Date:     2024-10-01 21:51:14 +0200 (Tue, 01 Oct 2024)
Log Message:
-----------
keytheorems (1oct24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.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

Modified: trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md	2024-10-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md	2024-10-01 19:51:14 UTC (rev 72443)
@@ -1,5 +1,9 @@
 # Changelog for keytheorems package
 
+## [v0.1.5]
+- add `format-code` list key
+- can now use `\thmname`, `\thmnumber`, `\thmnote` in `headformat`
+
 ## [v0.1.4]
 - add `store-sets-label` option
 - add `restatable*` environment for `thmtools-compat`
@@ -27,6 +31,7 @@
 ## 0.1.0 - 2024-09-04
 - First release
 
+[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
 [v0.1.2]: https://github.com/mbertucci47/keytheorems/compare/v0.1.1...v0.1.2

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-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex	2024-10-01 19:51:14 UTC (rev 72443)
@@ -1,4 +1,4 @@
-% !TeX program = txs:///pdflatex/[--shell-escape] | txs:///makeindex | txs:///pdflatex/[--shell-escape] | txs:///view-pdf
+% !TeX program = txs:///lualatex | txs:///makeindex | txs:///lualatex | txs:///view-pdf
 \PassOptionsToPackage{hyperindex}{hyperref}
 \PassOptionsToPackage{dvipsnames}{xcolor}
 \documentclass{ltxdoc}
@@ -5,22 +5,25 @@
 \usepackage{geometry}
 \geometry{margin=1in}
 \usepackage{tcolorbox}
+\PassOptionsToPackage{highlightmode=immediate}{minted}
 \tcbuselibrary{documentation,minted}
 \tcbset{
   listing engine=minted,
   minted language=latex,
   }
-\ifTUTeX\else
+\ifTUTeX
+\usepackage{newcomputermodern}
+\else
 \usepackage{lmodern}
 \usepackage[T1]{fontenc}
+\usepackage{amssymb}
 \fi
 \usetikzlibrary{cd}
 \usepackage{booktabs}
 \usepackage{keytheorems}
 \usepackage{cleveref}
-\usepackage{amssymb}
 
-\def\version{0.1.4}
+\def\version{0.1.5}
 
 \title{%
   \pkg{keytheorems} package \\[1ex]
@@ -169,6 +172,8 @@
 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.
 \end{docCommand}
 
+\subsection{Compatibility options}
+
 \begin{docKey}{overload}
   {}
   {initially unset}
@@ -180,40 +185,37 @@
   {}
   {initially unset}
 For compatibility with \pkg{thmtools} syntax.
-Currently defines the commands in the left column below.
+For most documents, \cs{usepackage}\bracks{thmtools-compat}\ttbraces{keytheorems} 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}
-\begin{tabular}{cc}
-\pkg{thmtools} command & \pkg{keytheorems} replacement \\
+\begin{tabular}{rcl}
+\multicolumn{1}{c}{\pkg{thmtools} command} & & \multicolumn{1}{c}{\pkg{keytheorems} replacement} \\
 \toprule
-\docAuxCommand*{declaretheorem} & \refCom{newkeytheorem} \\
-\docAuxCommand*{declaretheoremstyle} & \refCom{newkeytheoremstyle} \\
-\docAuxCommand*{listoftheorems} & \refCom{listofkeytheorems} \\
-\begin{tabular}{c}
+\docAuxCommand*{declaretheorem} & $\rightarrow$ & \refCom{newkeytheorem} \\
+\docAuxCommand*{declaretheoremstyle} & $\rightarrow$ & \refCom{newkeytheoremstyle} \\
+\docAuxCommand*{listoftheorems} & $\rightarrow$ & \refCom{listofkeytheorems} \\
+\docAuxCommand*{listtheoremname} & $\rightarrow$ & \refKey{title} key \\
+\begin{tabular}{r@{}}
 \docAuxCommand*{addtotheorempreheadhook}\\
 \docAuxCommand*{addtotheorempostheadhook}\\
 \docAuxCommand*{addtotheoremprefoothook}\\
 \docAuxCommand*{addtotheorempostfoothook}\\
-\end{tabular} & \refCom{addtotheoremhook} \\
-\docAuxEnvironment*{restatable} environment & \refKey{store} key \\
-\docAuxEnvironment*{restatable*} environment & \refKey[store*]{store} key
+\end{tabular} & $\rightarrow$ & \refCom{addtotheoremhook} \\
+\docAuxEnvironment*{restatable} environment & $\rightarrow$ & \refKey{store} key \\
+\docAuxEnvironment*{restatable*} environment & $\rightarrow$ & \refKey[store*]{store} key
 \end{tabular}
 \end{center}
 Also defined are the \docAuxKey*{shaded} and \docAuxKey*{thmbox} keys, implemented internally with \pkg{tcolorbox} rather than the \pkg{shadethm} and \pkg{thmbox} packages, respectively.
 \end{docKey}
 
-\begin{docKey}{store-all}
-  {}
-  {initially unset}
-Tells \pkg{keytheorems} to grab the body of each theorem so it can later be printed with the \refKey{print-body} option of \refCom{listofkeytheorems}.
-Note that this means a theorem body \emph{cannot} contain verbatim material.
-\end{docKey}
+\subsection{Other global options}
 
-\begin{docKey}{restate-counters}
-  {=\marg{comma-list of counters}}
-  {initially \ttbraces{equation}}
-Additional counters whose values are preserved when a theorem is restated.
-This key does not reset the list, so you don't need to include |equation| in \meta{comma-list}.
+\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.
+These texts can be manually customized with the \refKey{title} and \refKey{continues-code} keys, respectively.
 \end{docKey}
 
 \begin{docKey}{continues-code}
@@ -230,16 +232,23 @@
 Redefines \cs{qedsymbol} to be \meta{symbol}.
 \end{docKey}
 
-\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.
-These texts can be manually customized with the \refKey{title} and \refKey{continues-code} keys, respectively.
+\begin{docKey}{restate-counters}
+  {=\marg{comma-list of counters}}
+  {initially \ttbraces{equation}}
+Additional counters whose values are preserved when a theorem is restated.
+This key does not reset the list, so you don't need to include |equation| in \meta{comma-list}.
 \end{docKey}
 
-\begin{docKey}{store-sets-translate}
+\begin{docKey}{store-all}
   {}
   {initially unset}
+Tells \pkg{keytheorems} to grab the body of each theorem so it can later be printed with the \refKey{print-body} option of \refCom{listofkeytheorems}.
+Note that this means a theorem body \emph{cannot} contain verbatim material.
+\end{docKey}
+
+\begin{docKey}{store-sets-label}
+  {}
+  {initially unset}
 Defines the \refKey{store} key to also set \refKey{label}, i.e. it makes |store=|\meta{tag} equivalent to |store=|\meta{tag}|,label=|\meta{tag}. Similarly for \refKey[store*]{store}.
 \end{docKey}
 
@@ -424,7 +433,7 @@
 See \refKey{listof/seq} for more details.
 \end{docKey}
 
-\subsection{Keys inherited from \pkg{thmtools}} \label{thm-thmtools-keys}
+\subsection{Keys also defined in \pkg{thmtools}} \label{thm-thmtools-keys}
 
 These are the \oarg{options} available to \cs{newkeytheorem}.
 Except for \refKey{thm/name} and \refKey{style}, each key below can also be used in \refCom{newkeytheoremstyle}.
@@ -433,7 +442,7 @@
 \begin{docKey}[][doc label=thm/name]{name}
   {=\meta{display name}}
   {initially title-cased \meta{env name}}
-Aliases \docAuxKey{title} and \docAuxKey{heading}.
+Aliases \docAuxKey{heading} and \docAuxKey{title}.
 
 \begin{tcbwritetemp}
 \newkeytheorem{mythm}[name=Some Name]
@@ -545,6 +554,28 @@
 
 \end{docKeys}
 
+\begin{docKey}{qed}
+  {\colOpt{=\meta{symbol}}}
+  {default \cs{openbox}, initially unset}
+Adds \colOpt{\meta{symbol}} to the end of the theorem body.
+If no value is given, the symbol \openbox\ is used.
+
+\begin{tcbwritetemp}
+\newkeytheorem{example}[qed]
+\newkeytheorem{solution}[qed=$\clubsuit$]
+\end{tcbwritetemp}
+
+\begin{keythmscode}[withpreamble]
+\begin{example}
+Some text
+\end{example}
+\begin{solution}
+Some more text
+\end{solution}
+\end{keythmscode}
+
+\end{docKey}
+
 \begin{docKey}{refname}
   {=\meta{ref name} \textrm{or} \brackets{\meta{singular name},\meta{plural name}}}
   {initially \meta{display name}}
@@ -582,28 +613,6 @@
 
 \end{docKey}
 
-\begin{docKey}{qed}
-  {\colOpt{=\meta{symbol}}}
-  {default \cs{openbox}, initially unset}
-Adds \colOpt{\meta{symbol}} to the end of the theorem body.
-If no value is given, the symbol \openbox\ is used.
-
-\begin{tcbwritetemp}
-\newkeytheorem{example}[qed]
-\newkeytheorem{solution}[qed=$\clubsuit$]
-\end{tcbwritetemp}
-
-\begin{keythmscode}[withpreamble]
-\begin{example}
-Some text
-\end{example}
-\begin{solution}
-Some more text
-\end{solution}
-\end{keythmscode}
-
-\end{docKey}
-
 \subsection{Keys added by \pkg{keytheorems}} \label{thm-added-keys}
 
 \begin{docKey}{tcolorbox}
@@ -631,7 +640,7 @@
 \begin{corollary}
 Some text
 \end{corollary}
-\begin{definition}
+\begin{definition}[A nice definition]
 Some more text
 \end{definition}
 \end{keythmscode}
@@ -704,29 +713,39 @@
 For the AMS classes \cls{amsart}, \cls{amsbook}, and \cls{amsproc}, as well as the \cls{amsart}-based \cls{acmart}, the initial key values are slightly different than what's below in order to match those class's defaults.
 \end{notebox}
 
-\subsection{Keys inherited from \pkg{thmtools}}
+\subsection{Keys also defined in \pkg{thmtools}}
 
 The following keys have the same meaning and syntax as the corresponding \pkg{thmtools} keys.
 In addition to the list below, most of the keys available to \refCom{newkeytheorem} can be used in \cs{newkeytheoremstyle}.
 
-\begin{docKey}{spaceabove}
-  {=\meta{length}}
-  {initially \cs{topsep}}
+\begin{docKey}{bodyfont}
+  {=\meta{font declarations}}
+  {initially \cs{itshape}}
 
 \end{docKey}
 
-\begin{docKey}{spacebelow}
-  {=\meta{length}}
-  {initially \cs{topsep}}
-
+\begin{docKey}{break}
+  {}
+  {initially unset}
+Do not use this with the \refKey{postheadspace} key.
 \end{docKey}
 
-\begin{docKey}{bodyfont}
+\begin{docKey}{headfont}
   {=\meta{font declarations}}
-  {initially \cs{itshape}}
+  {initially \cs{bfseries}}
 
 \end{docKey}
 
+\begin{docKey}{headformat}
+  {=\docValue{margin}\textbar\docValue{swapnumber}\textbar\meta{code using \cs{NAME}, \cs{NUMBER}, and \cs{NOTE}\,}}
+  {}
+Alias \docAuxKey{headstyle}. Within \meta{code}, the commands \docAuxCommand{NAME}, \docAuxCommand{NUMBER}, and \docAuxCommand{NOTE} correspond to the formatted parts of the theorem head.
+\end{docKey}
+
+\begin{notebox}
+In \refKey{headformat}, you may also use the traditional \pkg{amsthm} commands \cs{thmname}, \cs{thmnumber}, and \cs{thmnote}, where |#1| is the theorem name, |#2| the number, and |#3| the note. \pkg{keytheorems} expands the head spec inside |\text_expand:n| so for these commands to work properly, the package adds them to |\l_text_expand_exclude_tl|. Note also that if you use these lower-level commands, the style keys \refKey{notebraces}, \refKey{notefont}, \refKey{noteseparator}, and \refKey{numberfont} will have no effect (of course, you can manually control these things inside the commands' arguments).
+\end{notebox}
+
 \begin{docKey}{headindent}
   {=\meta{length}}
   {initially |0pt|}
@@ -733,12 +752,6 @@
 
 \end{docKey}
 
-\begin{docKey}{headfont}
-  {=\meta{font declarations}}
-  {initially \cs{bfseries}}
-
-\end{docKey}
-
 \begin{docKey}{headpunct}
   {=\meta{code}}
   {initially \ttbraces{.}}
@@ -745,16 +758,10 @@
 
 \end{docKey}
 
-\begin{docKey}{postheadspace}
-  {=\meta{length}}
-  {initially |5pt plus 1pt minus 1pt|}
-Do not use this with the \refKey{break} key.
-\end{docKey}
+\begin{docKey}{notebraces}
+  {=\marg{left brace}\marg{right brace}}
+  {initially \ttbraces{(}\ttbraces{)}}
 
-\begin{docKey}{break}
-  {}
-  {initially unset}
-Do not use this with the \refKey{postheadspace} key.
 \end{docKey}
 
 \begin{docKey}{notefont}
@@ -763,20 +770,33 @@
 
 \end{docKey}
 
-\begin{docKey}{notebraces}
-  {=\marg{left brace}\marg{right brace}}
-  {initially \ttbraces{(}\ttbraces{)}}
+\begin{docKey}{postheadspace}
+  {=\meta{length}}
+  {initially |5pt plus 1pt minus 1pt|}
+Do not use this with the \refKey{break} key.
+\end{docKey}
 
+\begin{docKey}{spaceabove}
+  {=\meta{length}}
+  {initially \cs{topsep}}
+
 \end{docKey}
 
-\begin{docKey}{headformat}
-  {=\docValue{margin}\textbar\docValue{swapnumber}\textbar\meta{code using \cs{NAME}, \cs{NUMBER}, and \cs{NOTE}}}
-  {}
-Alias \docAuxKey{headstyle}. Within \meta{code}, the commands \docAuxCommand{NAME}, \docAuxCommand{NUMBER}, and \docAuxCommand{NOTE} correspond to the formatted parts of the theorem head.
+\begin{docKey}{spacebelow}
+  {=\meta{length}}
+  {initially \cs{topsep}}
+
 \end{docKey}
 
 \subsection{Keys added by \pkg{keytheorems}}
 
+\begin{docKey}{inherit-style}
+  {=\meta{style name}}
+  {initially unset}
+Inherit the keys of any style declared with \refCom{newkeytheoremstyle}.
+Additionally, the three styles predefined by \pkg{amsthm} are possible values: \docValue{plain}, \docValue{definition}, and \docValue{remark}.
+\end{docKey}
+
 \begin{docKey}{noteseparator}
   {=\meta{code}}
   {initially \textvisiblespace}
@@ -789,13 +809,6 @@
 For almost all theorem styles, it is recommended that you \emph{do not} change this setting.
 \end{docKey}
 
-\begin{docKey}{inherit-style}
-  {=\meta{style name}}
-  {initially unset}
-Inherit the keys of any style declared with \refCom{newkeytheoremstyle}.
-Additionally, the three styles predefined by \pkg{amsthm} are possible values: \docValue{plain}, \docValue{definition}, and \docValue{remark}.
-\end{docKey}
-
 \section{Restating theorems}
 
 When a theorem is given the \refKey{store} key, the contents of the theorem are saved and written to a |.thlist| file.
@@ -868,12 +881,6 @@
 
 \subsection{Keys inherited from \pkg{thmtools}}
 
-\begin{docKey}{numwidth}
-  {=\meta{length}}
-  {initially |2.3em|}
-For the AMS classes, this is initially |1.5pc|.
-\end{docKey}
-
 \begin{docKey}{ignore}
   {=\marg{comma-list of env names}}
   {initially unset}
@@ -880,18 +887,6 @@
 
 \end{docKey}
 
-\begin{docKey}{show}
-  {=\marg{comma-list of env names}}
-  {initially all theorems}
-
-\end{docKey}
-
-\begin{docKey}{onlynamed}
-  {\colOpt{=\marg{comma-list of env names}}}
-  {initially unset}
-
-\end{docKey}
-
 \begin{docKey}{ignoreall}
   {}
   {initially unset}
@@ -906,6 +901,24 @@
 
 \end{docKey}
 
+\begin{docKey}{numwidth}
+  {=\meta{length}}
+  {initially |2.3em|}
+For the AMS classes, this is initially |1.5pc|.
+\end{docKey}
+
+\begin{docKey}{onlynamed}
+  {\colOpt{=\marg{comma-list of env names}}}
+  {initially unset}
+
+\end{docKey}
+
+\begin{docKey}{show}
+  {=\marg{comma-list of env names}}
+  {initially all theorems}
+
+\end{docKey}
+
 \begin{docKey}{showall}
   {}
   {initially set}
@@ -912,6 +925,12 @@
 
 \end{docKey}
 
+\begin{docKey}{swapnumber}
+  {\colOpt{=true\textbar false}}
+  {initially |false|}
+
+\end{docKey}
+
 \begin{docKey}{title}
   {=\meta{text}}
   {initially \cs{GetTranslation}\ttbraces{keythms\string_listof\string_title}}
@@ -920,14 +939,14 @@
 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}.
 \end{docKey}
 
-\begin{docKey}{swapnumber}
-  {\colOpt{=true\textbar false}}
-  {initially |false|}
+\subsection{Keys added by \pkg{keytheorems}}
 
+\begin{docKey}{format-code}
+  {=\meta{code with \textup{\texttt{\#1}}, \textup{\texttt{\#2}}, and \textup{\texttt{\#3}}}}
+  {initially \cs{numberline}\texttt{\{\#2\}\#1\#3}}
+Allows full control over the format for list entries. The theorem name is |#1|, the number is |#2|, and the (formatted) note is |#3|. The note formatting is still controlled by \refKey{note-code}.
 \end{docKey}
 
-\subsection{Keys added by \pkg{keytheorems}}
-
 \begin{docKey}{indent}
   {=\meta{length}}
   {initially |1.5em|}
@@ -936,25 +955,23 @@
 It is not recommended to change this unless your class has different defaults not already covered.
 \end{docKey}
 
-\begin{docKey}{onlynumbered}
-  {\colOpt{=\marg{comma-list of env names}}}
-  {initially unset}
-Similar to \refKey{onlynamed}, but lists only those theorems which are numbered.
-This is useful if you'd like to exclude things like unnumbered definitions and remarks from the list of theorems.
+\begin{docKey}{no-chapter-skip}
+  {\colOpt{=true\textbar false}}
+  {initially |false|}
+By default a small vertical space is inserted between each chapter's chunk of theorems.
+Setting this key to |true| removes this space.
 \end{docKey}
 
-\begin{docKey}[][doc label=listof/seq]{seq}
-  {=\meta{name}}
-  {initially unset}
-Used to list only the theorems added to the custom sequence \meta{name} with the \refKey{thm/seq} theorem key.
-This is the only way to fully customize which theorems appear in the list of theorems.
-Unlike with \refKey{show}, you do not need to use \refKey{ignoreall} to prevent theorems not in \meta{name} from being printed.
+\begin{docKey}{chapter-skip-length}
+  {=\meta{dimension}}
+  {initially |10pt|}
+Controls the amount of space inserted between chunks.
 \end{docKey}
 
-\begin{docKey}{title-code}
-  {=\meta{code with \textup{\texttt{\#1}}}}
-  {initially \cs{section*}\ttbraces{\#1}}
-If \cs{chapter} is defined, then initially this is instead \cs{chapter*}\ttbraces{\#1}. This key has no effect if used with an AMS class because these classes hard-code the section heading into \cs{@starttoc}.
+\begin{docKey}{no-continues}
+  {\colOpt{=true\textbar false}}
+  {initially |false|}
+Suppresses the printing of theorems given the \refKey{continues} key in the list of theorems.
 \end{docKey}
 
 \begin{docKey}{no-title}
@@ -971,6 +988,12 @@
 
 \end{docKey}
 
+\begin{docKey}{no-toc}
+  {\colOpt{=true\textbar false}}
+  {initially false}
+With the standard classes, lists of figures/tables are not added to the table of contents by default. The same is true for \cs{listofkeytheorems}, and with those classes this key does nothing. However some classes, notably \cls{memoir} and the AMS classes, do add lists to the table of contents. With these classes, this key suppresses the addition of the list of theorems to the table of contents.
+\end{docKey}
+
 \begin{docKey}{note-code}
   {=\meta{code with \textup{\texttt{\#1}}}}
   {initially \ttbraces{ (\#1)}}
@@ -977,6 +1000,13 @@
 Formats the optional note in the list of theorems.
 \end{docKey}
 
+\begin{docKey}{onlynumbered}
+  {\colOpt{=\marg{comma-list of env names}}}
+  {initially unset}
+Similar to \refKey{onlynamed}, but lists only those theorems which are numbered.
+This is useful if you'd like to exclude things like unnumbered definitions and remarks from the list of theorems.
+\end{docKey}
+
 \begin{docKey}{print-body}
   {}
   {initially unset}
@@ -984,31 +1014,20 @@
 Not very useful without the \refKey{store-all} load-time option.
 \end{docKey}
 
-\begin{docKey}{no-continues}
-  {\colOpt{=true\textbar false}}
-  {initially |false|}
-Suppresses the printing of theorems given the \refKey{continues} key in the list of theorems.
+\begin{docKey}[][doc label=listof/seq]{seq}
+  {=\meta{name}}
+  {initially unset}
+Used to list only the theorems added to the custom sequence \meta{name} with the \refKey{thm/seq} theorem key.
+This is the only way to fully customize which theorems appear in the list of theorems.
+Unlike with \refKey{show}, you do not need to use \refKey{ignoreall} to prevent theorems not in \meta{name} from being printed.
 \end{docKey}
 
-\begin{docKey}{no-chapter-skip}
-  {\colOpt{=true\textbar false}}
-  {initially |false|}
-By default a small vertical space is inserted between each chapter's chunk of theorems.
-Setting this key to |true| removes this space.
+\begin{docKey}{title-code}
+  {=\meta{code with \textup{\texttt{\#1}}}}
+  {initially \cs{section*}\ttbraces{\#1}}
+If \cs{chapter} is defined, then initially this is instead \cs{chapter*}\ttbraces{\#1}. This key has no effect if used with an AMS class because these classes hard-code the section heading into \cs{@starttoc}.
 \end{docKey}
 
-\begin{docKey}{chapter-skip-length}
-  {=\meta{dimension}}
-  {initially |10pt|}
-Controls the amount of space inserted between chunks.
-\end{docKey}
-
-\begin{docKey}{no-toc}
-  {\colOpt{=true\textbar false}}
-  {initially false}
-With the standard classes, lists of figures/tables are not added to the table of contents by default. The same is true for \cs{listofkeytheorems}, and with those classes this key does nothing. However some classes, notably \cls{memoir} and the AMS classes, do add lists to the table of contents. With these classes, this key suppresses the addition of the list of theorems to the table of contents.
-\end{docKey}
-
 \subsection{Adding code to list of theorems}
 
 There are analogous commands to \cs{addcontentsline} and \cs{addtocontents} for adding entries or arbitrary code to the list of theorems.
@@ -1064,9 +1083,7 @@
 The \hook{restated} hook is applied at the start of theorems retrieved with \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][]{}%
-  }
+\addtotheoremhook{restated}{\renewcommand\footnote[2][]{}}
 \end{dispListing}
 By default, \pkg{keytheorems} disables the \cs{label} and \cs{RecordProperties} commands in restated theorems.
 

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-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsart-support.tex	2024-10-01 19:51:14 UTC (rev 72443)
@@ -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-22}{0.1.4}
+\ProvidesExplFile{keythms-amsart-support}{2024-09-30}{0.1.5}
   {keytheorems~support~for~the~amsart~class}
 
 \__keythms_support_AMSshared_code:
@@ -9,20 +9,15 @@
 \IfClassLoadedTF { acmart }
   { % acmart loads amsart
     \keytheoremset{overload} % since acmart predefines several theorems
-    \keythms_thmstyle_setdefaultkeys:n
+    \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,
         bodyfont      = \@acmplainbodyfont,
+        headfont      = \@acmplainheadfont,
         headindent    = \@acmplainindent,
-        headfont      = \@acmplainheadfont,
-        headpunct     = {.},
+        notefont      = \@acmplainnotefont,
         postheadspace = .5em,
-        numberfont    = \upshape,
-        notefont      = \@acmplainnotefont,
-        notebraces    = {(}{)},
-        noteseparator = {~},
-        headstyle     = \keythms_thmstyle_headcmd_default:nnn{#1}{#2}{#3},
+        spaceabove    = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
+        spacebelow    = .5\baselineskip plus .2\baselineskip minus .2\baselineskip,
       }
     \keys_define:nn { keytheorems/thmstyle }
       {
@@ -35,22 +30,12 @@
             notefont   = \@acmdefinitionnotefont,
           },
       }
-    % TODO: define inherit-style=acmdefinition/acmplain
   }
   {
-    \keythms_thmstyle_setdefaultkeys:n
+    \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,
-        bodyfont      = \itshape,
-        headindent    = 0pt,
-        headfont      = \bfseries,
-        headpunct     = {.},
-        postheadspace = 5pt plus 1pt minus 1pt,
-        notefont      = \fontseries\mddefault\upshape,
-        notebraces    = {(}{)},
-        noteseparator = {~},
-        headstyle     = \keythms_thmstyle_headcmd_default:nnn{#1}{#2}{#3},
       }
   }
 
@@ -58,7 +43,7 @@
   {
     inherit-style / remark .meta:n =
       {
+        bodyfont = \normalfont,
         headfont = \itshape,
-        bodyfont = \normalfont,
       }
   }
\ 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-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsbook-support.tex	2024-10-01 19:51:14 UTC (rev 72443)
@@ -1,25 +1,17 @@
 % 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-22}{0.1.4}
+\ProvidesExplFile{keythms-amsbook-support}{2024-09-30}{0.1.5}
   {keytheorems~support~for~the~amsbook~class}
 
 \__keythms_support_AMSshared_code:
 
-\keythms_thmstyle_setdefaultkeys:n
+\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,
-    bodyfont      = \itshape,
-    headindent    = \parindent,
-    headfont      = \scshape,
-    headpunct     = {.},
-    postheadspace = 5pt plus 1pt minus 1pt,
-    numberfont    = \upshape,
-    notefont      = \fontseries\mddefault\upshape,
-    notebraces    = {(}{)},
-    noteseparator = {~},
-    headstyle     = \keythms_thmstyle_headcmd_default:nnn{#1}{#2}{#3},
   }
 
 \keys_define:nn { keytheorems/thmstyle }

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-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-amsproc-support.tex	2024-10-01 19:51:14 UTC (rev 72443)
@@ -1,25 +1,17 @@
 % 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-22}{0.1.4}
+\ProvidesExplFile{keythms-amsproc-support}{2024-09-30}{0.1.5}
   {keytheorems~support~for~the~amsproc~class}
 
 \__keythms_support_AMSshared_code:
 
-\keythms_thmstyle_setdefaultkeys:n
+\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,
-    bodyfont      = \itshape,
-    headindent    = \parindent,
-    headfont      = \scshape,
-    headpunct     = {.},
-    postheadspace = 5pt plus 1pt minus 1pt,
-    numberfont    = \upshape,
-    notefont      = \fontseries\mddefault\upshape,
-    notebraces    = {(}{)},
-    noteseparator = {~},
-    headstyle     = \keythms_thmstyle_headcmd_default:nnn{#1}{#2}{#3},
   }
 
 \keys_define:nn { keytheorems/thmstyle }

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-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-memoir-support.tex	2024-10-01 19:51:14 UTC (rev 72443)
@@ -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-22}{0.1.4}
+\ProvidesExplFile{keythms-memoir-support}{2024-09-30}{0.1.5}
   {keytheorems~support~for~the~memoir~class}
 
 \bool_new:N \l__keythms_support_titlecode_bool
@@ -25,9 +25,10 @@
     \bool_gset_true:N \g__keythms_listof_writefile_bool
     \group_begin:
     \keys_set:nn { keytheorems/listof } { #1 }
-    \bool_if:NT \l__keythms_listof_nochapskip_bool
+    \cs_set_protected:Npn \KeyThmsContentsLine ##1 { ##1 }
+    \bool_if:NF \l__keythms_listof_nochapskip_bool
       {
-        \cs_set_eq:NN \KeyThmsAddvspace \use_none:n
+        \cs_set_eq:NN \KeyThmsAddvspace \addvspace
       }
     \bool_if:NTF \l__keythms_listof_notitle_bool
       {

Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty	2024-10-01 19:51:04 UTC (rev 72442)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty	2024-10-01 19:51:14 UTC (rev 72443)
@@ -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-22}{0.1.4}{l3keys interface to amsthm}
+\ProvidesExplPackage{keytheorems}{2024-09-30}{0.1.5}{l3keys interface to amsthm}
 
 \IfFormatAtLeastTF { 2024-06-01 } { }
   {
@@ -19,11 +19,10 @@
     \ProvideDocumentCommand \IfClassLoadedT { m m }
       { \IfClassLoadedTF{#1}{#2}{ } }
   }
-\RequirePackage{aliascnt} % for sibling theorems
-\RequirePackage{amsthm}
-% ^ ams classes have way of ignoring this so don't need to check if they're loaded
-\RequirePackage{refcount} % for \getrefnumber
-\RequirePackage{translations} % for translating "List of Theorems"
+\RequirePackage{aliascnt}
+\RequirePackage{amsthm} % ams classes have way of ignoring this
+\RequirePackage{refcount}
+\RequirePackage{translations}
 
 %%%%%%%%%%%%%%%%%%%%%%
 %%% Error Messages %%%
@@ -129,6 +128,7 @@
 \clist_new:N \l__keythms_thmstyle_savedkeys_clist
 \iow_new:N \g__keythms_listof_stream
 \prop_new:N \g__keythms_thmnames_prop
+\prop_new:N \g__keythms_thmstyle_defaultkeys_prop
 \prop_new:N \g__keythms_thmuse_othercounters_prop
 \prop_new:N \l__keythms_restate_counters_prop
 \tl_new:N \l__keythms_thm_currentthmstyle_tl
@@ -155,25 +155,24 @@
 \cs_gset:Npn \thekeythms_unnumbered_dummyctr { }
 
 \cs_generate_variant:Nn \hook_gput_code:nnn { nnV }
-\cs_generate_variant:Nn \keys_precompile:nnN { nv, nVc }
+\cs_generate_variant:Nn \keys_precompile:nnN { nv, nVc, nnc, ne }
 
 %%%%%%%%%%%%%%
 %%% Styles %%%
 %%%%%%%%%%%%%%
 
-% \__keythms_thmstyle_setbraces:nn { <left brace> } { <right brace> }
 \cs_new_protected:Npn \__keythms_thmstyle_setbraces:nn #1#2
-  {
+  { % #1 = left brace, #2 = right brace
     \tl_set:Nn \l__keythms_thmstyle_lnotebrace_tl { #1 }
     \tl_set:Nn \l__keythms_thmstyle_rnotebrace_tl { #2 }
   }
 \cs_new_protected:Npn \keythms_thmstyle_savethmkey_reqval:n #1
-  {
+  { % #1 = key value
     \clist_put_right:No \l__keythms_thmstyle_savedkeys_clist
       { \l_keys_key_str = { #1 } }
   }
 \cs_new_protected:Npn \keythms_thmstyle_savethmkey_optval:n #1
-  {
+  { % #1 = key value
     \tl_if_empty:NTF \l_keys_value_tl
       {
         \clist_put_right:No \l__keythms_thmstyle_savedkeys_clist
@@ -187,19 +186,13 @@
 
 \keys_define:nn { keytheorems/thmstyle }
   {
-    spaceabove    .tl_set:N = \l__keythms_thmstyle_spaceabove_tl,
-    spacebelow    .tl_set:N = \l__keythms_thmstyle_spacebelow_tl,
     bodyfont      .tl_set:N = \l__keythms_thmstyle_bodyfont_tl,
+    break         .meta:n   = { postheadspace = \newline }, % add error if postheadspace set
+    break         .value_forbidden:n = true,
+    headfont      .tl_set:N = \l__keythms_thmstyle_headfont_tl,
+    headformat    .meta:n   = { headstyle = #1 },
     headindent    .tl_set:N = \l__keythms_thmstyle_headindent_tl,
-    headfont      .tl_set:N = \l__keythms_thmstyle_headfont_tl,
     headpunct     .tl_set:N = \l__keythms_thmstyle_headpunct_tl,
-    postheadspace .tl_set:N = \l__keythms_thmstyle_postheadspace_tl,
-    break         .meta:n   = { postheadspace = \newline }, % add error if postheadspace set
-    break         .value_forbidden:n = true,
-    numberfont    .tl_set:N = \l__keythms_thmstyle_numberfont_tl,
-    notefont      .tl_set:N = \l__keythms_thmstyle_notefont_tl,
-    notebraces    .code:n   = \exp_after:wN \__keythms_thmstyle_setbraces:nn #1,
-    noteseparator .tl_set:N = \l__keythms_thmstyle_noteseparator_tl,
     headstyle     .choice:,
     headstyle / margin .code:n =
       {
@@ -211,32 +204,38 @@
         \cs_set:Nn \keythms_thmstyle_headcmd:nnn { \NUMBER\ \NAME\NOTE }
       },
     headstyle / unknown .cs_set:Np = \keythms_thmstyle_headcmd:nnn #1#2#3,
-    headformat    .meta:n = { headstyle = #1 },
     inherit-style .choice:,
     inherit-style / plain .meta:n = {},
     inherit-style / definition .meta:n = { bodyfont = \normalfont },
     inherit-style / remark .meta:n =
       {
-        headfont = \itshape,
-        bodyfont = \normalfont,
+        bodyfont   = \normalfont,
+        headfont   = \itshape,
         spaceabove = 0.5\topsep,
         spacebelow = 0.5\topsep,
       },
+    notebraces    .code:n   = \exp_after:wN \__keythms_thmstyle_setbraces:nn #1,
+    notefont      .tl_set:N = \l__keythms_thmstyle_notefont_tl,
+    noteseparator .tl_set:N = \l__keythms_thmstyle_noteseparator_tl,
+    numberfont    .tl_set:N = \l__keythms_thmstyle_numberfont_tl,
+    postheadspace .tl_set:N = \l__keythms_thmstyle_postheadspace_tl,
+    spaceabove    .tl_set:N = \l__keythms_thmstyle_spaceabove_tl,
+    spacebelow    .tl_set:N = \l__keythms_thmstyle_spacebelow_tl,
     % thm keys that are saved for later
     numbered              .code:n = \keythms_thmstyle_savethmkey_optval:n { #1 },
+    numberlike            .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
+    numberwithin          .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
     parent                .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    numberwithin          .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    within                .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    sibling               .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    numberlike            .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    sharenumber           .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    preheadhook           .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
+    postfoothook          .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
     postheadhook          .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
     prefoothook           .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
-    postfoothook          .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
+    preheadhook           .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
     qed                   .code:n = \keythms_thmstyle_savethmkey_optval:n { #1 },
+    sharenumber           .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
+    sibling               .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
     tcolorbox             .code:n = \keythms_thmstyle_savethmkey_optval:n { #1 },
     tcolorbox-no-titlebar .code:n = \keythms_thmstyle_savethmkey_optval:n { #1 },
+    within                .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
   }
 
 \cs_new_protected:Nn \keythms_thmstyle_thmname:n { \thmname{#1} }
@@ -243,30 +242,6 @@
 \cs_new_protected:Nn \keythms_thmstyle_thmnumber:n { \thmnumber{#1} }
 \cs_new_protected:Nn \keythms_thmstyle_thmnote:n { \thmnote{#1} }
 
-%% NOTE: if these are used, user is in charge of spacing with \NAME and \NUMBER
-%% QUESTION: should these be moved into def of \newkeytheoremstyle?
-\cs_new:Npn \NAME { \keythms_thmstyle_thmname:n { ##1 } }
-\cs_new:Npn \NUMBER
-  {
-    \keythms_thmstyle_thmnumber:n
-      {
-        \group_begin:
-        \exp_not:V \l__keythms_thmstyle_numberfont_tl
-        ##2
-        \group_end:
-      }
-  }
-\cs_new:Npn \NOTE
-  {
-    \keythms_thmstyle_thmnote:n
-      { \exp_not:V \l__keythms_thmstyle_noteseparator_tl
-        \group_begin: % group so notefont doesn't affect headpunct
-        \exp_not:V \l__keythms_thmstyle_notefont_tl
-        \l__keythms_thmstyle_lnotebrace_tl ##3 \l__keythms_thmstyle_rnotebrace_tl
-        \group_end:
-      }
-  }
-
 \cs_new:Npn \keythms_thmstyle_headcmd_default:nnn #1#2#3
   {
     \keythms_thmstyle_thmname:n { #1 }
@@ -286,27 +261,27 @@
       }
   }
 
-\cs_new_protected:Npn \keythms_thmstyle_setdefaultkeys:n #1
-  {
-    \keys_precompile:nnN { keytheorems/thmstyle }
-      { #1 }
-      \l__keythms_thmstyle_defaultkeys_tl
-  }
-\keythms_thmstyle_setdefaultkeys:n
+\prop_gset_from_keyval:Nn \g__keythms_thmstyle_defaultkeys_prop
   { % support files may overwrite these defaults
-    spaceabove    = \topsep,
-    spacebelow    = \topsep,
     bodyfont      = \itshape,
+    headfont      = \bfseries,
     headindent    = 0pt,
-    headfont      = \bfseries,
     headpunct     = {.},
-    postheadspace = 5pt plus 1pt minus 1pt,
-    numberfont    = \upshape,
+    headstyle     = \keythms_thmstyle_headcmd_default:nnn{#1}{#2}{#3},
+    notebraces    = {(}{)},
     notefont      = \fontseries\mddefault\upshape,
-    notebraces    = {(}{)},
     noteseparator = {~},
-    headstyle     = \keythms_thmstyle_headcmd_default:nnn{#1}{#2}{#3},
+    numberfont    = \upshape,
+    postheadspace = 5pt plus 1pt minus 1pt,
+    spaceabove    = \topsep,
+    spacebelow    = \topsep,
   }
+\hook_gput_code:nnn { package/keytheorems/after } { . }
+  { % need to defer to wait for support files
+    \keys_precompile:neN { keytheorems/thmstyle }
+      { \prop_to_keyval:N \g__keythms_thmstyle_defaultkeys_prop }
+      \l__keythms_thmstyle_defaultkeys_tl
+  }
 
 \NewDocumentCommand \newkeytheoremstyle { m m }
   {
@@ -338,8 +313,31 @@
 \cs_new_eq:NN \keythms_thmstyle_new:nnnnnnnnn \newtheoremstyle
 \cs_generate_variant:Nn \keythms_thmstyle_new:nnnnnnnnn { nVVVVVVVe }
 
+\tl_put_right:Nn \l_text_expand_exclude_tl { \thmnote \thmnumber \thmname }
+% ^ allows \thmnote, etc. to work in headstyle; hope no bad side effects!
 \cs_new_protected:Npn \keythms_thmstyle_declarestyle:nn #1#2
-  {
+  { % user is in charge of spacing with \NAME and \NUMBER (thmtools compat...)
+    \cs_set:Npn \NAME { \keythms_thmstyle_thmname:n { ####1 } }
+    \cs_set:Npn \NUMBER
+      {
+        \keythms_thmstyle_thmnumber:n
+          {
+            \group_begin:
+            \exp_not:V \l__keythms_thmstyle_numberfont_tl
+            ####2
+            \group_end:
+          }
+      }
+    \cs_set:Npn \NOTE
+      {
+        \keythms_thmstyle_thmnote:n
+          { \exp_not:V \l__keythms_thmstyle_noteseparator_tl
+            \group_begin: % group so notefont doesn't affect headpunct
+            \exp_not:V \l__keythms_thmstyle_notefont_tl
+            \l__keythms_thmstyle_lnotebrace_tl ####3 \l__keythms_thmstyle_rnotebrace_tl
+            \group_end:
+          }
+      }
     \clist_clear:N \l__keythms_thmstyle_savedkeys_clist
     \tl_use:N \l__keythms_thmstyle_defaultkeys_tl
     \keys_set:nn { keytheorems/thmstyle } { #2 }
@@ -352,14 +350,21 @@
       \l__keythms_thmstyle_headpunct_tl
       \l__keythms_thmstyle_postheadspace_tl
       { \text_expand:n { \keythms_thmstyle_headcmd:nnn{##1}{##2}{##3} } }
-    % Define new inherit-style key
-    \keys_define:nn { keytheorems/thmstyle }
-      { inherit-style / #1 .meta:n = { #2 } }
-    \tl_if_exist:cF { l__keythms_thmstyle_ #1 _savedkeys_tl }
-      { \tl_new:c { l__keythms_thmstyle_ #1 _savedkeys_tl } }
+    % Define inherit-style key
+    \tl_if_exist:cF { l__keythms_thmstyle_ #1 _metakeys_tl }
+      { \tl_new:c { l__keythms_thmstyle_ #1 _metakeys_tl } }
+    \keys_precompile:nnc { keytheorems/thmstyle } { #2 } % use precompile instead of meta key
+      { l__keythms_thmstyle_ #1 _metakeys_tl }           % because that's sensitive to hashes
+    \keys_define:nn { keytheorems/thmstyle }             % and we want to allow both # and ##
+      { inherit-style / #1 .code:n = \tl_use:c { l__keythms_thmstyle_ #1 _metakeys_tl } }
+    \tl_if_exist:cF { l__keythms_thmstyle_ #1 _savedthmkeys_tl }
+      { \tl_new:c { l__keythms_thmstyle_ #1 _savedthmkeys_tl } }
     \keys_precompile:nVc { keytheorems/thm }
       \l__keythms_thmstyle_savedkeys_clist
-      { l__keythms_thmstyle_ #1 _savedkeys_tl }
+      { l__keythms_thmstyle_ #1 _savedthmkeys_tl }
+    \cs_undefine:N \NAME % undefine to prevent conflicts
+    \cs_undefine:N \NUMBER
+    \cs_undefine:N \NOTE
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%
@@ -367,10 +372,8 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%
 
 % FIX: reimplement these without \NewDocumentCommand and \SplitArgument
-
-% \keythms_thm_setrefnames:n { <envname> } { <refname> or <sing,plural> }
 \NewDocumentCommand \keythms_thm_setrefnames:nn
-  { m >{\SplitArgument{1}{,}} m }
+  { m >{\SplitArgument{1}{,}} m } % #1 = envname, #2 = <refname> or <sing,plural>
   { \__keythms_thm_setrefnames_aux:nnn{#1}#2 }
 \cs_new_protected:Npn \__keythms_thm_setrefnames_aux:nnn #1#2#3
   {
@@ -384,9 +387,8 @@
   }
 \cs_generate_variant:Nn \keythms_thm_setrefnames:nn { nV }
 
-% \keythms_thm_setRefnames:n { <envname> } { <refname> or <sing,plural> }
 \NewDocumentCommand \keythms_thm_setRefnames:nn
-  { m >{\SplitArgument{1}{,}} m }
+  { m >{\SplitArgument{1}{,}} m } % #1 = envname, #2 = <refname> or <sing,plural>
   { \__keythms_thm_setRefnames_aux:nnn{#1}#2 }
 \cs_new_protected:Npn \__keythms_thm_setRefnames_aux:nnn #1#2#3
   {
@@ -402,37 +404,35 @@
 
 \keys_define:nn { keytheorems/thm }
   {
+    heading        .meta:n    = { name = #1 },
     name           .tl_set:N  = \l__keythms_thm_name_tl,
-    title          .meta:n    = { name = #1 },
-    heading        .meta:n    = { name = #1 },
-    refname        .tl_set:N  = \l__keythms_thm_refname_tl,
-    Refname        .tl_set:N  = \l__keythms_thm_Refname_tl,
     numbered       .choice:,
-    numbered / true .code:n   = \bool_set_true:N \l__keythms_thm_numbered_bool,
+    numbered       .default:n = true,
     numbered / false .code:n  = \bool_set_false:N \l__keythms_thm_numbered_bool,
-    numbered / yes .meta:n    = { numbered = true },
-    numbered / no  .meta:n    = { numbered = false },
+    numbered / no    .meta:n  = { numbered = false },
+    numbered / true  .code:n  = \bool_set_true:N \l__keythms_thm_numbered_bool,
     numbered / unless-unique .code:n = 
       {
         \bool_set_true:N \l__keythms_thm_unlessunique_bool
       },
     numbered / unless~unique .meta:n = { numbered = unless-unique },
-    numbered       .default:n = true,
+    numbered / yes .meta:n    = { numbered = true },
+    numberlike     .meta:n    = { sibling = #1 },
+    numberwithin   .meta:n    = { parent = #1 },
     parent         .tl_set:N  = \l__keythms_thm_parent_tl,
-    numberwithin   .meta:n    = { parent = #1 },
-    within         .meta:n    = { parent = #1 },
-    sibling        .tl_set:N  = \l__keythms_thm_sibling_tl,
-    numberlike     .meta:n    = { sibling = #1 },
-    sharenumber    .meta:n    = { sibling = #1 },
-    style          .tl_set:N  = \l__keythms_thm_style_tl,
-    style          .groups:n  = { style-comes-first },
-    preheadhook    .tl_set:N  = \l__keythms_thm_preheadhook_tl,
+    postfoothook   .tl_set:N  = \l__keythms_thm_postfoothook_tl,
     postheadhook   .tl_set:N  = \l__keythms_thm_postheadhook_tl,
     prefoothook    .tl_set:N  = \l__keythms_thm_prefoothook_tl,
-    postfoothook   .tl_set:N  = \l__keythms_thm_postfoothook_tl,
+    preheadhook    .tl_set:N  = \l__keythms_thm_preheadhook_tl,
     qed            .tl_set:N  = \l__keythms_thm_qed_tl,
     qed            .default:n = \c_novalue_tl,
     % ^ distinguish between 'qed' and 'qed={}'
+    refname        .tl_set:N  = \l__keythms_thm_refname_tl,
+    Refname        .tl_set:N  = \l__keythms_thm_Refname_tl,
+    sharenumber    .meta:n    = { sibling = #1 },
+    sibling        .tl_set:N  = \l__keythms_thm_sibling_tl,
+    style          .tl_set:N  = \l__keythms_thm_style_tl,
+    style          .groups:n  = { style-comes-first },
     tcolorbox      .tl_set:N  = \l__keythms_thm_tcbkeys_tl,
     tcolorbox      .default:n = {},
     tcolorbox-no-titlebar .meta:n =
@@ -448,6 +448,8 @@
           }
       },
     tcolorbox-no-titlebar .default:n = {},
+    title          .meta:n    = { name = #1 },
+    within         .meta:n    = { parent = #1 },
   }
 
 % what below is unnecessary? I really don't understand this code.
@@ -470,17 +472,17 @@
 \keys_precompile:nnN { keytheorems/thm }
   {
     name         = \q_no_value,
-    refname      = \q_no_value,
-    Refname      = \q_no_value,
     numbered     = true,
     parent       = {},
-    sibling      = {},
-    style        = {},
-    preheadhook  = {},
+    postfoothook = {},
     postheadhook = {},
     prefoothook  = {},
-    postfoothook = {},
+    preheadhook  = {},
     qed          = \q_no_value,
+    refname      = \q_no_value,
+    Refname      = \q_no_value,
+    sibling      = {},
+    style        = {},
     tcolorbox    = \q_no_value,
   }
   \l__keythms_thm_defaultkeys_tl
@@ -497,23 +499,20 @@
 % Make generic theorem hooks
 \__keythms_thm_makethmhooks:n { allthms }
 
-% \newkeytheorem{<name>}{<keys>}
 \NewDocumentCommand \newkeytheorem { m O{} }
-  {
+  { % #1 = name, #2 = keys
     \clist_map_inline:nn { #1 } % define multiple theorems at once
       { \keythms_thm_newkeythm:nn { ##1 } { #2 } }
   }
-
 \@onlypreamble \newkeytheorem
 
 % to prevent error when plain, remark, or definition style used
-\tl_new:N \l__keythms_thmstyle_plain_savedkeys_tl
-\tl_new:N \l__keythms_thmstyle_remark_savedkeys_tl
-\tl_new:N \l__keythms_thmstyle_definition_savedkeys_tl
+\tl_new:N \l__keythms_thmstyle_plain_savedthmkeys_tl
+\tl_new:N \l__keythms_thmstyle_remark_savedthmkeys_tl
+\tl_new:N \l__keythms_thmstyle_definition_savedthmkeys_tl
 
-% \keythms_thm_newkeythm:nn { <envname> } { <keys> }
 \cs_new_protected:Npn \keythms_thm_newkeythm:nn #1#2
-  {
+  { % #1 = name, #2 = keys
     % Store envname
     \tl_set:Nn \l__keythms_thm_envname_tl { #1 }
     % Make unless-unique false by default (can't precompile this)
@@ -526,8 +525,8 @@
     \tl_set:Ne \l__keythms_thm_currentthmstyle_tl { \the\thm at style }
     \tl_if_empty:NTF \l__keythms_thm_style_tl
       { % if \theoremstyle set, also use saved thm keys
-        \tl_if_exist:cT {l__keythms_thmstyle_ \l__keythms_thm_currentthmstyle_tl _savedkeys_tl}
-          { \tl_use:c {l__keythms_thmstyle_ \l__keythms_thm_currentthmstyle_tl _savedkeys_tl} }
+        \tl_if_exist:cT {l__keythms_thmstyle_ \l__keythms_thm_currentthmstyle_tl _savedthmkeys_tl}
+          { \tl_use:c {l__keythms_thmstyle_ \l__keythms_thm_currentthmstyle_tl _savedthmkeys_tl} }
       }
       {
         % Temporarily set theorem style
@@ -534,8 +533,8 @@
         \__keythms_theoremstyle:n { \l__keythms_thm_style_tl }
         % If thm keys given in style, call now (possibly overwritten in next step)
         % but don't error if user uses a style defined with just \newtheoremstyle
-        \tl_if_exist:cT { l__keythms_thmstyle_ \l__keythms_thm_style_tl _savedkeys_tl }
-          { \tl_use:c { l__keythms_thmstyle_ \l__keythms_thm_style_tl _savedkeys_tl } }
+        \tl_if_exist:cT { l__keythms_thmstyle_ \l__keythms_thm_style_tl _savedthmkeys_tl }
+          { \tl_use:c { l__keythms_thmstyle_ \l__keythms_thm_style_tl _savedthmkeys_tl } }
       }
     % Set env-specific keys
     \keys_set:nn { keytheorems/thm } { #2 }
@@ -567,7 +566,7 @@
     \quark_if_no_value:NT \l__keythms_thm_name_tl % use quark so name={} is valid
       {
         % use e so \text_titlecase called only once per theorem definition,
-        %  not each time the theorem is used
+        % not each time the theorem is used
         \tl_set:Ne \l__keythms_thm_name_tl 
           { \text_titlecase_first:n { #1 } }
       }
@@ -670,9 +669,7 @@
     \__keythms_listof_show_aux:n { #1 }
     % Set theorem style back to original state if needed
     \tl_if_empty:NF \l__keythms_thm_style_tl
-      {
-        \__keythms_theoremstyle:V \l__keythms_thm_currentthmstyle_tl
-      }
+      { \__keythms_theoremstyle:V \l__keythms_thm_currentthmstyle_tl }
   }
 
 \cs_new_protected:Npn \__keythms_thm_tcboxcode:nn #1#2
@@ -741,7 +738,6 @@
 \cs_new_eq:NN \__keythms_theoremstyle:n \theoremstyle
 \cs_generate_variant:Nn \__keythms_theoremstyle:n { V }
 
-% \newtheorem variants
 \cs_new_eq:NN \__keythms_thm_new:w \newtheorem
 
 \cs_new_protected:Npn \__keythms_thm_new_numbered:nn #1#2
@@ -820,13 +816,6 @@
 
 \keys_define:nn { keytheorems/thmuse }
   {
-    label      .tl_set:N = \l__keythms_thmuse_label_tl,
-    note       .tl_set:N = \l__keythms_thmuse_note_tl,
-    note       .initial:n = {},
-    name       .meta:n   = { note = #1 },
-    % ^ for compatibility. "name" is ambiguous and doesn't match amsthm language
-    short-note .code:n   = {}, % these do nothing at point of use
-    short-name .code:n   = {},
     continues  .tl_set:N = \l__keythms_thmuse_contlabel_tl,
     continues* .code:n   =
       {
@@ -838,17 +827,23 @@
               { note = \l__keythms_tmpa_tl }
           }
       },
-    store      .tl_set:N = \l__keythms_thmuse_store_tl, % should this be .tl_set_e:N ?
-    %store      .default:n = \q_no_value, % ={name} causes issues
+    label      .tl_set:N = \l__keythms_thmuse_label_tl,
+    listhack   .choice:, % needs equals sign
+    listhack / true .code:n = \bool_set_true:N \l__keythms_thmuse_listhack_bool,
+    listhack / false .code:n = \bool_set_false:N \l__keythms_thmuse_listhack_bool,
+    listhack   .initial:n = false,
+    name       .meta:n   = { note = #1 },
+    % ^ for compatibility. "name" is ambiguous and doesn't match amsthm language
+    note       .tl_set:N = \l__keythms_thmuse_note_tl,
+    note       .initial:n = {},
     restate    .meta:n   = { store = #1 }, % thmtools compatibility
-    store*     .tl_set:N = \l__keythms_thmuse_storereversed_tl,
     restate*   .meta:n   = { store* = #1 },
     restate-keys .clist_set:N = \l__keythms_thmuse_restatekeys_clist,
-    listhack   .choice:, % need equals sign
-    listhack / true .code:n = \bool_set_true:N \l__keythms_thmuse_listhack_bool,
-    listhack / false .code:n = \bool_set_false:N \l__keythms_thmuse_listhack_bool,
-    listhack   .initial:n = false,
     seq        .code:n = {},
+    short-note .code:n   = {}, % these do nothing at point of use
+    short-name .code:n   = {},
+    store      .tl_set:N = \l__keythms_thmuse_store_tl, % should this be .tl_set_e:N ?
+    store*     .tl_set:N = \l__keythms_thmuse_storereversed_tl,
   }
 
 \cs_new_protected:Npn \keythms_keyify_theorem:n #1
@@ -1147,6 +1142,7 @@
         { \exp_not:n { #3 } }
       }
   }
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%% Retrieving Theorem Data %%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1157,14 +1153,15 @@
 
 \keys_define:nn { keytheorems/storeatbegin }
   {
+    restate  .meta:n      = { store=#1 },
+    restate* .meta:n      = { store*=#1 },
     store    .tl_set:N    = \l__keythms_storeatbegin_store_tl,
-    restate  .meta:n      = { store=#1 },
     store*   .tl_set:N    = \l__keythms_storeatbegin_storereversed_tl,
-    restate* .meta:n      = { store*=#1 },
     unknown  .code:n      = { } % do nothing with unknown keys
   }
 
-\cs_new_protected:Npn \KeyThmsContentsLine #1 { #1 }
+\cs_new_protected:Npn \KeyThmsContentsLine #1 { }
+% ^ initially a no-op, redefined where needed; important it's protected!
 \NewDocumentCommand \addtheoremcontentsline { m m }
   {
     \addtocontents { thlist }
@@ -1187,8 +1184,6 @@
 \hook_gput_code:nnn { begindocument } { . }
   {
     \group_begin:
-    \cs_set_eq:NN \KeyThmsContentsLine \use_none:n
-    \cs_set_eq:NN \KeyThmsAddvspace \use_none:n
     \cs_set_protected:Npn \KeyThmsSavedTheorem #1#2#3#4#5#6#7
       {
         \group_begin:
@@ -1378,9 +1373,8 @@
     \group_end:
   }
 
-% \getkeytheorem[<property>]{<tag>}
 \NewDocumentCommand \getkeytheorem { O{theorem} m }
-  {
+  { % #1 = property, #2 = tag
     \cs_if_exist:cTF { __keythms_getthm_#2_#1 }
       {
         \bool_if_exist:cTF { g__keythms_restate_#2_called_bool }
@@ -1414,9 +1408,8 @@
 %%% Theorem Hooks %%%
 %%%%%%%%%%%%%%%%%%%%%
 
-%%% \addtotheoremhook[<envname>]{<hook>}{<code>}
 \NewDocumentCommand \addtotheoremhook { O{allthms} m +m }
-  {
+  { % #1 = envname, #2 = hook, #3 = code
     \__hook_if_declared:nTF { keytheorems/allthms/#2 }
       {
         \hook_gput_code:nnn { keytheorems/#1/#2 } { . } { #3 }
@@ -1425,7 +1418,6 @@
         \msg_error:nnn { keytheorems } { undefined-thm-hook } { #2 }
       }
   }
-
 % NOTE: I think it's OK we use the internal \__hook_if_declared:nTF above
 %       since we don't need to worry about the user creating new theorem hooks
 %       so, as we're only checking the existence of hooks created by us, it's OK.
@@ -1436,102 +1428,106 @@
 
 \keys_define:nn { keytheorems/listof }
   {
-    numwidth   .dim_set:N = \l__keythms_listof_numwidth_dim,
-    numwidth   .initial:n = 2.3em,
-    indent     .dim_set:N = \l__keythms_listof_indent_dim,
-    indent     .initial:n = 1.5em,
-    ignore     .code:n    =
+    chapter-skip-length .dim_set:N  = \keythms at listof@chaptervspace at dim,
+    chapter-skip-length .initial:n  = 10pt,
+    format-code         .cs_set:Np  = \__keythms_listof_misdirect:nnn #1#2#3,
+    format-code         .initial:n  = \numberline{#2}#1#3,
+    ignore              .code:n     =
       {
         \hook_gput_code:nnn { begindocument/before } { keytheorems }
           { \keythms_listof_ignore:n { #1 } }
       },
-    show       .code:n    =
-      {
+    ignoreall           .code:n     =
+      { % in case called before theorem defined
         \hook_gput_code:nnn { begindocument/before } { keytheorems }
-          { \keythms_listof_show:n { #1 } }
+          {
+            \prop_map_inline:Nn \g__keythms_thmnames_prop
+              { \__keythms_listof_ignore_aux:n { ##1 } }
+          }
       },
-    onlynamed  .code:n    =
+    indent              .dim_set:N  = \l__keythms_listof_indent_dim,
+    indent              .initial:n  = 1.5em,
+    no-chapter-skip     .bool_set:N = \l__keythms_listof_nochapskip_bool,
+    no-chapter-skip     .initial:n  = false,
+    no-continues        .bool_set:N = \l__keythms_listof_nocont_bool, 
+    no-continues        .initial:n  = false,
+    no-title            .bool_set:N = \l__keythms_listof_notitle_bool,
+    no-title            .initial:n  = false,
+    no-toc              .bool_set:N = \l__keythms_listof_notoc_bool,
+    no-toc              .initial:n  = false, % false does not mean "to-toc" for standard classes
+    note-code           .cs_set:Np  = \__keythms_listof_notecmd:n #1,
+    note-code           .initial:n  = { ~ (#1) },
+    numwidth            .dim_set:N  = \l__keythms_listof_numwidth_dim,
+    numwidth            .initial:n  = 2.3em,
+    onlynamed           .code:n     =
       {
         \hook_gput_code:nnn { begindocument/before } { keytheorems }
           { \keythms_listof_onlynamed:n { #1 } }
       },
-    onlynamed  .default:n = \q_no_value,
-    onlynumbered  .code:n    =
+    onlynamed           .default:n  = \q_no_value,
+    onlynumbered        .code:n     =
       {
         \hook_gput_code:nnn { begindocument/before } { keytheorems }
           { \keythms_listof_onlynumbered:n { #1 } }
       },
-    onlynumbered  .default:n = \q_no_value,
-    ignoreall  .code:n    =
+    onlynumbered        .default:n  = \q_no_value,
+    print-body          .code:n     =
       {
-        \hook_gput_code:nnn { begindocument/before } { keytheorems } % in case called before theorem defined
+        \cs_set_protected:Nn \keythms_listof_listcmd:nnnnnnn
           {
-            \prop_map_inline:Nn \g__keythms_thmnames_prop
-              { \__keythms_listof_ignore_aux:n { ##1 } }
+            \tl_if_empty:nF { ##7 }
+              {
+                \__keythms_getthm_theorem:nnnnn
+                  {##1}{##2}{##5}{##6}{##7}
+              }
           }
       },
-    showall    .code:n    =
+    seq                 .code:n     = 
       {
-        \hook_gput_code:nnn { begindocument/before } { keytheorems } % in case called before theorem defined
+        \hook_gput_code:nnn { begindocument/before } { keytheorems }
+          { \keythms_listof_showseq:n { #1 } }
+      },
+    show                .code:n     =
+      {
+        \hook_gput_code:nnn { begindocument/before } { keytheorems }
+          { \keythms_listof_show:n { #1 } }
+      },
+    showall             .code:n     =
+      { % in case called before theorem defined
+        \hook_gput_code:nnn { begindocument/before } { keytheorems }
           {
             \prop_map_inline:Nn \g__keythms_thmnames_prop
               { \__keythms_listof_show_aux:n { ##1 } }
           }
       },
-    title      .tl_set:N   = \l__keythms_listof_title_tl,
-    title      .initial:n  = \GetTranslation{keythms_listof_title},
-    swapnumber .bool_set:N = \l__keythms_listof_swapnumber_bool,
-    swapnumber .initial:n  = false,
-    title-code .cs_set:Np  = \__keythms_listof_titlecmd:n #1,
-    no-title   .bool_set:N = \l__keythms_listof_notitle_bool,
-    no-title   .initial:n  = false,
-    print-body .code:n     =
-      {
-        \cs_set_protected:Nn \keythms_listof_listcmd:nnnnnnn
-          {
-            \tl_if_empty:nF { ##7 }
-              {
-                \__keythms_getthm_theorem:nnnnn
-                  {##1}{##2}{##5}{##6}{##7}
-              }
-          }
-        \cs_set_eq:NN \KeyThmsContentsLine \use_none:n
-        % ^ I assume we want this?
-        \cs_set_eq:NN \KeyThmsAddvspace \use_none:n
-      },
-    note-code  .cs_set:Np = \__keythms_listof_notecmd:n #1,
-    note-code  .initial:n = { ~ (#1) },
-    no-continues .bool_set:N = \l__keythms_listof_nocont_bool, 
-    no-continues .initial:n  = false,
-    no-chapter-skip .bool_set:N = \l__keythms_listof_nochapskip_bool,
-    no-chapter-skip .initial:n  = false,
-    chapter-skip-length .dim_set:N = \keythms at listof@chaptervspace at dim,
-    chapter-skip-length .initial:n = 10pt,
-    no-toc .bool_set:N = \l__keythms_listof_notoc_bool,
-    no-toc .initial:n  = false, % false does not mean "to-toc" for standard classes
+    swapnumber          .bool_set:N = \l__keythms_listof_swapnumber_bool,
+    swapnumber          .initial:n  = false,
+    title               .tl_set:N   = \l__keythms_listof_title_tl,
+    title               .initial:n  = \GetTranslation{keythms_listof_title},
+    title-code          .cs_set:Np  = \__keythms_listof_titlecmd:n #1,
   }
 
-\hook_gput_code:nnn { begindocument } { . } % redefine these keys at begindocument
-  {
+\hook_gput_code:nnn { begindocument } { . }
+  { % redefine these keys at begindocument
     \keys_define:nn { keytheorems/listof }
       {
-        ignore    .code:n    = \keythms_listof_ignore:n { #1 },
-        show      .code:n    = \keythms_listof_show:n { #1 },
-        onlynamed .code:n    = \keythms_listof_onlynamed:n { #1 },
-        onlynamed .default:n = \q_no_value,
-        onlynumbered .code:n    = \keythms_listof_onlynumbered:n { #1 },
-        onlynumbered .default:n = \q_no_value,
-        ignoreall .code:n    =
+        ignore       .code:n       = \keythms_listof_ignore:n { #1 },
+        ignoreall    .code:n       =
           {
             \prop_map_inline:Nn \g__keythms_thmnames_prop
               { \__keythms_listof_ignore_aux:n { ##1 } }
           },
-        showall   .code:n    =
+        onlynamed    .code:n       = \keythms_listof_onlynamed:n { #1 },
+        onlynamed    .default:n    = \q_no_value,
+        onlynumbered .code:n       = \keythms_listof_onlynumbered:n { #1 },
+        onlynumbered .default:n    = \q_no_value,
+        seq          .code:n       = \keythms_listof_showseq:n { #1 },
+        show         .code:n       = \keythms_listof_show:n { #1 },
+        showall      .code:n       =
           {
             \prop_map_inline:Nn \g__keythms_thmnames_prop
               { \__keythms_listof_show_aux:n { ##1 } }
           },
-        seq       .code:n = \keythms_listof_showseq:n { #1 },
       }
   }
 
@@ -1640,18 +1636,14 @@
       }
   }
   
-% Seems unnecessary to repeat all this for reading the keyvals from seq.
+% Seems unnecessary to repeat all this for reading the keyvals from file.
 % In thmtools they just hook the "thmitem" definition into the theorem declaration.
 %% NOTE ON ABOVE: this gives more flexibility to define different kinds of lists.
 %% See acro.sty for template idea.
 \keys_define:nn { keytheorems/listofheading }
   {
-    note       .tl_set:N = \l__keythms_listofheading_note_tl,
-    name       .meta:n   = { note = #1 },
-    short-note .tl_set:N = \l__keythms_listofheading_shortnote_tl,
-    short-name .meta:n   = { short-note = #1 },
-    continues  .tl_set:N = \l__keythms_listofheading_contlabel_tl,
-    continues* .code:n   =
+    continues    .tl_set:N    = \l__keythms_listofheading_contlabel_tl,
+    continues*   .code:n      =
       {
         \keys_set:nn { keytheorems/listofheading } { continues = #1 }
         \protected at edef \l__keythms_tmpa_tl { \__keythms_getrecordednote:n{#1} }
@@ -1661,16 +1653,21 @@
               { note = \l__keythms_tmpa_tl }
           }
       },
-    seq     .tl_set:N = \l__keythms_listofheading_seq_tl,
-    store*  .code:n = \bool_set_true:N \l__keythms_listofheading_storereversed_bool,
-    restate* .meta:n = { store*=#1 },
+    name         .meta:n      = { note = #1 },
+    note         .tl_set:N    = \l__keythms_listofheading_note_tl,
+    restate*     .meta:n      = { store*=#1 },
     restate-keys .clist_set:N = \l__keythms_listofheading_restatekeys_clist,
-    unknown .code:n = { } % do nothing with unknown keys
-    % ^ this is OK because we have total control over possible keys; if invalid
-    %   key is given to theorem then an error will be raised there
+    seq          .tl_set:N    = \l__keythms_listofheading_seq_tl,
+    short-note   .tl_set:N    = \l__keythms_listofheading_shortnote_tl,
+    short-name   .meta:n      = { short-note = #1 },
+    store*       .code:n      =
+      {
+        \bool_set_true:N \l__keythms_listofheading_storereversed_bool
+      },
+    unknown      .code:n      = { } % do nothing with unknown keys
   }
 
-\cs_new:Npn \__keythms_listof_printheading:
+\cs_new:Npn \__keythms_listof_printnote:
   {
     \tl_if_empty:NTF \l__keythms_listofheading_shortnote_tl
       {
@@ -1682,19 +1679,14 @@
       }
   }
 
-\cs_new:Npn \__keythms_listof_default_listcmd:nnnnnnn #1#2#3#4#5#6#7
-  {
+\cs_new:Npn \keythms_listof_listcmd:nnnnnnn #1#2#3#4#5#6#7
+  { % #1=name, #2=number, #3=Href, #4=page, #5=restate counters, #6=keys, #7=body
     \contentsline{ #1 }
       {
-        \bool_if:NTF \l__keythms_listof_swapnumber_bool
-          {
-            \prop_item:Nn \g__keythms_thmnames_prop { #1 } ~ #2
-          }
-          {
-            \numberline{ #2 }
-            \prop_item:Nn \g__keythms_thmnames_prop { #1 }
-          }
-        \__keythms_listof_printheading:
+        \__keythms_listof_misdirect:nnn
+          { \prop_item:Nn \g__keythms_thmnames_prop { #1 } }
+          { #2 }
+          { \__keythms_listof_printnote: }
       }
       { #4 }{ #3 }
   }
@@ -1728,10 +1720,6 @@
     \group_end:
   }
 
-% set default listcmd
-\cs_new_eq:NN \keythms_listof_listcmd:nnnnnnn
-  \__keythms_listof_default_listcmd:nnnnnnn
-
 \cs_if_exist:NTF \chapter
   { \cs_set_protected:Npn \__keythms_listof_titlecmd:n #1 { \chapter*{#1} } }
   { \cs_set_protected:Npn \__keythms_listof_titlecmd:n #1 { \section*{#1} } }
@@ -1748,9 +1736,10 @@
     \bool_gset_true:N \g__keythms_listof_writefile_bool
     \group_begin:
     \keys_set:nn { keytheorems/listof } { #1 }
-    \bool_if:NT \l__keythms_listof_nochapskip_bool
+    \cs_set_protected:Npn \KeyThmsContentsLine ##1 { ##1 }
+    \bool_if:NF \l__keythms_listof_nochapskip_bool
       {
-        \cs_set_eq:NN \KeyThmsAddvspace \use_none:n
+        \cs_set_eq:NN \KeyThmsAddvspace \addvspace
       }
     \bool_if:NF \l__keythms_listof_notitle_bool
       {
@@ -1759,6 +1748,10 @@
           { \MakeUppercase \l__keythms_listof_title_tl }
           { \MakeUppercase \l__keythms_listof_title_tl }
       }
+    \bool_if:NT \l__keythms_listof_swapnumber_bool
+      {
+        \cs_set:Npn \__keythms_listof_misdirect:nnn ##1##2##3 { ##1 ~ ##2##3 }
+      }
     \legacy_if_set_false:n { @filesw }
     \@starttoc{ thlist }
     \group_end:
@@ -1787,7 +1780,7 @@
   }
 
 % chaptervspacehack (code translated from thmtools)
-\cs_new_eq:NN \KeyThmsAddvspace \addvspace
+\cs_new_protected:Npn \KeyThmsAddvspace #1 { } % initially no-op, redefined where needed
 \int_new:N \g_keythms_listof_prevchapter_int
 \int_gset:Nn \g_keythms_listof_prevchapter_int { 1 }
 % ^ if this is zero, bad things happen if title-code is changed; anyways don't
@@ -1804,7 +1797,7 @@
               {
                 \addtocontents{ thlist }
                   {
-                    \protect\KeyThmsAddvspace
+                    \KeyThmsAddvspace
                       { \keythms at listof@chaptervspace at dim }
                   }
                 \int_gset:Nn \g_keythms_listof_prevchapter_int { \value{chapter} }
@@ -1848,39 +1841,32 @@
 
 \keys_define:nn { keytheorems }
   {
-    restate-counters .code:n =
+    auto-translate   .bool_gset:N         = \g__keythms_autotranslate_bool,
+    auto-translate   .initial:n           = true,
+    continues-code   .cs_set:Np           = \__keythms_thmuse_continues:n #1,
+    continues-code   .initial:n           =
+      { % not sure how best to handle this translation
+        \GetTranslation{keythms_continues}\pageref{#1}
+      },
+    overload         .code:n              = \__keythms_overload_code:,
+    overload         .value_forbidden:n   = true,
+    overload         .usage:n             = preamble,
+    qed-symbol       .cs_set_protected:Np = \qedsymbol,
+    restate-counters .code:n              =
       {
         \clist_map_inline:nn { #1 }
           { \tl_new:c { l_keythms_restate_current_##1_tl } }
         \clist_gput_right:Nn \g__keythms_restatecounters_clist { #1 }
       },
-    restate-counters .initial:n = equation,
-    continues-code   .cs_set:Np = \__keythms_thmuse_continues:n #1,
-    continues-code   .initial:n =
-      { % not sure how best to handle this translation
-        \GetTranslation{keythms_continues}\pageref{#1}
-      },
-    qed-symbol       .cs_set_protected:Np = \qedsymbol,
-    overload         .code:n = \__keythms_overload_code:,
-    overload         .value_forbidden:n = true,
-    overload         .usage:n = preamble,
-    thmtools-compat  .code:n =
-      { % prevent loading the code again if key called twice
-        \bool_if:NF \g__keythms_thmtoolscompat_bool
-          { \__keythms_thmtoolscompat_code: }
-      },
-    thmtools-compat  .value_forbidden:n = true,
-    thmtools-compat  .usage:n = preamble,
-    store-all        .code:n = \__keythms_storeall_code:,
-    store-all        .value_forbidden:n = true,
-    store-all        .usage:n = preamble,
-    auto-translate   .bool_gset:N = \g__keythms_autotranslate_bool,
-    auto-translate   .initial:n = true,
-    store-sets-label .code:n =
+    restate-counters .initial:n           = equation,
+    store-all        .code:n              = \__keythms_storeall_code:,
+    store-all        .value_forbidden:n   = true,
+    store-all        .usage:n             = preamble,
+    store-sets-label .code:n              =
       {
         \keys_define:nn { keytheorems/thmuse }
           {
-            store .code:n =
+            store  .code:n =
               {
                 \tl_set:Nn \l__keythms_thmuse_label_tl { ##1 }
                 \tl_set:Nn \l__keythms_thmuse_store_tl { ##1 }
@@ -1892,13 +1878,19 @@
               },
           }
       },
+    thmtools-compat  .code:n              =
+      { % prevent loading the code again if key called twice
+        \bool_if:NF \g__keythms_thmtoolscompat_bool
+          { \__keythms_thmtoolscompat_code: }
+      },
+    thmtools-compat  .value_forbidden:n   = true,
+    thmtools-compat  .usage:n             = preamble,
   }
 
 \cs_generate_variant:Nn \__keythms_thmuse_continues:n { V }
 
-% \keytheoremset{<options>}
 \NewDocumentCommand \keytheoremset { m }
-  {
+  { % #1 = keys
     \keys_set:nn { keytheorems } { #1 }
   }
 
@@ -1993,6 +1985,12 @@
           }
       }
     \ProvideDocumentCommand { \listoftheorems } { } { \listofkeytheorems }
+    \ProvideDocumentCommand { \listtheoremname } { }
+      { \GetTranslation{keythms_listof_title} }
+    \keys_define:nn { keytheorems/listof }
+      { % redefine since thmtools way is \renewcommand\listtheoremname{...}
+        title .initial:n = \listtheoremname
+      }
     \ProvideDocumentCommand { \addtotheorempreheadhook } { O{allthms} m }
       {
         \addtotheoremhook [ ##1 ] { prehead } { ##2 }
@@ -2063,8 +2061,8 @@
           },
         cut .default:n = true,
         nocut .meta:n = { cut=false },
-        thickness .code:n = % could also add keys to clist with changed dimens; which is better?
-          {
+        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 }
               { \dim_set:Nn \l_keythms_tcbthmbox_thickness_dim { ##1 } }
@@ -2343,8 +2341,8 @@
   {
     \keys_define:nn { keytheorems/listof } % adjust to AMS classes
       {
+        indent     .initial:n = 0pt,
         numwidth   .initial:n = 1.5pc,
-        indent     .initial:n = 0pt,
         title-code .code:n    =
           { % warn but set titlecmd just in case
             \msg_warning:nn { keytheorems } { title-code-with-AMS }
@@ -2356,9 +2354,10 @@
         \bool_gset_true:N \g__keythms_listof_writefile_bool
         \group_begin:
         \keys_set:nn { keytheorems/listof } { ##1 }
-        \bool_if:NT \l__keythms_listof_nochapskip_bool
+        \cs_set_protected:Npn \KeyThmsContentsLine ####1 { ####1 }
+        \bool_if:NF \l__keythms_listof_nochapskip_bool
           {
-            \cs_set_eq:NN \KeyThmsAddvspace \use_none:n
+            \cs_set_eq:NN \KeyThmsAddvspace \addvspace
           }
         \legacy_if_set_false:n { @filesw }
         \bool_if:NTF \l__keythms_listof_notitle_bool



More information about the tex-live-commits mailing list.