summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/keytheorems
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/keytheorems')
-rw-r--r--macros/latex/contrib/keytheorems/CHANGELOG.md5
-rw-r--r--macros/latex/contrib/keytheorems/README.md5
-rw-r--r--macros/latex/contrib/keytheorems/doc/keytheorems-doc.pdfbin169165 -> 175459 bytes
-rw-r--r--macros/latex/contrib/keytheorems/doc/keytheorems-doc.tex73
-rw-r--r--macros/latex/contrib/keytheorems/tex/class-support/keythms-beamer-support.tex4
-rw-r--r--macros/latex/contrib/keytheorems/tex/keytheorems.sty43
6 files changed, 68 insertions, 62 deletions
diff --git a/macros/latex/contrib/keytheorems/CHANGELOG.md b/macros/latex/contrib/keytheorems/CHANGELOG.md
index 4050d96127..079b2bf542 100644
--- a/macros/latex/contrib/keytheorems/CHANGELOG.md
+++ b/macros/latex/contrib/keytheorems/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog for keytheorems package
+## [v0.2.4]
+- fixed issue with too much expansion in `manual-num`
+- fix [\#14](https://github.com/mbertucci47/keytheorems/issues/14)
+
## [v0.2.3]
- add many translations; some missing translation of "continuing from p."
- add `manual-num` key
@@ -58,6 +62,7 @@
## 0.1.0 - 2024-09-04
- First release
+[v0.2.4]: https://github.com/mbertucci47/keytheorems/compare/v0.2.3...v0.2.4
[v0.2.3]: https://github.com/mbertucci47/keytheorems/compare/v0.2.2...v0.2.3
[v0.2.2]: https://github.com/mbertucci47/keytheorems/compare/v0.2.1...v0.2.2
[v0.2.1]: https://github.com/mbertucci47/keytheorems/compare/v0.1.8...v0.2.1
diff --git a/macros/latex/contrib/keytheorems/README.md b/macros/latex/contrib/keytheorems/README.md
index 3e5d59a9c9..73b15c13da 100644
--- a/macros/latex/contrib/keytheorems/README.md
+++ b/macros/latex/contrib/keytheorems/README.md
@@ -640,10 +640,5 @@ blub
\end{document}
```
-## Things to do
-
-- Clean up the code. Things are out of order, poorly named, etc.
-- For a complete list, see [`keytheorems-ideas.md`](https://github.com/mbertucci47/keytheorems/blob/develop/keytheorems-ideas.md)
-
## License
Released under the LaTeX Project Public License v1.3c or later. See https://www.latex-project.org/lppl.txt. \ No newline at end of file
diff --git a/macros/latex/contrib/keytheorems/doc/keytheorems-doc.pdf b/macros/latex/contrib/keytheorems/doc/keytheorems-doc.pdf
index 5eb96e99bd..3b107f6a1e 100644
--- a/macros/latex/contrib/keytheorems/doc/keytheorems-doc.pdf
+++ b/macros/latex/contrib/keytheorems/doc/keytheorems-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/keytheorems/doc/keytheorems-doc.tex b/macros/latex/contrib/keytheorems/doc/keytheorems-doc.tex
index 9008b4300c..8edfc37667 100644
--- a/macros/latex/contrib/keytheorems/doc/keytheorems-doc.tex
+++ b/macros/latex/contrib/keytheorems/doc/keytheorems-doc.tex
@@ -148,6 +148,7 @@
colbacklower=ExampleBackLower,
breakable,
parbox=false, % so examples match document with indent, etc.
+ minted options app={breaksymbolleft={}},
#1
}
\newtcolorbox{notebox}[1][]{enhanced,
@@ -305,7 +306,7 @@ All \meta{options} are described in subsections \ref{thm-thmtools-keys} and \ref
\begin{keythmscode}[withpreamble]
\begin{theorem}
-Some text
+There are infinitely many prime numbers.
\end{theorem}
\end{keythmscode}
@@ -327,8 +328,8 @@ Sometimes a package or class defines theorems that need to be overwritten by the
As in \pkg{amsthm}, theorems can take an optional argument that contains a note or heading.
\begin{keythmscode}[]
-\begin{theorem}[some heading]
-Some text
+\begin{theorem}[Bertrand's postulate]
+For every $n\geq 1$, there is a prime number $p$ with $n<p\leq 2n$.
\end{theorem}
\end{keythmscode}
@@ -342,8 +343,10 @@ This is the key-value equivalent of the optional argument described above.
This syntax, however, allows the argument to contain other keys.
\begin{keythmscode}[]
-\begin{theorem}[note=another heading]
-Some more text
+\begin{theorem}[note=Legendre's formula]
+The number $n!$ contains the prime factor $p$ exactly
+ \[ \sum_{k\geq 1} \Bigl\lfloor\frac{n}{p^k}\Bigr\rfloor \]
+times.
\end{theorem}
\end{keythmscode}
@@ -362,10 +365,10 @@ This replaces the value of \refKey{note} when displayed in the list of theorems
This is the key-value equivalent of |\begin{theorem}| \cs{label}\marg{label name}.
\begin{keythmscode}[]
-\begin{theorem}[label=foo]
-Some text
+\begin{theorem}[label=bezout]
+Let $a$ and $b$ be integers. Then there exist integers $x$ and $y$ such that $ax+by=\gcd(a,b)$.
\end{theorem}
-\ref{foo}
+See \zcref{bezout}.
\end{keythmscode}
\end{docKey}
@@ -377,8 +380,8 @@ Use this to override the printed number of a theorem.
It is useful for making ``starred'' versions of other theorems, perhaps to represent a reformulated or more difficult version.
\begin{keythmscode}[]
-\begin{theorem}[manual-num=\ref*{foo}*]
-A reformulated version of \zcref[S]{foo}.
+\begin{theorem}[manual-num=\ref*{bezout}*]
+Let $a_1,\dots,a_n$ be integers. Then there exist integers $x_1,\dots,x_n$ such that $a_1x_1+\dots+a_nx_n=\gcd(a_1,\dots,a_n)$.
\end{theorem}
\begin{theorem}[manual-num=\faRocket] % requires fontawesome5
Don't confuse your readers by changing the numbering without good reason.
@@ -395,8 +398,8 @@ The printed text can be customized with the \refKey{continues-code} option.
The starred version also copies the theorem note, if it exists.
\begin{keythmscode}[]
-\begin{theorem}[continues=foo]
-\dots and some more text.
+\begin{theorem}[continues=bezout]
+Moreover, the integers of the form $az+bt$ are exactly the multiples of $\gcd(a,b)$.
\end{theorem}
\end{keythmscode}
@@ -428,15 +431,16 @@ The latter issue can be averted with the \texttt{ampersand-replacement} key.
\end{codepreamble}
\begin{keythmscode}[withpreamble]
-\begin{lemma}[store=diagram]
-Some commutative diagram:
+\begin{lemma}[store=fiberprod]
+For any $S$-schemes $X$ and $Y$, there exists a scheme $X\times_S Y$ with morphisms to $X$ and $Y$ such that the diagram
\[\begin{tikzcd}[ampersand replacement=\&]
X\times_S Y \ar[r] \ar[d] \& X \ar[d] \\
Y \ar[r] \& S
-\end{tikzcd}\]
+ \end{tikzcd}\]
+commutes and is universal with respect to this property.
\end{lemma}
\dots
-\getkeytheorem{diagram}
+\getkeytheorem{fiberprod}
\end{keythmscode}
\end{docKey}
@@ -451,7 +455,8 @@ At the moment this is only useful with the \refKey{note} key.
\begin{theorem}[
store=rktest,
note=ORIGINAL,
- restate-keys={note=RESTATED}]
+ restate-keys={note=RESTATED}
+ ]
Wow, yet another theorem.
\end{theorem}
\getkeytheorem{rktest}
@@ -474,12 +479,14 @@ Compare:
\begin{observation}
\begin{enumerate}
\item First item
+\item Second item
\end{enumerate}
\end{observation}
\begin{observation}[listhack=true]
\begin{enumerate}
\item First item
+\item Second item
\end{enumerate}
\end{observation}
\end{keythmscode}
@@ -577,7 +584,7 @@ Accepts any \meta{style name} defined by \refCom{newkeytheoremstyle}, as well as
\begin{keythmscode}[withpreamble]
\begin{remark}
-Some text
+It's nice to distinguish remarks from definitions and theorems.
\end{remark}
\end{keythmscode}
@@ -601,7 +608,7 @@ Details in \autoref{keythms-hooks}.
postheadhook=POSTHEAD,
prefoothook=PREFOOT,
postfoothook=POSTFOOT
-]
+ ]
\end{codepreamble}
\begin{keythmscode}[withpreamble]
@@ -625,10 +632,10 @@ If no value is given, the symbol \qedsymbol{} is used.
\begin{keythmscode}[withpreamble]
\begin{example}
-Some text
+Some text.
\end{example}
\begin{solution}
-Some more text
+Some more text.
\end{solution}
\end{keythmscode}
@@ -658,14 +665,12 @@ As with \cs{autoref}, there is also a starred version \docAuxCommand{Autoref*} t
\begin{keythmscode}[withpreamble]
\begin{prop}[label=abc]
-Some text
+Some text.
\end{prop}
\begin{prop}[label=def]
-Some more text
+Some more text.
\end{prop}
-\begin{theorem}
Consider \zcref{abc,def}. \Autoref{abc} \dots
-\end{theorem}
\end{keythmscode}
\end{docKey}
@@ -736,10 +741,10 @@ The theorem head is typeset as a tcolorbox title; to avoid this see \refKey{tcol
\begin{keythmscode}[withpreamble]
\begin{corollary}
-Some text
+Some text.
\end{corollary}
\begin{definition}[A nice definition]
-Some more text
+Some more text.
\end{definition}
\end{keythmscode}
@@ -759,7 +764,7 @@ Same usage as \refKey{tcolorbox} but the theorem head is typeset as usual, not a
\begin{keythmscode}[withpreamble]
\begin{boxcor}
-Some text
+Some text.
\end{boxcor}
\end{keythmscode}
@@ -783,12 +788,13 @@ Some text
}
\newkeytheorem{mytheo}[
name=My Theorem,
- style=tcb-standard]
+ style=tcb-standard
+ ]
\end{codepreamble}
\begin{keythmscode}[withpreamble]
\begin{mytheo}[This is my title]
-Some theorem text
+Some theorem text.
\end{mytheo}
\end{keythmscode}
@@ -952,9 +958,7 @@ Executes \meta{true code} if being retrieved with \refCom{getkeytheorem} and \me
\begin{keythmscode}[]
\begin{example}[store=hmm]
-I am the
-\IfRestatingTF{restated}{original}
-example!
+I am the \IfRestatingTF{restated}{original} example!
\end{example}
\getkeytheorem{hmm}
@@ -1263,7 +1267,6 @@ An example invocation might look like
\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/develop/tests/tagged-keytheorems-amsthmtest.tex}{\texttt{tagged-keytheorems-amsthmtest.tex}}.
\subsection{Public coding interfaces}
@@ -1289,7 +1292,7 @@ They can be useful with \cs{AddToHookNext} or the kernel's label mechanism for h
\section{Further examples}
More examples will be added soon -- rather, eventually\dots{}
-For now, you can find a \pkg{keytheorems} adaptation of \pkg{amsthm}'s classic file \href{https://mirrors.ctan.org/macros/latex/required/amscls/doc/thmtest.tex}{\texttt{thmtest.tex}} in the Github \texttt{tests} folder: \href{https://github.com/mbertucci47/keytheorems/blob/develop/tests/keytheorems-amsthmtest.tex}{\texttt{keytheorems-amsthmtest.tex}}.
+For now, you can find a \pkg{keytheorems} adaptation of \pkg{amsthm}'s classic \href{https://mirrors.ctan.org/macros/latex/required/amscls/doc/thmtest.tex}{\texttt{thmtest.tex}} in the Github \texttt{tests} folder: \href{https://github.com/mbertucci47/keytheorems/blob/develop/tests/keytheorems-amsthmtest.tex}{\texttt{keytheorems-amsthmtest.tex}}. There is also a version for tagged PDF: \href{https://github.com/mbertucci47/keytheorems/blob/develop/tests/tagged-keytheorems-amsthmtest.tex}{\texttt{tagged-keytheorems-amsthmtest.tex}}.
%\section{Implementation}
%\inputminted[linenos,style=bw]{latex}{../keytheorems.sty}
diff --git a/macros/latex/contrib/keytheorems/tex/class-support/keythms-beamer-support.tex b/macros/latex/contrib/keytheorems/tex/class-support/keythms-beamer-support.tex
index a767068565..8aef1cab3f 100644
--- a/macros/latex/contrib/keytheorems/tex/class-support/keythms-beamer-support.tex
+++ b/macros/latex/contrib/keytheorems/tex/class-support/keythms-beamer-support.tex
@@ -253,10 +253,10 @@
\cs_new:cpe
{ __keythms_getthm_ \l__keythms_thmuse_store_tl _body }
{
- \exp_not:N \__keythms_getthm_body:nn
+ \exp_not:N \__keythms_getthm_body:nnn
\exp_args:No \exp_not:o
{
- \exp_after:wN \__keythms_use_iii_v_braced:nnnnn
+ \exp_after:wN \__keythms_use_i_iii_v_braced:nnnnn
\g__keythms_thmuse_temprestatedata_tl
}
}
diff --git a/macros/latex/contrib/keytheorems/tex/keytheorems.sty b/macros/latex/contrib/keytheorems/tex/keytheorems.sty
index efc25150be..4f1d145935 100644
--- a/macros/latex/contrib/keytheorems/tex/keytheorems.sty
+++ b/macros/latex/contrib/keytheorems/tex/keytheorems.sty
@@ -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@date{2025-01-07}
-\def\@keythms@version{0.2.3}
+\def\@keythms@date{2025-01-21}
+\def\@keythms@version{0.2.4}
\ProvidesExplPackage{keytheorems}{\@keythms@date}{\@keythms@version}
{l3keys interface to amsthm}
@@ -1212,10 +1212,10 @@
\cs_new:cpe
{ __keythms_getthm_ \l__keythms_thmuse_store_tl _body }
{
- \exp_not:N \__keythms_getthm_body:nn
+ \exp_not:N \__keythms_getthm_body:nnn
\exp_args:No \exp_not:o
{
- \exp_after:wN \__keythms_use_iii_v_braced:nnnnn
+ \exp_after:wN \__keythms_use_i_iii_v_braced:nnnnn
\g__keythms_thmuse_temprestatedata_tl
}
}
@@ -1243,7 +1243,7 @@
}
}
}
-\cs_new:Npn \__keythms_use_iii_v_braced:nnnnn #1#2#3#4#5 { {#3}{#5} }
+\cs_new:Npn \__keythms_use_i_iii_v_braced:nnnnn #1#2#3#4#5 { {#1}{#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
@@ -1300,7 +1300,10 @@
}
\tl_if_empty:NF \l__keythms_thmuse_manualnum_tl
{
- \cs_set:cpn { the #1 } { \l__keythms_thmuse_manualnum_tl }
+ \cs_set:cpn { the #1 }
+ { % prevent expansion for unexpandable tokens in \the<counter>
+ \exp_not:N \exp_not:n { \l__keythms_thmuse_manualnum_tl }
+ }
\cs_set_eq:cN { c@ #1 } \c@keythms_manualnum_dummyctr
\cs_set_eq:cN { theH #1 } \theHkeythms_manualnum_dummyctr
}
@@ -1398,11 +1401,11 @@
\keys_define:nn { keytheorems/storeatbegin }
{
- restate .meta:n = { store = {#1} },
- restate* .meta:n = { store* = {#1} },
- store .tl_set:N = \l__keythms_storeatbegin_store_tl,
- store* .tl_set:N = \l__keythms_storeatbegin_storereversed_tl,
- unknown .code:n = { } % do nothing with unknown keys
+ restate .meta:n = { store = {#1} },
+ restate* .meta:n = { store* = {#1} },
+ store .tl_set:N = \l__keythms_storeatbegin_store_tl,
+ store* .tl_set:N = \l__keythms_storeatbegin_storereversed_tl,
+ unknown .code:n = { } % do nothing with unknown keys
}
\cs_new_protected:Npn \KeyThmsContentsLine #1 { }
@@ -1444,7 +1447,7 @@
\cs_new_protected:cpn
{ __keythms_getthm_ \l__keythms_storeatbegin_store_tl _body }
{
- \__keythms_getthm_body:nn {#5}{#7}
+ \__keythms_getthm_body:nnn {#1}{#5}{#7}
}
}
\tl_if_empty:NF \l__keythms_storeatbegin_storereversed_tl
@@ -1458,7 +1461,7 @@
\cs_new_protected:cpn
{ __keythms_getthm_ \l__keythms_storeatbegin_storereversed_tl _body }
{
- \__keythms_getthm_body:nn {#5}{#7}
+ \__keythms_getthm_body:nnn {#1}{#5}{#7}
}
}
\group_end:
@@ -1549,11 +1552,11 @@
\group_end:
}
-\cs_new_protected:Npn \__keythms_getthm_body:nn #1#2
- { % #1 = restate counters, #2 = theorem body
+\cs_new_protected:Npn \__keythms_getthm_body:nnn #1#2#3
+ { % #1 = name, #2 = restate counters, #3 = theorem body
\group_begin:
\bool_set_true:N \l__keythms_thmuse_restating_bool
- \prop_set_from_keyval:Nn \l__keythms_restate_counters_prop { #1 }
+ \prop_set_from_keyval:Nn \l__keythms_restate_counters_prop { #2 }
\prop_map_inline:Nn \l__keythms_restate_counters_prop
{
\tl_set:ce { l_keythms_restate_current_##1_tl } { \the\value{##1} }
@@ -1565,9 +1568,9 @@
{ \use:c { the ##1 } . \theHkeythms_restate_dummyctr }
}
\refstepcounter{keythms_restate_dummyctr}
- % \hook_use:n { keytheorems/#1/restated } % FIX!
+ \hook_use:n { keytheorems/#1/restated }
\hook_use:n { keytheorems/allthms/restated }
- #2
+ #3
\prop_map_inline:Nn \l__keythms_restate_counters_prop
{
\exp_args:Nnc \setcounter { ##1 }
@@ -1606,10 +1609,10 @@
\cs_new:cpe
{ __keythms_getthm_ \l__keythms_thmuse_storereversed_tl _body }
{
- \exp_not:N \__keythms_getthm_body:nn
+ \exp_not:N \__keythms_getthm_body:nnn
\exp_args:No \exp_not:o
{
- \exp_after:wN \__keythms_use_iii_v_braced:nnnnn
+ \exp_after:wN \__keythms_use_i_iii_v_braced:nnnnn
\g__keythms_thmuse_temprestatedata_tl
}
}