summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/exesheet/exesheet.dtx
blob: 02a8f5e68cd1882c3ca872f38f2e97f535d93dec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
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
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
% \iffalse meta-comment
%
% Copyright (C) 2020-2024 by Antoine Missier <antoine.missier@ac-toulouse.fr>
% ----------------------------------------------------------------------
% 
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX 
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{exesheet.dtx}
%</driver>
%<class|package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<class>\ProvidesClass{exesheet}
%<package>\ProvidesPackage{exesheet}
%<*class|package>
[2024/02/03 v2.6 .dtx Typesetting exercise or exam sheets]
%</class|package>
%<*driver>
\documentclass{ltxdoc}
%
% uncomment the following lines if you want to use the exesheet class instead of ltxdoc
%\usepackage{doc}
%\AtBeginDocument{\MakeShortVerb{\|}}
%\providecommand\marg[1]{{\ttfamily\{}\meta{#1}{\ttfamily\}}}
%\providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
\usepackage[exetoc=false,marginwidth=unset,display=notes]{exesheet}
\usepackage{schooldocs}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{multicol}
\usepackage{hyperref}
\usepackage{sectsty}
\usepackage{pstricks}
\usepackage{array}
\usepackage{spacingtricks}
\usepackage{pifont}
%
\psset{unit=1cm}
\geometry{textwidth=355pt,vmarginratio=1:1,hmarginratio=3:2}
% altered by schoodocs, now very close from the default geometry used by ltxdoc.
% The following instruction provides the same margin width
% as with display=notes without altering the margin ratio
\leftnotemarginwidth{0.55} % special setting here
\newcommand{\ds}{\displaystyle}
\newcommand{\bs}{\textbackslash}
\definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
\allsectionsfont{\sffamily\color{darkbrown}}
\renewcommand{\labelexercisestyle}{\rmfamily\color{black}}
\renewcommand{\labelsubpartstyle}{\rmfamily\color{black}}
\renewcommand{\annexstyle}{\rmfamily\color{black}\MakeUppercase}
\renewcommand{\correctionstyle}{\rmfamily\color{correctioncolor}}
\renewcommand{\titlestyle}{\LARGE\sffamily\bfseries}
%
\DisableCrossrefs
%\CodelineIndex
%\RecordChanges
\title{The \textsf{exesheet} class and package}
\subject{Antoine Missier \\
    \texttt{antoine.missier@ac-toulouse.fr}}
\date{\filedate, \fileversion}
\hypersetup{%
    colorlinks,
    linkcolor=blue,
    citecolor=red, 
    pdftitle={exesheet},
    pdfsubject={LaTeX class and package},
    pdfauthor={Antoine Missier}
}

\begin{document}
\DocInput{exesheet.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{1192}
%
% \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         \~}
%
% \changes{v0.0}{2010/09/01}{Initial personal version}
% \changes{v0.9}{2020/01/02}{Initial documentation in French}
% \changes{v1.0}{2020/07/22}{Initial public version with documentation in English}
% \changes{v1.1}{2021/08/30}{
%    - macro tablenum (also used by siunitx) is replaced by tablenum1, 
%    - small modifications due to changes in the tasks package}
%
% \changes{v1.2}{2021/09/18}{
%    - bug correction in the tablenum1 and tablenuma macros, 
%    - using the translations package for internationalization}
%
% \changes{v1.3}{2021/11/15}{
%    - bad spacing in the exe macro and bug correction in the starred version of this macro}
%
% \changes{v2.0}{2022/12/28}{
%    - options 'toc' and 'setlist' with kvoptions (instead of notoc and nosetlist),
%    - introducing the 'output' key instead of the old commands questionsonly, answersonly,
%    - introducing the 'display' key instead of the old commands displaypts, displaypoints,
%        displaynotes,
%    - introducing the 'margin' and 'noteragged' keys, to set how the notes are displayed,
%    - introducing the 'correct' key}
% \changes{v2.0}{2023/01/02}{
%    - documentation update,
%    - new option 'checkpts'}
% \changes{v2.0}{2023/01/09}{
%    - new option 'marginwidth', 
%    - modifying hmarginratio from 5:1 to 3:1 when 'display=notes',
%    - correct management of two-sided mode documents}
% \changes{v2.0}{2023/01/16}{
%    - \enskip between titles and their optional argument,
%    - simplifying the macros markingstyle and notestyle,
%    - use of the ragged2e package,
%    - code revision and simplification,
%    - documentation update}
%
% \changes{v2.1}{2023/07/30}{
%    - new starred environments tablenuma* and tablitem*}
% \changes{v2.1}{2023/08/24}{
%    - English corrections in the documentation}
%
% \changes{v2.2}{2023/09/02}{
%    - correction of a color bug in the answer macro and the answers* environment
%    - additional remark about the use of answers environments}
% \changes{v2.2}{2023/09/04}{
%    - new commands, labelenumone and labelenuma, allowing for global changes to
%        tasks environments
%    - the answerspace option is set to false when answers are displayed}
%
% \changes{v2.3}{2023/10/24}{
%    - new implementation of marking scheme checking:
%        checking is done in points or totalpoints instead of exercise command,
%    - correct ref macro for tablenuma using ref option in tasks, 
%        available since 2020/08/19
%    - new commands question* and answer* for executing code when 
%        questions are displayed but not answers, or the contrary
%    - using basic languages (with lower case first letter) instead of aliases
%        in translations commands}
%
% \changes{v2.4}{2023/10/28}{
%    - a small mistake in the documentation about the example of the tablenuma environment
%        is now corrected
%    - other small changes in the documentation
%    - lack of percent symbols at end of lines in the exe@check macro causes an unwanted
%        space in points macro}
%
% \changes{v2.5}{2023/12/30}{
%    - gsetlength and gaddtolength unnecessary
%    - deprecated commands -> old commands
%    - comparison with other packages
%    - modifying introduction}
%
% \changes{v2.6}{2024/02/03}{
%    - error message when using colsenum or colsitem without loading multicol
%    - changes in the comparison with other packages}
%
% \GetFileInfo{exesheet.dtx}
%
% \maketitle
% \tableofcontents
% \enlargethispage{1ex}
%
% \section{Introduction}
%
% The \textsf{exesheet} \emph{package} is designed for typesetting exercise or exam sheets.
% Additionally, the \textsf{exesheet} \emph{class} loads the 
% \textsf{schooldocs} package~\cite{SCHOOL}.
% The latter makes adjustments to margins and titles, and defines various layout styles 
% with specific headers and footers suitable for exercise sheets, among other uses.
% Refer to the documentation of the \textsf{schooldocs} package for more details.
% The \textsf{exesheet} \emph{class} is build upon the \textsf{article} class
% and forwards any unknown options to it.
%
% There are many other packages dedicated to exercise sheets.
% In section \ref{comparison} we provide an overview of some of their functionalities.
% Most of them suggest encapsulating each exercise within an environment.
% In contrast, \textsf{exesheet} starts each exercise with |\exercise|, 
% which functions similarly to a subsection (with the same features)
% and is suitable for documents that primarily consist of exercises.
% The package also offers alternative ways to introduce exercises, 
% which are more appropriate for shorter exercises.
%
% Another distinctive feature of the \textsf{exesheet} package is its specific settings
% for enumeration lists, which are
% suitable for numbering questions or answers within an exercise.
%
% For all exercises within the sheet, you can display only the questions, 
% only the answers, or both, all while preserving their placement as they appear
% in the source file. This choice allows for great flexibility:
% you can create a correct version for all exercises collectively, 
% or individual corrections per exercise,
% per part (subpart of exercise), per question, per sub-question.
%
% The ability to hide questions or answers is found in many packages, 
% but the main interest of \textsf{exesheet} is to be able to display or not 
% a detailed scoring guide, along with correction instructions. 
% This is very useful for grading papers with multiple graders.
% Furthermore \textsf{exesheet} can check the consistency of the scale.
%
% Many settings can be customized, and various options are available 
% to manage the output document.
% These options rely on the key-val mechanism: \texttt{key=value}.
% These options can be applied when calling the class or the package, \eg
% \begin{center}
% |\documentclass[a4paper,11pt,output=answers,display=pts]{exesheet}|
% \end{center}
% or later using the command |\exesheetset|\marg{options}.
% In the example above, \texttt{a4paper,11pt} are options
% that are passed to the underlying \textsf{article} class.
%
%\medskip
% \emph{In the current document, a frame is utilized to emphasize output 
% examples.}
%
% \section{Titles}
%
% \subsection{The \texttt{\bs exercise} command}
%
% \DescribeMacro{\exercise}
% The |\exercise|\oarg{opt} command initiates an exercise with the title 
% \textbf{\exercisename}, typeset as a document
% subsection, followed by automatic numbering,
% unique to the entire document.
% The optional parameter \meta{opt} is utilized to include additional text
% on the same title line, such as specifying a subject or a marking scheme.
% Thus, using |\exercise[(to begin)]| results in:
%
% \exercise[(to begin)]
% \psframe(-0.25,1.3)(12.75,-0.3)
% Try this first command; easy!
%
% To bring optional text closer to the exercise number, 
% you can employ |\unskip| which removes any preceding space.
% Take a look at the following example, achieved with 
% |\exercise[\unskip*** (difficult)]|:
% \exercise[\unskip*** (difficult)]
% \psframe(-0.25,1.3)(12.75,-0.3)
% Calculate $1+1$.
%
% \bigskip
% \DescribeMacro{\exercisename}
% The term ``\exercisename'' is automatically translated into various languages
% \footnote{Currently, translation is integrated into the package 
% for the following languages: French, German, Spanish, Italian, and Portuguese.}
% depending on the language that is loaded (via \textsf{babel} or \textsf{polyglossia}).
% You can alter it by modifying |\exercisename|.
% A better approach is to use macros from the \textsf{translations} 
% package by Clemens Niederberger~\cite{TRAN} (which allows dynamic language switching), 
% \eg |\DeclareTranslation{swedish}{exesheet-exercise}{\"Ovning}}|.
%
% \smallskip
% \DescribeMacro{\labelexercise}
% This command combines |\exercisename| with the exercise number and
% can be redefined. For instance, if you want to include a period after the exercise number,
% you can redefine it as follows:\\
% |\renewcommand{\labelexercise}{\exercisename~\theexercise.}|
% 
% \smallskip
% \DescribeMacro{\theexercise}
% If you wish to alter only the numbering style, you can redefine
% the |\theexercise| command based on the |exercise| counter.
%
% \smallskip
% \DescribeMacro{\labelexercisestyle}
% This macro, which is initially empty, enables the definition of a specific style
% for exercise titles. In this document, we have set the following in the preamble:
% |\renewcommand{\labelexercisestyle}{\rmfamily\color{black}}|
% \footnote{In this document, real section and subsection titles have been highlighted by
% modifying their color and font (sans serif) using the
% \texttt{\bs allsectionsfont} macro from the \textsf{sectsty} package~\cite{SECT}.}.
%
% \medskip
% \DescribeMacro{\exercise*}
% The starred version |\exercise*|\oarg{opt}\marg{label}
% permits the selection of an alternative \meta{label} for a specific exercise
% while omitting the numbering. For instance:
% |\exercise*[(Fermat's theorem)]{Problem}| results in:
%
% \exercise*[(Fermat's theorem)]{Problem}
% \psframe(-0.25,1.3)(12.75,-0.7)
% Prove that there are no positive integers $x, y, z$ such that $x^n+y^n=z^n$
% for any integer $n$ greater than 2.
%
% \subsection{The \texttt{\bs subpart} command}
% \DescribeMacro{\subpart}
% An exercise may consist of multiple parts, which can be created using 
% the |\subpart|\oarg{opt} command. 
% The part title is typeset similar to a sub-subsection.
%
% \exercise
% \subpart[(preliminary)]
% \psframe(-0.25,1.95)(12.75,-1.85)
% To begin, prepare your cup of tea.
% \subpart
% Now you are ready to proceed with the current exercise.
%
% \pagebreak
% The following macros allow customization in the same manner as for |\exercise|.
%
% \medskip
% \DescribeMacro{\thesubpart}
% By default, subpart numbering employs letters : A, B, C, and so on.
% This numbering style can be modified using the |\thesubpart| command, which relies on
% the |subpart| counter. For example, you can redefine it as follows:
% |\renewcommand\thesubpart{\arabic{subpart}}|.
%
% \smallskip
% \DescribeMacro{\subpartname} \DescribeMacro{\labelsubpart} 
% \DescribeMacro{\labelsubpartstyle}
% The |\subpart| command
% utilizes |\subpartname| (with automatic translation in several languages 
% according to the chosen language), as well as
% |\labelsubpart| and |\labelsubpartstyle|, all of which can be modified.
%
% \medskip
% \DescribeMacro{\subpart*}
% Similar to |\exercise*|, the starred version |\subpart*|\oarg{opt}\marg{label}
% permits an alternative \meta{label} and omits the numbering. For instance,
% you can use |\subpart*{First part}|.
%
% \subsection{The \texttt{\bs annex} command}
% \DescribeMacro{\annex}
% The |\annex|\oarg{opt} command composes the title \textbf{ANNEX}
% in uppercase letters, centered, using the subsection style,
% with an optional parameter that will be added on the same line.
%
% \vspace{-\baselineskip}
% \noindent\psframe(-0.25,-0.3)(12.75,-1.3)
% \annex[(to be returned)]
%
% \bigskip
% \DescribeMacro{\annexname}
% The term ``\annexname'' is automatically translated into several languages
% (depending on the chosen language).
% It can be extended to additional languages or altered by redefining |\annexname|
% or by utilizing macros from the \textsf{translations} package~\cite{TRAN}.
%
% \smallskip
% \DescribeMacro{\annexstyle}
% The style of the annex title is determined by the |\annexstyle| macro,
% which is defined as follows: |\newcommand\annexstyle{\MakeUppercase}|.
% This command may be redefined according to your preferences.
%
% \subsection{Titles in the table of contents} \label{toc}
% \DescribeMacro{[exetoc=\meta{bool}]}
% By default, the titles \textbf{\exercisename}, \textbf{\subpartname} 
% and \textbf{\annexname} are included in the table of contents, if there is any,
% or in the PDF file's summary when the \textsf{hyperref} package is utilized. 
% To prevent this, you can set the package option \texttt{exetoc=false}
% (with the default being \texttt{true}).
% However, note that optional title arguments will always be ignored in the table of contents.
%
% \subsection{Short exercises: the \texttt{\bs exe} command}
% \DescribeMacro{\exe}
% The |\exe| command initiates an exercise with the abbreviation \textbf{\exname}.\@
% followed by the exercise number. This is achieved without
% utilizing sectioning commands, and the exercise content begins on the same
% line. An exercise begins a new paragraph without any indentation.
%
% \exe This is a brief exercise that can encompass several
% paragraphs or questions.
%
% \noindent\psframe(-0.25,1.4)(12.75,-1.2)
% \indent Here for example a new paragraph begins.
% \exe This is another concise exercise.
%
% \bigskip
% \DescribeMacro{\exname} \DescribeMacro{\exlabel} \DescribeMacro{\exsepmark}
% The abbreviation \textbf{\exname} can be modified by
% redefining |\exname| or with macros from the \textsf{translations} package~\cite{TRAN}.
% The |\exlabel| macro combines |\exname| with a period then the exercise number
% (given by the same \texttt{exercise} counter),
% while |\exsepmark| typesets a long dash.
% These characteristics can be altered by redefining these commands.
%
% \medskip
% \DescribeMacro{\exe*}
% The starred version doesn't display a separator, as demonstrated below:
%
% \vspace{-\baselineskip}
% \noindent\psframe(-0.25,-0.35)(12.75,-1.1) 
% \exe* Another short exercise without a separator.
% 
% \section{Enumerations and lists}
%
% \subsection{List settings} \label{setlist}
% \DescribeEnv{enumerate} \DescribeMacro{\item}
% Enumeration lists are used to represent questions and sub-questions
% within exercises. To provide clear emphasis,
% labels are typeset in bold. 
% Additionally, these labels are aligned to the left, positioned at the start of the line
% without indentation, and the vertical spacing between items
% is increased compared to standard \LaTeX{} lists.
% These formatting adjustments are achieved using the |\setlist| command,
% a feature from the \textsf{enumitem} package by Javier Bezos~\cite{ENUM}.
%
% \vspace{-\baselineskip}
% \noindent\psframe(-0.25,-0.35)(12.75,-3.9) 
% \exercise
% \begin{enumerate}
% \item First question
% \begin{enumerate}
% \item First sub-question
% \item Second sub-question
% \end{enumerate}
% \item Second question
% \end{enumerate}
%
% \smallskip
% The \texttt{enumerate} environment takes an optional parameter, 
% that allows, among others things, 
% the typesetting of alternative list labels. For instance, typing
% |\begin{enumerate}[label=\alph*),font=\itshape\normalfont]|
% will yield the labels ``\emph{a)}, \emph{b)}, \emph{c)}\ldots''.
% There are many other options available
% (see the \textsf{enumitem}~\cite{ENUM} package documentation)
% \footnote{Labels can also be modified using a ``shortlabel'' argument, 
% \eg \texttt{\bs begin\{enumerate\}[A.]},
% or globally through the redefinition of \texttt{\bs labelenumi} 
% or \texttt{\bs labelenumii} commands.}.
% Label font formatting can be changed globally using
% |\setlist[enumerate]{font=...}|
% (called \emph{after} |\begin{document}|).
%
% Lists created with the \texttt{itemize} environment retain their default 
% configuration
% \footnote{However, the \texttt{french} option of the \textsf{babel} package
% changes the appearance of \texttt{itemize} lists and employs long dashes
% as labels for each list level.
% This can cause issues when mathematical content follows the dash
% symbol, as it might be mistaken for the minus sign.
% Thus, with the option \texttt{setlist=true}, the default \LaTeX{}
% \texttt{itemize} list style is 
% reinstated with \texttt{\bs frenchsetup\{StandardLists=true\}}.}.
% ^^A The \texttt{\bs frenchsetup} command can also achieve other settings.}.
%
% \medskip
% \DescribeMacro{[setlist=\meta{bool}]}
% The package option |setlist=false|  prevents changes to enumeration lists 
% and reverts to the default \LaTeX{} settings 
% (the default value is \texttt{true}).
%
% \subsection{List of exercises : the \texttt{exenumerate} environment}
% \DescribeEnv{exenumerate}
% When an exercise sheet consists of short, independent questions,
% it might be unreasonable to display the full title \textbf{\exercisename} for each one. 
% In addition to the previously mentioned |\exe| command,
% we offer an even more streamlined solution using the |exenumerate| environment.
% This environment is essentially an enumeration list with increased spacing
% between items, compared to the \texttt{enumerate} environment.
% Here is an example (the main list uses the \texttt{exenumerate} environment, while the
% sub-list is created using the standard \texttt{enumerate} environment):
%
% \vspace{-\baselineskip}
% \noindent\psframe(-0.25,-0.3)(12.75,-6) 
% \begin{exenumerate}
% \item Translate the following sentences in English: 
% \begin{enumerate}
% \item Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
% \item Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
% \end{enumerate}
% \item  Translate the following sentence in German:
% \par Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
% vitae ornare odio metus a mi. 
% \item  Translate the following sentence in French: 
% Cum sociis natoque penatibus 
% et magnis dis parturient montes, nascetur ridiculus mus.
% \end{exenumerate}
%
% \smallskip
% The \texttt{exenumerate} environment (also based on the 
% \textsf{enumitem}~\cite{ENUM} package) accepts an optional parameter, 
% similar to the \texttt{enumerate} environment.
%
% \subsection{Items aligned by row: \texttt{tablenum1}, \texttt{tablenuma}, \texttt{tablitem}}
% \DescribeEnv{tablenum1} 
% \DescribeEnv{tablenuma}
% \DescribeEnv{tablitem}
% These three environments are employed to typeset brief questions (\texttt{tablenum1}),
% sub-questions (\texttt{tablenuma}) or \texttt{itemize} lists (\texttt{tablitem})
% on the same line. They share the same syntax:
% |\begin{tablenum1}|\oarg{opt}|(|\meta{cols}|)|.
% The \meta{cols} parameter denotes the number of columns utilized by the environment. 
% It must be enclosed \emph{in parentheses}. 
% This parameter can be omitted, in which case its default value is 2.
% Similar to conventional lists, each item is initiated with the |\item| command.
%
% \smallskip
% Internally we have utilized the
% |\NewTasksEnvironment| macro from the \textsf{tasks} package by 
% Clemens Niederberger~\cite{TASK}.
% The usage of the optional argument \meta{opt} is
% explained in the documentation of this package.
% For example, similar to the \textsf{enumitem} package~\cite{ENUM},
% |label=\arabic*)| produces an Arabic numbering
% followed by a closing parenthesis.
% Additionally there are numerous possibilities for arranging items in original ways.
% For instance, the |\item*| command allows you to
% specify the number of columns the item is supposed to span.
% In the subsequent example,
% the five |\item| commands are sequentially positioned between
% |\begin{tablenum1}(3)| and |\end{tablenum1}|.
% Notice that numbering occurs line by line in this context.
%
% \exercise
% \psframe(-0.25,1.3)(12.75,-2.8)
% Calculate the derivative of the following functions:
% \begin{tablenum1}(3)
% \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
% \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$,
% \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
% \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
% \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
% \end{tablenum1}
%
% \smallskip
% For \texttt{tablenuma}, labels are letters, a, b, c, \ldots, enclosed in parentheses. 
%
% \DescribeMacro{\labelenumone}\DescribeMacro{\labelenuma}
% You can change the labels by redefining the macros |\labelenumone| 
% (for \texttt{tablenum1}) and |\labelenuma| (for \texttt{tablenuma}), 
% using the \texttt{task} counter:
% \eg |\renewcommand\labelenuma{\Alph{task}.}| yields the labels 
% \textbf{A.}, \textbf{B.}, \ldots
%
% \smallskip
% If the \textsf{exesheet} package is invoked with the option \texttt{setlist=false},
% labels within \texttt{tablenum1} and \texttt{tablenuma} environments
% will be presented with indentation and in normal font rather than bold.
% You can change the label formatting globally with the command |\settask|, \eg
% |\settask{label-format=\itshape}|.
% You can also completely redefine the environments using |\RenewTasksEnvironment|.
% When \texttt{setlist=true}, place these commands \emph{after} |\begin{document}|.
%
% \medskip
% \DescribeEnv{tablenuma*} \DescribeEnv{tablitem*}
% When you intend to utilize \texttt{tablenuma} (or \texttt{tablitem})
% immediately after inserting the |\item| command
% within an \texttt{enumerate} environment,
% a vertical misplacement may occur.
% ^^A as demonstrated in the following example:
% ^^A \begin{enumerate}
% ^^A \item 
% ^^A \begin{tablenuma}(3) \item One \item Two \item Three \end{tablenuma}
% ^^A \end{enumerate}
% To achieve proper vertical spacing in such cases, we offer
% the starred environments \texttt{tablenuma*} and \texttt{tablitem*}, 
% with corrected alignment as shown below:
%
% \noindent\psframe(-0.25,0.05)(12.75,-0.97)
% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0, -0.63)(10.5, -0.63)
% \begin{enumerate}
% \item 
% \begin{tablenuma*}(3) \item One \item Two \item Three \end{tablenuma*}
% \end{enumerate}
%
% \medskip
% If the vertical alignment is still not perfect, include
% |\mbox{}\vspace|\marg{height} just after |\item| and before invoking |\begin{tablenuma*}|
% (or |\begin{tablitem*}|), where \meta{height} can be a positive or negative length.
%
% \subsection{Items aligned by column: \texttt{colsenum}, \texttt{colsitem}}
% \DescribeEnv{colsenum}    
% To achieve numbering of items by column, we provide the
% \texttt{colsenum} environment:
% |\begin{colsenum}|\oarg{opt}\marg{cols}. 
% The mandatory parameter is the number of columns,
% and the optional parameter will be passed to the underlying \texttt{enumerate} environment,
% allowing you to change the numbering type (\eg a, A, etc.), among other possibilities.
% \emph{To use this environment, you need to load the
% \textsf{multicol} package in the preamble.}
% Here's an example with |\begin{colsenum}{3}|:
%
% \exercise
% \psframe(-0.25,1.3)(12.75,-2.65)
% Calculate the derivative of the following functions:
% \begin{colsenum}{3}
% \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
% \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$,
% \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
% \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
% \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
% \end{colsenum}
%
% \medskip
% \DescribeEnv{colsenum*}
% It may be observed that, on each line, items are not necessarily properly
% aligned, which can result in ungraceful effects. 
% On the other hand, the \texttt{colsenum} environment doesn't attempt to align columns 
% from the bottom by adjusting the vertical spacing between items.
% If you desire this alignment
% (which is the default behavior in \textsf{multicol}), you can use the
% \texttt{colsenum*} environment (with the same syntax as \texttt{colsenum}).
% Here's what we obtain with \texttt{colsenum*}:
%
% \exercise
% \psframe(-0.25,1.3)(12.75,-2.67)
% Calculate the derivative of the following functions:
% \begin{colsenum*}{3}
% \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
% \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$,
% \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
% \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
% \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
% \end{colsenum*}
%
% \medskip
% We can observe that these alignments are not as elegant as those
% achieved through row numbering. However, column numbering
% might still be more suitable when dealing with numerous items of varying heights,
% and especially when the number of items can differ from column to column.
% Additionally, a benefit of \texttt{colsenum} is that the label selection 
% is automatic, based on the list level (and the language),
% unlike \texttt{tablenum1} or \texttt{tablenuma}. 
%
% \bigskip
% \DescribeEnv{colsitem} 
% \DescribeEnv{colsitem*}
% For \texttt{itemize} lists, the \texttt{colsitem} environment
% generates items aligned by column, unlike the line-by-line alignment of
% \texttt{tablitem}. It follows the same syntax as \texttt{colsenum}:
% |\begin{colsitem}|\oarg{opt}\marg{cols}. The optional parameter,
% passed to the underlying \texttt{itemize} environment, 
% allow to change the item label (bullet by default).
% Furthermore, just like \texttt{colsenum*}, the \texttt{colsitem*} environment
% produces column alignment from the bottom.
% \emph{The \textsf{multicol} package is also required and must be loaded in the preamble.}
%
% \section{Questions and solutions}
%
% \subsection{Environments \texttt{questions} and \texttt{answers}}
% \label{output}
%
% \DescribeEnv{questions} \DescribeEnv{answers}
% The \textsf{exesheet} package offers two environments, 
% \texttt{questions} and \texttt{answers},
% which allow you to optionally show or hide questions and answers within exercises.
%
% \bigskip
% \DescribeMacro{[output=\meta{opt}]}
% The output is governed by the \texttt{output} key option which recognizes three
% values: \texttt{questions}, \texttt{answers}, and \texttt{both}.
% The \texttt{questions} value shows only questions without answers,
% \texttt{answers} displays answers without questions, and
% \texttt{both} (the default option) displays  both questions and answers.
% 
% \bigskip
% \DescribeMacro{\correctionstyle} \DescribeMacro{correctioncolor}
% In the default case where both questions and answers are displayed,
% the answers are typeset using the |\correctionstyle| style,
% which utilizes the color \texttt{correctioncolor}.
% You can modify this color using the |\definecolor| macro
% \footnote{The \texttt{\bs definecolor} command is provided by the \textsf{xcolor} package 
% developed by Uwe Kern, which is automatically loaded by \textsf{exesheet}.}.
% By default, |\definecolor{correctioncolor}{rgb}{0,0.2,0.6}| is used,
% resulting in a kind of dark blue.
%
% \medskip
% \DescribeMacro{\correctionname}
% Furthermore, when using \texttt{output=both}
% the title \textbf{\correctionname} is displayed at the beginning
% of \texttt{answers} environments.
% This title is defined by the |\correctionname| macro, 
% with translation available in several languages, and it can also be modified.
% For instance you might prefer ``Solution''
% over ``\correctionname''.
% The style defined by |\correctionstyle| will be applied to the title
% as well as the entire environment.
% Here's an example to illustrate this:
%
% \pagebreak
% ^^A \vspace{-\baselineskip}
% \noindent\psframe(-0.25,-0.25)(12.75,-7.1) 
% \exercise
% \begin{questions}
% \begin{enumerate}
% \item Is the \textsf{exesheet} package useful ? 
% \item Aren't there any other packages that deal with exercises ?
% \end{enumerate}
% \end{questions}
% \begin{answers}
% \begin{enumerate}
% \item The \textsf{exesheet} package is useful for teachers.
% \item There are numerous other packages that handle exercises and
% provide the capability to create questions and solutions separately.
% For instance the
% \textsf{exercise} package by Paul Pichaureau, \textsf{exercises} by Roger Jud,
% \textsf{exsheets} (now superseded by \textsf{xsim}) by Clemens Niederberger,
% \textsf{exframe} by Niklas Beisert,
% \textsf{exam} by Philip Hirschhorn,
% \textsf{answers} by Mike Piff and Joseph Wright,
% \textsf{probsoln} by Nicola Talbot, 
% \textsf{eqexam} by D. P. Story\ldots
% They are briefly presented in section \ref{comparison}.
% \end{enumerate}
% \end{answers}
%
% \medskip
% When only answers are displayed, the text color remains black and
% the word ``\correctionname'' is not displayed.
%
% \subsection{More about \texttt{answers} environments}
% Internally, we have utilized the |\comment| and |\endcomment| macros
% from the \textsf{versions} package by Uwe Lück~\cite{VERS}.
% ^^A Several other packages also enable selective management of code portions.
% ^^A Notably, the \textsf{verbatim} package by Rainer Schöpf, 
% ^^A \textsf{comment} by Victor Eijkhout, 
% ^^A \textsf{version} by Donald Arseneau and Stephen Bellantoni,
% ^^A \textsf{optional} by Donald Arseneau
% ^^A and \textsf{codesection} by Matthias Pospiech.
% Moreover, the \textsf{versions} package~\cite{VERS} offers 
% the |\excludeversion|\marg{env} and
% |\includeversion|\marg{env} macros which allow for the exclusion or inclusion of
% any environment \meta{env}. These ``optional'' environments
% can be nested.
% ^^A \footnote{The \textsf{codesection} package also supports
% ^^A such nesting, including within the preamble, as well as the \textsf{optional} package, 
% ^^A but the latter manages only short sections of optional code.}.
%
% However the \texttt{questions} and \texttt{answers} environments
% serve a broader purpose beyond merely displaying or hiding text.
% You can choose to have a single answers environment 
% for the entire sheet, or alternatively, have separate answers environments 
% for each exercise, exercise part, question, or sub-question. 
% The format in which the title \textbf{\correctionname} should appear
% in the output, and its placement in the table of contents
% or PDF file summary, depends on the nesting level of the environment.
% In fact, the rendering of the \textbf{\correctionname} title and its corresponding
% table of contents level will be automatically calculated by the environment.
%
% \medskip
% \DescribeEnv{answers\oarg{level}}
% However, users might wish to adjust the title's level themselves.
% To achieve this, you can manually set the level of the title ``\correctionname''
% using an optional \meta{level} argument which is defined as follows:
% 1 for section-level titles,
% 2 for subsections (akin to \textbf{\exercisename}), 
% 3 for sub-subsections (similar to \textbf{\partname}),
% other numbers for lower levels
% (which won't appear in the table of contents or in the PDF file’s summary).
%
% Caution should be taken that, if the \texttt{questions} environment is not used 
% beforehand in the same exercise (or part), 
% the \texttt{answers} environment will consider the correction as global 
% for the entire sheet (or exercise) and will reset the \texttt{exercise} 
% (or \texttt{part}) counter. 
% This can be managed properly with the optional argument.
% For example, use |\begin{answers}[2]| to prevent \texttt{exercise} counter reset,
% or |\begin{answers}[3]| to prevent \texttt{subpart} counter reset.
%
% \medskip
% \DescribeMacro{answers*}
% The starred version \texttt{answers*} doesn't display the
% \textbf{\correctionname} title.
%
% \subsection{Commands \texttt{\bs question}, \texttt{\bs answer} and \texttt{\bs answerspace}}
% \label{answerspace}
% \DescribeMacro{\question}\DescribeMacro{\answer}
% Instead of using \texttt{questions} and \texttt{answers} environments,
% we can also employ the simpler |\question|\marg{ques} and |\answer|\marg{ans} macros.
% The visibility of \meta{ques} and \meta{ans} content is  
% regulated by the same previous \texttt{output=\meta{opt}} key option.
% This approach might be more fitting when
% you wish to display answers immediately after each question item.
% The title ``\correctionname'' won't appear at the start
% of each answer with the |\answer| macro. 
% The answers are also formatted using |\correctionstyle|
% if \texttt{output=both}.
% However these commands do not support \texttt{verbatim} text within them,
% unlike the \texttt{questions} and \texttt{answers} environments.
% 
% \DescribeMacro{\question*}\DescribeMacro{\answer*}
% When a code must be executed only when questions are displayed but not
% answers, or the contrary, you have the starred versions \eg |\question*{\pagebreak}|.
%
% \bigskip
% \DescribeMacro{\answerspace}
% Some teachers are accustomed to providing their students with documents 
% where questions are typeset, leaving blank spaces instead of answers. 
% This layout allows students to fill in their responses on the paper.
% Thanks to a suggestion from Maxime Chupin,
% we achieve this with the |\answerspace|\marg{height} macro,
% in which the parameter \meta{height} is a valid length, 
% \eg |\answerspace{3cm}|.
%
% \medskip
% \DescribeMacro{[answerspace=\meta{bool}]}
% The blank spaces introduced by |\answerspace| can be displayed 
% or hidden, controlled by the
% \texttt{answerspace} option key, which can be set to either 
% \texttt{true} or \texttt{false} (the default).
% The  \texttt{answerspace} key option has no effect (equivalent to \texttt{false})
% when the answers are displayed (\texttt{output=answers} or \texttt{both}).
% Of course the |\answerspace| macro is not meant to be used within \texttt{answers}
% environments.
%
% \section{Marking scheme commands} 
%
% The \textsf{exesheet} package provides several commands to display a marking
% scheme, with optional comments and explanations about answers in the margins.
%
% \subsection{The \texttt{\bs points} command}\label{points}
% \DescribeMacro{\points}
% The |\points|\marg{pts} command displays the number of points awarded for an exercise.
% It is intended to be included in the optional argument of the 
% |\exercise| command
% \footnote{However using \texttt{\bs points} in the optional argument of 
% \texttt{\bs exercise} is not compatible with
% the \textsf{memoir} class, as the \textsf{memoir} class redefines section commands.}.
% In the following example, we used
% |\exercise[\points{5}]|:
% \exercise[\points{5}]
% \psframe(-0.25,1.3)(12.75,-0.4)
% Try to read this document to the end without drinking tea and you get five points.
%
% \bigskip
% When only the answers are displayed in an exercise, the |\points| macro doesn't
% show the points.
% Further, we provide another macro, which displays points
% in \texttt{questions} like here, and differently in \texttt{answers} environments
% (see section \ref{totalpoints}).
%
% \bigskip
% \DescribeMacro{\pointsname} \DescribeMacro{\pointname}
% The term ``\pointsname'' (or ``\pointname'' in the singular 
% if \meta{pts} is less than 2) is appended and
% is automatically translated into several languages
% (and can also be modified).
% 
% \smallskip
% \DescribeMacro{\pointsstyle} \DescribeMacro{pointscolor}
% You can adjust the |\points| command's style through |\pointsstyle|. 
% The color setting (red by default) is managed by |pointscolor| using |\definecolor|,
% for example you can declare: |\definecolor{pointscolor}{named}{blue}|.
%
% \subsection{The \texttt{\bs pts} command} \label{pts}
% \DescribeMacro{\pts}
% When exercises are typeset using the |\exe| macro
% or as a list with the \texttt{exenumerate} environment,
% the marking scheme can be shown in the margin, aligned with the line where
% the |\pts|\marg{num} command is placed (typically the first line of the exercise).
% The \meta{num} parameter represents the number of points assigned to the exercise.
% Here's an example with |\exe\pts{3}... \exe\pts{1.5}...|
%
% \vspace{-\baselineskip}
% \noindent\psframe(-3.0,-0.25)(12.75,-1.95)
% \exe \pts{3} The first short exercise with a marking scheme.
% \exe \pts{1.5} The second one.
% 
% \bigskip
% \DescribeMacro{\ptsname} \DescribeMacro{\ptname} 
% \DescribeMacro{ptscolor} \DescribeMacro{\ptsstyle}
% The abbreviation ``\ptsname'' (or ``\ptname''
% when the number of points is less than 2)
% is added automatically using |\ptsname| or |\ptname| macros
% (translated in several languages
% if \textsf{babel} or \textsf{polyglossia} is loaded).
% The point's display color is defined by \texttt{ptscolor}, changeable via
% |\definecolor| (red by default).
% The display style is determined by |\ptsstyle|, which among other things,
% adds parenthesis around.
%
% \bigskip
% \DescribeMacro{[display=\meta{opt}]} 
% The marking scheme visibility is controlled by the
% \texttt{display} option key.
% The default option is |display=none|, keeping the marking scheme hidden.
% To reveal the marking scheme, use |display=pts|.
% More details are available in section \ref{margin}.
%
% \medskip
% \DescribeMacro{[marginpos=\meta{opt}]} 
% The positioning of the scale is determined by the |marginpos| option key,
% typically \texttt{left} or \texttt{right}.
% The default value is \texttt{left}
% even though \LaTeX{} positions marginal notes on the right side by default. 
% This option has no impact when |display=none|.
%
% For a two-sided document, the default behavior is to place text in the outer margin,
% which is wider than the inner margin (that contains the binding).
% The outer margin is positioned on the right side on odd pages and on the left side
% on even pages. Therefore, the \texttt{marginpos} option can also take the  
% values \texttt{inner} or \texttt{outer}.
% If you specify \texttt{left} or \texttt{right} when the \texttt{twoside} mode is activated,
% this value will be converted to \texttt{outer}, accompanied by a warning message.
%
% \medskip
% With the \texttt{twoside} mode, marginal notes might occasionally 
% appear on the wrong side of a page. 
% This is a known \LaTeX{} bug, and the solution involves using
% the \textsf{mparhack} package by Tom Sgouros and Stefan Ulrich~\cite{MPAR}
% (which \textsf{exesheet} automatically includes
% for documents in two-side mode) and \emph{running \LaTeX{} twice}. 
% If necessary, a warning message will prompt you to perform the re-run.
% 
% \subsection{Commands \texttt{\bs totalexe}, \texttt{\bs note*} and \texttt{\bs note}}
%
% \label{note}
% For a more comprehensive marking scheme, the following commands are available. 
%
% \medskip
% \DescribeMacro{\totalexe}
% The |\totalexe|\marg{num} macro displays the total number of points of an exercise.
% By default, it appears inside an oval box, with the addition of the word 
% ``\ptsname'' (or ``\ptname'') in bold red.
% In the following example, the exercise title has been generated
% using |\exercise[\totalexe{4}]|.
%
% \medskip
% \DescribeMacro{\note*} 
% For each answer or solution in the correct version, the 
% |\note*|\marg{num} command indicates the number of points allocated to that question.
% The appearance slightly varies compared to |\pts|:
% by default the number is displayed in bold without the ``\ptsname'' or ``\ptname'' suffix,
% and without parenthesis. 
% In the following example, for answer 3, 
% we employed |\note*{1.5}|, placed right after |\item|.
%
% \medskip
% \DescribeMacro{\note}
% The |\note|\marg{comment} macro is utilized to provide additional information
% regarding the marking scheme and to explain how points are assigned.
% In the \meta{comment} argument you can use |\\| to create a line break
% or even |\\[|\meta{height}|]| to adjust the line spacing by \meta{height}.
%
% \DescribeMacro{\note\oarg{num}}
% Placing |\note*|\marg{num}|\note|\marg{comment} 
% at the beginning of an answer is often practical. 
% In such cases \LaTeX{} will align the margin
% notes vertically, which leads to a warning like: 
% \texttt{LaTeX Warning: Marginpar on page \ldots\@ moved.}
% However, this warning is not an issue, as \LaTeX{} can usually handle the arrangement
% of these marginal notes, stacking them one below the other. 
% Nonetheless, to prevent unnecessary warnings, you can combine both commands into a
% single one by specifying the number of points as an optional argument of the |\note| command:
% |\note|\oarg{num}\marg{comment}.
%
% The initial comment in the following example is generated (immediately after |\item|) using
% |\note[1]{0.5 for the anti-derivative\\0.5 for simplifying}|.
%
% \exercise[\totalexe{4}] \label{totalexe}
% \begin{questions}
% \psframe(-3.5,1.3)(12.75,-14)
% For each subsequent question, determine whether the statement is true or false.
% Provide a thorough justification for your answer.
% \begin{tablenum1}
% \item $\ds \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}} \,\mathrm{d}x = \ln 2$,
% \item $\ds \int_{2}^{\mathrm{e}} \frac{1}{x\ln x} \,\mathrm{d}x = -\ln 2$,
% \item* The function $F$, defined on $\mathbf{R}$ by 
% $F(x) = \ds \int_{0}^{x}\frac{1}{t^2+t+1}\,\mathrm{d} t$, is increasing on $\mathbf{R}$.
% \end{tablenum1}
% \end{questions}
% 
% \begin{answers}
% \begin{enumerate}
%    \item \note[1]{0.5 for the anti-derivative\\0.5 for simplifying}
%    We calculate:
%    \[ \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x
%        = \bigg[ \ln\left(x+\sqrt{3}\right) \bigg]_0^{\sqrt{3}}
%        = \ln\left(2\sqrt{3}\right)-\ln \sqrt{3}
%        = \ln\left(\frac{2 \sqrt{3}}{\sqrt{3}}\right)
%        =\ln 2.
%    \]
%    \textbf{TRUE}.
%
%    \item \note[1.5]{1 for the anti-derivative \\0.5 for the final value \\[2ex]
%        Other method: $\frac{1}{x \ln x} >0$ on $[2, \mathrm{e}]$ 
%        whereas $-\ln2<0$
%    }
%    We have $\ds\frac{1}{x \ln x}= \frac{\frac{1}{x}}{\ln x}= \frac{u'(x)}{u(x)}$
%    with $u(x)=\ln x$, which is positive on $[2, \mathrm{e}]$. Hence
%
%    \[ \int_{2}^{\mathrm{e}}\frac{1}{x \ln x}\,\mathrm{d}x
%        = \Big[ \ln(\ln x) \Big]_2^\mathrm{e}
%        = \ln(\ln \mathrm{e})-\ln(\ln2)= \ln1 -\ln(\ln2)=-\ln(\ln2).
%    \]
%    \textbf{FALSE}.
%
%    \item \note*{1.5}
%    The function $F$, defined on $\mathbf{R}$ by
%    \[ F(x)= \int_{0}^{x}\frac{1}{t^2+t+1}\, \mathrm{d}t, \]
%    is derivable on $\mathbf{R}$ and its derivative is such that
%    $F'(x)=\frac{1}{x^2+x+1}$.
%    \note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}
%    The denominator is a quadratic polynomial, always positive because its discriminant is
%    $\Delta=-3 <0$.
%    Thus $F$ is increasing on $\mathbf{R}$. \\
%    \textbf{TRUE}.
% \end{enumerate}
% \end{answers}
% In the comment for answer 2, a larger vertical space is created with
% the optional argument |\\[2ex]| for line break.
% The last comment, which isn't positioned next to the points number,
% was produced by placing the following on the first line after the formula:
% |\note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}|.
%
% \medskip
% \DescribeMacro{markingcolor} \DescribeMacro{\markingstyle} \DescribeMacro{\ptsboxlength}
% The color and style for displaying points in |\totalexe| and |\note*|
% can be customized using \texttt{markingcolor} and |\markingstyle|, respectively. 
% The oval box produced by |\totalexe| is created using the |\ovalbox| command
% from the \textsf{fancybox} package by Timothy Van Zandt~\cite{FBOX},
% with corner arcs set by |\cornersize{1}|.
% The box's length is determined by
% |\ptsboxlength|, and not by the box's content, to ensure uniformity across exercises.
%
% \medskip
% \DescribeMacro{notecolor} \DescribeMacro{\notestyle} 
% By default, comment notes are typeset in a dark green color
% defined by |\definecolor{notecolor}{rgb}{0.0,0.4,0.0}|.
% The style of comments is determined by the |\notestyle| macro.
%
% \subsection{Margin notes options} \label{margin}
%
% \DescribeMacro{[display=\meta{opt}]}
% The \texttt{display} key option governs the presentation of the marking scheme:
% as discussed previously (subsection \ref{pts}), 
% \texttt{display=none} shows nothing. When using \texttt{display=pts}
% the numbers provided as arguments to |\pts|, |\totalexe|, |\note*|
% or as optional arguments of |\note|\oarg{num}\texttt{\{...\}} will be exhibited.
% The final option is \texttt{display=notes} which reveals the complete marginal
% notes, containing points and comments (the mandatory argument of |\note|),
% as illustrated in the previous example.
%
% \medskip
% \DescribeMacro{[marginpos=\meta{opt}]}
% As previously mentioned  in subsection \ref{pts}, the side on which
% to position the scale is determined by the \texttt{marginpos} key option,
% with possible values of \texttt{left} and \texttt{right} 
% (or \texttt{inner} and \texttt{outer} if the document is in \texttt{twoside} mode).
%
% \medskip
% \DescribeMacro{[marginwidth=\meta{opt}]}
% The margin layout is governed by the \texttt{marginwidth} key option, 
% which can take one of the following values:
% \texttt{standard}, \texttt{expand}, or \texttt{unset}.
%
% This option has no effect when \texttt{display=none}.
% In this case, both the left and right margins have the same width,
% except in a two-sided document where the ratio between the left and right
% margins is 2:3.
% Otherwise the \texttt{marginwidth} key option behaves as follows:
% \begin{description}
% \item[\texttt{standard}] 
% The left margin is widened, and the 
% right margin is reduced, with a ratio of 3:2 (or 2:3 if \texttt{marginpos=right}).
% The text body is shifted without changing its width.
% The margin paragraph width remains relatively short
% (depends on page geometry).
% This option is not ideal for lengthy comments.
% 
% \item[\texttt{expand}] (default value)\enskip
% The behavior is the same as with the
% \texttt{standard} value when \texttt{display=pts}. However, when \texttt{display=notes},
% the margin expands with a ratio of 3:1 (or 1:3) and the width of margin paragraphs
% increases.
%
% \item[\texttt{unset}] This option is provided for cases where the previous settings
% are not suitable.
% In this case, no adjustments are made to the margin width. Instead, you can define
% your own settings using the convenient |\geometry| macro
% from the \textsf{geometry} package by Hideo Umeki~\cite{GEOM}.
% For instance, you can place the following in the preamble:
% \centeredline{|\geometry{hmarginratio=2:1,marginparwidth=2.5cm}|.}
%
% If \texttt{marginpos=right}, you need to invert the ratio, \eg 1:2 instead of 2:1.
% If \texttt{marginwidth} is not set to \texttt{unset}, 
% such a command will have no effect.
% \end{description}

% Margin settings are applicable to the entire document 
% and need to be configured in the preamble.
%
% \medskip
% \DescribeMacro{[noteragged=\meta{opt}]}
% The package option \texttt{noteragged} controls the text alignment within the margins 
% for the mandatory argument of |\note|.
% It offers the following values: 
% \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}.
% The default value is \texttt{noteragged=left}, resulting in right-aligned text, 
% which is common for text in the left margin.
% When \texttt{noteragged=right}, the text is left-aligned.
% Using \texttt{justify} makes the text justified, aligning with
% \LaTeX's default behavior for marginal notes. 
% Finally \texttt{noteragged=twoside} aligns text to the left on odd pages
% and to the right on even pages in a two-sided document.
% It has no effect otherwise (the default \texttt{noteragged=left} is used
% and a warning message appears in the terminal).
%
% When \texttt{display} is not set to \texttt{notes}, the \texttt{noteragged} option
% has no impact, as it specifically applies to text within the mandatory argument of |\note|.
% 
% \subsection{The \texttt{\bs totalpoints} command} \label{totalpoints}
%
% \DescribeMacro{\totalpoints}
% The |\totalpoints|\marg{num} macro serves as a replacement for
% |\points| when using a comprehensive marking scheme.
% When the scale is not displayed,
% it functions similarly to |\points| (visible in questions but not in answers),
% and when the scale is shown,
% it's akin to |\totalexe|.
% For instance, in exercise \ref{totalexe}, we could have used |\totalpoints| 
% instead of |\totalexe|. Thus,
% if the detailed marking scheme is not displayed, the total points would be presented
% similarly to exercise \ref{points}.
%
% \subsection{Marking scheme consistency checking}\label{scale}
%
% \DescribeMacro{[checkpts=\meta{bool}]}
% The marking scheme can be checked out
% \footnote{Thanks to Denis Bitouzé for his suggestion about this feature.}
% using the key-val option \texttt{checkpts=true} (or just \texttt{checkpts});
% the default value is \texttt{false}.
%
% \medskip
% For each exercise, the cumulative points allocated to each question (via |\pts|, |\note*|
% or |\note[ ]| are compared to the exercise's total specified in 
% |\points|, |\totalexe| or |\totalpoints|.
% A warning message will be displayed in the shell to indicate whether
% the scale is valid
% for the exercise or not. For example:
% \begin{center}
% \texttt{Package exesheet warning: Exercise 3: Sum of points is 4.5pt instead of 5pt.}
% \end{center}
% Both comma notation (\eg 4,5) and decimal point format (\eg 4.5)
% may be accepted, depending on your chosen language.
% The control is made at the beginning of the subsequent exercise,
% inside the |\points|, |\totalexe| or |\totalpoints| macros.
% No deep checking will be processed at this level if no points are displayed
% for the questions inside the exercise (with \texttt{display=none} option).
%
% \medskip
% \DescribeMacro{\totalsheet}
% At the end of the document, the last exercise is checked, 
% followed by a global examination of the entire sheet. 
% This last task requires knowledge of the total points for the sheet, which must be given
% by the |\totalsheet|\marg{points} macro in the preamble;
% otherwise, a warning message will be displayed.
% If subtotals have been assigned to exercises and \emph{displayed}, the overall comparison
% is made between the sum of these subtotals and the total points recorded
% using |\totalsheet|.
% If not, the evaluation encompasses the sum of points for each individual question.
% A subsequent warning message indicates the outcome of this last verification.
% Finally, a message indicates whether all scale controls have been successfully
% passed or not.
%
% \section{Options and comparison with other packages} 
%
% \subsection{Summary of available options}\label{options}
%
% Here we provide a summary table of the available options. Details on their usage
% can be found in the respective sections.
% The default value is displayed in bold.
%
% \begin{center} \ttfamily
% \setlength{\extrarowheight}{1pt}
% \begin{tabular}{llc}
% \hline
% \textsf{Key} & \textsf{Possible values} & \textsf{See section} \\
% \hline
% exetoc & \textbf{true}, false & \ref{toc} \\
% setlist & \textbf{true}, false & \ref{setlist} \\
% output & questions, answers, \textbf{both} & \ref{output} \\
% answerspace & true, \textbf{false} & \ref{answerspace}\\
% display & \textbf{none}, pts, notes & \ref{pts}, \ref{margin} \\
% marginpos & \textbf{left} (inner), right (\textbf{outer}) & \ref{pts}, \ref{margin} \\
% marginwidth & standard, \textbf{expand}, unset & \ref{margin} \\
% noteragged & \textbf{left}, right, center, justify, twoside & \ref{margin} \\
% checkpts & true, \textbf{false} & \ref{scale} \\
% correct & true, \textbf{false}, conditional & \hyperlink{correct}{see below} \\
% \hline
% \end{tabular}
% \end{center}
%
% When an invalid key is provided, an error is generated. However,
% an unrecognized value only triggers a warning message:
% \centeredline{\texttt{Value ... is not supported by ... option
% on input line \ldots}}
% For each option, you can set them through the class or package invocation, \eg 
% |\usepackage[output=answers,display=notes,noteragged=right]{exesheet}|
%
% \bigskip
% \DescribeMacro{\exesheetset}
% You can also use the |\exesheetset|\{list of \meta{key}=\meta{value}\}
% command.
% Note that some options, \texttt{output}, \texttt{answerspace}, \texttt{display}, 
% and \texttt{noteragged}, 
% can be changed dynamically, even within the document,
% while the others are applicable in the preamble exclusively.
% Dynamic options are processed with each call, whereas the others are processed once,
% at the beginning of the document.
% \hypertarget{correct}{}
%
% \bigskip
% \DescribeMacro{[correct=\meta{opt}]} 
% A special option, \texttt{correct}, can be employed when using the \textsf{exesheet}
% \emph{class} or in conjunction with the \textsf{schooldocs} package.
% This option adds ``\correctname'' (or its translation)
% to the document title and headers.
% Possible values are: \texttt{true}, \texttt{false} (by default) or \texttt{conditional}.
% Using \texttt{correct=conditional}, it behaves as \texttt{true} 
% when answers are displayed and \texttt{false} when they're not.
%
% \subsection{Alternative commands}
% 
% Prior to version 2.0, we used specialized commands to configure 
% output and display options.
% We have now implemented \emph{key=value} options.
% Although the latter are more user-friendly,
% one may prefer the old commands, so they are still supported,
% but will trigger a warning message. These commands are presented below.
%
% However, the previous options \texttt{nosetlist} and \texttt{notoc}
% are no longer supported.
%
% \bigskip
% \DescribeMacro{\questionsonly} \DescribeMacro{\answersonly}
% The command |\questionslonly| is equivalent to setting \texttt{output=questions} 
% and |\answersonly| means \texttt{output=answers}.
%
% \DescribeMacro{\displaypts} \DescribeMacro{\displaypoints} 
% The commands |\displaypts| and |\displaypoints| 
% are equivalent to setting \texttt{display=pts}.
%
% \bigskip
% \DescribeMacro{\displaynotes}\DescribeMacro{\displaynotesright}
% |\displaynotes| means \texttt{display=notes},
% and |\displaynotesright| corresponds to
% \texttt{display=notes,marginpos=right}.
% These two commands have an optional argument |\displaynotes|\marg{ragged}
% where \meta{ragged} is an alignment command to work inside margin notes.
% By default it is |\RaggedLeft| with |\displaynotes| and |RaggedRight|
% \footnote{These commands come from the \textsf{ragged2e} package 
% by Martin Schröder~\cite{RAGG}.}
% with |\displaynotesright|.
%
% \subsection{Comparison with other packages}\label{comparison}
%
% In this section, we will provide an overview of the functionalities (as of today \today) 
% of various packages or classes found in the `Exercise' or `Exam' sections 
% of the CTAN archives
% (Comprehensive \TeX\ Archive Network).
% Considering the substantial number of packages in these sections, 
% some omissions may have been unintentionally made.
% Those excluded are those with documentation not in English 
% or primarily dedicated to producing multiple-choice questions 
% or random question generation. 
% We have focused here on typesetting functionalities and not on managing exercise 
% databases as there are specialized packages or external softwares for that.
%
% The following table is not a result of tests but presents a summary of information 
% collected from the documentation of these packages. 
%
% \begin{multicols}{2}
% \begin{flushleft}
% \begin{enumerate}[label=\Alph*., font=\normalfont, noitemsep]
% \item \textsf{exercise}, Paul Pichaureau~\cite{EXER}
% \item \textsf{exercises}, Roger Jud~\cite{EXES}
% \item \textsf{xsim}, Clemens Niederberger~\cite{XSIM}
% \item \textsf{exframe}, Niklas Beisert~\cite{EXFR}
% \item \textsf{exam}, Philip Hirschhorn~\cite{EXAM}
% \item \textsf{answers}, Mike Piff and Joseph Wright~\cite{ANSW}
% \item \textsf{probsoln}, Nicola L.C.\@ Talbot~\cite{PROB}
% \item \textsf{exsol}, Walter Daems~\cite{EXSO}
% \item \textsf{exercisepoints}, Henning Kerstan~\cite{EXEP}
% \item \textsf{worksheet}, Benjamin Zöllner~\cite{WORK}
% \item \textsf{exam-n}, Norman Gray~\cite{EXAN}
% \item \textsf{eqexam}, D. P. Story~\cite{EQEX}
% \item \textsf{cesenaexam}, Alex Pacini~\cite{CESE}
% \item \textsf{esami}, Grazia Messineo, Salvatore Vassallo~\cite{ESAMI}
% \item \textsf{randexam}, Jianrui Lyu~\cite{RAND}
% \item \textsf{hideanswer}, Yukoh Kusakabe~\cite{HIDE}
% ^^A\item \textsf{mathexam}, Jan Hlavacek~\cite{MATH}
% \item \textsf{exesheet}, Antoine Missier
% \end{enumerate}
% \end{flushleft}
% \end{multicols}
%
% \newcommand\X{\ding{56}}
% \setlength{\extrarowheight}{2pt}
% \noindent\begin{tabular}{@{\hspace{1.8pt}}l@{\hspace{2pt}}|%
%  *{17}{@{\hspace{1.8pt}}c@{\hspace{1.8pt}}|}}
% \hline
% Functionality &A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q \\
% \hline
% Optional text for exercise titles &\X&&\X&\X&\X&&&&\X&&&&\X&&&&\X \\
% Subparts of exercises &\X&&&\X&\X&&&&\X&&\X&\X&\X&\X&\X&&\X \\
% Annex title or appendix &&&&&&&&&&&&&&&\X&&\X \\
% Exercise titles in TOC of PDF files &\X&&&&&&&&&&&&&&&&\X \\
% Short labels for exercises &\X&&\X&\X&&&&&&&&&&&&&\X \\
% Hiding questions or answers* &\X&*&\X&\X&*&\X&\X&\X&&&*&\X&&\X&*&*&\X \\
% Different placements for answers &\X&&&&&&&&&&\X&\X&&&&&\X \\
% Change answers placement in output &\X&&&\X&&\X&&\X&&&&\X&&&&& \\
% Blank spacing in place of answers &&\X&\X&&\X&&&&&&&\X&&\X&\X&&\X \\
% Marking scheme commands &&\X&\X&\X&\X&&&&\X&\X&\X&\X&&\X&\X&&\X \\
% Various positions of points &&&&\X&\X&&&&&&&\X&&\X&&&\X \\
% Marking scheme calculation/checking &&\X&\X&\X&\X&&&&\X&&\X&\X&&&\X&&\X \\
% Detailed notes for scoring guide &&&&&&&&&&&&&&&&&\X \\
% \hline
% \end{tabular}
% \medskip
%
% \StopEventually{}
%
% \pagebreak
% \section{Implementation}
%
% \subsection{Options and required packages}
% The \texttt{exesheet} class is build upon the \texttt{article} class
% and transfers all its unknown options to it. The use of
% |\ProcessKeyvalOptions*| is unnecessary within the class 
% as it will be managed by the package.
%    \begin{macrocode}
%<*class>
\RequirePackage{kvoptions}
\DeclareBoolOption[true]{exetoc}
\DeclareBoolOption[true]{setlist}
\DeclareStringOption[both]{output}
\DeclareStringOption[none]{display}
\DeclareBoolOption[false]{answerspace}
\DeclareStringOption[left]{marginpos}
\DeclareStringOption[expand]{marginwidth}
\DeclareStringOption[left]{noteragged}
\DeclareBoolOption[false]{checkpts}
\DeclareStringOption[false]{correct}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax
\LoadClass{article}
\RequirePackage{exesheet}
\RequirePackage{schooldocs}
%</class>
%    \end{macrocode}
%
% Options are defined using the \textsf{kvoptions} package.
% String options are managed through distinct processing macros 
% that are implemented in their respective sections.
% For options whose effects cannot be dynamically altered 
% and must be configured in the preamble, they are processed once, 
% at |\begin{document}|.
% The other options are executed when this package is loaded
% (at the end of the package, as |\exs@process...| 
% commands are not recognized at the outset).
%
% A distinct case is to mention with \texttt{setlist} when utilized in conjunction with
% \textsf{babel-french}.
% In this instance, this option is processed immediately
% (further clarification follows below).
% 
%    \begin{macrocode}
%<*package>
\@ifclassloaded{exesheet}{}{
    \RequirePackage{kvoptions}
    \DeclareBoolOption[true]{exetoc}
    \DeclareBoolOption[true]{setlist} 
    \DeclareStringOption[both]{output}
    \DeclareStringOption[none]{display}
    \DeclareBoolOption[false]{answerspace}
    \DeclareStringOption[left]{marginpos}
    \DeclareStringOption[expand]{marginwidth}
    \DeclareStringOption[left]{noteragged}
    \DeclareBoolOption[false]{checkpts}
    \DeclareStringOption[false]{correct}
}

\ProcessKeyvalOptions*

\PackageInfo{exesheet}{The options `notoc' and `nosetlist' 
    \MessageBreak are no longer supported\@gobble}
    % \@gobble suppresses the line number here

\def\exs@process@dynoptions{
    \exs@process@output
    \exs@process@display 
    \exs@process@noteragged
} % answerspace do not need a special process macro

\AtEndOfPackage{\exs@process@dynoptions}
\AtBeginDocument{
    \newif\ifexesheet@multicol
    \@ifpackageloaded{multicol}{
        \exesheet@multicoltrue}{\exesheet@multicolfalse}
        % configuring the rule color within answers environments
    \exs@process@setlist
    \exs@process@marginpos
    \exs@process@marginwidth
    \exs@process@checkpts
    \exs@process@correct
    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginpos}
    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginwidth}
    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{checkpts}
    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{correct}
}

%    \end{macrocode}
% \begin{macro}{\exesheetset}
% The |\exesheetset| macro can accept key-val options and
% can be utilized anywhere in the document to adjust certain settings.
% However, it won't affect non dynamic options if called outside the preamble.
% In such cases a warning message occur due to the use of |\DisableKeyValOption|.
%    \begin{macrocode}  
\def\exesheetset#1{\setkeys{exesheet}{#1}\exs@process@dynoptions}

%    \end{macrocode}
% \end{macro}
%
% The following old macros (used before version 2.0) provide an alternative to keyval options.
% They are kept for compatibility reasons.
%    \begin{macrocode}
\newcommand{\questionsonly}{
    \PackageWarning{exesheet}{Old command \string\questionsonly\space 
        is used. \MessageBreak
        It can be replaced by the option `output=questions'}
    \renewcommand\exesheet@output{questions}
    \exs@process@output
}
\newcommand{\answersonly}{
    \PackageWarning{exesheet}{Old command \string\answersonly\space 
        is used. \MessageBreak
        It can be replaced by the option `output=answers'}
    \renewcommand\exesheet@output{answers}
    \exs@process@output
}
\newcommand{\displaypts}{%
    \PackageWarning{exesheet}{Old command \string\displaypts\space 
        is used. \MessageBreak
        It can be replaced by the option `display=pts'}
    \renewcommand\exesheet@display{pts}
    \exs@process@display
}
\newcommand{\displaypoints}{%
    \PackageWarning{exesheet}{Old command \string\displaypoints\space 
        is used. \MessageBreak
        It can be replaced by the option `display=pts'}
    \renewcommand\exesheet@display{pts}
    \exs@process@display
}
\newcommand*{\displaynotes}[1][\RaggedLeft]{%
    \PackageWarning{exesheet}{Old command \string\displaynotes\space 
        is used. \MessageBreak
        It can be replaced by the option `display=notes'}
    \renewcommand\exesheet@display{notes}
    \exs@process@display
    \renewcommand{\noteragged}{#1}
}
\newcommand*{\displaynotesright}[1][\RaggedRight]{%
    \PackageWarning{exesheet}{Old command \string\displaynotesright\space 
        is used. \MessageBreak
        It can be replaced by the options `display=notes, margin=right'}
    \renewcommand\exesheet@display{notes}
    \exs@process@display
    \renewcommand\exesheet@margin{right}
    \renewcommand{\noteragged}{#1}
}

%    \end{macrocode}
%
% Now, we load several packages.
% If the \textsf{geometry} package is already loaded, it will not be reloaded
% to prevent an option clash.
% The \texttt{shortlabel} option in the \textsf{enumitem} package~\cite{ENUM} allows the use
% of labels similar to
% the \textsf{enumerate} package such as 1., a), A., and so on.
% The \textsf{mparhack} package by Tom Sgouros and Stefan Ulrich~\cite{MPAR}
% is loaded exclusively for documents in \texttt{twoside} mode.
%    \begin{macrocode}
\RequirePackage{ifthen}
\@ifpackageloaded{geometry}{}{\RequirePackage{geometry}}
\RequirePackage{xcolor}
\RequirePackage[shortlabels]{enumitem}
\RequirePackage{tasks}[2020/08/19]
\RequirePackage{versions}
\RequirePackage{fancybox}
\RequirePackage{translations}
\RequirePackage{ragged2e}
\ifthenelse{\boolean{@twoside}}{\RequirePackage{mparhack}}{}

%    \end{macrocode}
%
% \subsection{Internationalization}
% Here we define keywords along with their translations in French, German, Spanish
% Italian, Portuguese. We achieve this using macros from the \textsf{translations} package 
% by Clemens Niederberger~\cite{TRAN}. 
% This package automatically detects the language being used,
% as loaded by \textsf{babel} or \textsf{polyglossia}.
%
%    \begin{macrocode}
\DeclareTranslationFallback{exesheet-exercise}{Exercise}
\DeclareTranslationFallback{exesheet-subpart}{Part}
\DeclareTranslationFallback{exesheet-annex}{Annex}
\DeclareTranslationFallback{exesheet-ex}{Ex}
\DeclareTranslationFallback{exesheet-points}{points}
\DeclareTranslationFallback{exesheet-point}{point}
\DeclareTranslationFallback{exesheet-correction}{Correction}
\DeclareTranslationFallback{exesheet-pts}{pts}
\DeclareTranslationFallback{exesheet-pt}{pt}

\DeclareTranslation{english}{exesheet-exercise}{Exercise}
\DeclareTranslation{english}{exesheet-subpart}{Part}
\DeclareTranslation{english}{exesheet-annex}{Annex}
\DeclareTranslation{english}{exesheet-ex}{Ex}
\DeclareTranslation{english}{exesheet-points}{points}
\DeclareTranslation{english}{exesheet-point}{point}
\DeclareTranslation{english}{exesheet-correction}{Correction}
\DeclareTranslation{english}{exesheet-pts}{pts}
\DeclareTranslation{english}{exesheet-pt}{pt}

\DeclareTranslation{french}{exesheet-exercise}{Exercice}
\DeclareTranslation{french}{exesheet-subpart}{Partie}
\DeclareTranslation{french}{exesheet-annex}{Annexe}
\DeclareTranslation{french}{exesheet-ex}{Ex}
\DeclareTranslation{french}{exesheet-points}{points}
\DeclareTranslation{french}{exesheet-point}{point}
\DeclareTranslation{french}{exesheet-correction}{Correction}
\DeclareTranslation{french}{exesheet-pts}{pts}
\DeclareTranslation{french}{exesheet-pt}{pt}

\DeclareTranslation{german}{exesheet-exercise}{\"Ubung}
\DeclareTranslation{german}{exesheet-subpart}{Teil}
\DeclareTranslation{german}{exesheet-annex}{Anhang}
\DeclareTranslation{german}{exesheet-ex}{\"Ub}
\DeclareTranslation{german}{exesheet-points}{Punkte}
\DeclareTranslation{german}{exesheet-point}{Punkt}
\DeclareTranslation{german}{exesheet-correction}{Verbesserung}
\DeclareTranslation{german}{exesheet-pts}{P.}
\DeclareTranslation{german}{exesheet-pt}{P.}

\DeclareTranslation{spanish}{exesheet-exercise}{Ejercicio}
\DeclareTranslation{spanish}{exesheet-subpart}{Parte}
\DeclareTranslation{spanish}{exesheet-annex}{Anexo}
\DeclareTranslation{spanish}{exesheet-ex}{Ej}
\DeclareTranslation{spanish}{exesheet-points}{puntos}
\DeclareTranslation{spanish}{exesheet-point}{punto}
\DeclareTranslation{spanish}{exesheet-correction}{Correcci\'on}
\DeclareTranslation{spanish}{exesheet-pts}{ptos}
\DeclareTranslation{spanish}{exesheet-pt}{pto}

\DeclareTranslation{italian}{exesheet-exercise}{Esercizio}
\DeclareTranslation{italian}{exesheet-subpart}{Parte}
\DeclareTranslation{italian}{exesheet-annex}{Annesso}
\DeclareTranslation{italian}{exesheet-ex}{Es}
\DeclareTranslation{italian}{exesheet-points}{punti}
\DeclareTranslation{italian}{exesheet-point}{punto}
\DeclareTranslation{italian}{exesheet-correction}{Correzione}
\DeclareTranslation{italian}{exesheet-pts}{pti}
\DeclareTranslation{italian}{exesheet-pt}{pt}

\DeclareTranslation{portuges}{exesheet-exercise}{Exerc\'icio}
\DeclareTranslation{portuges}{exesheet-subpart}{Parte}
\DeclareTranslation{portuges}{exesheet-annex}{Anexo}
\DeclareTranslation{portuges}{exesheet-ex}{Ex}
\DeclareTranslation{portuges}{exesheet-points}{pontos}
\DeclareTranslation{portuges}{exesheet-point}{ponto}
\DeclareTranslation{portuges}{exesheet-correction}{Corre\c c\~ao}
\DeclareTranslation{portuges}{exesheet-pts}{pts}
\DeclareTranslation{portuges}{exesheet-pt}{pt}

\newcommand*\exercisename{\GetTranslation{exesheet-exercise}}
\newcommand*\subpartname{\GetTranslation{exesheet-subpart}}
\newcommand*\annexname{\GetTranslation{exesheet-annex}}
\newcommand*\exname{\GetTranslation{exesheet-ex}}
\newcommand*\pointsname{\GetTranslation{exesheet-points}}
\newcommand*\pointname{\GetTranslation{exesheet-point}}
\newcommand*\correctionname{\GetTranslation{exesheet-correction}}
\newcommand*\ptsname{\GetTranslation{exesheet-pts}}
\newcommand*\ptname{\GetTranslation{exesheet-pt}}

%    \end{macrocode}
%
% \subsection{Titles}
%
% The \texttt{exercise} counter assigns numbers to exercises throughout the entire document, 
% regardless of sections.
% To reset the counter manually, simply use |\setcounter{exercise}{0}|.
% For an automatic reset at each new section,
% include the following code in the preamble \\
% |\makeatletter \@addtoreset{exercise}{section} \makeatother|.
%
% The parts counter (\texttt{subpart}) depends on the \texttt{exercise} counter and is reset
% with each new exercise.
%
% The commands |\labelexercisestyle| and |\labelsubpartstyle|
% are initially empty, but they allow you to customize the styling. For example:\\
% |\renewcommand\labelexercisestyle{\sffamily}|.
%
% The |\exe@label| macro, which needs the |exe@check| counter, will be used
% inside warning messages about the marking scheme (see section \ref{MSoptions}).
%
% By default, the table of contents includes both exercises and parts titles,
% as controlled by the boolean |\ifexesheet@exetoc|. 
% To only display exercise titles in the table of contents while omitting parts,
% include the following code in the preamble: |\setcounter{tocdepth}{2}|.
%
% \begin{macro}{\exercise}
%    \begin{macrocode}
\newcounter{exercise}
\newcounter{exe@check}

\newcommand{\labelexercise}{\exercisename\space \theexercise}
\newcommand{\labelexercisestyle}{}
\newcommand*{\@exercise}[1][]{%
    \refstepcounter{exercise}
    \subsection*{\labelexercisestyle\labelexercise\enskip #1}
    \ifexesheet@exetoc
        \addcontentsline{toc}{subsection}{\labelexercise}
    \fi
    \ifexesheet@checkpts
    	\setcounter{exe@check}{\value{exercise}} 
        \def\exe@label{\exercisename\space\theexe@check} 
    \fi
}
\newcommand*{\@@exercise}[2][]{%
    \subsection*{\labelexercisestyle #2\enskip #1}
    \setcounter{subpart}{0} % resets the parts counter
    \ifexesheet@exetoc
        \addcontentsline{toc}{subsection}{#2}
    \fi
    \ifexesheet@checkpts \def\exe@label{#2} \fi
}
\newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\subpart}
%    \begin{macrocode}
\newcounter{subpart}[exercise] %
\renewcommand{\thesubpart}{\Alph{subpart}}

\newcommand{\labelsubpart}{\subpartname~\thesubpart}
\newcommand{\labelsubpartstyle}{}
\newcommand*{\@subpart}[1][]{%
    \refstepcounter{subpart}%
    \subsubsection*{\labelsubpartstyle\labelsubpart\enskip #1}
    \ifexesheet@exetoc
        \addcontentsline{toc}{subsubsection}{\labelsubpart}
    \fi
}
\newcommand*{\@@subpart}[2][]{%
    \subsubsection*{\labelsubpartstyle #2\enskip #1}
    \ifexesheet@exetoc
        \addcontentsline{toc}{subsubsection}{#2}
    \fi
}
\newcommand{\subpart}{\@ifstar{\@@subpart}{\@subpart}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\annex}
%    \begin{macrocode}
\newcommand{\annexstyle}{\MakeUppercase}
\newcommand*{\annex}[1][]{%
    \subsection*{\mbox{}\hfill\annexstyle{\annexname} #1\hfill\mbox{}}
    \ifexesheet@exetoc
        \addcontentsline{toc}{subsection}{\annexname}
    \fi
}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\exe}
%    \begin{macrocode}
\newcommand{\exlabel}{\exname.~\theexercise}
\newcommand{\exsepmark}{---}
\newcommand{\@exe}{\bigskip\refstepcounter{exercise}
    \ifexesheet@checkpts
        \setcounter{exe@check}{\value{exercise}} 
        \def\exe@label{\exname\space\theexe@check} 
    \fi
    \par\noindent\textbf{\exlabel~\exsepmark}~}
\newcommand{\@@exe}{\bigskip\refstepcounter{exercise}
    \ifexesheet@checkpts
        \setcounter{exe@check}{\value{exercise}} 
        \def\exe@label{\exname\space\theexe@check} 
    \fi
    \par\noindent\textbf{\exlabel}~}
\newcommand{\exe}{\@ifstar{\@@exe}{\@exe}}

%    \end{macrocode}
% \end{macro}
%
% \subsection{Enumerations and lists}
%
% \begin{macro}{\exenumerate}
% The |\setlist| command is part of the \textsf{enumitem} package
% (|\setenumerate| is deprecated). By default, |itemsep=1ex| is set for first-level lists,
% and |leftmargin=1.5em| is used to align labels with the start of lines.
%    \begin{macrocode}
\newenvironment{exenumerate}[1][]{%
    \setlist[enumerate]{font=\bfseries}
    \setlist[enumerate,1]{leftmargin=1.5em,
        itemsep=3ex plus 1ex minus 1ex,topsep=3ex plus 1ex minus 1ex}
    \setlist[enumerate,3]{noitemsep,nolistsep}
    \setlist[itemize]{noitemsep,nolistsep}
    \begin{enumerate}[#1]
        }{\end{enumerate}}

%    \end{macrocode}
% \end{macro}
% When using the \textsf{babel} package with the \texttt{french} option,
% \texttt{itemize} lists are altered to use the same dash label for each list level. 
% These modifications are undone here to revert to  the default 
% \LaTeX\ \texttt{itemize} lists, including labels and spaces.
% We have created the |\standardfrenchlists| command, which should be invoked within the
% |\AtBeginDocument| command or immediately, depending on whether
% \textsf{exesheet} is loaded before or after \textsf{babel}.
%    \begin{macrocode}
\newcommand\standardfrenchlists{%
    \@ifpackagewith{babel}{french}{
        \frenchsetup{StandardLists=true}
    }{}
}
\ifexesheet@setlist
    \standardfrenchlists 
    % must be executed here (and not at begin doc) if loaded after babel
\fi

\newcommand\labelenumone{\arabic{task}.}
\newcommand\labelenuma{(\alph{task})}

\def\exs@process@setlist{% must be executed at begin document
  \ifexesheet@setlist
    \standardfrenchlists % executed at begin doc if loaded before babel
    \setlist[enumerate]{font=\bfseries}
    \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em}
  \fi
%    \end{macrocode}

% \DescribeEnv{tablenum1} \DescribeEnv{tablenuma}
% The |\NewTasks| command is part of the \textsf{tasks} package~\cite{TASK}.
% It enables the definition of the environments \texttt{tablenum1}, 
% \texttt{tablenuma} and \texttt{tablitem}.
% Horizontal spacing is adjusted to ensure proper alignment with
% items in other \texttt{enumerate} (or \texttt{itemize}) environments.
%    \begin{macrocode}
  \ifexesheet@setlist
    \settasks{label-format=\bfseries}
    \NewTasksEnvironment[label=\labelenumone,
        column-sep=1em,label-align=right,
        item-indent=1.5em,label-width=1em,label-offset=0.5em,
        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
    \NewTasksEnvironment[label=\labelenuma,ref=\alph{task},
        column-sep=1em,label-align=right,
        item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
  \else
    \NewTasksEnvironment[label=\labelenumone,
        column-sep=1em,label-align=right,
        label-width=1em,label-offset=0.5em,
        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
    \NewTasksEnvironment[label=\labelenuma,ref=\alph{task},
        column-sep=1em,label-align=right,
        item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
  \fi
} % end of macro \exs@process@setlist

\PackageInfo{exesheet}{The environment `tablenum' is deprecated 
    \MessageBreak and has been replaced by `tablenum1'\@gobble}
    % \@gobble suppresses the line number here

%    \end{macrocode}
% \DescribeEnv{tablitem}
%    \begin{macrocode}
\NewTasksEnvironment[label=\labelitemi,
    label-align=right,
    item-indent=2.5em,label-offset=0.5em,
    after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2)

%    \end{macrocode}
% \DescribeEnv{tablenuma*} \DescribeEnv{tablitem*}
% The starred environments \texttt{tablenuma*} and \texttt{tablitem*} 
% are designed to be employed within an \texttt{enumerate} environment,
% precisely at the outset of an |\item|, in order to achieve correct horizontal
% alignment.
% The length of |-1.667\baselineskip| has been tested with various font families and sizes.
% The alignment is generally good.
%    \begin{macrocode}
\newenvironment{tablenuma*}{%
    \mbox{}\vspace{-1.667\baselineskip}\begin{tablenuma}}{
    \end{tablenuma}}
\newenvironment{tablitem*}{%
    \mbox{}\vspace{-1.667\baselineskip}\begin{tablitem}}{
    \end{tablitem}}
   
%    \end{macrocode}
% \DescribeEnv{colsenum}\DescribeEnv{colsenum*}
% For items aligned by columns, we provide the \texttt{colsemnum} and \texttt{colsenum*}
% environments. The \textsf{multicol} package is required and an error message
% is produced if it has not been loaded.
% |\multicolsep| is the amount of space that should be added above or below the
% environment.
%    \begin{macrocode}
\newenvironment{colsenum*}[2][]{%
    \ifexesheet@multicol \else
        \PackageError{exesheet}{The environments colsenum and colsenum* 
            \MessageBreak need the multicol package}{
            Add \string\usepackage{multicol}\space in the preamble.}
    \fi
    \setlength{\multicolsep}{2ex}
    \begin{multicols}{#2} % #2 = number of columns
    \begin{enumerate}[#1] % #1 = options of enumerate
    }{
    \end{enumerate}
    \end{multicols}
}

\newenvironment{colsenum}[2][]{%
    \raggedcolumns % default is \flushcolumns
    \begin{colsenum*}[#1]{#2}
    }{
    \end{colsenum*}
}

%    \end{macrocode}
% \DescribeEnv{colsitem}\DescribeEnv{colsitem*}
% The corresponding environments for itemize lists.
%    \begin{macrocode}
\newenvironment{colsitem*}[2][]{%
    \ifexesheet@multicol \else
        \PackageError{exesheet}{The environments colsitem and colsitem* 
            \MessageBreak need the multicol package}{
            Add \string\usepackage{multicol}\space in the preamble.}
    \fi
    \setlength{\multicolsep}{2ex}
    \begin{multicols}{#2} % #2 = number of columns
    \begin{itemize}[#1] % #1 = options of itemize
    }{
    \end{itemize}
    \end{multicols}
}

\newenvironment{colsitem}[2][]{%
    \raggedcolumns % default is \flushcolumns
    \begin{colsitem*}[#1]{#2}
    }{
    \end{colsitem*}
}

%    \end{macrocode}
%
% \subsection{Questions and answers}
%
% \begin{macro}{\exs@process@output}
% The booleans |exesheet@questions| and |exesheet@answers| 
% governs the visibility of their corresponding environments.
% These booleans are configured through the \texttt{output} key option within the
% |\exs@process@output| macro.
%    \begin{macrocode}
\newboolean{exesheet@questions}\setboolean{exesheet@questions}{true}
\newboolean{exesheet@answers}\setboolean{exesheet@answers}{true}

\def\exs@process@output{
    \ifthenelse{\equal{\exesheet@output}{questions}}{
        \setboolean{exesheet@questions}{true}
        \setboolean{exesheet@answers}{false}
    }{% else if
    \ifthenelse{\equal{\exesheet@output}{answers}}{
        \setboolean{exesheet@questions}{false}
        \setboolean{exesheet@answers}{true}
        \exesheet@answerspacefalse
    }{% else if
    \ifthenelse{\equal{\exesheet@output}{both}}{
        \setboolean{exesheet@questions}{true}
        \setboolean{exesheet@answers}{true}
        \exesheet@answerspacefalse
    }{% else
    \PackageWarning{exesheet}{Value `\exesheet@output'
         is not supported by `output' option}
    }}}
}

%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{questions}
% We utilize the \textsf{versions} package developed by Uwe Lück~\cite{VERS},
% which introduces the macros |\comment| and |\endcomment|. 
% These macros facilitate conditional displays, a technique also employed 
% in the \textsf{verbatim} and \textsf{version} packages.
% Additionally, the notable \textsf{codesection} package offers the capability
% to enclose optional code between |\BeginCodeSection|\marg{skip} 
% and |\EndCodeSection|\marg{skip} macros,
% both in the text body and the preamble.
% However, these macros cannot be used within an environment 
% as we have done here with |\comment| and |\endcomment|.
% Several of our tests use the \LaTeX{} syntax |\ifthenelse{\bolean{...}}|
% since |\comment| and |\endcomment| can sometimes interfere
% with the \TeX\ structure |\if| \ldots |\else| \ldots |\fi|.
%
% The two counters |exe@ini| and |subpart@ini| are employed in
% the subsequent |\set@toclevel| macro.
%    \begin{macrocode}
\newcounter{exe@ini}
\newcounter{subpart@ini}

\newenvironment{questions}{
    \ifthenelse{\boolean{exesheet@questions}}{%
        \setcounter{exe@ini}{\value{exercise}}
        \setcounter{subpart@ini}{\value{subpart}}
    }{\comment}
}{\ifthenelse{\boolean{exesheet@questions}}{}{\endcomment}}

%    \end{macrocode}
% \end{environment}
% \begin{environment}{answers}
% The internal macro |\set@toclevel| calculates the title level (counter |toc@level|)
% to ensure correct typesetting of ``\correctionname'' at the start of an
% \texttt{answers} environment, when \texttt{questions} and \texttt{answers} are
% displayed together. It involves comparing the \texttt{exercise} and \texttt{subpart} 
% counters with their values at the time of the \texttt{questions} environment call. 
% The |\@enumdepth| counter indicates the 
% current \texttt{enumerate} list level (with 0 indicating outside of any list).
% The optional parameter of the \texttt{answers} environment permits 
% the explicit specification of this title level.
%    \begin{macrocode}
\newcounter{@toclevel}
\newcommand{\set@toclevel}[1][]{
    \ifthenelse{\equal{#1}{}}{
        \ifthenelse{\value{exercise} > \value{exe@ini}}{
            \setcounter{@toclevel}{1}
        }{% else
        \ifthenelse{\equal{\the\@enumdepth}{0}}{
            % we're not in an enumerate environment
            \ifthenelse{\(\value{subpart} > \value{subpart@ini}\)
                \or \(\value{subpart} = 0\)}{
              \setcounter{@toclevel}{2}
            }{\setcounter{@toclevel}{3}}
        }{\setcounter{@toclevel}{4}}}
    }{\setcounter{@toclevel}{#1}}}

%    \end{macrocode}
% The internal macro |\typeset@correctionname|,
% displays the term ``\correctionname'' at the appropriate level.
%    \begin{macrocode}
\definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue
\newcommand{\correctionstyle}{\color{correctioncolor}}

\newcommand{\typeset@correctionname}{
    \ifthenelse{\value{@toclevel} = 1}{
        \section*{\correctionstyle\correctionname}
        \ifexesheet@exetoc
            \addcontentsline{toc}{section}{\correctionname}
        \fi
        \setcounter{exercise}{0}
    }{% else if
    \ifthenelse{\value{@toclevel} = 2}{%
        \subsection*{\correctionstyle\correctionname}
        \ifexesheet@exetoc
            \addcontentsline{toc}{subsection}{\correctionname}
        \fi
        \setcounter{subpart}{0}
    }{% else if
    \ifthenelse{\value{@toclevel} = 3}{%
        \subsubsection*{\correctionstyle\correctionname}
        \ifexesheet@exetoc
            \addcontentsline{toc}{subsubsection}{\correctionname}
        \fi
    }{% else
    \par\textbf{\correctionstyle\correctionname}\par
    }}}
}

%    \end{macrocode}
% Then we proceed to define the \texttt{answers} environment.
%    \begin{macrocode}
\newenvironment{answers}[1][]{% #1 is the optional level
    \ifthenelse{\boolean{exesheet@answers}}{%
        \ifthenelse{\boolean{exesheet@questions}}{
            \set@toclevel[#1]
            \typeset@correctionname
            \correctionstyle%
            \ifexesheet@multicol
                \renewcommand{\columnseprulecolor}{\color{correctioncolor}}
            \fi
        }{}
    }{\comment}
}{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}}

\newenvironment{answers*}{
    \ifthenelse{\boolean{exesheet@answers}}{\correctionstyle}{\comment}
}{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}}

%    \end{macrocode}
% When placing |\correctionstyle| before |\subsubsection|
% in the \texttt{answers} environment (as in the case of |\typeset@correctionname|),
% the preceding vertical space may become too wide.
% \end{environment}
%
% \DescribeMacro{\question}\DescribeMacro{\question*}
%    \begin{macrocode}
\newcommand{\@question}[1]{\ifexesheet@questions #1\fi}
\newcommand{\@@question}[1]{%
    \ifexesheet@questions\ifexesheet@answers \else #1\fi\fi}
\newcommand{\question}{\@ifstar{\@@question}{\@question}}

%    \end{macrocode}
%
% \DescribeMacro{\answer}\DescribeMacro{\answer*}
%    \begin{macrocode}
\newcommand{\@answer}[1]{%
    \ifexesheet@answers%
        \ifexesheet@questions {\correctionstyle #1}\else #1\fi
    \fi
}
\newcommand{\@@answer}[1]{%
    \ifexesheet@answers\ifexesheet@questions \else #1\fi\fi}
\newcommand{\answer}{\@ifstar{\@@answer}{\@answer}}

%    \end{macrocode}
%
% \begin{macro}{\answerspace}
% The |\answerspace| macro leaves blank space to allow students for writing 
% their answers on the provided paper following a suggestion by Maxime Chupin.
%    \begin{macrocode}
\newcommand\answerspace[1]{
    \ifexesheet@answerspace \par\vspace{#1} \fi}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\exs@process@correct}
% The \texttt{correct} option needs the \textsf{schooldocs} package.
% It triggers the |\correct| macro of \textsf{schooldocs} which
% adds the content of |\correctname| in the title of the document.
% Here the option \texttt{conditional} triggers |\correct| only if 
% \texttt{output=answers} or \texttt{both}.
%    \begin{macrocode}
\def\exs@process@correct{     
    \ifthenelse{\equal{\exesheet@correct}{false}}{% do nothing    
    }{% else
    \@ifpackageloaded{schooldocs}{
        \ifthenelse{\equal{\exesheet@correct}{true}}{
            \correct
        }{% else
        \ifthenelse{\equal{\exesheet@correct}{conditional}}{
            \ifexesheet@answers \correct \fi
        }{}}
    }{
        \PackageWarningNoLine{exesheet}{The `correct' option requires
            \MessageBreak
            the `schooldocs' package to be loaded}
    }}
}

%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Marking scheme options processing} \label{MSoptions}
%
% The options \texttt{display}, \texttt{marginpos}, \texttt{marginwidth} 
% and \texttt{noteragged} are handled using the following internal commands.
%
% \medskip
% The \texttt{display} key option determines the value of the two booleans
% |exesheet@pts| and |exesheet@notes|. 
% The |exesheet@pts| boolean controls the display of the content of |\pts| 
% and optional arguments of |\note|,
% while the |exesheet@notes| boolean controls mandatory arguments of |\note|.
%
% \begin{macro}{\exs@process@display}
%    \begin{macrocode}
\newboolean{exesheet@pts}
\newboolean{exesheet@notes}

\def\exs@process@display{
    \ifthenelse{\equal{\exesheet@display}{pts}}{
        \setboolean{exesheet@pts}{true}
        \setboolean{exesheet@notes}{false}
    }{% else if
    \ifthenelse{\equal{\exesheet@display}{notes}}{
        \setboolean{exesheet@pts}{true}
        \setboolean{exesheet@notes}{true}
    }{% else if
    \ifthenelse{\equal{\exesheet@display}{none}}{
        \setboolean{exesheet@pts}{false}
        \setboolean{exesheet@notes}{false}
    }{% else
    \PackageWarning{exesheet}{Value `\exesheet@display'
         is not supported by `display' option}
    }}}
}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\exs@process@marginpos}
% The \texttt{marginpos} key option takes the values \texttt{left} (the default value) 
% or \texttt{right} (or \texttt{inner} and \texttt{outer}). 
% In practice, \texttt{inner} is equivalent to \texttt{left},
% but in two-sided mode, the values \texttt{left} or \texttt{right} 
% are converted to \texttt{outer} (which is then the default value for two-sided mode).
%    \begin{macrocode}
\newboolean{exesheet@leftmargin}

\def\exs@process@marginpos{
    \ifthenelse{\equal{\exesheet@marginpos}{left}}{
        \if@twoside%
            \PackageWarningNoLine{exesheet}{The default `marginpos'
                option \MessageBreak
                for two-sided documents is `outer'.\MessageBreak
                To change the side, use `inner'}
            \def\exesheet@marginpos{outer}
            \setboolean{exesheet@leftmargin}{false}
            \normalmarginpar
        \else% default
            \setboolean{exesheet@leftmargin}{true}
            \reversemarginpar
        \fi
    }{% else if
    \ifthenelse{\equal{\exesheet@marginpos}{right}}{
        \if@twoside%
            \PackageWarningNoLine{exesheet}{The default `marginpos'
                option \MessageBreak
                for two-sided documents is `outer'.\MessageBreak
                To change the side, use `inner'}
            \def\exesheet@marginpos{outer}
        \fi
        \setboolean{exesheet@leftmargin}{false}
        \normalmarginpar
    }{% else if
    \ifthenelse{\equal{\exesheet@marginpos}{inner}}{
        \setboolean{exesheet@leftmargin}{true}
        \reversemarginpar
    }{% else if
    \ifthenelse{\equal{\exesheet@marginpos}{outer}}{
        \setboolean{exesheet@leftmargin}{false}
        \normalmarginpar
    }{% else
    \PackageWarningNoLine{exesheet}{The value `\exesheet@marginpos'
         is not supported by the `marginpos' option}
    }}}}
}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\exs@process@marginwidth}
% The \texttt{marginwidth} option adjusts the ratio between left and right margins
% based on what needs to be displayed in the margin (points only or full notes)
% \footnote{To ensure the accurate effect on the margin ratio, this option is processed
% at the beginning of the document, after other commands 
% that could potentially alter the page geometry.}.
%
% When \texttt{display=notes}, the additional length of \texttt{1\,in} corresponds to 
% the default free space to the left of |\oddsidemargin|.
%
% The macros |\standardmarginwidthfactor| and |\largemarginwidthfactor|
% represent the ratios between the total margin width and |\marginparwidth|.
%
%    \begin{macrocode}
\def\standardmarginwidthfactor{0.6}
\def\largemarginwidthfactor{0.8}

\newcommand*{\leftnotemarginwidth}[1]{
    \setlength{\marginparwidth}{\oddsidemargin}
    \addtolength{\marginparwidth}{1in}
    \addtolength{\marginparwidth}{-\marginparsep}
    \setlength{\marginparwidth}{#1\marginparwidth}
}

\newcommand*\rightnotemarginwidth[1]{
    \setlength{\marginparwidth}{\paperwidth}
    \addtolength{\marginparwidth}{-\textwidth}
    \addtolength{\marginparwidth}{-\oddsidemargin}
    \addtolength{\marginparwidth}{-\marginparsep}
    \addtolength{\marginparwidth}{-1in}
    \setlength{\marginparwidth}{#1\marginparwidth} 
}

\def\exesheet@smallmargins{
    \geometry{hmarginratio=1:1}
    \leftnotemarginwidth{\standardmarginwidthfactor}
}
\def\exesheet@standardmargins{
    \ifexesheet@leftmargin
        \geometry{hmarginratio=3:2}
        \leftnotemarginwidth{\standardmarginwidthfactor}
    \else
        \geometry{hmarginratio=2:3}
        \rightnotemarginwidth{\standardmarginwidthfactor}
    \fi
}
\def\exesheet@largemargins{
    \ifexesheet@leftmargin
        \geometry{hmarginratio=3:1}
        \leftnotemarginwidth{\largemarginwidthfactor}
    \else
        \geometry{hmarginratio=1:3}
        \rightnotemarginwidth{\largemarginwidthfactor}
    \fi
}

\def\exs@process@marginwidth{
    \ifthenelse{\equal{\exesheet@marginwidth}{standard}}{
        \ifthenelse{\equal{\exesheet@display}{none}}{
            \if@twoside
                \exesheet@standardmargins
            \else
                \exesheet@smallmargins
            \fi
        }{% else display=pts or display=notes
            \exesheet@standardmargins
        }
    }{% else if
    \ifthenelse{\equal{\exesheet@marginwidth}{expand}}{
        \ifthenelse{\equal{\exesheet@display}{none}}{
            \if@twoside
                \exesheet@standardmargins
            \else
                \exesheet@smallmargins
            \fi
        }{% else if
        \ifthenelse{\equal{\exesheet@display}{pts}}{
            \exesheet@standardmargins
        }{% else display=notes
            \exesheet@largemargins
        }}
    }{% else if  
        \ifthenelse{\equal{\exesheet@marginwidth}{unset}}{
        % do nothing
    }{% else
    \PackageWarningNoLine{exesheet}{The value `\exesheet@marginwidth'
         is not supported by the `marginwidth' option}
    }}}
}

%    \end{macrocode}
% \end{macro}
% For a two-sided document, the \textsf{geometry} package does not correctly set 
% the default width of the margin paragraph; it's too wide. 
% Therefore, we provide an explicit setting here, which is
% useful when \texttt{marginwidth=unset}. Otherwise, the setting is
% handled by the \texttt{marginwidth} key option.
% 
%    \begin{macrocode}
\if@twoside \rightnotemarginwidth{0.5} \fi

%    \end{macrocode}
% \begin{macro}{\exs@process@noteragged}
% The noteragged option can take one of the following values:
% \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}.
% When working with a two-sided document, |\marginpar| can be used with an optional parameter 
% to distinguish left from right contents.
% In this context, we employ |\noteraggedleft| and |\noteraggedright| instead of |\noteragged|.
% The \textsf{ragged2e} package by Martin Schröder~\cite{RAGG} offers the commands 
% |\RaggedLeft|, |\RaggedRight|, |\Centering|, and |\justifying|.
% These commands yield better results compared to the standard
% |\raggedleft|, |\raggedright| and |\centering| commands.
% Margin paragraphs are justified by default in \LaTeX.
%    \begin{macrocode}
\newcommand{\noteragged}{}
\newcommand{\noteraggedleft}{}
\newcommand{\noteraggedright}{}

\def\exs@process@noteragged{
    \ifthenelse{\equal{\exesheet@noteragged}{left}}{
        \if@twoside
            \renewcommand{\noteraggedleft}{\RaggedLeft}
            \renewcommand{\noteraggedright}{\RaggedLeft}
        \else
            \renewcommand{\noteragged}{\RaggedLeft}
        \fi
    }{% else if
    \ifthenelse{\equal{\exesheet@noteragged}{right}}{
        \if@twoside
            \renewcommand{\noteraggedleft}{\RaggedRight}
            \renewcommand{\noteraggedright}{\RaggedRight}
        \else
            \renewcommand{\noteragged}{\RaggedRight}
        \fi
    }{% else if
    \ifthenelse{\equal{\exesheet@noteragged}{center}}{
        \if@twoside
            \renewcommand{\noteraggedleft}{\Centering}
            \renewcommand{\noteraggedright}{\Centering}
        \else
            \renewcommand{\noteragged}{\Centering}
        \fi
    }{% else if
    \ifthenelse{\equal{\exesheet@noteragged}{justify}}{
          \renewcommand{\noteraggedleft}{\justifying} % equiv to nothing
          \renewcommand{\noteraggedright}{\justifying}
          \renewcommand{\noteragged}{\justifying}
    % justify is the default LaTeX setting
    }{% else  if
    \ifthenelse{\equal{\exesheet@noteragged}{twoside}}{
        \if@twoside
            \renewcommand{\noteraggedleft}{\RaggedLeft}
            \renewcommand{\noteraggedright}{\RaggedRight}
        \else
            \PackageWarning{exesheet}{Invalid option `noteragged=twoside'
             when the document \MessageBreak is not in two-side mode}
        \fi
    }{% else
    \PackageWarning{exesheet}{The value `\exesheet@noteragged'
         is not supported by the `noteragged' option}
    }}}}}
}

%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\exs@process@checkpts}
% The scale control option relies on calculations with \emph{lengths}, 
% which need to have a \emph{global} scope.
%
% For questions, assigned points will be added in |\sum@pts|,
% while for exercises, points accumulate in |\sum@exe|.
% These lengths are compared against |\exe@total| and |\sheet@total|.
% The |\exe@check| macro validates the calculations of the previous exercise 
% when triggered by |\points|, |\totalexe| or |\totalpoints| macros.
% Percent symbols at end of lines are necessary to prevent unwanted spaces.
% |\exe@check| is also invoked within |\exs@process@checkpts| at the document's end
% for a final check on the last exercise.
%    \begin{macrocode}
\newlength{\sheet@total}
\newlength{\sum@exe}
\newlength{\exe@total}
\newlength{\sum@pts}
\def\exe@currentlabel{none}
\newboolean{scale@valid}

\def\exe@check{%
    \ifthenelse{\lengthtest{\sum@pts = 0pt}}{%
    % do not check, no points or first exercise begins
    \ifthenelse{\equal{\exe@currentlabel}{none}}{}{%
        \PackageWarningNoLine{exesheet}{\exe@currentlabel: 
            \the\exe@total}}%
    }{%
        \ifthenelse{\lengthtest{\exe@total = \sum@pts}}{%
            \PackageWarningNoLine{exesheet}{\exe@currentlabel:
                Sum of points \the\exe@total\space is valid}%
        }{%
        \PackageWarningNoLine{exesheet}{\exe@currentlabel:
            Sum of points is \the\sum@pts\space
            instead of \the\exe@total}%
        \setboolean{scale@valid}{false}%
        }%
    }%
}

\def\exs@process@checkpts{
    \ifexesheet@checkpts
        \ifthenelse{\lengthtest{\sheet@total = 0pt}}{
            \PackageWarningNoLine{exesheet}{Option checkpts is true,
                \MessageBreak
                but \string\totalsheet\space is missing
                in the preamble. \MessageBreak
                See documentation}
        }{}
        \global\sum@exe=0pt
        \global\exe@total=0pt
        \global\sum@pts=0pt
        \setboolean{scale@valid}{true}
        \AtEndDocument{% final checking (global)
            \ifthenelse{\equal{\exe@currentlabel}{none}}{
              \ifthenelse{\lengthtest{\sum@pts = 0pt}}{
                \PackageWarningNoLine{exesheet}{checkpts: No points displayed}
              }{
                \ifthenelse{\lengthtest{\sheet@total = \sum@pts}}{
                    \PackageWarningNoLine{exesheet}{Total:
                        Sum of points \the\sheet@total\space is valid}
                }{
                    \PackageWarningNoLine{exesheet}{Total:
                        Sum of points is \the\sum@pts\space
                        instead of \the\sheet@total}
                }}
            }{% last exercise and final checking
              \exe@check
              \ifthenelse{\lengthtest{\sum@exe} = 0pt}{
                \PackageWarningNoLine{exesheet}{checkpts: No points displayed}
                }{
                \ifthenelse{\lengthtest{\sheet@total = \sum@exe}}{
                    \PackageWarningNoLine{exesheet}{Total:
                        Sum of points \the\sheet@total\space is valid}
                }{
                    \PackageWarningNoLine{exesheet}{Total:
                        Sum of points is \the\sum@exe\space
                        instead of \the\sheet@total}
                    \setboolean{scale@valid}{false}
                }
                \ifthenelse{\boolean{scale@valid}}{
                    \PackageWarningNoLine{exesheet}{
                        Marking scheme checked without errors}
                }{
                    \PackageWarningNoLine{exesheet}{
                        Marking scheme checked with ERRORS! See above}
                }             
              }  
            }
        }
    \fi
}

%    \end{macrocode}
%
% \subsection{Marking scheme commands}
%
% The |\check@points| macro, used by |\points| and |\totalexe|, triggers
% the marking scheme control (with |\exe@check| defined above) and
% sets label and lengths for the next exercise.
%    \begin{macrocode}
\newcommand*{\check@points}[1]{%
    \ifexesheet@checkpts%
        \exe@check% checks the previous exercise
        \gdef\exe@currentlabel{\exe@label}% for the upcoming exercise 
        \global\sum@pts=0pt%
        \global\exe@total=#1pt%
        \global\advance\sum@exe by #1pt%
    \fi%        
}

%    \end{macrocode}
%
% \begin{macro}{\points}
%    \begin{macrocode}
\definecolor{pointscolor}{named}{red}
\newcommand{\pointsstyle}{%
    \small\mdseries\sffamily\color{pointscolor}\fbox}
\newcommand*{\points}[1]{%
    \ifthenelse{\boolean{exesheet@questions}}{\hfill
        \pointsstyle{#1~%
            \ifthenelse{\lengthtest{#1pt < 2pt}}{\pointname}{\pointsname}}%      
        \check@points{#1}%
    }{}
}

%    \end{macrocode}
% \end{macro}
% To prevent spaces between the |\fbox| and its inner text,
% percent symbols are necessary.
% The test |#1 < 2| doesn't work with decimal numbers without |\lengthtest|,
% but it works with lengths.
% \end{macro}
% \DescribeMacro{\pts}
%    \begin{macrocode}
\definecolor{ptscolor}{named}{red}
\newcommand{\ptsstyle}[1]{%
    \footnotesize\centering\sffamily\color{ptscolor} (#1)}
\newcommand*{\ptsmark}[1]{%
    \ifthenelse{\lengthtest{#1pt < 2pt}}{#1 \ptname}{#1 \ptsname}}
\newcommand*{\pts}[1]{%
    \ifexesheet@pts%
        \mbox{}%
        \marginpar{\hspace{0pt}\ptsstyle{\ptsmark{#1}}}%
        \ifexesheet@checkpts%
            \global\advance\sum@pts by #1pt% 
        \fi%
    \fi%
    \ignorespaces
}

%    \end{macrocode}
%
% \begin{macro}{\totalexe}
% In the subsequent macros that utilize
% |\marginpar|, the presence of percent symbols and |\ignorespaces| is essential
% to prevent the occurrence of expanded blank spaces in the text (or the margin),
% where these macros are incorporated.
%    \begin{macrocode}
\definecolor{markingcolor}{named}{red}
\newcommand{\markingstyle}[1]{\footnotesize\sffamily% 
    \centering\color{markingcolor}\textbf{#1}}
    % inner arguments enable the implementation of boxed styles
\newlength{\ptsboxlength}
\setlength{\ptsboxlength}{3.1em}
\cornersize{1}
\newcommand*{\totalexe}[1]{%
    \ifexesheet@pts%
        \mbox{}%
        \marginpar{\hspace{0pt}\markingstyle{\ovalbox{%
            \makebox[\ptsboxlength]{\ptsmark{#1}}}}}%
        \check@points{#1}%
    \fi%
    \ignorespaces
}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\totalsheet}
%    \begin{macrocode}
\newcommand*{\totalsheet}[1]{
    \global\sheet@total=#1pt
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\note} 
% The booleans \texttt{exesheet@pts} and \texttt{exesheet@notes} control
% the display of marginal notes. If \texttt{exesheet@pts} is set to \texttt{false},
% \DescribeMacro{\note*}
% \texttt{exesheet@notes} will be ignored.
% |\noindent| is required when using |\justifying| from the \textsf{ragged2e}
% package~\cite{RAGG}.
% Within the |\note@marginpar| macro, enclosing |\markingstyle| in double braces
% helps prevent unintended formatting within the mandatory argument of |\note|. 
% A vicious error occurs when using an |\if| \ldots |\fi| structure 
% instead of |\ifthenelse| inside |\note@marginpar|
% (but only if |@twoside| is \texttt{true}).
%    \begin{macrocode}
\definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green  
\newcommand{\notestyle}[1]{\footnotesize\sffamily\color{notecolor} #1}
\newcommand{\note@marginpar}[1]{%
    \if@twoside%
        \marginpar[\noteraggedleft #1]{\noteraggedright #1}%
    \else%
        \marginpar{\noteragged #1}%
    \fi%
}
\newcommand{\@note}[2][]{%
    \ifexesheet@pts%
        \mbox{}%
        \note@marginpar{%
            \ifthenelse{\equal{#1}{}}{}{{%
                \noindent\hspace{0pt}\markingstyle{#1}\\}}%
            \ifthenelse{\boolean{exesheet@notes}}{%
                \noindent\hspace{0pt}\notestyle #2%
            }{}%
        }%
        \ifexesheet@checkpts%
            \ifthenelse{\equal{#1}{}}{}{%
                \global\advance\sum@pts by #1pt%
            }%
        \fi%
    \fi%
    \ignorespaces
}
\newcommand{\@@note}[1]{%
    \ifexesheet@pts%
        \mbox{}%
        \marginpar{\noindent\hspace{0pt}\markingstyle{#1}}%
        \ifexesheet@checkpts%
            \global\advance\sum@pts by #1pt%
        \fi%
    \fi%
    \ignorespaces
}
\newcommand{\note}{\@ifstar{\@@note}{\@note}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\totalpoints}
%    \begin{macrocode}
\newcommand{\totalpoints}{%
    \ifthenelse{\boolean{exesheet@pts}}{\totalexe}{\points}}

%</package>
%    \end{macrocode}
% \end{macro}
%
% \begin{thebibliography}{27}
% % \begin{raggedright}
% \bibitem{SCHOOL} \emph{The \textsf{schooldocs} package}, Antoine Missier,
% CTAN, v1.4 2023/12/28.
% \bibitem{GEOM} \emph{The \textsf{geometry} package}, 
% Hideo Umeki, CTAN, v5.9 2020/01/02.
% \bibitem{ENUM} \emph{Customizing lists with the \textsf{enumitem} package}, 
% Javier Bezos, CTAN, v3.9 2019/06/20.
% \bibitem{TASK} \emph{\textsf{tasks} -- lists with columns filled horizontally}, 
% Clemens Niederberger. CTAN, v1.4a, 2022/01/08.
% \bibitem{VERS} \emph{The \textsf{versions} package -- Omit passages optionally 
% under \LaTeX}, Uwe Lück, CTAN, v0.55 2005/04/28.
% \bibitem{FBOX} \emph{Documentation for \texttt{fancybox.sty}: 
% Box tips and tricks for \LaTeX}, Timothy Van Zandt, CTAN, v1.4 2010/05/15.
% \bibitem{TRAN} \emph{\textsf{translations} -- Internationalization of \LaTeXe\ Packages},
% Clemens Niederberger, CTAN, v1.12 2022/02/05.
% \bibitem{RAGG} \emph{The \textsf{ragged2e-}package}, Martin Schröder,
% CTAN, v3.6 2023/06/22.
% \bibitem{MPAR} \emph{\texttt{mparhack.sty}}, Tom Sgouros, Stefan Ulrich,
% CTAN, v1.5 2021/05/02.
% \bibitem{SECT} \emph{The \textsf{sectsty} package}, Rowland McDonnell,
% CTAN, v2.0.2 2002/02/25.
% \bibitem{EXER} \emph{\texttt{exercise.sty} : a package to typeset exercises}, 
% Paul Pichaureau, CTAN, v1.6 2014/10/21.
% \bibitem{EXES} \emph{The \textsf{exercises} package}, Roger Jud,
% CTAN, v1.1 2000/05/17.
% \bibitem{XSIM} \emph{\textsf{xsim} -- eXercise Sheets IMproved --
% the official successor of the \textsf{exsheets} package}, Clemens Niederberger,
% CTAN, v0.21 2022/02/12.
% \bibitem{EXFR} \emph{The \textsf{exframe} package}, Niklas Beisert,
% CTAN, v3.4 2020/02/24.
% \bibitem{EXAM} \emph{Using the \textsf{exam} document class}, Philip Hirschhorn,
% CTAN, v2.704 2023/07/09.
% \bibitem{ANSW} \emph{\textsf{answers} Production of solution sheets in \LaTeXe}, 
% Mike Piff and Joseph Wright, CTAN, 2.16 2014/08/24.
% \bibitem{PROB} \emph{The \textsf{probsoln v3.05}: creating problem sheets
% optionally with solutions}, Nicola L.C.\@ Talbot, CTAN 2017/07/10.
% \bibitem{EXSO} \emph{The \textsf{ExSol} package}, Walter Daems,
% CTAN, 1.4 2018/10/23.
% \bibitem{EXEP} \emph{The \textsf{exercisepoints} Package}, Henning Kerstan,
% CTAN, v1.2.3 2019/01/03.
% \bibitem{WORK} \emph{\textsf{worksheet}}, Benjamin Zöllner, CTAN, v1.1 2018/08/17.
% \bibitem{EXAN} \emph{\textsf{exam-n}: exam papers}, Norman Gray, CTAN, v1.4.0 2022/10/10.
% \bibitem{EQEX} \emph{The \textsf{eqexam} Package -- part of the Acro\TeX\ eDucation Bundle},
% D. P. Story, CTAN, 5.2 2021/02/26.
% \bibitem{CESE} \emph{\textsf{cesenaexam} — class file to typeset exams}, Alex Pacini,
% CTAN, v2.0 2017/08/03.
% \bibitem{ESAMI} \emph{Package \textsf{esami}}, Grazia Messineo, Salvatore Vassallo,
% CTAN, v2.8 2023/07/21.
% \bibitem{RAND} \emph{Teh \textsf{randexam} class for \LaTeX}, Jianrui Lyu,
% CTAN, 2024D, 2024/02/03.
% \bibitem{HIDE} \emph{The \textsf{hideanswer} package: generate documents with 
% and without answers by toggling a switch}, Yukoh Kusakabe, CTAN, v1.1 2022/07/09.
% \bibitem{MATH} \emph{The \textsf{mathexam} Package}, Jan Hlavacek, CTAN, v1.00 2007/07/30.
% \end{raggedright}
% \end{thebibliography}
% \Finale
\endinput