summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/keytheorems/keytheorems-doc.tex
blob: 464d92e2d29c9f885fb0271684d6c7ec328981ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
% !TeX program = txs:///lualatex | txs:///makeindex | txs:///lualatex | txs:///view-pdf
\PassOptionsToPackage{hyperindex}{hyperref}
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass{ltxdoc}
\usepackage{geometry}
\geometry{margin=1.5in}
\usepackage{tcolorbox}
\tcbuselibrary{documentation,minted,breakable,hooks}
\tcbset{
  listing engine=minted,
  minted language=latex,
  }
\ifTUTeX
\usepackage{newcomputermodern}
\else
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\fi
\usetikzlibrary{cd}
\usepackage{booktabs}
\usepackage{keytheorems}
\usepackage{cleveref}

%%% TEMPORARY (https://tex.stackexchange.com/q/730126/208544)
\RemoveFromHook{label}[firstaid/cleveref]
\makeatletter
\AddToHook{label}[firstaid/cleveref]
         {\ifx
           \@currentcounter\@empty
          \else
           \firstaid@cref@updatelabeldata{\@currentcounter}%<--- was missing
          \fi} 
\makeatother
%%% END TEMPORARY

\makeatletter
\newcommand\keythmsversion{\@keythms@version}
\makeatother

\title{%
  \pkg{keytheorems} package \\[1ex]
  \large version \keythmsversion \\[1ex]
  \href{https://github.com/mbertucci47/keytheorems}
    {\texttt{github.com/mbertucci47/keytheorems}}
  }
\author{Matthew Bertucci}

\newkeytheoremstyle{breaksty}{break}
\newkeytheorem{theorem}
\newkeytheorem{mythm}[name=Some Name]
\newkeytheorem{theorem*}[name=Theorem,numbered=false]
\newkeytheorem{conjecture}[parent=section]
\newkeytheorem{lemma}[sibling=theorem]
\newkeytheorem{test}[
  preheadhook=PREHEAD,
  postheadhook=POSTHEAD,
  prefoothook=PREFOOT,
  postfoothook=POSTFOOT
]
\newkeytheorem{prop}[
  name=Proposition,
  refname={proposition,propositions},
  Refname={Proposition,Propositions}
  ]
\newkeytheorem{example}[qed]
\newkeytheorem{solution}[qed=$\clubsuit$]
\newkeytheorem{remark}[style=remark]
\tcbset{
  defstyle/.style={arc=0mm,colback=blue!5!white,colframe=blue!75!black},
  thmstyle/.style={colback=green!5,colframe=green!35!black},
  }
\newkeytheoremstyle{tcb-standard}{
  tcolorbox=thmstyle,
  headpunct={},
  notebraces={}{},
  noteseparator={: },
  notefont=\bfseries,
  bodyfont=\normalfont,
  }
\newkeytheorem{mytheo}[name=My Theorem,style=tcb-standard]
\newkeytheorem{corollary}[tcolorbox]
\newkeytheorem{definition}[
  style=definition,
  tcolorbox={defstyle}
  ]
\newkeytheorem{boxcor}[
  tcolorbox-no-titlebar={colback=red!10},
  name=Corollary,
  sibling=corollary,
  ]
\newkeytheorem{observation}[style=breaksty]
\newkeytheorem{quotethm}[name=Quote Theorem,leftmargin=1cm,rightmargin=1cm]
\newkeytheorem{indentedthm}[name=Indented Theorem,leftmargin=1cm]

\MakeShortVerb{\|}
\newcommand{\env}{\texttt}
\newcommand{\hook}{\texttt}
\NewCommandCopy{\braces}{\brackets}
\newcommand{\bracks}[1]{\texttt{[#1]}}
\newcommand{\ttbraces}[1]{\braces{\texttt{#1}}}
%\tcbset{index gather commands=false}
\usepackage{xcolor-solarized}
\colorlet{ExampleBack}{solarized-base3!50}
\colorlet{ExampleBackLower}{solarized-base3}
\tcbset{
  color command=BrickRed,
  color key=Fuchsia,
  color value=teal,
  before doc body={%
    \setlength{\parindent}{15pt}
    \noindent
    },
  docexample/.append style={boxrule=0pt,arc=0pt,after app={\noindent}}
  }
\tcbset{
  withpreamble/.style = {
    before upper = {%
      {\ttfamily\itshape \% preamble}%
      \vspace{-0.7\baselineskip}%
      \tcbusetemplisting
      \noindent{\ttfamily\itshape \% document}%
      \vspace{-0.7\baselineskip}%
      }
    }
  }

\NewTCBListing{keythmscode}{ O{} }
  {
    colback=ExampleBack,
    arc=0pt,
    boxrule=0pt,
%    listing side text,
%    lower separated=false,
    skin=bicolor,
    colbacklower=ExampleBackLower,
    breakable,
    parbox=false, % so examples match document with indent, etc.
%    enhanced,
%    segmentation engine=path,
%    segmentation style={solid,gray},
    #1
  }
\newtcolorbox{notebox}[1][]{enhanced,
  before skip balanced=2mm,after skip balanced=4mm,
  boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
  colback=red!20,
  colframe=red!40!black,
  sharp corners,rounded corners=southeast,arc is angular,arc=3mm,
  underlay={%
    \path[fill=tcbcolback!80!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
    \path[draw=tcbcolframe,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
    \path[fill=red!40!black,draw=none] (interior.south west) rectangle node[white]{\LARGE\bfseries !} ([xshift=4mm]interior.north west);
    },
  drop fuzzy shadow,#1}
\makeatletter
% allow for optional argument specifying printed text, mostly for starred keys
\RenewDocumentCommand\tcb@ref@doc{msom}{%
  \hyperref[{#1:#4}]{%
  \IfValueTF{#3}{\texttt{#3}}{\texttt{\ref*{#1:#4}}}%
  \IfBooleanTF{#2}{}{%
    \ifnum\getpagerefnumber{#1:#4}=\thepage\relax%
    \else%
      \kvtcb@doc@format@page{{\fontfamily{pzd}\fontencoding{U}\fontseries{m}\fontshape{n}\selectfont\char213}%
      \,\kvtcb@text@pageshort\,\pageref*{#1:#4}}%
    \fi}}%
}
\makeatother
\makeindex

\begin{document}

\maketitle

\begin{abstract}
An \pkg{expl3}-implementation of a key-value interface to \pkg{amsthm}, implementing most of the functionality provided by \pkg{thmtools}.
Several issues encountered with \pkg{thmtools} are avoided (see the README for a list) and a few new features are added.
\end{abstract}

\tableofcontents

\section{Dependencies}

The package depends on the \pkg{aliascnt}, \pkg{amsthm}, \pkg{etoolbox}, \pkg{refcount}, \pkg{translations} packages.
The \refKey{tcolorbox} and \refKey{tcolorbox-no-titlebar} keys require \pkg{tcolorbox}, and the \refKey[numbered=unless-unique]{numbered} key requires the \pkg{unique} package.
A \LaTeX{} kernel no older than 2023-06-01 is required; if older than 2024-06-01, \pkg{nameref} is required.
    
\section{Global options}

\begin{docCommand}{keytheoremset}
  {\marg{options}}
Every key in this section can be given as an option to \cs{usepackage} or in \cs{keytheoremset}, with the exception that \refKey{continues-code} can only be used in the latter.
\end{docCommand}

\subsection{Compatibility options}

\begin{docKey}{overload}
  {}
  {initially unset}
Redefines \cs{newtheorem} to internally use the \pkg{keytheorems} machinery. The syntax remains the same.
This is automatically set by \refKey{thmtools-compat}.
\end{docKey}

\begin{docKey}{thmtools-compat}
  {}
  {initially unset}
For compatibility with \pkg{thmtools} syntax.
For most documents,
\begin{dispListing}
\usepackage[thmtools-compat]{keytheorems}
\end{dispListing}
should be a drop-in replacement for \cs{usepackage}\ttbraces{amsthm,thmtools}.
The option defines the commands in the left column below.
The right column lists the corresponding \pkg{keytheorems} replacement that should be used in new documents.
\begin{center}
\begin{tabular}{rcl}
\multicolumn{1}{c}{\pkg{thmtools} command} & & \multicolumn{1}{c}{\pkg{keytheorems} replacement} \\
\toprule
\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} & $\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}

\subsection{Other global options}

\begin{docKey}{auto-translate}
  {\colOpt{=true\textbar false}}
  {default |true|, initially |true|}
If |false|, \pkg{keytheorems} does not automatically translate the title text used for \refCom{listofkeytheorems} and the note produced by the \refKey{continues} key.
These texts can be manually customized with the \refKey{title} and \refKey{continues-code} keys, respectively.
\end{docKey}

\begin{docKey}{continues-code}
  {=\meta{code with \textup{\texttt{\#1}}}}
  {initially\\ \cs{GetTranslation}\ttbraces{keythms\string_continues}\cs{pageref}\ttbraces{\#1}}
The code used to typeset the note produced by the \refKey{continues} key.
If English or an unknown language is used, defaults to \texttt{continuing from p.}\cs{,}\cs{pageref}\ttbraces{\#1}.
Currently (likely inaccurate!) translations exist for French, German, Italian, Portuguese, and Spanish.
\end{docKey}

\begin{docKey}{qed-symbol}
  {=\meta{symbol}}
  {initially \cs{openbox}}
Redefines \cs{qedsymbol} to be \meta{symbol}.
\end{docKey}

\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-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}

\section{Defining theorems}

\begin{docCommand}{newkeytheorem}
  {\marg{env name}\oarg{options}}
Defines a theorem environment \meta{env name} which itself takes a few options (see \autoref{in-doc-keys}).
You can also declare multiple theorems at once by replacing \meta{env name} with a comma-list of names, e.g.
\begin{center}
\cs{newkeytheorem}\ttbraces{theorem,lemma,proposition}\bracks{\meta{options}}.
\end{center}

By default, the theorem's printed name is a title-cased \meta{env name}.
This can be changed with the \refKey{thm/name} key.
All \meta{options} are described in subsections \ref{thm-thmtools-keys} and \ref{thm-added-keys}.

\begin{tcbwritetemp}
\newkeytheorem{theorem}
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{theorem}
Some text
\end{theorem}
\end{keythmscode}

\end{docCommand}

\begin{docCommands}[
  doc parameter=\marg{env name}\oarg{options}
  ]
  {
    {doc name = renewkeytheorem},
    {doc name = providekeytheorem},
    {doc name = declarekeytheorem},
  }
Sometimes a package or class defines theorems that need to be overwritten by the user. For this case, \pkg{keytheorems} provides \cs{renewkeytheorem} which redefines \meta{env name} or errors if it is not defined. For completeness, also provided are \cs{providekeytheorem} and \cs{declarekeytheorem}. The former only defines \meta{env name} if it is not already defined; the latter always overwrites \meta{env name}.
\end{docCommands}

\subsection{Keys available to theorem environments} \label{in-doc-keys}

As in \pkg{amsthm}, theorems can take an optional argument that contains a note or heading.

\begin{keythmscode}[]
\begin{theorem}[some heading]
Some text
\end{theorem}
\end{keythmscode}

Alternatively, the optional argument may contain any of the following keys.

\begin{docKey}{note}
  {=\meta{text}}
  {initially unset}
Alias \docAuxKey[][doc label=thmuse/name]{name}.
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
\end{theorem}
\end{keythmscode}

\end{docKey}

\begin{docKey}{short-note}
  {=\meta{text}}
  {initially unset}
Alias \docAuxKey{short-name}.
This replaces the value of \refKey{note} when displayed in the list of theorems (\refCom{listofkeytheorems}).
\end{docKey}

\begin{docKey}{label}
  {=\meta{label name}}
  {initially unset}
This is the key-value equivalent of |\begin{theorem}| \cs{label}\marg{label name}.

\begin{keythmscode}[]
\begin{theorem}[label=foo]
Some text
\end{theorem}
\ref{foo}
\end{keythmscode}

\end{docKey}

\begin{docKey}{continues}
  {\sarg=\meta{label name}}
  {initially unset}
Pick up a theorem where you left off.
The theorem number remains the same.
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.
\end{theorem}
\end{keythmscode}

\end{docKey}

\begin{docKey}{store}
  {\sarg=\meta{tag}}
  {initially unset}
Alias \docAuxKey{restate}\sarg.
Stores the the theorem to be restated at any point in the document with \refCom{getkeytheorem}.
With the starred version, counters and labels are taken from the copy called with \cs{getkeytheorem}, so in this case can only be restated once.
This allows you, for example, to write all theorems and proofs in the appendix and call \cs{getkeytheorem} at the appropriate time mid-document.
For the numbering to be correct, the unstarred key will need at most two runs and the starred key at most three runs.

\begin{keythmscode}[]
\begin{theorem}[store=blub]
A theorem worth restating.
\end{theorem}
More brilliant mathematics.
\getkeytheorem{blub}
\end{keythmscode}

A theorem given this key \emph{cannot} contain verbatim material or other unexpected catcodes, such as a \pkg{tikz-cd} diagram.
The latter issue can be averted with the \texttt{ampersand-replacement} key.

\begin{tcbwritetemp}
\usepackage{tikz}
\usetikzlibrary{cd}
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{lemma}[store=diagram]
Some commutative diagram:
\[\begin{tikzcd}[ampersand replacement=\&]
X\times_S Y \ar[r] \ar[d] \& X \ar[d] \\
Y \ar[r] \& S
\end{tikzcd}\]
\end{lemma}
\dots
\getkeytheorem{diagram}
\end{keythmscode}

\end{docKey}

\begin{docKey}{restate-keys}
  {=\marg{list of keys}}
  {initially unset}
Allows passing different keys to the restated theorem.
At the moment this is only useful with the \refKey{note} key.

\begin{keythmscode}[]
\begin{theorem}[
  store=rktest,
  note=ORIGINAL,
  restate-keys={note=RESTATED}]
Wow, yet another theorem.
\end{theorem}
\getkeytheorem{rktest}
\end{keythmscode}

\end{docKey}

\begin{docKey}{listhack}
  {=\docValue*{true}\textbar\docValue*{false}}
  {initially |false|}
Meant only to be used with the \refKey{break} style key for a theorem starting with a list.
Compare:

\begin{tcbwritetemp}
\newkeytheoremstyle{breaksty}{break}
\newkeytheorem{observation}[style=breaksty]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{observation}
\begin{enumerate}
\item First item
\end{enumerate}
\end{observation}

\begin{observation}[listhack=true]
\begin{enumerate}
\item First item
\end{enumerate}
\end{observation}
\end{keythmscode}

Note that the value |true| must be explicitly set so that |listhack| is not interpreted as the note text.
\end{docKey}

\begin{docKey}[][doc label=thm/seq]{seq}
  {=\meta{name}}
  {initially unset}
Adds the theorem to a custom sequence \meta{name} that can then be listed with \cs{listofkeytheorems}\bracks{seq=\meta{name}}.
See \refKey{listof/seq} for more details.
\end{docKey}

\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}.
For more description, see the \href{https://ctan.org/pkg/thmtools}{\pkg{thmtools}} package.

\begin{docKey}[][doc label=thm/name]{name}
  {=\meta{display name}}
  {initially title-cased \meta{env name}}
Aliases \docAuxKey{heading} and \docAuxKey{title}.

\begin{tcbwritetemp}
\newkeytheorem{mythm}[name=Some Name]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{mythm}
Some text
\end{mythm}
\end{keythmscode}

\end{docKey}

\begin{docKey}{numbered}
  {=\docValue*{true}\textbar\docValue*{false}\textbar \docValue{unless-unique}}
  {default |true|, initially |true|}
For compatibility with \pkg{thmtools}, also accepts the values \docValue*{yes}, \docValue*{no}, and \docValue*{unless unique}.

\begin{tcbwritetemp}
\newkeytheorem{theorem*}[name=Theorem, numbered=false]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{theorem*}
An unnumbered theorem.
\end{theorem*}
\end{keythmscode}

\end{docKey}

\begin{docKey}{parent}
  {=\meta{counter}}
  {initially unset}
Aliases \docAuxKey{numberwithin} and \docAuxKey{within}.

\begin{tcbwritetemp}
\newkeytheorem{conjecture}[parent=section]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{conjecture}
The first number is the section.
\end{conjecture}
\end{keythmscode}

\end{docKey}

\begin{docKey}{sibling}{=\meta{counter}}{initially unset}
Aliases \docAuxKey{numberlike} and \docAuxKey{sharenumber}.

\begin{tcbwritetemp}
\newkeytheorem{lemma}[sibling=theorem]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{lemma}
This shares its counter with \texttt{theorem}.
\end{lemma}
\end{keythmscode}

\end{docKey}

\begin{docKey}{style}
  {=\meta{style name}}
  {initially unset}
Accepts any \meta{style name} defined by \refCom{newkeytheoremstyle}, as well as any of the predefined \pkg{amsthm} styles: \docValue{plain}, \docValue{definition}, and \docValue{remark}.

\begin{tcbwritetemp}
\newkeytheorem{remark}[style=remark]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{remark}
Some text
\end{remark}
\end{keythmscode}

\end{docKey}

\begin{docKeys}[
  doc parameter = {=\meta{code}},
  doc description = initially unset,
  ]
  {
    { doc name = preheadhook },
    { doc name = postheadhook },
    { doc name = prefoothook },
    { doc name = postfoothook },
  }
Details in \autoref{keythms-hooks}.

\begin{tcbwritetemp}
\newkeytheorem{test}[
  preheadhook=PREHEAD,
  postheadhook=POSTHEAD,
  prefoothook=PREFOOT,
  postfoothook=POSTFOOT
]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{test}
Some text
\end{test}
\end{keythmscode}

\end{docKeys}

\begin{docKey}{qed}
  {\colOpt{=\meta{symbol}}}
  {default \cs{qedsymbol}, initially unset}
Adds \colOpt{\meta{symbol}} to the end of the theorem body.
If no value is given, the symbol \qedsymbol{} 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}}
If a single string, then the name used by \pkg{hyperref}'s \cs{autoref} and \pkg{cleveref}'s \cs{cref}.
If two strings separated by a comma, then the second string is the plural form used by \cs{cref}.
\end{docKey}

\begin{docKey}{Refname}
  {=\meta{ref name} \textrm{or} \brackets{\meta{singular name},\meta{plural name}}}
  {initially \meta{display name}}
Same as \refKey{refname} but for \docAuxCommand{Autoref} and \cs{Cref}.
Note that \cs{Autoref} is defined by \pkg{keytheorems}, but requires \pkg{hyperref} to work.
As with \cs{autoref}, there is also a starred version \docAuxCommand{Autoref*} that suppresses the hyperlink.

\begin{tcbwritetemp}
\newkeytheorem{prop}[
  name=Proposition,
  refname={proposition,propositions},
  Refname={Proposition,Propositions}
  ]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{prop}[label=abc]
Some text
\end{prop}
\begin{prop}[label=def]
Some more text
\end{prop}
\begin{theorem}
Consider \cref{abc,def}. \Autoref{abc} \dots
\end{theorem}
\end{keythmscode}

\end{docKey}

\subsection{Keys added by \pkg{keytheorems}} \label{thm-added-keys}

\begin{docKeys}[doc parameter={=\meta{length}}]
  {
    { doc name=leftmargin },
    { doc name=rightmargin },
  }
Sets the left (respectively, right) margin of the theorem relative to the text width.
This sets the theorem apart from the text, similar to a block quote. Code adapted from Enrico Gregorio's \TeX{} Stack Exchange answers:
\begin{itemize}
	\item \href{https://tex.stackexchange.com/a/67251/208544}{How to change margins in enunciation (theorem-like environment)?}
	\item \href{https://tex.stackexchange.com/a/236407/208544}{A theoremstyle with complete indentation using amsthm}
\end{itemize}
\begin{tcbwritetemp}
\newcommand{\marginthmtext}{%
  We need some text to show off theorems with margins. }
\newkeytheorem{quotethm}[
  name=Quote Theorem,
  leftmargin=1cm, rightmargin=1cm]
\newkeytheorem{indentedthm}[name=Indented Theorem, leftmargin=1cm]
\end{tcbwritetemp}

\newcommand{\marginthmtext}{We need some text to show off theorems with margins. }
\begin{keythmscode}[withpreamble]
\marginthmtext\marginthmtext\marginthmtext

\begin{quotethm}
\marginthmtext\marginthmtext\marginthmtext
\end{quotethm}

\marginthmtext\marginthmtext\marginthmtext

\begin{indentedthm}
\marginthmtext\marginthmtext\marginthmtext
\end{indentedthm}
\end{keythmscode}

\end{docKeys}

\begin{docKey}{tcolorbox}
  {\colOpt{=\marg{tcolorbox options}}}
  {initially unset}
This key specifies that the theorem be placed inside a tcolorbox environment with \colOpt{\meta{options}}.
The theorem head is typeset as a tcolorbox title; to avoid this see \refKey{tcolorbox-no-titlebar}.

\begin{tcbwritetemp}
\tcbset{
  defstyle/.style={
    arc=0mm,
    colback=blue!5!white,
    colframe=blue!75!black
    },
  }
\newkeytheorem{corollary}[tcolorbox]
\newkeytheorem{definition}[style=definition, tcolorbox={defstyle}]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{corollary}
Some text
\end{corollary}
\begin{definition}[A nice definition]
Some more text
\end{definition}
\end{keythmscode}

\end{docKey}

\begin{docKey}{tcolorbox-no-titlebar}
  {\colOpt{=\marg{tcolorbox options}}}
  {initially unset}
Same usage as \refKey{tcolorbox} but the theorem head is typeset as usual, not as a tcolorbox title.

\begin{tcbwritetemp}
\newkeytheorem{boxcor}[
  tcolorbox-no-titlebar={colback=red!10},
  name=Corollary, sibling=corollary
  ]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{boxcor}
Some text
\end{boxcor}
\end{keythmscode}

\end{docKey}

\pkg{tcolorbox} offers its own comprehensive \texttt{theorems} library. If all of your theorems are to be tcolorboxes, I highly recommend using it instead of this package! However, if only some of your theorems will use a tcolorbox, you may want to replicate the styles of \cs{NewTcbTheorem}. Here is an example that emulates \pkg{tcolorbox}'s \texttt{standard} theorem style.

\begin{tcbwritetemp}
\tcbset{
  thmstyle/.style={
    colback=green!5,
    colframe=green!35!black},
  }
\newkeytheoremstyle{tcb-standard}{
  tcolorbox=thmstyle,
  headpunct={},
  notebraces={}{},
  noteseparator={: },
  notefont=\bfseries,
  bodyfont=\normalfont,
  }
\newkeytheorem{mytheo}[
  name=My Theorem,
  style=tcb-standard]
\end{tcbwritetemp}

\begin{keythmscode}[withpreamble]
\begin{mytheo}[This is my title]
Some theorem text
\end{mytheo}
\end{keythmscode}

\section{Theorem styles}
\label{thmstyles}

\begin{docCommand}{newkeytheoremstyle}
  {\marg{name}\marg{options}}
This is \pkg{keytheorems}' version of \pkg{thmtools}' \cs{declaretheoremstyle}.
Since it makes little sense to define a style with no keys, we've made the \meta{options} argument mandatory.
Note that unlike \pkg{amsthm}'s \cs{newtheoremstyle}, this command will error if a style has already been defined.
To overwrite an existing style, there is the analogous \docAuxCommand{renewkeytheoremstyle}.
For completeness, there are also \docAuxCommand{providekeytheoremstyle} and \docAuxCommand{declarekeytheoremstyle}.

The defined style can be used with either the \refKey{style} key or the traditional \cs{theoremstyle}.
\end{docCommand}

\begin{notebox}
For the AMS classes \cls{amsart}, \cls{amsbook}, and \cls{amsproc}, as well as the \cls{amsart}-based \cls{acmart} and \cls{aomart}, the initial key values are slightly different than what's below in order to match those class's defaults. See \autoref{class-support} for details.
\end{notebox}

\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}{bodyfont}
  {=\meta{font declarations}}
  {initially \cs{itshape}}

\end{docKey}

\begin{docKey}{break}
  {}
  {initially unset}
Do not use this with the \refKey{postheadspace} key.
\end{docKey}

\begin{docKey}{headfont}
  {=\meta{font declarations}}
  {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|}

\end{docKey}

\begin{docKey}{headpunct}
  {=\meta{code}}
  {initially \ttbraces{.}}

\end{docKey}

\begin{docKey}{notebraces}
  {=\marg{left brace}\marg{right brace}}
  {initially \ttbraces{(}\ttbraces{)}}

\end{docKey}

\begin{docKey}{notefont}
  {=\meta{font declarations}}
  {initially \cs{fontseries}\cs{mddefault}\cs{upshape}}

\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}{spaceabove}
  {=\meta{length}}
  {initially \cs{topsep}}

\end{docKey}

\begin{docKey}{spacebelow}
  {=\meta{length}}
  {initially \cs{topsep}}

\end{docKey}

\begin{notebox}
With \refKey{tcolorbox} and \refKey{tcolorbox-no-titlebar}, the \refKey{spaceabove} and \refKey{spacebelow} keys are internally passed to \pkg{tcolorbox}'s \texttt{before skip} and \texttt{after skip}. When no explicit \texttt{spaceabove} or \texttt{spacebelow} values are given, \pkg{tcolorbox} defaults are used instead of \cs{topsep}.
\end{notebox}

\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}
The code inserted before the note, and printed only if there is a note. This is executed \emph{before} the font commands set by \refKey{notefont} take effect.
\end{docKey}

\begin{docKey}{numberfont}
  {=\meta{font declarations}}
  {initially |\upshape|}
For almost all theorem styles, it is recommended that you \emph{do not} change this setting.
\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.
At the start of the next run, this file is input at the beginning of the document and allows you to retrieve the stored theorems at any point, before or after the original theorem.

\begin{docCommand}{getkeytheorem}
  {\oarg{property}\marg{tag}}
Retrieves the theorem given the key |store=|\meta{tag} or |store*=|\meta{tag}.
An optional \meta{property} can be given to retrieve only the corresponding part of the theorem.
Currently only the property |body| is implemented, which retrieves the (unformatted) body of the theorem.

\begin{keythmscode}[]
\getkeytheorem{mytag}

\begin{example}[store=mytag]
Fascinating example.
\end{example}

\getkeytheorem[body]{mytag}
\end{keythmscode}

\end{docCommand}

\begin{docCommands}
  {
    {
      doc name = IfRestatingTF,
      doc parameter=\marg{true code}\marg{false code}
    },
    {
      doc name = IfRestatingT,
      doc parameter=\marg{true code}
    },
    {
      doc name = IfRestatingF,
      doc parameter=\marg{false code}
    }
  }
Executes \meta{true code} if being retrieved with \refCom{getkeytheorem} and \meta{false code} if in the original theorem. This is reversed if \texttt{store*} is used.

\begin{keythmscode}[]
\begin{example}[store=hmm]
I am the
\IfRestatingTF{restated}{original}
example!
\end{example}

\getkeytheorem{hmm}
\end{keythmscode}

\end{docCommands}

\section{Listing theorems}
\label{listingthms}

\begin{docCommand}{listofkeytheorems}
  {\oarg{options}}
Similar to \cs{listoffigures} or \cs{listoftables} but for theorems.
For \cls{memoir} and the AMS classes, \pkg{keytheorems} tries to copy the formatting of these commands as defined by the class.
For other classes, manual adjustments to \refKey{numwidth} and \refKey{indent} may be necessary.
\end{docCommand}

\begin{docCommand}{keytheoremlistset}
  {\marg{options}}

\end{docCommand}

\begin{keythmscode}[]
\listofkeytheorems
\end{keythmscode}

\subsection{Keys also defined in \pkg{thmtools}}

\begin{docKey}{ignore}
  {=\marg{comma-list of env names}}
  {initially unset}

\end{docKey}

\begin{docKey}{ignoreall}
  {}
  {initially unset}
  
\begin{keythmscode}[]
\listofkeytheorems[ignoreall,show=theorem]
\listofkeytheorems[
  ignoreall, show=conjecture,
  title=List of Conjectures
  ]
\end{keythmscode}

\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}

\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}}
Defaults to ``List of Theorems'' if English or an unknown language is used.
Currently French, German, Italian, Portuguese, and Spanish have (likely inaccurate!) translations.
A translation can be added with a GitHub pull request or manually with
\begin{center}
\cs{DeclareTranslation}\marg{lang}\ttbraces{keythms\string_listof\string_title}\marg{text}.
\end{center}
\end{docKey}

\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}

\begin{docKey}{indent}
  {=\meta{length}}
  {initially |1.5em|}
Sets the left indent of items in the list of theorems.
For \cls{memoir} and the AMS classes, the indent is initially |0pt|.
It is not recommended to change this unless your class has different defaults not already covered.
\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.
\end{docKey}

\begin{docKey}{chapter-skip-length}
  {=\meta{length}}
  {initially |10pt|}
Controls the amount of space inserted between chunks.
\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.
\end{docKey}

\begin{docKey}{no-title}
  {\colOpt{=true\textbar false}}
  {initially |false|}
Suppresses the title of the list of theorems.
Useful for custom ordering of the list.

\begin{keythmscode}[]
\keytheoremlistset{ignoreall}
\listofkeytheorems[show=example]
\listofkeytheorems[show=solution, no-title]
\end{keythmscode}

\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)}}
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}
Instead of listing the theorem headings, the theorems are restated with their body text.
Not very useful without the \refKey{store-all} load-time option.
\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.
\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}.
\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.

\begin{notebox}
You \emph{must} use these commands rather than the aforementioned because the |.thlist| file is also used to define restated theorems and cannot contain unexpected code.
\end{notebox}

\begin{docCommand}{addtheoremcontentsline}
  {\marg{level}\marg{text}}

\end{docCommand}

\begin{docCommand}{addtotheoremcontents}
  {\marg{code}}

\end{docCommand}

\section{Theorem hooks} \label{keythms-hooks}

\begin{docCommand}{addtotheoremhook}
  {\oarg{env name}\marg{hook name}\marg{code}}
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:

\begin{center}
  \small
  \tcbset{
    nobeforeafter,
    tikznode,
    tcbox width=forced center,
    width=1.85cm,
    tcbox raise=-0.4cm,
    size=fbox,
    after=\;$\rightarrow$
    }
  \tcbox{\meta{env name}\\ \hook{prehead}}
  \tcbox{generic\\ \hook{prehead}}
  \tcbox[width=3.25cm,tcbox raise=-0.2cm]{\cs{begin}\brackets{\meta{env name}}}
  \tcbox{\meta{env name}\\ \hook{posthead}}
  \tcbox[after={}]{generic\\ \hook{posthead}}
  \\[2ex]
  \tcbset{before=$\rightarrow$\;}
  \tcbox[width=2.25cm,tcbox raise=-0.2cm]{\meta{theorem body}}
  \\[2ex]
  \tcbset{after={}}
  \tcbox[before={}]{generic\\ \hook{prefoot}}
  \tcbox{\meta{env name}\\ \hook{prefoot}}
  \tcbox[width=3.25cm,tcbox raise=-0.2cm]{\cs{end}\brackets{\meta{env name}}}
  \tcbox{generic\\ \hook{postfoot}}
  \tcbox{\meta{env name}\\ \hook{postfoot}}
\end{center}
The \hook{restated} hook is applied at the start of theorems retrieved with 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
\begin{dispListing}
\addtotheorempostfoothook{A}
\addtotheorempostfoothook{B}
\end{dispListing}
results in |BA| after the theorem.
With \pkg{keytheorems}, code is added in the order declared, meaning
\begin{dispListing}
\addtotheoremhook{postfoot}{A}
\addtotheoremhook{postfoot}{B}
\end{dispListing}
results in |AB| after the theorem.
This is the behavior of the \LaTeX{} kernel hooks that \pkg{keytheorems} uses under the hood.

Code added using the hook keys \refKey{preheadhook}, etc. is outermost, meaning executed first in \hook{prehead} and \hook{posthead} and last in \hook{prefoot} and \hook{postfoot}.
\end{docCommand}

\section{Miscellaneous notes}

\subsection{\cls{beamer} support}

The package contains some \emph{highly experimental} code to support theorems with \cls{beamer}, including overlays.
Most style keys are disabled by the |default| \cls{beamer} theorem template.
More become functional by setting
\begin{dispListing}
\setbeamertemplate{theorems}[ams style]
\end{dispListing}
in the preamble.
Alternatively, you have full control of theorems by setting the class option |noamsthm|.

Note that by default \cls{beamer} defines a set of theorems when the class is loaded.
These can be overwritten with \refCom{renewkeytheorem} or disabled entirely with the |notheorems| class option.

Due to complications with overlays, writing contents of theorems to the |thlist| file is disabled. This means theorems can only be restated \emph{after} their original statement. Furthermore, \refCom{listofkeytheorems} is disabled and a warning issued if used.

User feedback is necessary to make this code fully compatible. Please report issues on the \href{https://github.com/mbertucci47/keytheorems/issues}{Github page}!

\subsection{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}, 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}.

\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.
Explicitly not supported are the \refKey{tcolorbox} and \refKey{tcolorbox-no-titlebar} keys.
There is only partial support for \refKey{leftmargin} and \refKey{rightmargin}, namely only the latter works.

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{docCommand}{l_keythms_thmuse_envname_tl}{}
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{docCommand}

\begin{docKeys}[doc no index,color key=black]
  {
    {
      doc name=keytheorems/allthms/\textmd{\meta{hook name}},
      doc label=allthms-hook,
    },
    {
      doc name=keytheorems/\textmd{\meta{envname}}/\textmd{\meta{hook name}},
      doc label=envname-hook,
    }
  }
These are the ``real'' names for the hooks described in \autoref{keythms-hooks}.
They can be useful with \cs{AddToHookNext} or the kernel's label mechanism for hooks.
\end{docKeys}

\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/main/tests/keytheorems-amsthmtest.tex}{\texttt{keytheorems-amsthmtest.tex}}.

%\section{Implementation}
%\inputminted[linenos,style=bw]{latex}{../keytheorems.sty}

\printindex

\end{document}