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
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
|
%\iffalse
% proof-at-the-end.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
% -author "Léo Colisson"
% -doc "../doc/proof-at-the-end_doc.tex"
% -src "proof-at-the-end\.sty=>proof-at-the-end.sty"
% -dir "/tmp/proof-at-the-end/"
% proof-at-the-end
% Created on 2022/8/24 17:25
%\fi
%\iffalse
%<*package>
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%</package>
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
% Copyright (C) 2022 Léo Colisson, all rights reserved.
% \fi
% \iffalse
%<*driver>
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
pdftitle={Proof-at-the-end, or how to move proofs in appendix in LaTeX},
pdfauthor={Léo Colisson},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\newenvironment{Shaded}{}{}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\title{Proof-at-the-end, or how to move proofs in appendix in LaTeX}
\author{Léo Colisson}
\date{}
\begin{document}
\DocInput{proof-at-the-end.dtx}
\end{document}
%</driver>
%\fi
%\maketitle
%
%{
%\setcounter{tocdepth}{3}
%\tableofcontents
%}
%WARNING: this package is definitely usable, but may not be as tested and
%stable as standard packages. Note also that it may change a bit in the
%future, but we will of course try to avoid as much as possible backward
%incompatibilities. To ensure your document won't change when the package
%get updates, it is always safer to copy the
%\texttt{proof-at-the-end.sty} file at the root of your project.
%
%\hypertarget{introduction}{%
%\section{Introduction}\label{introduction}}
%
%This package aims to provide a way to easily move proofs in the
%appendix. You can:
%
%\begin{itemize}
%\tightlist
%\item
% Move proofs in different places/sections by giving different
% ``categories'' to the theorems
%\item
% Create links from theorem to proof, and from proof to theorem (and
% configure the text)
%\item
% Restate the theorem in appendix (or before)
%\item
% Choose what you want to keep in the main text or in appendix (you can
% put in appendix either everything, just the proof, the theorem and the
% proof by keeping (or not) a copy in the body of the article\ldots)
%\item
% Duplicate the proof in appendix and in the current section, practical
% to use synctex during the proof writting
%\item
% Add text that would appear only in the appendix (or in both body and
% appendix)
%\item
% Easily change the defaults, and create your own styles/environments
%\item
% Include sketch of proof in the main text, and full proof in appendix
%\item
% Change the text of the link, for example to translate into another
% language
%\item
% Have a nice environment-based commands in order to mimic the usual
% theorem/proof structure.
%\item
% Separate the main article and the body in two documents (some journals
% may ask for a separate file for the appendix)
%\end{itemize}
%
%NB: This project is hosted on github at
%\url{https://github.com/leo-colisson/proof-at-the-end} . Feel free to
%contribute, report bugs, or read/copy-paste the documentation/examples
%from there.
%
%Disclaimer: This package is still in beta and not considered as stable.
%
%This package is licensed under LPPL v1.3, and the last version of this
%package on CTAN is 2022/08/24.
%
%\hypertarget{demo}{%
%\section{Demo}\label{demo}}
%
%If you just want to see an example of what you can do, you can directly
%open the file \texttt{demo.pdf} (also available online at
%\url{https://github.com/leo-colisson/proof-at-the-end/raw/master/demo.pdf})
%to see what is possible, or generate it with
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{git}\NormalTok{ clone https://github.com/leo{-}colisson/proof{-}at{-}the{-}end.git}
%\ExtensionTok{pdflatex}\NormalTok{ demo.tex }\KeywordTok{\&\&} \ExtensionTok{pdflatex}\NormalTok{ demo.tex}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{quickstart}{%
%\section{Quickstart}\label{quickstart}}
%
%\hypertarget{super-quick-quickstart}{%
%\subsection{Super Quick QuickStart}\label{super-quick-quickstart}}
%
%If \texttt{proof-at-the-end} it's not installed in your CTAN
%distribution, copy the
%\href{https://github.com/leo-colisson/proof-at-the-end/}{\texttt{proof-at-the-end.sty}
%file} in your project. Then, in your project, create new theorem/lemma
%environments (using any tool you like, like asmthm, ntheorem and
%thmtools), load the library using
%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}}
%(note that you need the version 2022/01/28 to have
%\texttt{createShortEnv} defined, otherwise you need to use directly
%\texttt{theoremEnd}) and write your theorem using:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]}
%\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ And I am a proof.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%The options (here \texttt{restate} and \texttt{end}) tells what should
%go in appendix, how to configure the links\ldots{} Here the proof should
%go in appendix, and the \texttt{restate} options states that the theorem
%should be restated before the proof. Note that in case you don't want
%any title but do want to add options, make sure to insert an empty pair
%of brackets like in
%\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}end,\ text\ link={]}} (the
%option \texttt{text\ link} is used to choose the text of the link to the
%proof, writting \texttt{text\ link=} is used to display no link at all).
%
%You can find below a full example to compile which should produce this
%output (sorry, this is a screenshot, that way I can export it easily in
%the github page). Just make sure to compile twice to get references.
%
%\begin{figure}
%\centering
%\includegraphics{screenshot.png}
%\caption{Screenshot of the quickstart}
%\end{figure}
%
%You can directly copy them (with a more complete demo) in the github
%page here https://github.com/leo-colisson/proof-at-the-end/.
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}documentclass}\NormalTok{\{}\ExtensionTok{article}\NormalTok{\}}
%
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{xparse}\NormalTok{\} }\CommentTok{\% Not needed with recent LaTeX}
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amsthm}\NormalTok{\}}
%
%\CommentTok{\% Create new theorems, or use ntheorem/thmtools/...}
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]}
%\CommentTok{\% Default uses autoref, but you can also use cleveref, see the documentation.}
%\CommentTok{\% Say to autoref that "thm" are Theorems.}
%\FunctionTok{\textbackslash{}newcommand}\NormalTok{\{}\ExtensionTok{\textbackslash{}thmautorefname}\NormalTok{\}\{Theorem\}}
%
%\CommentTok{\%\% Load the library. createShortEnv automatically creates the shortcuts}
%\CommentTok{\%\% thmE, theoremE, lemmaE, propositionE, corollaryE, proofE. See \textbackslash{}newEndThm for more details.}
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Theorems\}}
%
%\CommentTok{\%\% If you don\textquotesingle{}t have any title, leave an empty bracket like \textbackslash{}begin\{thmE\}[][end]}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]}
%\NormalTok{ I am a theorem}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ And I am a proof.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Proofs\}}
%\FunctionTok{\textbackslash{}printProofs}
%
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{install}{%
%\subsection{Install}\label{install}}
%
%If your CTAN distribution is recent enough, you have nothing to do (if
%you are using overleaf, note that you can configure your project to use
%a more recent TexLive distribution: this packages is included starting
%from TexLive 2019). Otherwise if it's not yet in your CTAN distribution,
%first download the \texttt{proof-at-the-end.sty} file and insert it in
%the root of your project with the following commands on unix (you can
%also clone this repository if you prefer, or just manually download or
%copy/paste the files on Windows).
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}}
%\VariableTok{repopratend}\OperatorTok{=}\StringTok{"https://raw.githubusercontent.com/leo{-}colisson/proof{-}at{-}the{-}end"}
%\FunctionTok{wget} \VariableTok{$\{repopratend\}}\NormalTok{/master/proof{-}at{-}the{-}end.sty}
%\end{Highlighting}
%\end{Shaded}
%
%It also requires a recent version of xparse (not present in TexLive 2018
%and before basically), otherwise you will get an error like:
%
%\begin{verbatim}
%Unknown argument type 'b' replaced by 'm'
%\end{verbatim}
%
%While
%\href{https://raw.githubusercontent.com/leo-colisson/proof-at-the-end/c2150f4feba4709d47e43c00e5f8eb93ce345cab/xparse.sty}{we
%used to provide} for simplicity a \texttt{xparse.sty} file (version
%\texttt{2018-04-12}) in older versions of this repository, we removed it
%to
%\href{https://github.com/leo-colisson/proof-at-the-end/issues/6}{avoid
%license issues and conflicts with recent LaTeX distributions that
%already include xparse}. Nevertheless, if you are using an older
%distribution, you can also download \texttt{xparse} manually
%\href{http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip}{here},
%unzip it, and copy the \texttt{.sty} files contained in
%\texttt{tex/latex/l3packages/xparse/} at the root of your project. On
%linux, you can do that via:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}}
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip}
%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3packages.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3packages/xparse/*\textquotesingle{}}
%\FunctionTok{rm} \AttributeTok{{-}f}\NormalTok{ l3packages.tds.zip xparse.ltx}
%\end{Highlighting}
%\end{Shaded}
%
%If you have an old distribution of LaTeX (2017 or before basically), you
%may also need a
%\href{https://tex.stackexchange.com/questions/489646/expl3-and-recent-xparse-on-overleaf-no-expl3-loader-detected/489649?noredirect=1\#comment1236409_489649}{more
%recent expl3} or you will get an error like:
%
%\begin{verbatim}
%Package xparse Error: Support package l3kernel too old.
%\end{verbatim}
%
%To install it, download the zip files
%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip}
%and
%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip}
%(\texttt{l3backend} is
%\href{https://tex.stackexchange.com/questions/499082/file-l3backend-pdfmode-def-not-found-when-loading-expl3}{since
%July 1st, 2019} a dependency of l3kernel), unzip, and copy the content
%of the directories \texttt{tex/latex/l3kernel/} (first archive) and
%\texttt{tex/latex/l3backend/} (second archive) into your project. On
%linux it's a matter of two commands in your project:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}}
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip}
%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3kernel.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3kernel/*\textquotesingle{}}
%\FunctionTok{rm}\NormalTok{ l3kernel.tds.zip}
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip}
%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3backend.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3backend/*\textquotesingle{}}
%\FunctionTok{rm}\NormalTok{ l3backend.tds.zip}
%\end{Highlighting}
%\end{Shaded}
%
%If you don't want to pollute your main project with all these files, you
%may be interested to put them in a subfolder and update the environment
%variable \texttt{TEXINPUTS} or, if you use latexmk or overleaf, you can
%write instead a \texttt{latexmkrc} file as explained
%\href{https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_.cls,_.sty,_.bst_files,_and_I_want_to_put_them_in_a_folder_to_keep_my_project_uncluttered._But_my_project_is_not_finding_them_to_compile_correctly}{here}.
%
%If you still have errors, it's likely that your LaTeX distribution is
%just too old (LaTeX 2016 seems to be too old to install a recent l3exp).
%So just upgrade to a decent version, and you should not have any
%troubles anymore.
%
%You can test your install by compiling the \texttt{demo.tex} file
%present in the repository. When it compiles, you are ready to start!
%
%\hypertarget{use-in-your-project}{%
%\subsection{Use in your project}\label{use-in-your-project}}
%
%Now, you can load the library in your project by simply using:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Then, you can configure your theorem/lemma/\ldots{} environments as
%usual, by using any counter you like\ldots:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amssymb, amsthm, amsmath}\NormalTok{\}}
%\CommentTok{\% Theorems}
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]}
%\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{thm*\}\{Theorem\}}
%\FunctionTok{\textbackslash{}providecommand*\textbackslash{}thmautorefname}\NormalTok{\{Theorem\}}
%\CommentTok{\% Lemmata}
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{lemma\}[thm]\{Lemma\}}
%\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{lemma*\}\{Lemma\}}
%\FunctionTok{\textbackslash{}providecommand*\textbackslash{}lemmaautorefname}\NormalTok{\{Lemma\}}
%\end{Highlighting}
%\end{Shaded}
%
%And inside your document, you can use the following syntax to create a
%new theorem:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[OPTIONS]\{THEOREM ENVIRONMENT\}[OPTIONAL TITLE]}
%\NormalTok{ YOUR THEOREM, with eventually labels like }\KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:OPTIONAL LABEL}\NormalTok{\}}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\} }\CommentTok{\%\% Optional environment}
%\NormalTok{ YOUR (OPTIONAL) PROOF}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%For example:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}\{thm\}[Yes I can have a title]}
% \KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:ilikelabels}\NormalTok{\}}
%\NormalTok{ Creating a new theorem is easy}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ You want a proof? Here is it!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Since \texttt{theoremEnd} may be a bit verbose to use, we provide since
%the version 2022/01/28, an option: if you load the program using
%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}},
%you will automatically have the shortcut environments \texttt{proofE}
%(to replace \texttt{proof}), \texttt{thmE} (to replace \texttt{thm}),
%\texttt{theoremE} (to replace\ldots{} ok you got the pattern),
%\texttt{lemmaE}, \texttt{propositionE} and \texttt{corollaryE}. Note
%that it is your role to define the initial commands \texttt{thm}\ldots,
%but you don't need to define them all, only those that you use. Then,
%you can use them like:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]}
%\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ And I am a proof.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Finally, to display the proofs, just use
%\texttt{\textbackslash{}printProofs} where you like:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}printProofs}
%\end{Highlighting}
%\end{Shaded}
%
%If you would like to display a lemma instead, just change
%\texttt{\{thm\}} into \texttt{\{lemma\}}, or into any other theorem
%environment you defined! You can now compile safely your document ;)
%
%NB: if you want to make sure all the references are linked correctly,
%make sure to compile twice the document!
%
%Isn't it simple ?
%
%\hypertarget{a-note-on-hyperref}{%
%\subsection{\texorpdfstring{A note on
%\texttt{hyperref}}{A note on hyperref}}\label{a-note-on-hyperref}}
%
%An older version of the package explicitely loaded \texttt{hyperref}
%with no option, and an option clash could occur if the user wanted to
%add options to \texttt{hyperref}. We now push the loading to the very
%end to avoid that issue, but if you want to load packages \emph{after}
%\texttt{hyperref} (like \texttt{cleveref}), it is your job to include
%\texttt{hyperref}, for example by putting at the end of the preambule
%something like:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[colorlinks]\{}\ExtensionTok{hyperref}\NormalTok{\}}
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{cleveref}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{use-cases}{%
%\section{Use cases}\label{use-cases}}
%
%\hypertarget{configuration-and-how-to-use-and-create-styles}{%
%\subsection{Configuration and how to use and create
%styles}\label{configuration-and-how-to-use-and-create-styles}}
%
%You can very easily configure this package, and choose how each
%theorem/proof must be displayed by providing a value in
%\texttt{OPTIONS}. For example, if you would like to keep the proof of a
%theorem in the main text like any normal theorem, use the
%\texttt{normal} option.
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[normal]\{thm\}[A title]}
%\NormalTok{ You can easily turn a theorem back into a normal theorem!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ And keep the proof with you!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%If you loaded the package using
%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}}
%(starting from 2022/01/28), you also have preconfigured shortcuts for
%multiple environments, namely \texttt{proofE} (to replace
%\texttt{proof}), \texttt{thmE} (to replace \texttt{thm}),
%\texttt{theoremE} (to replace\ldots{} ok you got the pattern),
%\texttt{lemmaE}, \texttt{propositionE}, \texttt{propertyE},
%\texttt{factE} and \texttt{corollaryE}. This way, you can simplify the
%above as:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[A title][normal]}
%\NormalTok{ You can easily turn a theorem back into a normal theorem!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ And keep the proof with you!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%(You can of course remove the \texttt{{[}...{]}} containing the options
%and the title, however if you want to add options without any title,
%\textbf{make sure to use empty brackets for the title}, like
%\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}normal{]}}.
%
%Since 2022/01/28, you can also create new theorem environment that
%directly come with a preconfigured style (you may also find
%\texttt{\textbackslash{}pratendSetLocal} useful if you want to change
%the style in a whole section). For instance to create a
%\texttt{thmNormal} environment having the \texttt{normal} option and a
%\texttt{thmSpecial} environment having the
%\texttt{all\ end,\ category=mySpecial} options, just do:
%
%\begin{verbatim}
%\newEndThm[normal]{thmNormal}{thm} % 'thm' is the name of the existing thm environment
%\newEndThm[all end, category=mySpecial]{thmSpecial}{thm}
%\end{verbatim}
%
%This way, you can simply use
%\texttt{\textbackslash{}begin\{thmSpecial\}{[}Special\ title{]}\ ...\ \textbackslash{}end\{thmSpecial\}}
%to create a theorem going in the special category (see below). (you also
%have \texttt{\textbackslash{}newEndProof{[}options{]}\{newProofEnv\}} to
%define new proofs, but it is less useful as options are typically given
%in the theorem).
%
%The options are in fact a set of keys/values, thanks to
%\texttt{pgfkeys}. So you can combine them with comma separated list like
%that (order matters, as the right-most values may overwrite
%configuration set by left-most values):
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[proof at the end,}
%\NormalTok{ no link to proof,}
%\NormalTok{ text proof=\{Difficult proof\}}
%\NormalTok{ ]\{thm\}[A title]}
%\NormalTok{ Each theorem can have a custom configuration!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ Quite practical, isn\textquotesingle{}t it?}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%You can easily create your own styles like that:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/my great style/.style=\{}
%\NormalTok{ proot at the end,}
%\NormalTok{ no link to proof,}
%\NormalTok{ text proof=\{Difficult proof\},}
%\NormalTok{ \}}
%\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%You can also change the default configuration when you load the package
%by nesting the configuration into a \texttt{conf} key:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[conf=\{normal, one big link\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Note however that for now it is \emph{not} possible to use macros
%directly inside the options when you load the package, so if you need to
%use more complicated configuration, you can overwrite the
%\texttt{global\ custom\ defaults} style for global configuration, and
%the \texttt{local\ custom\ defaults} style for local configuration
%(useful for example if you want to define a category for a single
%section):
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/global custom defaults/.style=\{}
%\NormalTok{ one big link=\{Go to proof on page\textasciitilde{}}\FunctionTok{\textbackslash{}pageref*}\NormalTok{\{proof:prAtEnd}\FunctionTok{\textbackslash{}pratendcountercurrent}\NormalTok{\}\}}
%\NormalTok{ \}}
%\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%or, for short (needs version \textgreater{} 2022/02/04):
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pratendSetGlobal}\NormalTok{\{one big link="blabla"\}}
%\end{Highlighting}
%\end{Shaded}
%
%and for local configuration:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/local custom defaults/.style=\{}
%\NormalTok{ category=greattheorem}
%\NormalTok{ \}}
%\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%for short (needs version \textgreater{} 2022/02/04):
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pratendSetLocal}\NormalTok{\{category=greattheorem\}}
%\end{Highlighting}
%\end{Shaded}
%
%Then you can use like that:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title]}
%\NormalTok{ Here is a normal theorem with the proof in the main text.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ The (optional) proof}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title][end]}
%\NormalTok{ Here is a theorem whose proof goes to the end.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ The proof}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title][all end]}
%\NormalTok{ Here is a theorem that goes with the proof at the end.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\NormalTok{ The proof}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Note also that it is possible to give options to the \texttt{proofEnd}
%environment, but it is usually useless, as it will automatically pick
%the parameters from the last \texttt{theoremEnd} environment. However,
%if for some reasons you want to change the options of the proof only,
%you can do it, but do it as your own risks ;)
%
%\hypertarget{usual-styles}{%
%\subsection{Usual styles}\label{usual-styles}}
%
%We predefined some pretty common styles/options. The full list is at the
%end of this document, but here is a list of the most practical ones:
%
%\begin{itemize}
%\tightlist
%\item
% \texttt{normal}: turn the theorem into a ``normal'' theorem, with the
% proof in the main text and nothing in appendix
%\item
% \texttt{category=yourowncategory}: change the category of the theorem
% (see next sub-section)
%\item
% \texttt{end}: put the proof in appendix
%\item
% \texttt{all\ end}: put both the theorem and the proof in appendix
%\item
% \texttt{debug}: make sure the proof is written in the main text as
% well. Practical when you write the proof to be able to use synctex (if
% you use synctex with the proof in appendix, your will be unfortunately
% moved to a temporary file that this library is using\ldots{} so
% \textbf{make sure you don't modify the files named like
% \texttt{*prattheenddefaultcategory.tex} or all your changes will be
% lost at the next compilation}!).
%\item
% \texttt{one\ big\ link}: if you prefer to have a single big link
% instead of two links (one for the proof, one for the page)
%\item
% \texttt{one\ big\ link\ translated=Your\ translation}: to
% change/translate the text of the link easily
%\item
% \texttt{text\ link\ section}: put a link looking like ``See proof in
% section XX.''. You can use \texttt{text\ link=} to remove this link.
%\item
% \texttt{text\ link\ section\ full\ proof}: put a link looking like
% ``See full proof in section XX.''
%\item
% \texttt{text\ proof\ translated=Your\ translation}: to
% change/translate the text of the proof at the end easily
%\item
% \texttt{global\ custom\ defaults}: empty style that you can modify to
% change the configuration (globally)
%\item
% \texttt{local\ custom\ defaults}: empty style that you can modify to
% change the configuration (locally). Practical to set a category for a
% single section.
%\end{itemize}
%
%\hypertarget{categories-or-how-to-move-proofs-in-different-sections}{%
%\subsection{Categories, or how to move proofs in different
%sections}\label{categories-or-how-to-move-proofs-in-different-sections}}
%
%Let's imagine that you have some proofs that are easy to do, and some
%proofs that are long but interesting. You may want to put the easy
%proofs in a different place that the long proofs. It is super easy to
%do, you just need to give a category name to the option
%\texttt{category} like here:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[category=mylongproofs]\{thm\}[A title]}
%\NormalTok{ You can easily change the place of the proofs}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ Just use a different category name!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%and give this category name to \texttt{\textbackslash{}printProofs} in
%the section where you would like to display the proofs:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}printProofs}\NormalTok{[mylongproofs]}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{comments}{%
%\subsection{Comments}\label{comments}}
%
%You can also move some text in the appendix by using:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}textEnd}\NormalTok{\{Your text that should go in appendix\}}
%\end{Highlighting}
%\end{Shaded}
%
%You can also give it a category as explained above, or configure it to
%be displayed in both the main text and at the end of the file with:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}textEnd}\NormalTok{[both]\{I am a comment that is written in both the main text}
%\NormalTok{and the appendix\}}
%\end{Highlighting}
%\end{Shaded}
%
%You can also use the environment notation like that:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{textAtEnd}\NormalTok{\}[options]}
%\NormalTok{ You can also use the environment syntax.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{textAtEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{restate-a-theorem}{%
%\subsection{Restate a theorem}\label{restate-a-theorem}}
%
%It is easy to restate a theorem in the appendix, to have both the
%theorem in the main text and in the appendix: just use the option
%\texttt{restate}:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[end, restate]\{thm\}[A title]}
%\NormalTok{ This theorem will be displayed both in main text and appendix.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ Just use restate option.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%You can also use the option \texttt{restate\ command=yourcustomcommand}
%in order to create a macro \texttt{\textbackslash{}yourcustomcommand}
%that will restate the theorem wherever you want (but after the
%definition).
%
%If you want to (re)state a theorem \emph{before} its definition (say in
%the introduction), there is also a special environment
%\texttt{theoremEndRestateBefore} that requires a (unique) custom name
%that you need to provide also later on in place of the real theorem with
%the option \texttt{restated\ before}:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Introduction\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEndRestateBefore}\NormalTok{\}\{thm\}[Title]\{anamethatisusedtorestate\}}
%\NormalTok{ It is possible to state the theorem before}
%\NormalTok{ in the introduction, and restate it later}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEndRestateBefore}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Real definition\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[restated before]\{thm\}}
%\NormalTok{ anamethatisusedtorestate}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ Proof of the theorem, put in place of the theorem the unique name}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{translate-the-links}{%
%\subsection{Translate the links}\label{translate-the-links}}
%
%The more powerful way to change the text of the links is to redefine
%\texttt{text\ link} and \texttt{text\ proof} (see section List of
%options for more details). However we defined also some easy way to
%redefine the text using \texttt{one\ big\ link\ translated} and
%\texttt{text\ proof\ translated}. For example, to create your
%\texttt{french} style you can do:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/french/.style=\{}
%\NormalTok{ one big link translated=\{Voir preuve page\},}
%\NormalTok{ text proof translated=\{Preuve du\}}
%\NormalTok{ \}}
%\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{write-a-sketch-of-proof-in-the-main-text}{%
%\subsection{Write a sketch of proof in the main
%text}\label{write-a-sketch-of-proof-in-the-main-text}}
%
%You can include a sketch of proof in the main text by simply adding a
%proof in between \texttt{theoremEnd} and \texttt{proofEnd}. An alias
%option \texttt{see\ full\ proof} can also be used to change the link
%into ``See full proof on page X.'':
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[see full proof]\{thm\}}
%\NormalTok{ I can also write a sketch of proof, and put the full proof in appendix.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}}
%\NormalTok{ Hint: look at the alias options.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\NormalTok{ You just use \textasciigrave{}\textasciigrave{}see full proof\textquotesingle{}\textquotesingle{} as an option}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix}{%
%\subsection{Split the article in two documents, one for the main body
%and one for the
%appendix}\label{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix}}
%
%Since 2022/02/04, it is possible to include the appendix in a separate
%file. Internally, this library creates a new file having the form
%\texttt{NAME\_OF\_FILE-pratendNAME\_CATEGORY.tex} containing the proofs
%to include (then, \texttt{\textbackslash{}printProofs} only input that
%file). You can input that file from other files if you want to separate
%the body from the proof, but it won't work if you have restate theorems.
%You should use the option \texttt{external\ appendix} (starting from
%version 2022/02/04) to restate appropriately the theorem:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv,conf=\{external appendix\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Then, compile your main file and create a new file for the appendix,
%load the theorems environments as for the main file, in the preambule
%load the \texttt{xr} package to properly have references (otherwise you
%won't have the appropriate number for the theorems) using something
%like:
%
%\begin{verbatim}
%\usepackage{xr}
%\externaldocument{name_of_main_file_without_extension}
%\end{verbatim}
%
%and in this new document just add the appendix wherever you want:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}includeExternalAppendix}\NormalTok{\{name\_of\_main\_file\_without\_extension\}}
%\end{Highlighting}
%\end{Shaded}
%
%You can see an exemple in the github repository, with the two files
%\texttt{demo\_external\_appendix.tex} and
%\texttt{demo\_external\_appendix\_part2.tex}. Whenever your proofs
%change in the main paper, make sure to compile first the main document
%(so that the auxiliary file gets updated), and then compile the appendix
%document. Note that you can still use
%\texttt{\textbackslash{}printProofs} in the main document if you like
%(while writting your paper, it is certainly easier to keep the proofs
%and theorems in the same document).
%
%\hypertarget{list-of-options}{%
%\section{List of options}\label{list-of-options}}
%
%Here is the list of fundamental options supported. Most options have a
%\texttt{no} version, with \texttt{no} written before. Note that you may
%prefer to use directly the alias/styles (see next paragraph) as the
%options listed here are quite fundamental and atomic.
%
%\begin{itemize}
%\item
% \texttt{category}: category of the proof (if you want to put proofs at
% several places), can be anything
%\item
% \texttt{proof\ here}/\texttt{no\ proof\ here}: put (or not) the proof
% in the main text
%\item
% \texttt{proof\ end}/\texttt{no\ proof\ end}: display the proof in
% appendix
%\item
% \texttt{restate}/\texttt{no\ restate}: restate the theorem in appendix
%\item
% \texttt{link\ to\ proof}/\texttt{no\ link\ to\ proof}: Display a link
% to the proof in the main text
%\item
% \texttt{opt\ all\ end}/\texttt{no\ opt\ all\ end}: put the theorem and
% proof only in appendix. You may prefer the alias \texttt{all\ end},
% that also makes sure that the proof is indeed displayed in appendix.
%\item
% \texttt{text\ link}: text of the link to the proof, defaults to
%
% \texttt{\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}}
%\item
% \texttt{text\ proof}: text displayed in place of ``Proof'' in the
% appendix. Defaults to
% \texttt{\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}
%\item
% \texttt{restate\ command}: name of a unique macro (without backslash)
% that will be defined as an alias to restate the theorem wherever you
% want
%\item
% \texttt{restated\ before}: if the theorems has been stated before
% (with \texttt{\textbackslash{}theoremProofEndRestateBefore}), then we
% just need to put the restate command in place of the theorem, and
% enable this option
%\item
% \texttt{both}/\texttt{no\ both}: only for
% \texttt{\textbackslash{}textInAppendix}, specifies that the text must
% be present in both the main text and the appendix.
%\item
% \texttt{external\ appendix}: to ensure the appendix can be included in
% another file (see details above), starting from version 2022/02/04.
%\end{itemize}
%
%Here are all the alias/styles (you can create you own as well), they are
%practical to quickly define a behaviours, but are made of the basic
%options listed above:
%
%\begin{itemize}
%\tightlist
%\item
% \texttt{normal}: like a `normal' theorem, without any proof in the
% appendix, and with a proof displayed in the main text. Shortcut for
% \texttt{proof\ here,\ no\ all\ end,\ no\ proof\ end,\ no\ link\ to\ proof,\ no\ restate,\ no\ both}.
%\item
% \texttt{end}: theorems whose proof need to go in the appendix. Shorcut
% for \texttt{proof\ at\ the\ end,\ link\ to\ proof}.
%\item
% \texttt{all\ end}: makes sure both the theorem and the proof are in
% appendix. Alias of \texttt{end,\ opt\ all\ end}.
%\item
% \texttt{proof\ at\ the\ end}: theorems whose proof need to go in the
% appendix contrary to \texttt{end} it does not make sure that there is
% a link to the proof. Shorcut for
% \texttt{no\ proof\ here,\ no\ all\ end,\ proof\ end,\ no\ both}.
%\item
% \texttt{debug}: make sure the proof is written in the main text as
% well (alias of \texttt{proof\ here,\ no\ opt\ all\ end}), it is quite
% practical to use when you write a proof to be able to use synctex
% features to move between the pdf and the file.
%\item
% \texttt{no\ link\ to\ theorem}: Remove the link from the proof to the
% theorem, alias of \texttt{text\ proof=\{\textbackslash{}proofname\}}
%\item
% \texttt{stared} (or \texttt{no\ number}): when you use the stared
% version of a theorem you don't have any number, so cref fails to write
% a nice link to the theorem. This option changes the text of ``Proof'',
% by keeping the link but writting only \texttt{Proof}. Equivalent to
% \texttt{text\ proof=\{\textbackslash{}string\textbackslash{}mbox\{\textbackslash{}string\textbackslash{}hyperref{[}thm:prAtEnd\textbackslash{}pratendcountercurrent{]}\{\textbackslash{}proofname\}\}\}}
%\item
% \texttt{see\ full\ proof}: useful when you want to write in the main
% text only a sketch of proof, this alias writes a link
% \texttt{See\ full\ proof\ on\ page\ X.}. Equivalent to
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}}
%\item
% \texttt{one\ big\ link}: instead of two links, one for page, one for
% proof, put just one link around everything. It can also accept an
% optional argument which will be the text of the link, like
% \texttt{one\ big\ link=Go\ to\ the\ proof}. The default value is
% \texttt{See\ proof\ on\ page\textasciitilde{}\textbackslash{}pageref*\{proof:prAtEnd\textbackslash{}pratendcountercurrent.\}}.
%\item
% \texttt{one\ big\ link\ translated}: This is like
% \texttt{one\ big\ link}, but automatically add the page at the end
% (and a big link around). Practical to quickly define a translation
% like \texttt{one\ big\ link\ translated=Voir\ preuve\ page}. See also
% \texttt{text\ proof\ translated}.
%\item
% \texttt{text\ link\ section}: Put a link to the proof looking like
% ``See proof in section X''. Defaults to
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ in\ \textbackslash{}pratendSectionlikeCref.\}}
%\item
% \texttt{text\ link\ section\ full\ proof}: Put a link to the proof
% looking like ``See full proof in section X''. Defaults to
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ in\ \textbackslash{}pratendSectionlikeCref.\}}
%\item
% \texttt{default\ text\ link}: default text for the link to the proof,
% equivalent of
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}}
%\item
% \texttt{default\ text\ proof}: default text for the proof in appendix,
% equivalent of
% \texttt{text\ proof=\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}
%\item
% \texttt{text\ proof\ translated}: like \texttt{default\ text\ proof},
% but takes one argument and use it instead of \texttt{Proof\ of}.
% Example: \texttt{text\ proof\ translated=\{Preuve\ du\}}
%\item
% \texttt{text\ link\ external\ appendix}: style used to configure the
% text to display when the appendix is in an external file. Defaults to
% \texttt{text\ link=\{The\ proof\ is\ in\ the\ appendix.\}}.
%\item
% \texttt{external\ appendix}: useful when the the proofs are moved in
% an external file (read more above). In particular, it will ensure that
% normal theorems are used instead of restate since restate does not
% work across files. This will also apply
% \texttt{text\ link\ external\ appendix} to change the text
% accordingly.
%\item
% \texttt{only\ external\ appendix}: like \texttt{external\ appendix},
% but without changing the text.
%\item
% \texttt{bare\ defaults}: default style that is loaded before anything
% else that configure by default a link to the proof, put the proof in
% appendix, use the category \texttt{defaultcategory}. It is an alias of
% \texttt{end,\ link\ to\ proof,\ no\ restate,category=defaultcategory,\ default\ text\ link,default\ text\ proof,restate\ command=pratenddummymacro}.
%\item
% \texttt{configuration\ options}: style that contains the options used
% to load the package. It is called right after \texttt{bare\ defaults}.
% Note that you cannot insert macro in the options, overwrite
% \texttt{global\ custom\ defaults} instead
%\item
% \texttt{global\ custom\ defaults}: empty style that you can overwrite
% to change the global defaults
%\item
% \texttt{local\ custom\ defaults}: empty style that you can overwrite
% to change the ``local'' defaults, like category
%\item
% \texttt{all\ defaults}: all the defaults, equivalent of
% \texttt{bare\ defaults,\ configuration\ options,\ global\ custom\ defaults,\ local\ custom\ defaults}
%\end{itemize}
%
%\hypertarget{package-options}{%
%\section{Package options}\label{package-options}}
%
%The package comes with multiple options: - The
%\texttt{conf=\{CONFIGURATION\}} option is used to configure the default
%style. Usage:
%\texttt{\textbackslash{}usepackage{[}conf=\{normal,\ text\ link\ section\}{]}\{proof-at-the-end\}}
%- The \texttt{disablePatchSection} is useful to stop the library from
%patching the section-like commands and chapters (by default, we
%automatically add a \texttt{\textbackslash{}label} at the end of the
%section which is used by \texttt{text\ link\ section} to find the
%Appendix). If you enable this option, you can manually add the label by
%using \texttt{\textbackslash{}pratendAddLabel} after the appendix
%section (without any argument). - \texttt{commandRef=NAMECOMMAND}: By
%default, theorem are referenced to using
%\texttt{\textbackslash{}autoref\{\}}. You can change the value of
%\texttt{NAMECOMMAND} to use another command, like
%\texttt{commandRef=Cref} to use \texttt{\textbackslash{}Cref\{\}}. In
%that case, make sure to load both \texttt{hyperref} and
%\texttt{cleveref} (typically at the very end of your preambule) as
%\texttt{cleveref} needs to be loaded after \texttt{hyperref}.
%Internally, the library creates and uses
%\texttt{\textbackslash{}pratendRef} instead of
%\texttt{\textbackslash{}autoref}. - \texttt{createShortEnv}: creates
%(using \texttt{newEndThm} and \texttt{newEndProof}) the shortcut
%environments \texttt{proofE} (to replace \texttt{proof}), \texttt{thmE}
%(to replace \texttt{thm}), \texttt{theoremE} (to replace\ldots{} ok you
%got the pattern), \texttt{lemmaE} and \texttt{corollaryE}. Note that it
%is still your job to define the \texttt{thm}, \texttt{lemma}
%environments.
%
%\hypertarget{troubleshooting}{%
%\section{Troubleshooting}\label{troubleshooting}}
%
%Here are some common issues you may have, with explainations to solve
%them.
%
%\hypertarget{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.}{%
%\subsection{The link after the proof does not mention the section, but
%something else (an equation, a figure,
%etc.)}\label{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.}}
%
%Sometimes, you may see something like
%\texttt{See\ proof\ in\ Equation\ A} instead of
%`\texttt{See\ proof\ in\ Appendix\ A}. This issue
%\href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{was
%reported before} and should be solved on newer versions (starting from
%2022/01/27) by automatically patching sections. If you have this issue,
%just upgrade (for instance by copying the
%\href{https://github.com/leo-colisson/proof-at-the-end}{\texttt{proof-at-the-end.sty}
%file} at the root of your project). We proceed by patching the
%\texttt{\textbackslash{}chapter}, \texttt{\textbackslash{}section},
%\texttt{\textbackslash{}subsection}, \texttt{subsubsection} and
%\texttt{\textbackslash{}paragraph} commands to add
%\texttt{\textbackslash{}pratendAddLabel} which will help the package to
%find the label of the current section. If you prefer the old behavior,
%you can disable it using the \texttt{disablePatchSection} option (more
%details in the package options).
%
%\hypertarget{i-get-an-error-error-file-ended-while-scanning-use-of-xverbatim.-when-using-verbatim-inside-a-theorem}{%
%\subsection{\texorpdfstring{I get an error
%\texttt{ERROR:\ File\ ended\ while\ scanning\ use\ of\ \textbackslash{}@xverbatim.}
%when using verbatim inside a
%theorem}{I get an error ERROR: File ended while scanning use of \textbackslash@xverbatim. when using verbatim inside a theorem}}\label{i-get-an-error-error-file-ended-while-scanning-use-of-xverbatim.-when-using-verbatim-inside-a-theorem}}
%
%I turns out that this library needs to use the \texttt{+b} option of
%environments in order to manipulate appropriately the theorem/proof.
%Unfortunately, it means that it is not possible to use verbatim
%environments inside. While
%\href{https://tex.stackexchange.com/questions/489435/use-environment-into-new-xparse-environment}{this
%answer} suggests that it is impossible to avoid this issue, other people
%reported that it may be possible to use catcodes to capture the
%environment body verbatim, before using scantokens to reparse it, or to
%use
%\href{https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf}{filecontentsdef}
%(see for instance
%\href{https://tex.stackexchange.com/questions/631810/create-a-newdocumentenvironment-programmatically?noredirect=1\#comment1575605_631810}{this
%comment}{]}, ). However, it may be possible that this make syntex
%unusable, so it may not worth the effort.
%
%In anycase, there exists some workarounds, some of the are for instance
%give in the \href{https://texfaq.org/FAQ-verbwithin}{TeX FAQ}. The
%simplest solution, if your code is simple/short enough, is to use
%\texttt{\textbackslash{}texttt} (you can replace backslash with
%\texttt{\textbackslash{}textbackslash} inside etc, and include it in a
%\texttt{verse} if you have multiple lines). If you have a longer text,
%you may also like \texttt{lrbox} to put your content inside a box, for
%instance like that:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\CommentTok{\%\% Create the box}
%\FunctionTok{\textbackslash{}newsavebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}}
%
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}}
% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}\{1.0}\FunctionTok{\textbackslash{}linewidth}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}}
%\VerbatimStringTok{\textbackslash{}newEndThm[normal]\{thmE\}\{thm\}}
%\VerbatimStringTok{\textbackslash{}newEndProof\{proofE\}\{proof\}}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}}
% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}}
%
%\CommentTok{\%\% Create a theorem:}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\NormalTok{ Insert the box:}
%
% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}}
% \FunctionTok{\textbackslash{}usebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}}
% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{changelog}{%
%\section{Changelog}\label{changelog}}
%
%\begin{itemize}
%\tightlist
%\item
% 2022/08/24: Fix the issues on KOMA classes
% https://github.com/leo-colisson/proof-at-the-end/issues/11
%\item
% 2022/02/07:
%
% \begin{enumerate}
% \def\labelenumi{\arabic{enumi}.}
% \tightlist
% \item
% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue
% 2} was not really solved in fact\ldots{} Now, I use a more robust
% method to detect the current section: I write in an AUX file the
% label of the proof section. This way, I don't need anymore to use
% dirty tricks to recover the section label.
% \item
% Change the default text when the appendix is in an external file,
% and add options like \texttt{text\ link\ external\ appendix} to
% customize the text appearing when the appendix is in an external
% file. Of course, you can still change it using \texttt{text\ link}
% directly.
% \end{enumerate}
%\item
% 2022/02/04:
%
% \begin{enumerate}
% \def\labelenumi{\arabic{enumi}.}
% \tightlist
% \item
% Add a way to put theorems in different files. (see
% \texttt{external\ appendix})
% \item
% Change the path for auxiliary files (should be transparent for the
% user)
% \item
% Add commands to change local/global configuration easily (see
% \texttt{\textbackslash{}pratendSetLocal},\texttt{\textbackslash{}pratendSetGlobal})
% \end{enumerate}
%\item
% 2022/02/01:
%
% \begin{enumerate}
% \def\labelenumi{\arabic{enumi}.}
% \tightlist
% \item
% Fix a typo when defining the shortcut for lemma
% \item
% Add a shortcut for proposition
% \item
% Fix a small spacing issue in the text before the proof in Appendix
% \end{enumerate}
%\item
% 2022/01/28:
%
% \begin{enumerate}
% \def\labelenumi{\arabic{enumi}.}
% \tightlist
% \item
% Fix the issue when using sharps in a proof
% https://github.com/leo-colisson/proof-at-the-end/issues/7.
% \item
% Provide \texttt{\textbackslash{}newEndThm},
% \texttt{\textbackslash{}newEndProof} and the option
% \texttt{createShortEnv} to quickly create environments.
% \end{enumerate}
%\item
% 2022/01/27:
%
% \begin{enumerate}
% \def\labelenumi{\arabic{enumi}.}
% \tightlist
% \item
% Patch chapters/sections/\ldots{} to better detect the current
% section and fix
% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue
% 2}. This can be disabled using the package option
% \texttt{disablePatchSection}.
% \item
% Add an option \texttt{commandRef} to use other ref libraries, like
% \texttt{cleveref} instead of \texttt{autoref}.
% \item
% Normal restatable theorem do not need to be restated. Fix
% \href{https://github.com/leo-colisson/proof-at-the-end/issues/8}{issue
% 8}.
% \end{enumerate}
%\end{itemize}
%
%\hypertarget{contributions}{%
%\section{Contributions}\label{contributions}}
%
%Feel free to contribute, report bugs, and send pull requests on the
%github repository \url{https://github.com/leo-colisson/proof-at-the-end}
%!
%
%NB: the documentation is generated from the Markdown file
%\texttt{README.md} thanks to pandoc. These commands may help you:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\ExtensionTok{\%\%}\NormalTok{ Compile the demo}
%\FunctionTok{make}\NormalTok{ demo}
%\ExtensionTok{\%\%}\NormalTok{ Clean the project}
%\FunctionTok{make}\NormalTok{ clean}
%\ExtensionTok{\%\%}\NormalTok{ Generate the documentation}
%\FunctionTok{make}\NormalTok{ doc}
%\ExtensionTok{\%\%}\NormalTok{ Generate a package for CTAN}
%\FunctionTok{make}\NormalTok{ package}
%\end{Highlighting}
%\end{Shaded}
%
%
%
%
%\StopEventually{}
%\section{The Code}
%\iffalse
% \begin{macrocode}
%<*proof-at-the-end.sty>
% \end{macrocode}
%\fi
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{proof-at-the-end}[2022/08/24 A package to move proofs in appendix]
\RequirePackage{etoolbox}
\RequirePackage{thmtools}
\RequirePackage{thm-restate}
\RequirePackage{catchfile}
\RequirePackage{pgfkeys}
\RequirePackage{xparse}
% Load hyperref at the end
\AtEndPreamble{%
\RequirePackage{hyperref}
}%
\RequirePackage{kvoptions}
%% https://tex.stackexchange.com/questions/109747/put-all-package-options-into-one-command
%% Forward the options list to the command \pratendOptdefconf
%% in order to use:
%% \usepackage[conf={normal}]{proof-at-the-end}
\SetupKeyvalOptions{
family=pratendOpt,
prefix=pratendOpt, % "Namespace": Prefix of the commands, conditions....
}
\DeclareStringOption{conf}
\DeclareLocalOptions{conf}% \pratendOptdefconf contains the proof
\DeclareBoolOption{disablePatchSection} % Use \ifpratendOptdisablePatchSection ... \else ... \fi
\DeclareStringOption[autoref]{commandRef} % Use commandRef=cref to use cleveref. Defaults to autoref.
\DeclareBoolOption{createShortEnv} % To create thmE, theoremE, proofE, lemmaE, corrolaryE
\ProcessKeyvalOptions*
% \DeclareOption*{\PackageWarning{proof-at-the-end}{Unknown}}
% \ProcessOptions\relax
%% https://tex.stackexchange.com/a/13289/116348
\newwrite\appendwrite
\newcount\pratend@count@makeallother
%%% Loop to make sure all chars are normal letters, including #.
\newcommand{\makeallother}{%
\pratend@count@makeallother0\relax
\loop\ifnum\pratend@count@makeallother<255\relax
\catcode\pratend@count@makeallother12\relax
\advance\pratend@count@makeallother by 1\relax
\repeat
}
%%% This command allows the user to append things to a file. But the content may contain macros that
%%% will be evaluated before writing them to the file.
%%% TODO: Efficiency may be improved by writing to the file only before the printProof.
% The first argument is the file name
% The second argument is the text to write
\NewDocumentCommand\appendtofile{m+m}{%
\begingroup
%% Read the content
\begingroup%
\IfFileExists{#1}{%
\newlinechar\endlinechar%
\makeallother% Turn all chars into normal letters.
\everyeof{\noexpand}%
\edef\fileContent{\@@input #1 }%
}{%
\let\fileContent\empty
}%
%% Open the file to write in it:
\immediate\openout\appendwrite #1\relax%
%% Write the text
\immediate\write\appendwrite{\fileContent}%
\endgroup%
\immediate\write\appendwrite{#2}%
%% Close the file
\immediate\closeout\appendwrite%
\endgroup
}
%% Get the prefix of the file, given the jobname.
\NewDocumentCommand\pratendGeneratePrefixFile{m}{#1-pratend}
\def\prefixPrAtEndFiles{\pratendGeneratePrefixFile{\jobname}}
%% This functions takes one input: the category (without .tex),
%% If it's the first time we write in this
%% category file, it "blanks" it.
\newcommand*\eraseIfNeeded[1]{%
% A macro 'pratendmacrocat{category}' is created to check
% if it's the first time we write in this category file.
\protected@edef\macroname{pratendmacrocat#1}%
\ifcsdef{\macroname}{% The macro exists, nothing to do
}{ % The macro does not exists, create it, and empty the file
\global\expandafter\def\csname \macroname\endcsname{true}%
\immediate\openout\appendwrite=\prefixPrAtEndFiles#1.tex%
\immediate\write\appendwrite{}%
\immediate\closeout\appendwrite%
}%
}
\newif\ifproofhere
\newif\ifproofend
\newif\ifrestatethm
\newif\ifexternalAppendix% True if the output file should me inputable in another file (using xr for crossref). Useful to remote restate.
\newif\iflinktoproof
\newif\ifboth
\newif\ifallattheend
\newif\ifrestatedbefore
\pgfkeys{
/prAtEnd/.cd, %% Proof at end will be the main path
%% Category of the proof (if you want to put proofs
%% at several places), can be anything
category/.initial=defaultcategory,
category/.store in=\category,
category/.get=\category,
%% Display the proof in the main part
proof here/.is if=proofhere,
no proof here/.style={proof here=false}, % alias
%% Display the proof when using \printProofs
proof end/.is if=proofend,
no proof end/.style={proof end=false},
%% Restate the theorem when using \printProofs
only external appendix/.is if=externalAppendix,
text link external appendix/.style={
text link={The proof is in the appendix.}
},
external appendix/.style={
only external appendix,
text link external appendix,
},
%% Restate the theorem when using \printProofs
restate/.is if=restatethm,
no restate/.style={restate=false},
%% Put a link to the proof after the theorem
link to proof/.is if=linktoproof,
no link to proof/.style={link to proof=false},
%% Put the theorem and proof only in appendix
opt all end/.is if=allattheend,
no opt all end/.style={opt all end=false},
%% Text of link
text link/.code={\def\pratendtextlink{#1}},
%% Text of proof. Make sure also to "\renewcommand*{\proofname}{Name of the proof}"
%% to make sure the proof for normal theorems are changed
text proof/.code={\def\pratendtextproof{#1}},
%% Custom restate command
restate command/.code={\protected@edef\pratendcustomrestate{#1}},
%% (Re)stated before
%% If the theorems has been stated before, then we just need to put the restate command in
%% place of the argument, and we set this value to true:
restated before/.is if=restatedbefore,
no restated before/.style={restated before=false},
%% In star version, we don't want
%% Put the text (defined only for \textInAppendix) in both the
%% current location and in appendix
both/.is if=both,
no both/.style={both=false},
%%%% Alias and styles
normal/.style={
proof here,
no opt all end,
no proof end,
no link to proof,
no restate,
no both,
},
proof at the end/.style={
no proof here,
no opt all end,
proof end,
no both,
},
end/.style={
proof at the end,
link to proof,
},
all end/.style={
end,
opt all end,
},
debug/.style={
no opt all end,
proof here
},
no link to theorem/.style={ % Remove the link to the theorem
text proof={\proofname},
},
stared/.style={ % Remove
text proof={\string\mbox{\string\hyperref[thm:prAtEnd\pratendcountercurrent]{\proofname}}},
},
no number/.style={
stared
},
see full proof/.style={
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}
},
one big link/.style={
text link={\hyperref[proof:prAtEnd\pratendcountercurrent] {#1}}
},
one big link/.default={%
See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent}.
},
one big link translated/.style={
one big link={#1~\pageref*{proof:prAtEnd\pratendcountercurrent}.}
},
text link section/.style={%
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \pratendSectionlikeCref.}
},
text link section full proof/.style={%
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \pratendSectionlikeCref.}
},
default text link/.style={
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.},
},
text proof translated/.style={
text proof={#1 \string\pratendRef{thm:prAtEnd\pratendcountercurrent}},
},
default text proof/.style={
text proof={Proof of \string\pratendRef{thm:prAtEnd\pratendcountercurrent}},
},
%%%% Defaults
bare defaults/.style={
end,
link to proof,
no restate,
category=defaultcategory,
default text link,
default text proof,
restate command=pratenddummymacro,
},
configuration options/.style/.expand once={
% This styles will contain the configuration
% given as options of the package like:
% \usepackage[conf={normal, no link to proof}]{proof-at-the-end}
% The package options does not accept macros and valued keys
% due to some fundamental issues:
% https://tex.stackexchange.com/questions/489564/use-unexpanded-macro-in-package-options/489570#489570
% so if you need to write macro/valued key, edit instead the
% style "/prAtEnd/global custom defaults" or
% "local /prAtEnd/custom defaults" for local changes instead.
\pratendOptconf%
},
global custom defaults/.style={
%% you can put in this style any global defaults
%% that should overwrite the usual defaults.
},
local custom defaults/.style={
%% you can put in this style any overwrite of the defaults
%% that should be "local" and changed over the file, like
% the category for a given section.
},
all defaults/.style={
%% Load all the style that sets the default values
bare defaults,
configuration options,
global custom defaults,
local custom defaults,
},
}
\newcounter{counterAllProofEnd}
\stepcounter{counterAllProofEnd}
\NewDocumentEnvironment{theoremEndRestateBefore}{mO{}m+b}{
\stepcounter{counterAllProofEnd}%
\protected@edef\currcounterval{\roman{counterAllProofEnd}}
\protected@edef\temprest{\noexpand\begin{restatable*}[#2]{#1}{prAtEndRestate\currcounterval}\noexpand\label{thm:prAtEnd\currcounterval}}%
\expandafter\protected@xdef\csname #3\endcsname{\currcounterval}%
\temprest%
#4%
\end{restatable*}%
}{}
\NewDocumentEnvironment{theoremEndOrig}{O{}mO{}+b}{
% The first facultative argument will be the options: type of proof you want, the file to which you want to write...
% The first mandatory option is the type of the theorem (thm,lemma,...)
% The second facultative argument will be the title
% the second mandatory option is the theorem (will \label inside eventually)
% the last mandatory option is the proof
\global\def\pratendlastoptions{#1}%
\pgfkeys{%
/prAtEnd/.cd,
all defaults,
#1
}%
\stepcounter{counterAllProofEnd}%
%% Pre-expand the restatable environment. Need protected
%% otherwise can't have $\mathtt{G}$ in the title
\protected@edef\temprest{\noexpand\begin{restatable}[#3]{#2}{prAtEndRestate\roman{counterAllProofEnd}}}%
%% Create the file if it's the first time
\eraseIfNeeded{\category}%
%% If the theorem must be written here:
\unless\ifallattheend%
%% Restate the theorem if it was stated before:
\ifrestatedbefore%
\protected@xdef\pratendcountercurrent{\csname #4\endcsname} % Store the current (alpha value of the) counter
\csname prAtEndRestate\pratendcountercurrent\endcsname % Restate the theorem
\fi%
%% Otherwise just state the theorem in a restatable environment
\unless\ifrestatedbefore%
\temprest%
\label{thm:prAtEnd\roman{counterAllProofEnd}}%
#4%
\end{restatable}%
%% Store the current (alpha value of the) counter
%% in \pratendcountercurrent
\protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}} %
\fi%
%% Create a custom alias to restate the theorem
\expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
%% Restate the theorem if needed in appendix.
%% As explained in https://github.com/leo-colisson/proof-at-the-end/issues/8
%% No need to restate of there is no proof at the end.
\ifproofend%
\ifrestatethm%
\ifexternalAppendix% We write the full theorem, useful to compile in a separate file (use xr for references)
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begingroup\string\renewcommand\string\the\detokenize{#2}{\string\ref{thm:prAtEnd\pratendcountercurrent}}\string\begin{\detokenize{#2}}[#3]\detokenize{#4}\string\end{\detokenize{#2}}\string\endgroup}%
\else%
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}%
\fi%
\fi%
\fi%
\fi%
%% If the theorem is not stated in the main text,
%% write it at the end
\ifallattheend%
%% Store the current (alpha value of the) counter
%% in \pratendcountercurrent
\protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}}
%% Create a custom alias to restate the theorem
\expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{restatable}[\detokenize{#3}]{#2}{prAtEndRestate\pratendcountercurrent}\string\label{thm:prAtEnd\pratendcountercurrent}\detokenize{#4}\string\end{restatable}}%
\fi%
}{}
%% See proofEnableDebugSynctex
%%% WARNING: if you change this function, change also proofDisableDebugSynctex
\NewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{%
\begin{theoremEndOrig}[#1]{#2}[#3]
#4%
\end{theoremEndOrig}%
}{}
\NewDocumentEnvironment{proofEndOrig}{O{}+b}{
\pgfkeys{%
/prAtEnd/.cd,
all defaults,
prAtEndTmpStyle/.style/.expand once={\pratendlastoptions},
prAtEndTmpStyle,
#1
}%
\unless\ifallattheend
%% Write eventually a link to the proof
\iflinktoproof%
\pratendtextlink{}%
\fi%
%% And eventually the proof
\ifproofhere%
\begin{proof}%
#2%
\end{proof}%
\fi%
\fi%
%% Write the proof at the end
\ifproofend%
\appendtofile{\prefixPrAtEndFiles\category.tex}{%
%% The label alone adds some space, see e.g.
%% https://tex.stackexchange.com/questions/600118/selectlanguage-in-the-middle-of-text-causes-extra-vertical-space/600142#600142
%% and https://tex.stackexchange.com/questions/600577/adding-a-label-between-two-proofs-adds-unwanted-space
%% The solution is to use \\Hy@SaveLastskip and \Hy@RestoreLastskip from hyperref
%% See also
%% https://tex.stackexchange.com/questions/553394/reliably-add-a-label-to-the-current-section-even-if-the-label-is-not-placed-rig/600847#600847
\string\makeatletter\string\Hy@SaveLastskip%
%% This tries to recover the label of the current section... But it is very bad. I keep it only for backward compatibility. I tried to fix it by changing the value of \@counter, but it's not always working
%% as cref is not using it apparently, and it turns Appendix A into appendix a after using phantomsection.
%% https://github.com/leo-colisson/proof-at-the-end/issues/2
\string\label{proofsection:prAtEnd\pratendcountercurrent}% WARNING <-- do not use this label in new documents!
% the problem is that setting the \@currentlabel does not work for cref, and turns Appendix A
% into section A when a phantomsection lies in between (not sure why):
% https://github.com/leo-colisson/proof-at-the-end/issues/2
%% Now, we prefer a different method: instead we generate a single label per section, and we generate
%% a new macro in the aux file that will save this label, by creating one such macro per theorem.
%% This is basically doing something like \pratend@section@for@proofiii{prAtEnd:sectionlike3}
%% Note that I need sometimes 3 \string because I write two times: the first time I write in the FILE-pratendCATEGORY.tex
%% file, and this file will be in charge of writting into the .aux file.
\string\ifdefined\string\pratend@current@sectionlike@label% But before, we check if the section was defined, or the code may fail if no section are defined.
\string\immediate\string\write\string\@auxout{%
\string\string\string\gdef\string\string\string\pratend@section@for@proof\pratendcountercurrent{\string\pratend@current@sectionlike@label}%
}%
\string\fi
% See above
\string\Hy@RestoreLastskip\string\makeatother%
% We start the proof
\string\begin{proof}[\pratendtextproof]%
% We add a label to have a reference to the section
\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}%
% We add the proof
\detokenize{#2}%
% We end the proof
\string\end{proof}}%
\fi%
}{}
%%% WARNING: if you change this function, change also proofDisableDebugSynctex
\NewDocumentEnvironment{proofEnd}{O{}+b}{%
\begin{proofEndOrig}[#1]%
#2
\end{proofEndOrig}%
}{}
%%%%% For synctex debugging
%% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10
\NewDocumentCommand{\pratendEnableDebugSynctex}{}{%
\RenewDocumentEnvironment{theoremEnd}{O{}mO{}}{\begin{##2}}{\end{##2}}
\RenewDocumentEnvironment{proofEnd}{O{}}{\begin{proof}}{\end{proof}}
}
%% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10
\NewDocumentCommand{\pratendDisableDebugSynctex}{}{%
\RenewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{%
\begin{theoremEndOrig}[##1]{##2}[##3]%
##4%
\end{theoremEndOrig}%
}{}%
\RenewDocumentEnvironment{proofEnd}{O{}+b}{%
\begin{proofEndOrig}[##1]%
##2%
\end{proofEndOrig}%
}{}
}
\NewDocumentEnvironment{proofEndDebug}{O{}}{%
\begin{proof}%
}{%
\end{proof}%
}
\NewDocumentEnvironment{theoremEndDebug}{O{}mO{}}{\begin{#2}}{\end{#2}}
%%%%% Text in appendix
\NewDocumentEnvironment{textAtEnd}{O{}+b}{
% Use it to put normal text in Appendix.
\pgfkeys{
/prAtEnd/.cd,
all defaults,
#1
}%
\ifboth%
#2%
\fi%
\eraseIfNeeded{\category}%
\appendtofile{\prefixPrAtEndFiles\category.tex}{\detokenize{#2}}%
}{}
\NewDocumentCommand\textEnd{O{}+m}{%
\begin{textAtEnd}[#1]%
#2%
\end{textAtEnd}%
}
\NewDocumentCommand\printProofs{O{defaultcategory}}{
\input{\prefixPrAtEndFiles#1.tex}
}
%%% You can easily modify the defaults:
% \pgfkeys{/prAtEnd/custom defaults/.style={
% category=greattheorem
% }
% }
%%% Or create new styles to apply:
% \pgfkeys{/prAtEnd/great category/.style={
% category=greattheorem
% }
% }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Patch sections, chapters...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We patch the \section, \subsection and \chapter commands to make sure that
% the text "See proof in Section XX" points to the appropriate section/subsection (option conf={text link section}).
% We basically maintain a counter counting how many times we saw a section/subsection/... and use it to label
% directly the section afterwards.
\newcounter{pratend@counter@sectionlike}
%% Command to add after a label like "prAtEnd:sectionlike10". Useful to patch \section, \chapter...
\NewDocumentCommand\pratendAddLabel{}{%
%% First, we get the label
%% Cool explaination of expandafter, edef, noexpand:
%%% https://www.tug.org/TUGboat/tb09-1/tb20bechtolsheim.pdf
%% The label \pratend@current@sectionlike@label is used later.
\xdef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}%
\expandafter\label{\pratend@current@sectionlike@label}%
\stepcounter{pratend@counter@sectionlike}%
}%
%% Returns the label of the section (in appendix) that contains the proof of the current theorem.
%% The first time, it will return an empty label.
\NewDocumentCommand\pratendLabelProofSection{}{%
\ifcsname pratend@section@for@proof\pratendcountercurrent\endcsname%
\csname pratend@section@for@proof\pratendcountercurrent\endcsname%
\fi%
}%
\NewDocumentCommand\pratendSectionlikeCref{}{%
% \pratendRef{proofsection:prAtEnd\pratendcountercurrent}% This is not robust enough. Lets change strategy.
\expandafter\pratendRef{\pratendLabelProofSection}
}
\ifpratendOptdisablePatchSection%
\else %
%% Add the command \pratendAddLabel to \chapter/sections… if the command exists
%% KOMA class need a special treatment
\@ifundefined{KOMAClassName}{%
% For articles/...
\ifdef{\@chapter}{
\ifpatchable*{\@chapter}{
\apptocmd{\@chapter}{\pratendAddLabel}{}{}%
}{\PackageWarning{proof-at-the-end}{Chapters are not patchable.}{}}
}{}
%% patch sections/subsections/paragraph/...
%% https://tex.stackexchange.com/questions/631713/patch-section-command-fails/631717?noredirect=1#comment1575337_631717
\ifdef{\@sect}{
% \apptocmd{\section}{\pratendAddLabel}{}{}%
\ifpatchable*{\@sect}{
\apptocmd{\@sect}{\pratendAddLabel}{}{}%
}{\PackageWarning{proof-at-the-end}{Sections are not patchable.}{}}
}{}%
}{%
%% For KOMA classes/... or it won't work with scrreport
%% \AddtoDoHook{heading/endgroup/chapter} is too specific
\AddtoDoHook{heading/endgroup/chapter}{\pratendAddLabel}%
\AddtoDoHook{heading/endgroup/section}{\pratendAddLabel}%
}%
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Allow cref/autoref/...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Instead of \autoref{proof:blabla} use \pratendRef{proof:blabla}, it allows the ref command to be customized
%% as an option of the package.
\NewDocumentCommand\pratendRef{m}{%
\csname \pratendOptcommandRef\endcsname{#1}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Create automatically wrapper
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Defines a shortcut to avoid typing the whole theoremEnd environment.
%% Avoid to manually type \NewDocumentEnvironment...
%% Usage: \newEndThm[default options]{new environment}{old environment}
% E.g.: \newEndThm[normal]{thmE}{thm}{}
\NewDocumentCommand{\newEndThm}{O{}mm}{%
% \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{%
% \begin{theoremEnd}[#1,##2]{#3}[##1]%
% ##3%
% \end{theoremEnd}%
% }{}
\NewDocumentEnvironment{#2}{O{}O{}}{%
\begin{theoremEnd}[#1,##2]{#3}[##1]%
}{\end{theoremEnd}}%
\NewDocumentEnvironment{#2D}{O{}O{}}{%
\bgroup%
\pratendEnableDebugSynctex{}%
\begin{theoremEnd}[#1,##2]{#3}[##1]%
}{\end{theoremEnd}%
\egroup%
}%
}
% \NewDocumentCommand{\newEndThm}{O{}mm}{%
% % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{%
% % \begin{theoremEnd}[#1,##2]{#3}[##1]%
% % ##3%
% % \end{theoremEnd}%
% % }{}
% \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{%
% \begin{theoremEnd}[#1,##2]{#3}[##1]%
% ##3
% \end{theoremEnd}%
% }{}
% }
%% Avoid to manually type \NewDocumentEnvironment...
%% Usage: \newEndProof[default options]{new proof environment}{old proof environment}
% E.g.: \newEndProof[]{proofE}{proof}
\NewDocumentCommand{\newEndProof}{O{}m}{%
\NewDocumentEnvironment{#2}{O{}+b}{%
\begin{proofEnd}[#1,##1]%
##2%
\end{proofEnd}%
}{}%
\NewDocumentEnvironment{#2D}{O{}}{%
\begin{proofEndDebug}[##1]%
}{%
\end{proofEndDebug}%
}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Create even more automatically wrapper with option "createShortEnv"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifpratendOptcreateShortEnv
%%% We create automatically the environments.
\newEndProof{proofE}
\newEndThm{thmE}{thm}
\newEndThm{lemmaE}{lemma}
\newEndThm{theoremE}{theorem}
\newEndThm{corollaryE}{corollary}
\newEndThm{propositionE}{proposition}
\newEndThm{propertyE}{proposition}
\newEndThm{factE}{proposition}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Create functions to easily overwrite defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NewDocumentCommand\pratendSetGlobal{m}{%
\pgfkeys{/prAtEnd/global custom defaults/.style={
#1
}%
}%
}
\NewDocumentCommand\pratendSetLocal{m}{%
\pgfkeys{/prAtEnd/local custom defaults/.style={
#1
}%
}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Create functions to load the category file in another file (external bibliography)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Takes an optional category, and the job name of the external file.
\NewDocumentCommand\includeExternalAppendix{O{defaultcategory}m}{%
\expandafter\input{\pratendGeneratePrefixFile{#2}#1}
}
\endinput
%\iffalse
% \begin{macrocode}
%</proof-at-the-end.sty>
% \end{macrocode}
%\fi
%\Finale
\endinput
|