texlive[72620] Master/texmf-dist: keytheorems (22oct24)
commits+karl at tug.org
commits+karl at tug.org
Tue Oct 22 22:38:17 CEST 2024
Revision: 72620
https://tug.org/svn/texlive?view=revision&revision=72620
Author: karl
Date: 2024-10-22 22:38:17 +0200 (Tue, 22 Oct 2024)
Log Message:
-----------
keytheorems (22oct24)
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-beamer-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-22 20:38:07 UTC (rev 72619)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/CHANGELOG.md 2024-10-22 20:38:17 UTC (rev 72620)
@@ -1,11 +1,15 @@
# Changelog for keytheorems package
+## [v0.1.8]
+- add support for tagged PDF ([\#4](https://github.com/mbertucci47/keytheorems/issues/4))
+- add tagged example file tagged-keytheorems-amsthmtest.tex
+
## [v0.1.7]
- add support for aomart class
- add support for Michael Sharpe's font packages that change plain style
## [v0.1.6]
-- add `\renewkeytheorem`, `\providekeytheorem`, and `\declarekeytheorem`
+- add `\renewkeytheorem`, `\providekeytheorem`, and `\declarekeytheorem` ([\#5](https://github.com/mbertucci47/keytheorems/issues/5))
- tcolorbox theorems no longer error with beamer
- add support for beamer action spec
@@ -40,7 +44,8 @@
## 0.1.0 - 2024-09-04
- First release
-[unreleased]: https://github.com/mbertucci47/keytheorems/compare/v0.1.6...develop
+[v0.1.8]: https://github.com/mbertucci47/keytheorems/compare/v0.1.7...v0.1.8
+[v0.1.7]: https://github.com/mbertucci47/keytheorems/compare/v0.1.6...v0.1.7
[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
Modified: trunk/Master/texmf-dist/doc/latex/keytheorems/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keytheorems/README.md 2024-10-22 20:38:07 UTC (rev 72619)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/README.md 2024-10-22 20:38:17 UTC (rev 72620)
@@ -618,7 +618,7 @@
```
### new theorem styles do not preserve "plain" keys
-With keytheorems, this is handled only for the AMS classes and acmart.
+With keytheorems, this is handled only for the AMS classes, acmart, aomart, and jlreq.
```tex
\documentclass{amsbook}
\usepackage{thmtools}
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-22 20:38:07 UTC (rev 72619)
+++ trunk/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex 2024-10-22 20:38:17 UTC (rev 72620)
@@ -1065,7 +1065,7 @@
\begin{docCommand}{addtotheoremhook}
{\oarg{env name}\marg{hook name}\marg{code}}
-\meta{hook name} can be \hook{prehead}, \hook{posthead}, \hook{prefoot}, \hook{postfoot}, or \hook{restated}.
+The \meta{hook name} can be \hook{prehead}, \hook{posthead}, \hook{prefoot}, \hook{postfoot}, or \hook{restated}.
If no \meta{env name} is given, the \meta{code} is added to the ``generic'' hook, i.e. applied to all theorems.
As in \pkg{thmtools}, the order of hooks is as follows:
@@ -1096,11 +1096,12 @@
\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 the command \cs{getkeytheorem}, before the \hook{prehead} hook.
+The \hook{restated} hook is applied at the start of theorems retrieved with the command \cs{getkeytheorem}, after 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][]{}}
\end{dispListing}
+
By default, \pkg{keytheorems} disables the \cs{label} and \cs{RecordProperties} commands in restated theorems.
In \pkg{thmtools}, the \hook{prefoot} and \hook{postfoot} hooks always prepend code, i.e. the code
@@ -1143,7 +1144,7 @@
\subsection{Support for other classes}
\label{class-support}
-As mentioned in \autoref{thmstyles}, the initial style key values set by \pkg{keytheorems} are adjusted for the AMS classes \cls{amsart}, \cls{amsbook}, and \cls{amsproc}, as well as the \cls{amsart}-based \cls{acmart} and \cls{aomart}. You can find the exact changed values in the support files \texttt{keythms-\meta{class}-support.tex}.
+As mentioned in \autoref{thmstyles}, the initial style key values set by \pkg{keytheorems} are adjusted for the AMS classes \cls{amsart}, \cls{amsbook}, and \cls{amsproc}, the \cls{amsart}-based \cls{acmart} and \cls{aomart}, and \cls{jlreq}. You can find the exact changed values in the support files \texttt{keythms-\meta{class}-support.tex}.
These class support files also contain code to adapt to class' formatting of lists-of as mentioned in \autoref{listingthms}; changes are made for the AMS classes, \cls{memoir}, \cls{IEEEtran}, and \cls{jlreq}.
@@ -1150,13 +1151,36 @@
\subsection{Support for font packages}
Some font packages, all by Michael Sharpe, offer a |theoremfont| option that redefines the |plain| style body font to have italic text with upright figures, punctuation, and delimiters. \pkg{keytheorems} detects this option and sets its initial style values accordingly. The supported packages are \pkg{baskervillef}, \pkg{cochineal}, \pkg{libertinust1math}, \pkg{newpxtext}, \pkg{newtxtext}, \pkg{scholax}, and \pkg{XCharter}.
-
+
+\subsection{Support for tagged PDF}
+
+The \LaTeX{} team has been working hard to support the creation of tagged PDFs (see \url{https://latex3.github.io/tagging-project/}).
+The current |dev| formats make \pkg{amsthm} compatible with the kernel tagging code.
+Most of \pkg{keytheorems} is supported too, and anything that doesn't work should be reported.
+The only things explicitly not supported are the \refKey{tcolorbox} and \refKey{tcolorbox-no-titlebar} keys.
+
+To produce a tagged PDF, add \cs{DocumentMetadata} in the first line of your document (additional instructions are found on the Tagging Project \href{https://latex3.github.io/tagging-project/documentation/prototype-usage-instructions.html}{website}).
+An example invocation might look like
+
+\begin{dispListing}
+\DocumentMetadata
+ {
+ lang=en-US,
+ pdfversion=2.0,
+ pdfstandard=ua-2,
+ testphase={phase-III,math,table,title,firstaid}
+ }
+\end{dispListing}
+
+At a minimum, the |testphase| modules |phase-III| and |firstaid| are required.
+The GitHub tests folder contains an example of a tagged PDF using \pkg{keytheorems}: \href{https://github.com/mbertucci47/keytheorems/blob/main/tests/tagged-keytheorems-amsthmtest.tex}{\texttt{tagged-keytheorems-amsthmtest.tex}}.
+
\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.
+ Inside theorem environments and in all theorem hooks, you have access to the theorem's environment and counter name in this token list variable.
\end{itemize}
\section{Further examples}
Modified: 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 2024-10-22 20:38:07 UTC (rev 72619)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/class-support/keythms-beamer-support.tex 2024-10-22 20:38:17 UTC (rev 72620)
@@ -4,7 +4,17 @@
\ProvidesExplFile{keythms-beamer-support}{\@keythms at date}{\@keythms at version}
{keytheorems~support~for~the~beamer~class}
-% do nothing if noamsthm loaded
+% 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 }
+ }
+
+% besides above, do nothing if noamsthm loaded
\IfClassLoadedWithOptionsT{ beamer }{ noamsthm }{ \file_input_stop: }
\keys_define:nn { keytheorems/thmstyle }
@@ -68,7 +78,6 @@
\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> }
@@ -96,7 +105,7 @@
{ 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
+ \prop_set_from_keyval:Ne \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
{
@@ -124,12 +133,11 @@
}
}
{
- \msg_warning:nne { keytheorems } { store-reversed-not-got }
- { \l__keythms_thmuse_storereversed_tl }
+ \msg_warning:nnV { keytheorems } { store-reversed-not-got }
+ \l__keythms_thmuse_storereversed_tl
}
\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> }
@@ -160,7 +168,6 @@
{
% \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
@@ -167,10 +174,9 @@
{
% \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 }
+ \__keythms_thm_prehead_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 }
@@ -231,7 +237,6 @@
\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> }
@@ -261,15 +266,37 @@
\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 }
+\cs_new_protected:Npn \__keythms_beamer_reversedauxdata:nnnn #1#2#3#4
{
- \protect\listofkeytheorems\space not~supported~with~beamer
+ \iow_shipout:Ne \@auxout
+ {
+ \KeyThmsBeamerReversedData { \l__keythms_thmuse_storereversed_tl }
+ { \@currentlabel }
+ { #2 }
+ }
}
-\RenewDocumentCommand \listofkeytheorems { o }
+\cs_new_protected:Npn \KeyThmsBeamerReversedData #1#2#3
{
- \msg_warning:nn { keytheorems } { beamer-listof }
+ \tl_if_exist:cF { c__keythms_storeatbegin_#1_label_tl }
+ {
+ \tl_const:cn { c__keythms_storeatbegin_#1_label_tl } { #2 }
+ }
+ \tl_if_exist:cF { c__keythms_storeatbegin_#1_restatecounters_tl }
+ {
+ \tl_const:cn { c__keythms_storeatbegin_#1_restatecounters_tl } { #3 }
+ }
+ \bool_if_exist:cF { g__keythms_restate_#1_called_bool }
+ { \bool_new:c { g__keythms_restate_#1_called_bool } }
}
+\cs_new_eq:NN \__keythms_ORIGgetthmreversed_theorem:nnn
+ \__keythms_getthmreversed_theorem:nnn
+\cs_set_protected:Npn \__keythms_getthmreversed_theorem:nnn #1#2#3
+ {
+ \group_begin:
+ \cs_set_eq:NN \__keythms_thm_addcontentsdata:nnnn \__keythms_beamer_reversedauxdata:nnnn
+ \__keythms_ORIGgetthmreversed_theorem:nnn { #1 } { #2 } { #3 }
+ \group_end:
+ }
% restatable and restatable* environments need redefinition
\bool_if:NT \g__keythms_thmtoolscompat_bool
@@ -291,6 +318,15 @@
}
\RenewDocumentEnvironment { restatable* } { O{} m m }
{
+ \cs_set_protected:Npn \__keythms_thm_tempstorerestatedatareversed:nnn ##1##2##3
+ {
+ \tl_gset:Ne \g__keythms_thmuse_temprestatedatareversed_tl % needs to be global to get out of env
+ {
+ { ##1 }
+ { store*=\l__keythms_thmuse_storereversed_tl,\exp_not:n { ##2 } }
+ { \exp_not:n { ##3 } }
+ }
+ }
% set store* outside [] so keyless note is recognized
\keys_set:nn { keytheorems/thmuse } { store*=#3 }
\begin{#2}[#1]
Modified: trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty 2024-10-22 20:38:07 UTC (rev 72619)
+++ trunk/Master/texmf-dist/tex/latex/keytheorems/keytheorems.sty 2024-10-22 20:38:17 UTC (rev 72620)
@@ -2,8 +2,8 @@
% 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]
-\def\@keythms at date{2024-10-10}
-\def\@keythms at version{0.1.7}
+\def\@keythms at date{2024-10-21}
+\def\@keythms at version{0.1.8}
\ProvidesExplPackage{keytheorems}{\@keythms at date}{\@keythms at version}
{l3keys interface to amsthm}
@@ -125,6 +125,7 @@
%%% Declare Variables %%%
%%%%%%%%%%%%%%%%%%%%%%%%%
+\iow_new:N \g__keythms_tmpa_iow
\tl_new:N \l__keythms_tmpa_tl
\bool_new:N \g__keythms_listof_writefile_bool
@@ -138,7 +139,6 @@
\bool_new:N \l__keythms_thmuse_restating_bool
\clist_new:N \g__keythms_restatecounters_clist
\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
@@ -168,6 +168,8 @@
\cs_generate_variant:Nn \hook_gput_code:nnn { nnv }
\cs_generate_variant:Nn \keys_precompile:nnN { nv, nVc, nnc, ne }
+\cs_generate_variant:Nn \prop_set_from_keyval:Nn { Ne }
+\prg_generate_conditional_variant:Nnn \tl_if_novalue:n { o } { T, F, TF }
%%%%%%%%%%%%%%
%%% Styles %%%
@@ -209,12 +211,24 @@
headstyle / margin .code:n =
{
\cs_set:Nn \keythms_thmstyle_headcmd:nnn
- { \makebox[0pt][r]{\thmnumber{ ##2 ~ }}\NAME\NOTE }
+ {
+ \makebox[0pt][r]{
+ \keythms_thmstyle_thmnumber:n {
+ \group_begin: \exp_not:V \l__keythms_thmstyle_numberfont_tl
+ ##2 ~ \group_end: }
+ }
+ \NAME\NOTE
+ }
},
headstyle / swapnumber .code:n =
{
\cs_set:Nn \keythms_thmstyle_headcmd:nnn
- { \thmnumber{ ##2 ~ }\NAME\NOTE }
+ {
+ \keythms_thmstyle_thmnumber:n {
+ \group_begin: \exp_not:V \l__keythms_thmstyle_numberfont_tl
+ ##2 ~ \group_end: }
+ \NAME\NOTE
+ }
},
headstyle / unknown .cs_set:Np = \keythms_thmstyle_headcmd:nnn #1#2#3,
inherit-style .choice:,
@@ -245,7 +259,7 @@
preheadhook .code:n = \keythms_thmstyle_savethmkey_reqval:n { #1 },
qed .code:n =
{ % qed needs special treatment to distinguish qed from qed={}
- \exp_args:No \tl_if_novalue:nTF { #1 }
+ \tl_if_novalue:oTF { #1 }
{
\clist_put_right:No \l__keythms_thmstyle_savedkeys_clist
{ \l_keys_key_str }
@@ -376,17 +390,17 @@
\l__keythms_thmstyle_postheadspace_tl
{ \text_expand:n { \keythms_thmstyle_headcmd:nnn{##1}{##2}{##3} } }
% Define inherit-style key
- \tl_if_exist:cF { l__keythms_thmstyle_ #1 _metakeys_tl }
- { \tl_new:c { l__keythms_thmstyle_ #1 _metakeys_tl } }
+ \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
+ { 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 } }
+ { 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 _savedthmkeys_tl }
+ { l__keythms_thmstyle_#1_savedthmkeys_tl }
\cs_undefine:N \NAME % undefine to prevent conflicts
\cs_undefine:N \NUMBER
\cs_undefine:N \NOTE
@@ -764,12 +778,12 @@
{ % #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} }
+ \tl_if_novalue:oF { #2 } { \protected at edef\qedsymbol{#2} }
\pushQED{\qed}
}
\tl_gput_left:cn { g__keythms_thm_prefootfromkeys_#1_tl }
{
- \exp_args:No \tl_if_novalue:nF { #2 } { \protected at edef\qedsymbol{#2} }
+ \tl_if_novalue:oF { #2 } { \protected at edef\qedsymbol{#2} }
\popQED
}
}
@@ -942,7 +956,6 @@
\DeclareEnvironmentCopy { keythms_orig_#1 } { #1 }
\DeclareDocumentEnvironment { keythms_grab_#1 } { m m +b }
{ % ##1 = keys, ##2 = note, ##3 = theorem body
- \__keythms_thm_prehead_code:n { #1 }
\begin{keythms_orig_#1}[{##2}]
\clist_map_inline:Nn \g__keythms_restatecounters_clist
{
@@ -968,7 +981,7 @@
{ 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
+ \prop_set_from_keyval:Ne \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
{
@@ -996,12 +1009,11 @@
}
}
{
- \msg_warning:nne { keytheorems } { store-reversed-not-got }
- { \l__keythms_thmuse_storereversed_tl }
+ \msg_warning:nnV { keytheorems } { store-reversed-not-got }
+ \l__keythms_thmuse_storereversed_tl
}
\hook_use:n { keytheorems/#1/restated }
\hook_use:n { keytheorems/allthms/restated }
- \__keythms_thm_prehead_code:n { #1 }
\begin{keythms_orig_#1}[{##2}]
\__keythms_thm_posthead_code:n { #1 }
% below needs to come after posthead so that correct \@currentHref
@@ -1030,7 +1042,6 @@
{
\bool_gset_true:N \g__keythms_listof_writefile_bool
\cs_set_eq:NN \__keythms_withhooks_begin:nnn \__keythms_grab_begin:nnn
- \cs_set_eq:NN \__keythms_withhooks_begin:nnV \__keythms_grab_begin:nnV
\cs_set_eq:NN \__keythms_withhooks_end:n \__keythms_grab_end:n
}
\tl_if_empty:NF \l__keythms_thmuse_storereversed_tl
@@ -1037,10 +1048,9 @@
{
\bool_gset_true:N \g__keythms_listof_writefile_bool
\cs_set_eq:NN \__keythms_withhooks_begin:nnn \__keythms_grabreversed_begin:nnn
- \cs_set_eq:NN \__keythms_withhooks_begin:nnV \__keythms_grabreversed_begin:nnV
\cs_set_eq:NN \__keythms_withhooks_end:n \__keythms_grabreversed_end:n
}
- \__keythms_thm_prehead_continues_code:n { #1 }
+ \__keythms_thm_prehead_code:n { #1 }
\__keythms_withhooks_begin:nnV { #1 } { ##1 } \l__keythms_thmuse_note_tl
}
{
@@ -1092,9 +1102,9 @@
}
\cs_new:Npn \__keythms_use_iii_v_braced:nnnnn #1#2#3#4#5 { {#3}{#5} }
+% withhooks_begin does not include prehead hook because we want to be able to access note
\cs_new_protected:Npn \__keythms_withhooks_begin:nnn #1#2#3
{ % #1 = theorem name, #2 = keys, #3 = note
- \__keythms_thm_prehead_code:n { #1 }
\begin{keythms_orig_#1}[{#3}]
\__keythms_thm_posthead_code:n { #1 }
\__keythms_thm_addcontentsdata:nnnn { #1 } { } { #2 } { }
@@ -1127,15 +1137,10 @@
\cs_generate_variant:Nn \__keythms_orig_begin:nn { nV }
\cs_new_protected:Npn \__keythms_orig_end:n #1 { \end{keythms_orig_#1} }
+%% this below has to be separate from withhooks_begin above since we need to add
+%% continues-code to note before retrieving it in \__keythms_withhooks_begin:nnV
\cs_new_protected:Npn \__keythms_thm_prehead_code:n #1
{ % #1 = theorem name
- \hook_use:n { keytheorems/#1/prehead }
- \hook_use:n { keytheorems/allthms/prehead }
- }
-%% this below has to be separate from prehead_code above since we need to add
-%% continues-code to note before retrieving it in \__keythms_withhooks_begin:nnV
-\cs_new_protected:Npn \__keythms_thm_prehead_continues_code:n #1
- { % #1 = theorem name
\tl_if_empty:NF \l__keythms_thmuse_contlabel_tl
{
\tl_if_empty:NF \l__keythms_thmuse_note_tl
@@ -1150,6 +1155,8 @@
\cs_set_eq:cN { theH #1 } \theHkeythms_continues_dummyctr
%\cs_set_eq:NN \setuniqmark \use_none:n % not the right fix
}
+ \hook_use:n { keytheorems/#1/prehead }
+ \hook_use:n { keytheorems/allthms/prehead }
}
\cs_new_protected:Npn \__keythms_thm_posthead_code:n #1
{ % #1 = theorem name
@@ -1307,13 +1314,13 @@
\cs_set_protected:Npn \KeyThmsSavedTheoremReversed #1#2#3#4
{
\bool_new:c { g__keythms_restate_#1_called_bool }
- \cs_gset:cpn { __keythms_getthm_ #1 _theorem }
+ \cs_gset:cpn { __keythms_getthm_#1_theorem }
{ \__keythms_getthmreversed_theorem:nnn { #2 } { #3 } { #4 } }
\hook_gput_code:nnn { begindocument/end } { . }
{
- \cs_if_exist:cF { __keythms_getthm_ #1 _body }
+ \cs_if_exist:cF { __keythms_getthm_#1_body }
{
- \cs_new_protected:cpn { __keythms_getthm_ #1 _body }
+ \cs_new_protected:cpn { __keythms_getthm_#1_body }
{
\textbf{??}
\msg_warning:nnn { keytheorems } { restate-body-never-got } { #1 }
@@ -1373,10 +1380,9 @@
\tl_set:Nn \l_keythms_thmuse_envname_tl { #1 }
\keys_set:nn { keytheorems/thmuse } { #4 }
\keys_set:no { keytheorems/thmuse } { \l__keythms_thmuse_restatekeys_clist }
+ \__keythms_thm_prehead_code:n { #1 }
\hook_use:n { keytheorems/#1/restated }
\hook_use:n { keytheorems/allthms/restated }
- \__keythms_thm_prehead_continues_code:n { #1 }
- \__keythms_thm_prehead_code:n { #1 }
\__keythms_orig_begin:nV { #1 } \l__keythms_thmuse_note_tl
\__keythms_thm_posthead_code:n { #1 }
#5
@@ -1407,7 +1413,7 @@
{ \use:c { the ##1 } . \theHkeythms_restate_dummyctr }
}
\refstepcounter{keythms_restate_dummyctr}
- \hook_use:n { keytheorems/#1/restated }
+ % \hook_use:n { keytheorems/#1/restated } % FIX!
\hook_use:n { keytheorems/allthms/restated }
#2
\prop_map_inline:Nn \l__keythms_restate_counters_prop
@@ -1425,7 +1431,6 @@
\tl_set:Nn \l_keythms_thmuse_envname_tl { #1 }
\keys_set:nn { keytheorems/thmuse } { #2 }
\keys_set:no { keytheorems/thmuse } { \l__keythms_thmuse_restatekeys_clist }
- \__keythms_thm_prehead_continues_code:n { #1 }
\__keythms_thm_prehead_code:n { #1 }
\__keythms_orig_begin:nV { #1 } \l__keythms_thmuse_note_tl
\clist_map_inline:Nn \g__keythms_restatecounters_clist
@@ -1780,6 +1785,9 @@
{ #4 }{ #3 }
}
+\NewDocumentCommand \__keythms_listof_pagerefnolink:w { s m }
+ { \getpagerefnumber{#2} } % tagging does not like links within link
+
% NOTE: We still need to do this setup for [print-body] so that onlynamed works
\cs_new_protected:Npn \__keythms_listof_listcmd_setup:nn #1#2
{ % #1 = keys, #2 = list command
@@ -1803,6 +1811,7 @@
{
\__keythms_thmuse_continues:V \l__keythms_listofheading_contlabel_tl
}
+ \cs_set_eq:NN \pageref \__keythms_listof_pagerefnolink:w % always no link
#2
}
}
@@ -1862,8 +1871,8 @@
{ % if .thlist file left over from previous run but not needed, clear it
\file_if_exist:nT { \c_sys_jobname_str.thlist }
{
- \iow_open:Nn \g_tmpa_iow { \c_sys_jobname_str.thlist }
- \iow_close:N \g_tmpa_iow
+ \iow_open:Nn \g__keythms_tmpa_iow { \c_sys_jobname_str.thlist }
+ \iow_close:N \g__keythms_tmpa_iow
}
}
}
@@ -2056,6 +2065,15 @@
{ \exp_not:n { ####3 } }
}
}
+ } % and this because otherwise adds an extra run; not needed for unstarred
+ \cs_set_protected:Npn \__keythms_thm_tempstorerestatedatareversed:nnn ####1####2####3
+ {
+ \tl_gset:Ne \g__keythms_thmuse_temprestatedatareversed_tl % needs to be global to get out of env
+ {
+ { ####1 }
+ { store*=\l__keythms_thmuse_storereversed_tl,\exp_not:n { ####2 } }
+ { \exp_not:n { ####3 } }
+ }
}
% set store* outside [] so keyless note is recognized
\keys_set:nn { keytheorems/thmuse } { store*=##3 }
@@ -2387,7 +2405,6 @@
\cs_new_protected:Npn \__keythms_storeall_code:
{
\cs_set_eq:NN \__keythms_withhooks_begin:nnn \__keythms_grab_begin:nnn
- \cs_set_eq:NN \__keythms_withhooks_begin:nnV \__keythms_grab_begin:nnV
\cs_set_eq:NN \__keythms_withhooks_end:n \__keythms_grab_end:n
}
@@ -2519,4 +2536,43 @@
}
\__keythms_support_fontpkg:nn { scholax } { bodyfont = \thfamily }
+%%%%%%%%%%%%%%%%%%%%%%%
+%%% Tagging Support %%%
+%%%%%%%%%%%%%%%%%%%%%%%
+
+\IfDocumentMetadataTF
+ {
+ \tag_if_active:T
+ {
+ \msg_new:nnn { keytheorems } { tcolorbox-tagging }
+ {
+ The~key~'tcolorbox'~does~not~currently~work~with~
+ tagging.~Ignoring~this~key.
+ }
+ \keys_define:nn { keytheorems/thm }
+ {
+ tcolorbox .code:n =
+ \msg_warning:nn { keytheorems } { tcolorbox-tagging },
+ }
+ \keys_define:nn { keytheorems/listof }
+ {
+ 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}
+ }
+ }
+ % with tagging, make \@starttoc same as input
+ \cs_set_protected:Npn \@starttoc ##1
+ { \makeatletter \@input { \jobname.##1 } }
+ },
+ }
+ }
+ }
+ { }
+
\file_input_stop:
\ No newline at end of file
More information about the tex-live-commits
mailing list.