summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hep-paper/hep-paper-implementation.dtx
blob: ea537d218e1096101818a3dced7a9e34e4626abf (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
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
% \iffalse meta-comment
%
% Copyright (C) 2019-2020 by Jan Hajer
% -----------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% 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.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse

%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{hep-paper}[2020/12/01 v1.6 Publications in High Energy Physics]
%<datamodel>\ProvidesFile{hep-paper.dbx}[2020/12/01 v1.6 HEP-Paper biblatex data model]
%<documentation>\ProvidesFile{hep-paper-documentation.tex}[2020/12/01 v1.6 HEP-Paper documentation]
%
%<*documentation>

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass{ltxdoc}

\EnableCrossrefs
\CodelineIndex
\RecordChanges

\MacroIndent=1.5em

\usepackage[parskip]{hep-paper}

\bibliography{bibliography}

\acronym{PDF}{portable document format}
\acronym{URL}{uniform resource locator}
\acronym{CM}{computer modern}
\acronym{LM}{latin modern}

\usepackage{hologo}
\usepackage{fonttable}

\newenvironment{columns}[1][.5]{%
  \par\vspace{-\bigskipamount}%
  \begin{minipage}[t]{\linewidth}%
  \begin{minipage}[t]{#1\linewidth}%
  \newcommand{\column}{%
    \end{minipage}%
    \begin{minipage}[t]{\linewidth-#1\linewidth}%
  }%
}{\end{minipage}\end{minipage}\par}

\setlength{\fboxsep}{1pt}
\AtBeginEnvironment{macrocode}{\renewcommand{\ttdefault}{clmt}}
%</documentation>

%<*driver>
\expandafter\newif\csname ifshort\endcsname
\shortfalse
\begin{document}
\DocInput{hep-paper-implementation.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{1673}
%
% \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{v1.0}{2019/01/01}{Initial version of the style file.}
% \changes{v1.1}{2020/01/01}{Transition to documented \hologo{LaTeX} source file.}
% \changes{v1.2}{2020/03/01}{Introduction of package options.}
% \changes{v1.3}{2020/05/01}{Inclusion of JHEP and JCAP package options. Fix of incompatibility with recent subcaption package version. Move of biblatex datamodel into its own file}
% \changes{v1.4}{2020/09/01}{If possible the compatibility options are selected automatically. Inclusion of PubMed IDs in bibliography.}
% \changes{v1.5}{2020/10/01}{Reduce the numer of math alphabets used in sans serif mode. Add more title options such as a subtitle. Use standard class options.}
% \changes{v1.6}{2020/12/01}{Implementation of the twocolumn mode.}
%
% \ifshort
%<*documentation>
% \fi
%
\GetFileInfo{hep-paper.sty}

\title{The \textsmaller[1.5]{HEP\raisebox{.25ex}{--}PAPER} package\thanks{This document corresponds to \software{hep-paper}~\fileversion.}}
\subtitle{Publications in high energy physics}
\author{Jan Hajer \email{jan.hajer@uclouvain.be}}
\affiliation{Centre for Cosmology, Particle Physics and Phenomenology, Université catholique de Louvain, Louvain-la-Neuve B-1348, Belgium}
\preprint{Preprint-Number}
\date{\filedate}

% \ifshort
\begin{document}
% \fi

\maketitle

\begin{abstract}
The \software{hep-paper} package aims to provide a single style file containing most configurations and macros necessary to write appealing publications in High Energy Physics.
Instead of reinventing the wheel by introducing newly created macros \software{hep-paper} preferably loads third party packages as long as they are lightweight enough.
\end{abstract}

\tableofcontents\clearpage

\newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em}

\section{Introduction}

For usual publications it is enough to load additionally to the |article| class without optional arguments only the \software{hep-paper} package \cite{hep-paper}.
\begin{verbatim}
\documentclass{article}
\usepackage{hep-paper}
\end{verbatim}
The most notable changes after loading the \software{hep-paper} package is the change of some \hologo{LaTeX} defaults.
The paper and font sizes are set to A4 and \unit[11]{pt}, respectively.
Additionally, the paper geometry is adjusted using the \software{geometry} package \cite{geometry}.
Furthermore, the font is changed to \LM using the \software{cfr-lm} package \cite{cfr-lm} with \software{microtype} \cite{microtype} optimizations.
Finally, \PDF hyperlinks are implemented with the \software{hyperref} package \cite{hyperref}.

\subsection{Options}

\DescribeMacro{paper}
The |paper=|\meta{format} option loads the specified paper format.
The possible \meta{formats} are:
|a0|, |a1|, |a2|, |a3|, |a4|, |a5|, |a6|,
|b0|, |b1|, |b2|, |b3|, |b4|, |b5|, |b6|,
|c0|, |c1|, |c2|, |c3|, |c4|, |c5|, |c6|,
|ansia|, |ansib|, |ansic|, |ansid|, |ansie|,
|letter|, |executive|, |legal|.
The default is |a4|.

\DescribeMacro{font}
The |font=|\meta{size} option loads the specified font size.
The possible \meta{sizes} are:
|8pt|, |9pt|, |10pt|, |11pt|, |12pt|, |14pt|, |17pt|, |20pt|.
The default is \unit[11]{pt}.

\DescribeMacro{lang}
The |lang|=\meta{name} option switches the document language to one of the values values provided by the \software{babel} package \cite{babel}.
The default is |british|.

\DescribeMacro{sansserif}
The |sansserif| option switches the document including math to sans serif font shape.

\DescribeMacro{parskip}
The |parskip| option changes how paragraphs are separated from each other using the \software{parskip} package \cite{parskip}.
The \hologo{LaTeX} default is separation via indentation the |parskip| option switches to separation via vertical space.
\footnote{Although the |parskip| option is used for this document, it is recommended only for very few document types such as technical manuals or answers to referees.}

\DescribeMacro{symbols}
The |symbols|=\meta{family} set the family of the symbol fonts.
|symbols=ams| loads the two \hologo{AmS} fonts \cite{amsfonts} and the \software{bm} bold fonts.
The default |symbols=true| replaces additionally the blackboard font with the \software{dsfont} \cite{dsfont}.
|symbols=minion| switches the symbol fonts to the Adobe MinionPro companion font from the \software{MnSymbol} package \cite{MnSymbol}.
|symbols=false| deactivates loading any additional symbol fonts.

\subsubsection{Deactivation}

The \software{hep-paper} package loads few bigger packages which have a large impact on the document.
The deactivation options can prevent such and other adjustments.

\DescribeMacro{defaults}
The |defaults| option prevents the adjustment of the page geometry and the font size set by the document class.

\DescribeMacro{lining}
The |lining| option deactivates the use of text- (\texto{123}) in favour of lining- (\textl{123}) figures in text mode.

\DescribeMacro{title}
The |title=false| option deactivates the title page adjustments.

\DescribeMacro{bibliography}
The |bibliography|=\meta{key} option prevents the automatic loading of the \software{biblatex} package \cite{biblatex} if \meta{key}=|false|.
Otherwise the \meta{key} is passed as |style| string to the \software{biblatex} package.

\DescribeMacro{glossaries}
The |glossaries=false| option deactives acronyms and the use of the \software{glossaries} package \cite{glossaries}.

\DescribeMacro{references}
The |references=false| option prevents the \software{cleveref} package \cite{cleveref} from being loaded and deactivates further redefinitions of reference macros.

\subsubsection{Compatibility}

The compatibility options activate the compatibility mode for certain classes and packages used for publications in high energy physics.
They are mostly suitable combinations of options described in the previous section.
If \software{hep-paper} is able to detect the presence of such a class or package, \ie if it is loaded before the \software{hep-paper} package, the compatibility mode is activated automatically.

\DescribeMacro{beamer}
The |beamer| option activates the \software{beamer} \cite{beamer} compatibility mode.

\DescribeMacro{jhep}
The |jhep| option activates the \software{JHEP} \cite{jhep} compatibility mode.

\DescribeMacro{jcap}
The |jcap| option activates the \software{JCAP} \cite{jcap} compatibility mode.

\DescribeMacro{revtex}
The |revtex| option activates the REV\hologo{TeX} \cite{revtex} compatibility mode.

\DescribeMacro{pos}
The |pos| option activates the \software{PoS} compatibility mode.

\DescribeMacro{springer}
The |springer| option activates the compatibility mode the |svjour| class \cite{svjour}.

\subsubsection{Reactivation}

The \software{hep-paper} package deactivates unrecommended macros, which can be reactivated manually.

\DescribeMacro{manualplacement}
The |manualplacement| option reactivates manual float placement.

\DescribeMacro{eqnarray}
The |eqnarray| option reactivates the depreciated |eqnarray| environment.

\section{Macros and environments}

\DescribeMacro{twocolumn}
\DescribeMacro{abstract*}
If the global |twocolumn| option is present the page geometry is changed to cover almost the entire page.
Additionally the |abstract*| environment is defined that generates a one column abstract and takes care of placing the title information.

\subsection{Title page}

\DescribeMacro{\title}
The \PDF meta information is set according to the |\title|\marg{text} and |\author| \marg{text} information.

\DescribeMacro{\subtitle}
The |\subtitle|\marg{subtitle} macro is defined using the \software{titling} package \cite{titling}.

\DescribeMacro{\author}
\DescribeMacro{\affiliation}
\DescribeMacro{\email}
In order to facilitate multiple authors with different affiliations the \software{authblk} package \cite{authblk} is loaded.
The following lines add \eg two authors with different affiliations
\begin{verbatim}
\author[1]{Author one \email{email one}}
\affiliation[1]{Affiliation one}
\author[2]{Author two \email{email two}}
\affiliation[1,2]{Affiliation two}
\end{verbatim}

\DescribeMacro{\preprint}
The |\preprint|\marg{numer} macro places a pre-print number in the upper right corner of the title page.

\DescribeEnv{abstract}
The |abstract| environment is adjusted to not start with an indentation.

\DescribeMacro{\titlefont}
\DescribeMacro{\subtitlefont}
\DescribeMacro{\authorfont}
\DescribeMacro{\affiliationfont}
\DescribeMacro{\preprintfont}
Various title font macros are defined, allowing to change the appearance of the |\maketitle| output.

\subsection{Text}

Hyphenation is provided by the \software{babel} package \cite{babel} and quotation commands are provided by the \software{csquotes} package \cite{csquotes}.
\DescribeMacro{\enquote}
\DescribeMacro{\MakeOuterQuote}
The latter package provides the convenient macros |\enquote|\marg{text} and |\MakeOuterQuote{"}| allowing to leave the choice of quotation marks to \hologo{LaTeX} and use |"| instead of the pair |``| and |''|, respectively.

\DescribeMacro{\eg}
\DescribeMacro{\vs}
The \software{foreign} package \cite{foreign} defines macros such as |\eg|, |\ie|, |\cf|, and |\vs| which are typeset as \eg, \ie, \cf, and \vs.

\DescribeMacro{\no}
The |\no|\marg{number} macro is typeset as \no{123}.

\DescribeMacro{\software}
The |\software|\oarg{version}\marg{name} macro is typeset as \software[\fileversion]{HEP-Paper}.

\DescribeMacro{\online}
The |\online|\marg{url}\marg{text} macro combines the features of the |\href|\marg{url}\allowbreak\marg{text}\allowbreak \cite{hyperref} and the |\url|\marg{text} \cite{url} macros, resulting in \eg \online{https://ctan.org/pkg/hep-paper}{ctan.org/pkg/hep-paper}.


\DescribeMacro{inlinelist}
\DescribeMacro{enumdescript}
The |inlinelist| and |enumdescript| environments are defined using the \software{enumitem} package \cite{enumitem}.
\begin{columns}
\begin{verbatim}
The three main points are
\begin{inlinelist}
  \item one
  \item two
  \item three
\end{inlinelist}
\end{verbatim}
\column
The three main points are
\begin{inlinelist}
 \item one
 \item two
 \item three
\end{inlinelist}
\end{columns}
\vspace{4ex}
\begin{columns}[.6]
\begin{verbatim}
\begin{enumdescript}[label=\Roman*)]
  \item{First} one
  \item{Second} two
  \item{Third} three
\end{enumdescript}
\end{verbatim}
\column
\begin{enumdescript}[label=\Roman*)]
 \item{First} one
 \item{Second} two
 \item{Third} three
\end{enumdescript}
\end{columns}

\DescribeMacro{\textsc}
A bold versions \textbf{\textsc{Small Caps}} and a sans serif version of \textsf{\textsc{Small Caps}} based on the \CM font \cite{cm} is provided, the latter using the \software{sansmathfonts} package \cite{sansmathfonts}.

\DescribeMacro{\underline}
\DescribeMacro{\overline}
The |\underline| macro is redefined to allow line-breaks using the \software{ulem} package \cite{ulem}.
The |\overline| macro is extended to also \overline{overline} text outside of math environments.

\DescribeMacro{\useparskip}
\DescribeMacro{\useparindent}
If the |parskip| option is activated the |\useparindent| macro switches to the usual parindent mode, while the |\useparskip| macro switches to the parskip mode.

\subsubsection{References and footnotes}

\DescribeMacro{\cref}
References are extended with the \software{cleveref} package \cite{cleveref}, which allows to \eg just type |\cref|\marg{key}  in order to write \enquote{figure 1}.
Furthermore, the \software{cleveref} package allows to reference multiple objects within one |\cref|\marg{key1,key2}.

\DescribeMacro{\cite}
Citations are adjusted to not start on a new line in order to avoid the repeated use of |~\cite|\marg{key}.

\DescribeMacro{\ref}
\DescribeMacro{\eqref}
\DescribeMacro{\subref}
References are also adjusted to not start on a new line.

\DescribeMacro{\footnote}
Footnotes are adjusted to swallow white space before the footnote mark and at the beginning of the footnote text.

\subsubsection{Acronyms}

\DescribeMacro{\acronym}
\DescribeMacro{\shortacronym}
\DescribeMacro{\longacronym}
The |\acronym|\meta{*}\oarg{typeset abbreviation}\marg{abbreviation}\meta{*}\marg{definition}\oarg{plural\linebreak[4]definition} macro generates the singular |\|\meta{abbreviation} and plural |\|\meta{abbreviation}|s| macros.
The first star prevents the addition of an \enquote{s} to the abbreviation plural.
The second star restores the \hologo{TeX} default of swallowing subsequent white space.
The long form is only shown at the first appearance of these macros, later appearances generate the abbreviation with a hyperlink to the long form.
The long form is never used in math mode.
Capitalization at the beginning of paragraphs and sentences is (mostly) ensured.
The |\shortacronym| and |\longacronym| macros are drop-in replacements of the |\acronym| macro showing only the short or long form of their acronym.
\DescribeMacro{\resetacronym}
\DescribeMacro{\dummyacronym}
The first use form of the acronym can be enforced by resetting the acronym counter with |\resetacronym|\marg{key}.
If the acronym counter equals one at the end of the document the short form of the acronym is not introduced.
Placing a |\dummyacronym|\marg{key} at the end of the document ensures that the short form is introduced.

\subsection{Math}

The \software{mathtools} \cite{mathtools} and \software{amssymb} \cite{amsfonts} packages are loaded.
They in turn load the \hologo{AmSLaTeX} \software{amsmath} \cite{amsmath} and \software{amsfonts} \cite{amsfonts} packages.
\DescribeMacro{\mathbf}
Bold math, via |\mathbf| is improved by the \software{bm} package \cite{bm}, \ie ($ A  b  \Gamma \delta \mathbf A \mathbf b \mathbf \Gamma \mathbf \delta$).
Macros switching to |bfseries| such as |\section|\marg{text} are ensured to also typeset math in bold.
\DescribeMacro{\text}
The |\text|\marg{text} macro makes it possible to write text within math mode, \ie ($ \text A  \text b  \text \Gamma \text \delta \text{\textbf A} \text{\textbf b} \text{\textbf \Gamma} \text{\textbf \delta}$).
\DescribeMacro{\mathsf}
The math sans serif alphabet is redefined to be italic sans serif if the main text is serif and italic serif if the main text is sans serif, \ie ($\mathsf A \mathsf b \mathsf \Gamma \mathsf \delta \mathbf{\mathsf A} \mathbf{\mathsf b} \mathbf{\mathsf \Gamma} \mathbf{\mathsf \delta}$).
\DescribeMacro{\mathscr}
The |\mathcal| font \ie ($\mathcal{ABCD}$) is accompanied by the |\mathscr| font \ie ($\mathscr{ABCD}$).
\DescribeMacro{\mathbb}
The |\mathbb| font is improved by the \software{doublestroke} package \cite{dsfont} and adjusted depending on the |sansserif| option \ie ($\mathbb{Ah1}$).
\DescribeMacro{\mathfrak}
Finally, the |\mathfrak| font is also available \ie ($\mathfrak{AaBb12}$).
Details about the font handling in \hologo{TeX} can be found in \ccite{fntguide}.

\DescribeMacro{\nicefrac}
\DescribeMacro{\flatfrac}
\DescribeMacro{\textfrac}
The |\frac|\marg{number}\marg{number} macro is accompanied by |\nicefrac|\linebreak[1]\marg{number}\linebreak[1]\marg{number}, |\textfrac|\marg{number}\marg{number}, and |\flatfrac|\marg{number}\marg{number} leading to $\frac12$, $\nicefrac12$, \textfrac12, and $\flatfrac12$.
\DescribeMacro{\diag}
\DescribeMacro{\sgn}
Diagonal matrix |\diag| and signum |\sgn| operators are defined.

\DescribeMacro{\mathdef}
The |\mathdef|\marg{name}\oarg{arguments}\marg{code} macro \prefix{re}{defines} macros only within math mode without changing the text mode definition.

\DescribeMacro{\i}
\DescribeMacro{\d}
The imaginary unit $\i$ and the differential $\d$ are defined using this functionality.

\DescribeMacro{\numberwithin}
For longer paper it can be useful to re-number the equation in accordance with the section numbering |\numberwithin{equation}{section}|.
\DescribeMacro{subequations}
In order to further reduce the size the of equation counter it can be useful to wrap |align| environments with multiple rows in a |subequations| environment.
Both macros are provided by the \software{amsmath} package.

\DescribeMacro{eqnarray}
The depreciated |eqnarray| environment is undefined as long this behaviour is not prevented by the |eqnarray| package option.
The |split|, |multline|, |align|, |multlined|, |aligned|, |alignedat|, and |cases| environments of the \software{amsmath} and \software{mathtools} packages should be used instead.

\DescribeMacro{equation}
Use the |equation| environment for short equations.
\begin{columns}
\begin{verbatim}
\begin{equation}
  left = right \ .
\end{equation}
\end{verbatim}
\column
\begin{equation}
\framebox[2em]{left\strut} = \framebox[7em]{right\strut} \ .
\end{equation}
\end{columns}

\DescribeMacro{multline}
Use the |multline| environment for longer equations.
\begin{columns}
\begin{verbatim}
\begin{multline}
  left = right 1 \\
  + right 2 \ .
\end{multline}
\end{verbatim}
\column
\begin{multline}
\framebox[2em]{left\strut} = \framebox[7em]{right 1\strut} \\
\framebox[7em]{+ right 2\strut} \ .
\end{multline}
\end{columns}

\DescribeMacro{split}
Use the |split| sub environment for equations in which multiple equal signs should be aligned.
\begin{columns}
\begin{verbatim}
\begin{equation} \begin{split}
  left &= right 1 \\
  &= right 2 \ .
\end{split} \end{equation}
\end{verbatim}
\column
\begin{equation}
\begin{split}
\framebox[2em]{left\strut} &= \framebox[7em]{right 1\strut} \\
&= \framebox[7em]{right 2\strut} \ .
\end{split}
\end{equation}
\end{columns}

\DescribeMacro{align}
Use the |align| environment for the vertical alignment and horizontal distribution of multiple equations.
\begin{columns}
\begin{verbatim}
\begin{subequations} \begin{align}
  left &= right \ , &
  left &= right \ , \\
  left &= right \ , &
  left &= right \ .
\end{align} \end{subequations}
\end{verbatim}
\column
\begin{subequations}
\begin{align}
\framebox[2em]{left\strut} &= \framebox[3em]{right\strut} \ , &
\framebox[2em]{left\strut} &= \framebox[3em]{right\strut} \ , \\
\framebox[2em]{left\strut} &= \framebox[3em]{right\strut} \ , &
\framebox[2em]{left\strut} &= \framebox[3em]{right\strut} \ .
\end{align}
\end{subequations}
\end{columns}

\DescribeMacro{aligned}
Use the |aligned| environment within a |equation| environment if the aligned equations should be labeled with a single equation number.

\DescribeMacro{multlined}
Use the |multlined| environment if either |split| or |align| contain very long lines.
\begin{columns}
\begin{verbatim}
\begin{equation} \begin{split}
  left &= right 1 \\ &=
  \begin{multlined}[t]
     right 2 \\ + right 3 \ .
  \end{multlined}
\end{split} \end{equation}
\end{verbatim}
\column
\begin{equation}
\begin{split}
\framebox[2em]{left\strut} &= \framebox[7em]{right 1\strut} \\ &=
 \begin{multlined}[t]
  \framebox[7em]{right 2\strut} \\
  \framebox[7em]{+ right 3\strut} \ .
\end{multlined}
\end{split}
\end{equation}
\end{columns}

\DescribeMacro{alignat}
Use the |alignat| environment together with the |\mathllap| macro for the alignment of multiple equations with vastly different lengths.
\begin{columns}
\begin{verbatim}
\begin{subequations}
\begin{alignat}{2}
  left &= long right && \ , \\
  le. 2 &= ri. 2 \ , &
  \mathllap{le. 3 = ri. 3} & \ .
\end{alignat}
\end{subequations}
\end{verbatim}
\column
\begin{subequations}
\begin{alignat}{2}
\framebox[2em]{left\strut} &=
\framebox[11em]{long right\strut} && \ , \\
\framebox[2em]{le.\ 2\strut}
&= \framebox[2.5em]{ri.\ 2\strut} \ , &
\mathllap{\framebox[2em]{le.\ 3\strut}
= \framebox[2.5em]{ri.\ 3\strut}} & \ .
\end{alignat}
\end{subequations}
\end{columns}

As a rule of thumb if you have to use |\notag|, |\nonumber|, or perform manual spacing via |\quad| you are probably using the wrong environment.

\subsubsection{Physics}

\DescribeMacro{\unit}
\DescribeMacro{\inv}
The correct spacing for units, \cf \cref{eq:greek}, is provided by the macro |\unit|\oarg{value} \marg{unit} from the \software{units} package \cite{units} which can also be used in text mode.
The macro |\inv|\oarg{power}\marg{text} allows to avoid math mode also for inverse units such as \unit[5]{\inv{fb}} typeset via |\unit[5]{\inv{fb}}|.

Greek letters are adjusted to always be italic and upright in math and text mode, respectively, using the \software{fixmath} \cite{fixmath} and \software{alphabeta} \cite{alphabeta} packages.
This allows differentiations like
\begin{align}
\sigma &= \unit[5]{fb} \ , & &\text{at \unit[5]{\sigma} C.L.} \ , & \mu &= \unit[5]{cm} \ , & l &= \unit[5]{\text \mu m} \ ,
\label{eq:greek}
\end{align}
and \eg to distinguish gauge $\nu$ and mass \nu\ eigenstates in models with massive neutrinos.
Note that |\mathrm| and therefore |\unit| transform italic greek character to seemingly random upright characters, this can be avoided by using |\unit{\text\mu m}|.
Additionally, Greek letters can also be directly typed using Unicode.

\DescribeMacro{\ev}
\DescribeMacro{\pdv}
\DescribeMacro{\comm}
\DescribeMacro{\order}
The \software{physics} package \cite{physics} provides additional macros such as
\begin{align}
&\ev{\phi} \ ,
&&\pdv[n]{f}{x} \ ,
&&\comm{A}{B} \ ,
&&\order{x^2} \ ,
&&\eval{x}_0^\infty \ ,
&&\det(M)\ .
\end{align}

\DescribeMacro{\cancel}
\DescribeMacro{\slashed}
The |\cancel|\marg{characters} macro from the \software{cancel} package \cite{cancel} and the |\slashed| \marg{character} macro from the \software{slashed} package \cite{slashed} allow to $\cancel{\text{cancel}}$ math and use the Dirac slash notation \ie $\slashed \partial$, respectively.

\DescribeMacro{\overleftright}
A better looking over left right arrow is defined \ie $\overleftright{\partial}$.

\subsection{Floats}

\DescribeEnv{figure}
\DescribeEnv{table}
Automatic float placement is adjusted to place a single float at the top of pages and to reduce the number of float pages, using the \hologo{LaTeX} macros.

|\setcounter{bottomnumber}{0}| \hfill no floats at the bottom of a page (default 1) \\
|\setcounter{topnumber}{1}| \hfill a single float at the top of a page (default 2) \\
|\setcounter{dbltopnumber}{1}| \hfill same for full widths floats in two-column mode \\
|\renewcommand{\textfraction}{.1}| \hfill large floats are allowed (default 0.2)\\
|\renewcommand{\topfraction}{.9}| \hfill (default 0.7) \\
|\renewcommand{\dbltopfraction}{.9}| \hfill (default 0.7) \\
|\renewcommand{\floatpagefraction}{.8}| \hfill float pages must be full (default 0.5)

Additionally, manual float placement is deactivated but can be reactivated using the |manualplacement| package option.
It is however recommended to archive the desired design by adjusting above macros.
The most useful float placement is usually archived by placing the float \emph{in front} of the paragraph it is referenced in first.
\DescribeMacro{\raggedright}
The float environments have been adjusted to center their content.
The usual behaviour can be reactivated using |\raggedright|.

\begin{table}
\begin{panels}{.6}
\begin{verbatim}
\begin{panels}{.6}
  code
\panel{.4}
  \begin{tabular}...\end{tabular}
\end{panels}
\end{verbatim}
\caption{Code for this panel environment.}
\label{tab:panels}
\panel{.4}
\begin{tabular}{cccc}
\toprule
\multicolumn{2}{c}{one}& \multicolumn{2}{c}{two} \\ \cmidrule(r){1-2} \cmidrule(l){3-4}
\multirow{2}{*}{a} & b & c & d \\
 & b & c & d \\
\bottomrule
\end{tabular}
\caption{The \protecting{|booktabs|} and \protecting{|multirow|} features.}
\label{tab:booktabs}
\end{panels}
\caption{Example use of the \protecting{|panels|} environment in Panel \subref{tab:panels} and the features from the \software{booktabs} and \software{multirow} packages in Panel \subref{tab:booktabs}.
} \label{tab:table}
\end{table}

\DescribeEnv{panels}
\DescribeMacro{\panel}
The |panels| environment makes use of the \software{subcaption} package \cite{subcaption}.
It provides sub-floats and takes as mandatory argument either the number of sub-floats (default~2) or the width of the first sub-float as fraction of the |\linewidth|.
Within the |\begin{panels}|\oarg{vertical alignment}\marg{width} environment the |\panel| macro initiates a new sub-float.
In the case that the width of the first sub-float has been given as an optional argument to the |panels| environment the |\panel|\marg{width} macro takes the width of the next sub-float as mandatory argument.
The example code is presented in \cref{tab:panels}.

\DescribeEnv{tabular}
The \software{booktabs} \cite{booktabs} and \software{multirow} \cite{multirow} packages are loaded enabling publication quality tabulars such as in \cref{tab:booktabs}.

\DescribeMacro{\graphic}
\DescribeMacro{\graphics}
The \software{graphicx} package \cite{graphicx} is loaded and the |\graphic|\oarg{width}\marg{figure} macro is defined, which is a wrapper for the |\includegraphics|\marg{figure} macro and takes the figure width as fraction of the |\linewidth| as optional argument (default~1).
If the graphics are located in a sub-folder its path can be indicated by |\graphics|\marg{subfolder}.

\subsection{Bibliography}

\DescribeMacro{\bibliography}
\DescribeMacro{\printbibliography}
The \software{biblatex} package \cite{biblatex} is loaded for bibliography management.
The user has to add the line |\bibliography|\marg{my.bib} to the preamble of the document and |\printbibliography| at the end of the document.
The bibliography is generated by \software{Biber} \cite{biber}.
|biblatex| is extended to be able to cope with the |collaboration| and |reportNumber| fields provided by \online{https://inspirehep.net}{inspirehep.net} and a bug in the volume number is fixed.
Additionally, the PubMed IDs are recognized and \online{https://ctan.org}{ctan.org}, \online{https://github.com}{github.com}, \online{https://gitlab.com}{gitlab.com}, \online{https://bitbucket.org}{bitbucket.org}, \online{https://www.launchpad.net}{launchpad.net}, \online{https://sourceforge.net}{sourceforge.net}, and \online{https://hepforge.org}{hepforge.org} are valid |eprinttype|s.
\DescribeMacro{erratum}
Errata can be included using the |related| feature.
\begin{verbatim}
\article{key1,
  ...,
  relatedtype="erratum",
  related="key2",
}
\article{key2,
  ...,
}
\end{verbatim}

\section{Conclusion}

The \software{hep-paper} package provides a matching selection of preloaded packages and additional macros enabling the user to focus on the content instead of the layout by reducing the amount of manual tasks.
The majority of the loaded packages are fairly lightweight, the others can be deactivated with package options.

\DescribeMacro{arxiv-collector}
\nolinkurl{arxiv.org} \cite{arxiv} requires the setup dependent |bbl| files instead of the original |bib| files, which causes trouble if the local \hologo{LaTeX} version differs from the one used by arXiv.
The \software{arxiv-collector} python script \cite{arxiv-collector} alleviates this problem by collecting all files necessary for publication on arXiv (including figures).

% \ifshort
\printbibliography

\end{document}
%
%</documentation>
% \fi
%
% \StopEventually{
% \printbibliography
% \PrintChanges
% }
%
% \addtocontents{toc}{\protect\clearpage}
% \clearpage
% \appendix
%
% \ifshort
%<*package>
% \fi
%
% \section{Math alphabet allocation}
%
% \bgroup
% \makeatletter
% \renewcommand{\arraystretch}{0}
% \setlength{\tabcolsep}{0pt}
% \nodecimals
% \nohexoct
% \fntcolwidth=0pt
% \setlength\arrayrulewidth{0pt}
%
% \begin{figure}
% \begin{panels}[t]{.22}
% \fonttable{rm-\ifhep@serif lmr\else lmss\fi10}
% \caption{Text}
% \panel{.22}
% \fontrange{0}{127}
% \fonttable{\ifhep@serif lm\else cmbr\fi mi10}
% \caption{Math}\vspace{2ex}
% \fonttable{\ifhep@serif lm\else cmbr\fi sy10}
% \caption{Symbol}
% \panel{.352}
% \fontrange{0}{127}
% \fonttable{\ifhep@serif\else ss\fi msam10}
% \caption{AMS a}\vspace{2ex}
% \fonttable{\ifhep@serif\else ss\fi msbm10}
% \caption{AMS b}
% \panel{.19}
% \fontrange{0}{127}
% \fonttable{eufm10}
% \caption{Euler fraktur}\vspace{2ex}
% \fontrange{64}{95}
% \fonttable{eusm10}
% \caption{Euler caligraphy}\vspace{2ex}
% \fonttable{MnSymbolS10}
% \caption{Minion caligraphy}\vspace{2ex}
% \fonttable{ds\ifhep@serif rom\else ss\fi10}
% \caption{Doublestroke}
% \end{panels}
% \caption{Basic math fonts}
% \end{figure}
%
% \begin{figure}
% \hspace*{-2cm}%
% \begin{panels}[t]{.3}
% \fontrange{0}{127}
% \fonttable{cm\ifhep@serif\else ss\fi ex10}
% \caption{Computer modern}
% \panel{.22}
% \fontrange{0}{143}
% \fonttable{MnSymbolE5}
% \caption{Mn Symbol E 1}
% \panel{.6}
% \fontrange{144}{215}
% \fonttable{MnSymbolE5}
% \caption{Mn Symbol E 2}\vspace{2ex}
% \begin{minipage}{.48\linewidth}
% \fontrange{0}{127}\fonttable{MnSymbolF10}
% \caption{Mn Symbols F}
% \end{minipage}%
% \begin{minipage}{.5\linewidth}
% \fontrange{0}{47}\fonttable{\ifhep@serif\else ss\fi esint10}
% \caption{Extended set of integrals}
% \end{minipage}
% \end{panels}
% \caption{Math extension fonts}
% \end{figure}
%
% \begin{figure}
% \begin{panels}[t]{.26}
% \fonttable{MnSymbolA10}
% \caption{Mn Symbol A}
% \panel{.26}
% \fonttable{MnSymbolB10}
% \caption{Mn Symbol B}
% \panel{.26}
% \fonttable{MnSymbolC10}
% \caption{Mn Symbol C}
% \panel{.2}
% \fonttable{MnSymbolD10}
% \caption{Mn Symbol D}
% \end{panels}
% \makeatother
% \caption{Minion symbol fonts}
% \end{figure}
% \egroup
%
% Of the 16 available math alphabets, \hologo{TeX} loads four by default
% \begin{enumdescript}[start=0]
% \item{OT1} \label{it:math text} Text (latin, upper case greek, numerals, text symbols)
% \item{OML} \label{it:math italic} Math Italic (latin, greek, numerals, text symbols)
% \item{OMS} \label{it:math symbol} Symbol (|\mathcal|, operators)
% \item{OMX} \label{it:math extension} Math Extension (big operators, delimiters)
% \end{enumdescript}
% The text font \ref{it:math text}\strut\ of \CM is \textbf{cmr10} |\OT1/cmr/m/n/10|, which is replaced by \LM to be \textbf{rm-lmr10} |\OT1/lmr/m/n/10|, the |sansserif| option uses \textbf{rm-lmss10} |\OT1/lmss/m/n/10|.
% The italic math font \ref{it:math italic} of \CM is \textbf{cmmi10} |\OML/cmm/m/it/|\allowbreak|10|, and is replaced by \LM to be \textbf{lmmi10} |\OML/lmm/m/it/10|, the |sansserif| options uses \textbf{cmbrmi10} |\OML/cmbrm/m/it/10| from the \software{cmbright} package \cite{cmbright}.
% The symbol font \ref{it:math symbol}\strut\ of \CM is \textbf{cmsy10} |\OMS/cmsy/m/n/10|, and is replaced by \LM to be \textbf{lmsy10} |\OMS/lmsy/m/n/10|, the |sansserif| options uses \textbf{cmsssy10} |\OMS/cmsssy/m/n/10| from the \software{sansmathfonts} package \cite{sansmathfonts}.
% The extension font \ref{it:math extension}\strut\ of \CM is \textbf{cmex10} |\OMX/cmex/m/n/5|, and is replaced by the \software{exscale} package \cite{exscale} to be \textbf{cmex10} |\OMX/cmex/m/n/10|, the |sansserif| option loads \textbf{cmssex10} |\OMX/cmssex/m/n/10|.
% The \software{amssymb} (\software{amsfonts}) packages \cite{amssymb} load two more symbol fonts
% \begin{enumdescript}[start=4]
% \item{msam10} \label{it:math ams a} |\U/msa/m/n/10| AMS symbol font A (special math operators)
% \item{msbm10} \label{it:math ams b} |\U/msb/m/n/10| AMS symbol font B (|\mathbb|, negated operators)
% \end{enumdescript}
% The |sansserif| option replaces them with \textbf{ssmsam10} |\U/ssmsa/m/n/10| and \textbf{ssmsbm10} |\U/ssmsb/m/n/10| from the \software{sansmathfonts} package \cite{sansmathfonts}, respectively.
% The \software{bm} package \cite{bm} loads the bold version for the fonts \labelcref{it:math text,it:math italic,it:math symbol}.
%
% Other math alphabets are only loaded on demand, \eg |\mathsf| uses a sans serif font and |\mathbf| without the \software{bm} package uses a bold font.
% The |\mathscr| macro uses the script font from the \software{mathrsfs} package \cite{mathrsfs}
% \begin{enumdescript}[start=9]
% \item{rsfs10} |\U/rsfs/m/n/10| Math script font (capital letters)
% \end{enumdescript}
% The |\mathbb| macro loads the double stroke font from the \software{dsfont} package \cite{dsfont}, this can be prevented with the |symbols=ams| option.
% \begin{enumdescript}[start=10]
% \item{dsrom10} |\U/dsrom/m/n/10| Double stroke font
% \end{enumdescript}
% The |\mathfrak| macro loads the fractur font from the \software{amssymb} package \cite{amssymb}
% \begin{enumdescript}[start=11]
% \item{eufm10} |\U/euf/m/n/10| Math fraktur (Basic Latin)
% \end{enumdescript}
%
% The \software{hep-paper} package uses nine of the available 16 math alphabets.
% This number can be reduced by three using |\newcommand{\bmmax}{0}| from the \software{bm} package \cite{bm} and brought down to the default of four with the option |symbols=false|.
%
% The |symbols=minion| options replaces the fonts \labelcref{it:math symbol,it:math extension,it:math ams a,it:math ams b} with corresponding fonts from the \software{MnSymbol} package \cite{MnSymbol}.
% Additionally, two more symbol alphabets are allocated, the \software{bm} package \cite{bm} loads one more font and now |\mathcal| triggers the use of one additional alphabet.
% Hence, the minion option uses three to four more math alphabets than a usual setup.
%
% \section{Options}
%
% Load the \software{pdftexcmds} \cite{pdftexcmds} and \software{kvoptions} \cite{kvoptions} packages and define a |hep| namespace.
%    \begin{macrocode}
\RequirePackage{pdftexcmds}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=hep,
  prefix=hep@
}
%    \end{macrocode}
%
% \begin{macro}{paper}
% Define a |paper=|\meta{size} option.
% Make A4 paper the default.
%    \begin{macrocode}
\DeclareStringOption[a4]{paper}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{font}
% Define a |figures=|\meta{size} option.
% Make \unit[11]{pt} the default font size.
%    \begin{macrocode}
\DeclareStringOption[11pt]{font}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{lang}
% Define the |lang| option, which takes the values provided by the \software{babel} package \cite{babel}.
% Make |british| the default language.
%    \begin{macrocode}
\DeclareStringOption[british]{lang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{sansserif}
% Define the option pair |serif| and |sansserif| controling the font shape of the whole document.
%    \begin{macrocode}
\DeclareBoolOption[true]{serif}
\DeclareComplementaryOption{sansserif}{serif}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{parskip}
% Define the option pair |parindent| and |parskip| controlling the separation of paragraphs.
%    \begin{macrocode}
\DeclareBoolOption[true]{parindent}
\DeclareComplementaryOption{parskip}{parindent}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{symbols}
% Provide the |symbols| option allowing to switch the symbol font.
%    \begin{macrocode}
\DeclareStringOption[true]{symbols}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Deactivation}
%
% \begin{macro}{defaults}
% Define the |defaults| option which deactivates the |paper| and |font| options and prevents the change of the class defaults by this package.
%    \begin{macrocode}
\DeclareBoolOption[false]{defaults}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{lining}
% Define the |lining| option deactivating the use of text figures in text mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{lining}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{title}
% Provide the |title| option deactivating redefinitions of title macros.
%    \begin{macrocode}
\DeclareBoolOption[true]{title}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{physics}
% Provide the |physics| option for deactivating redefinition of physics macros.
%    \begin{macrocode}
\DeclareBoolOption[true]{physics}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{bibliography}
% Provide the |bibliography| option for passing a |style| string to the \software{biblatex} package \cite{biblatex} or disabling the automatic loading of |biblatex|.
%    \begin{macrocode}
\DeclareStringOption[numeric-comp]{bibliography}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{glossaries}
% Provide the |glossaries| option able to turn of the use of the \software{glossaries} package \cite{glossaries}.
%    \begin{macrocode}
\DeclareBoolOption[true]{glossaries}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{references}
% Provide the |references| option for preventing the \software{cleveref} package from being loaded redefinitions of reference macros.
%    \begin{macrocode}
\DeclareBoolOption[true]{references}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Compatibility}
%
% \begin{macro}{beamer}
% Provide the |beamer| option for \software{beamer} \cite{beamer} compatibility mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{beamer}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{revtex}
% Provide the |revtex| option for REV\hologo{TeX} \cite{revtex} compatibility mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{revtex}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{jhep}
% Provide the |jhep| option for JHEP \cite{jhep} compatibility mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{jhep}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{jcap}
% Provide the |jcap| option for JCAP \cite{jcap} compatibility mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{jcap}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{pos}
% Provide the |pos| option for PoS compatibility mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{pos}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{springer}
% Provide the |springer| option for Springer compatibility mode.
%    \begin{macrocode}
\DeclareBoolOption[false]{springer}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Reactivation}
%
% \begin{macro}{eqnarray}
% Provide the |eqnarray| option for reactivating the |eqnarray| environment.
%    \begin{macrocode}
\DeclareBoolOption[false]{eqnarray}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{manualplacement}
% Provide the |manualplacement| option for reactivating the manual placement of floats.
%    \begin{macrocode}
\DeclareBoolOption[false]{manualplacement}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Process options}
%
%    \begin{macrocode}
\ProcessKeyvalOptions*
%    \end{macrocode}
%
% Read the class options regarding font and paper size.
%    \begin{macrocode}
\def\hep@get@class#1.cls#2\relax{\def\hep@class{#1}}
\def\hep@getclass{\expandafter\hep@get@class\@filelist\relax}
\hep@getclass
\@ifclasswith{\hep@class}{10pt}{\setkeys{hep}{font=10pt}}{}
\@ifclasswith{\hep@class}{12pt}{\setkeys{hep}{font=12pt}}{}
\@ifclasswith{\hep@class}{a5paper}{\setkeys{hep}{paper=a5}}{}
\@ifclasswith{\hep@class}{b5paper}{\setkeys{hep}{paper=b5}}{}
\@ifclasswith{\hep@class}{letterpaper}{\setkeys{hep}{paper=letter}}{}
\@ifclasswith{\hep@class}{legalpaper}{\setkeys{hep}{paper=legal}}{}
\@ifclasswith{\hep@class}{executivepaper}{%
  \setkeys{hep}{paper=executive}%
}{}
%    \end{macrocode}
%
% \subsection{Set compatibility}
%
% Set the |springer| compatibility options.
%    \begin{macrocode}
\@ifclassloaded{svjour}{\setkeys{hep}{springer}}{}
\@ifclassloaded{svjour2}{\setkeys{hep}{springer}}{}
\@ifclassloaded{svjour3}{\setkeys{hep}{springer}}{}
\ifhep@springer
  \setkeys{hep}{defaults, title=false}
  \let\cl@chapter\undefined
\fi
%    \end{macrocode}
%
% Set the |pos| compatibility options.
%    \begin{macrocode}
\@ifclassloaded{PoS}{\setkeys{hep}{pos}}{}
\ifhep@pos
  \setkeys{hep}{defaults, title=false}
  \DeclareRobustCommand\boldmath{\@nomath\boldmath\mathversion{bold}}
\fi
%    \end{macrocode}
%
% Set the |beamer| compatibility options.
%    \begin{macrocode}
\@ifclassloaded{beamer}{\setkeys{hep}{beamer}}{}
\ifhep@beamer
  \setkeys{hep}{defaults, title=false, references=false, sansserif}
  \@ifpackageloaded{beamerbasefont}{\usefonttheme{professionalfonts}}{}
  \setbeamertemplate{navigation symbols}{}
\fi
%    \end{macrocode}
%
% Set the |revtex| compatibility options.
%    \begin{macrocode}
\@ifclassloaded{revtex4}{\setkeys{hep}{revtex}}{}
\@ifclassloaded{revtex4-1}{\setkeys{hep}{revtex}}{}
\@ifclassloaded{revtex4-2}{\setkeys{hep}{revtex}}{}
\ifhep@revtex
  \setkeys{hep}{defaults, title=false, bibliography=false, lang=american}
\fi
%    \end{macrocode}
%
% Define the SISSA conditional.
%    \begin{macrocode}
\@ifpackageloaded{jheppub}{\setkeys{hep}{jhep}}{}
\@ifpackageloaded{jcappub}{\setkeys{hep}{jcap}}{}
\newif\ifhep@sissa
\ifhep@jhep\hep@sissatrue
\else
  \ifhep@jcap\hep@sissatrue
  \else\hep@sissafalse
  \fi
\fi
%    \end{macrocode}
%
% Set the SISSA compatibility options.
%    \begin{macrocode}
\ifhep@sissa
  \setkeys{hep}{title=false, bibliography=false}
  \PassOptionsToPackage{
    colorlinks=true, linktocpage=true, pdfproducer=medialab, pdfa=true,
    urlcolor=blue, anchorcolor=blue, citecolor=blue, filecolor=blue,
    linkcolor=blue, menucolor=blue, pagecolor=blue
  }{hyperref}
  \PassOptionsToPackage{reset}{geometry}
  \AtBeginDocument{\renewcommand{\foreignabbrfont}{}}
\fi
%    \end{macrocode}
% Set the JHEP compatibility options.
%    \begin{macrocode}
\ifhep@jhep
  \voffset 0in
  \hoffset 0in
\fi
%    \end{macrocode}

% \section{Text}
%
% Set the whole text to sans serif if requested.
%    \begin{macrocode}
\ifhep@serif\else
  \renewcommand{\familydefault}{\sfdefault}
\fi
%    \end{macrocode}
%
% \begin{macro}{\ifxetexorluatex}
% Load the \software{ifluatex} \cite{ifluatex} and \software{ifxetex} \cite{ifxetex} packages.
% Define the |\ifxetexorluatex| conditional checking if the package is executed by \hologo{LuaLaTeX} or \hologo{XeLaTeX}.
%    \begin{macrocode}
\RequirePackage{ifluatex}
\RequirePackage{ifxetex}
\newif\ifxetexorluatex
\ifxetex\xetexorluatextrue
\else
  \ifluatex\xetexorluatextrue
  \else\xetexorluatexfalse
  \fi
\fi
%    \end{macrocode}
% \end{macro}
%
% Pick the correct font encoding depending on the engine used and load the \software{fontenc} package \cite{fontenc} with this encoding.
% For details of the font encoding see \cite{encguide}.
%    \begin{macrocode}
\ifxetexorluatex
  \def\hep@encoding{TU}
\else
  \def\hep@encoding{T1}
\fi
\RequirePackage[\hep@encoding]{fontenc}
%    \end{macrocode}
% Fix the remaining \CM fonts \cite{fix-cm}, load the \LM font via \software{cfr-lm} \cite{cfr-lm} supported also by \software{lmodern} \cite{lmodern}, the \software{textcomp} extension \cite{textcomp}, and the \software{microtype} font optimization \cite{microtype}.
% Adjust the figures according to the |lining| option and ensure that tables always use lining, using the \software{etoolbox} package \cite{etoolbox}.
%    \begin{macrocode}
\RequirePackage{fix-cm}
\RequirePackage{microtype}
\ifhep@lining
  \RequirePackage[rm={lining},sf={lining},tt={lining}]{cfr-lm}
\else
  \RequirePackage{cfr-lm}
\fi
\RequirePackage{etoolbox}
% \AtBeginEnvironment{tabular}{\tlstyle}
\RequirePackage{textcomp}
%    \end{macrocode}
%
% Define bold and sans serif small caps font shapes using the \software{fontspec} package \cite{fontspec}.
% The font abbreviations are
% \begin{description}[nosep]
%  \item[lmr] \LM regular font
%  \item[lmss] \LM sans serif font
%  \item[cmss] \CM sans serif font
%  \item[xcmss] Extended \CM sans serif font (from the \software{sansmathfonts} package \cite{sansmathfonts})
%  \item[bx] Bold extended series
%  \item[b] Bold series
%  \item[m] Medium weight and width series
%  \item[c] Medium weight, condensed width series
%  \item[sc] Caps and small caps font shape
% \end{description}
%    \begin{macrocode}
\newcommand{\hep@sf@fontshape}[3]{%
  \DeclareFontShape{\hep@encoding}{\sfdefault}{#1}{#2}{#3}{}%
}
\newcommand{\hep@rm@fontshape}[3]{%
  \DeclareFontShape{\hep@encoding}{\rmdefault}{#1}{#2}{#3}{}%
}
\ifxetexorluatex
  \RequirePackage{fontspec}
  \setmainfont{Latin Modern Roman}[
    UprightFeatures={SmallCapsFont={[lmromancaps10-regular.otf]}},
    BoldFeatures={
      SmallCapsFeatures={Letters=SmallCaps},
      SmallCapsFont={[cmunbx.otf]}
    }
  ]
  \hep@sf@fontshape{bx}{sc}{<->cmssbxcsc10}{}
  \hep@sf@fontshape{b}{sc}{<->cmssbxcsc10}{}
  \hep@sf@fontshape{m}{scit}{<->cmsscsci10}{}
  \hep@sf@fontshape{m}{sc}{%
    <-9>cmsscsc8<9-10>cmsscsc9<10->cmsscsc10%
  }{}
\else
  \rmfamily
  \hep@rm@fontshape{b}{sc}{<->ssub*cmr/bx/sc}{}
  \hep@rm@fontshape{bx}{sc}{<->ssub*cmr/bx/sc}{}
  \sffamily
  \hep@sf@fontshape{m}{sc}{<->ssub*xcmss/m/sc}{}
  \hep@sf@fontshape{b}{sc}{<->ssub*xcmss/bx/sc}{}
  \hep@sf@fontshape{bx}{sc}{<->ssub*xcmss/bx/sc}{}
  \hep@sf@fontshape{m}{scit}{<->ssub*xcmss/m/scit}{}
  \hep@sf@fontshape{b}{scit}{<->ssub*xcmss/bx/scit}{}
  \hep@sf@fontshape{bx}{scit}{<->ssub*xcmss/bx/scit}{}
\fi
%    \end{macrocode}
%
% Load the \software{inputenc} package \cite{inputenc}.
%    \begin{macrocode}
\ifxetexorluatex\else
  \RequirePackage[utf8]{inputenc}
\fi
%    \end{macrocode}
%
% Load the \software{babel} package \cite{babel} for hyphenation and the recommended \software{csquotes} package \cite{csquotes}.
%    \begin{macrocode}
\RequirePackage[\hep@lang]{babel}
\RequirePackage[autostyle]{csquotes}
%    \end{macrocode}
%
% \begin{macro}{\underline}
% Load the \software{ulem} package \cite{ulem} for hyphenable underlined text.
%    \begin{macrocode}
\RequirePackage[normalem]{ulem}
\let\underline\uline
%    \end{macrocode}
% \end{macro}
%
% \subsection{Font size} \label{sec:font size}
%
% Undefine previously defined font sizes and load the \hologo{LaTeX} font size file corresponding to the font size option.
%    \begin{macrocode}
\ifhep@defaults\else
  \def\hep@remove@pt#1pt{#1}
  \edef\hep@pt@size{\expandafter\hep@remove@pt\hep@font}
  \let\small\relax
  \let\footnotesize\relax
  \let\scriptsize\relax
  \let\tiny\relax
  \let\large\relax
  \let\Large\relax
  \let\LARGE\relax
  \let\huge\relax
  \let\Huge\relax
  \input{size\hep@pt@size.clo}
\fi
%    \end{macrocode}

% \subsection{Text macros}
%
%\begin{macro}{\vs}
% Load the \software{foreign} package \cite{foreign} in order to highlight abbreviations and vocabularies from foreign languages.
% Add the missing |\vs| command.
%    \begin{macrocode}
\ifnum\pdf@strcmp{\hep@lang}{american}=0
  \newcommand{\hep@lang@foreign}{USenglish}
\else
  \ifnum\pdf@strcmp{\hep@lang}{USenglish}=0
    \newcommand{\hep@lang@foreign}{USenglish}
  \else
    \newcommand{\hep@lang@foreign}{british}
  \fi
\fi
\RequirePackage[all, \hep@lang@foreign]{foreign}
\DeclareRobustCommand\vs{\xperiodafter{{\foreignabbrfont{vs}}}}
%    \end{macrocode}
% \end{macro}
%
% The \software{foreign} package relies on the \software{xspace} package \cite{xspace}.
% Ensure that |\xspace| is compatible with the |\enquote| macro from the \software{csquote} package.
%    \begin{macrocode}
\xspaceaddexceptions{\csq@qclose@i}
%    \end{macrocode}
%
%\begin{macro}{\no}
% Define the macro |\no|\marg{number} for the use of \textnumero\ with appropriate spacing.
%    \begin{macrocode}
\newcommand{\no}[1]{\textnumero~#1}
%    \end{macrocode}
% \end{macro}
%
%\begin{macro}{\software}
% Define a macro for software with optional version information |\software|\linebreak[1]\oarg{version}\linebreak[1]\marg{name}, using the \software{relsize} package \cite{relsize}.
%    \begin{macrocode}
\RequirePackage{relsize}
\newcommand{\software}[2][\hspace{-\fontdimen2\font}]{%
  {\smaller[.5]\textsc{#2}~#1}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\online}
% \begin{macro}{\email}
% Define the |\online|\marg{text}\marg{url} macro combining the features of the |\href| and the |\url| macros.
% Define a macro for typesetting emails.
%    \begin{macrocode}
\newcommand{\online}[2]{\href{#1}{\nolinkurl{#2}}}
\providecommand{\email}[1]{\online{mailto:#1}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\prefix}
% Define the |\prefix|\marg{prefix}\marg{word} macro ensuring the correct linebreak in \prefix{prefix}{word}.
%    \begin{macrocode}
\newcommand{\prefix}[2]{(#1\mbox{-)}\allowbreak #2}
%    \end{macrocode}
% \end{macro}

% \subsection{Lists}
%
% Load the \software{enumitem} package \cite{enumitem}.
%    \begin{macrocode}
\RequirePackage[inline]{enumitem}
%    \end{macrocode}
%
% \begin{environment}{inlinelist}
% Define an inline list environment.
%    \begin{macrocode}
\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{%
  label=\roman*), itemjoin={,\ }, itemjoin*={, and\ }, after=.%
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{enumdescript}
% Define an enumdescript list environment.
%    \begin{macrocode}
\newlist{enum@descript}{enumerate}{2}
\setlist[enum@descript]{label=\arabic*.}
\newenvironment{enumdescript}[1][]{
\begin{enum@descript}[#1]
  \let\hep@item\item
  \renewcommand{\item}[2][]{
    \ifx&##1&\hep@item\else\hep@item[##1]\fi
    \textbf{##2}\ifx##2\empty\else~\fi\@ifnextchar\par\@gobble\relax
  }
}{\end{enum@descript}}
%    \end{macrocode}
% \end{environment}

% \section{Geometry}
%
% Load the \software{geometry} package \cite{geometry} and adjust the text width and height.
% This step must happen after readjusting the font size in \cref{sec:font size}.
%    \begin{macrocode}
\ifhep@defaults\else
  \RequirePackage{geometry}
  \geometry{\hep@paper paper, includeheadfoot}
  \if@twocolumn
    \geometry{hscale=.85, vscale=.925, vmarginratio=1:1}
    \geometry{headsep=2ex, footskip=6ex}
    \setlength{\columnsep}{1.1em}
  \else
    \geometry{hscale=.75, vscale=.8, vmarginratio=3:4}
  \fi
\fi
%    \end{macrocode}
%
%\begin{macro}{\useparskip}
%\begin{macro}{\useparindent}
% Load the \software{parskip} package \cite{parskip} if requested and provide two commands switching between the two paragraph modes.
%    \begin{macrocode}
\ifhep@parindent\else
\RequirePackage{parskip}
\newcommand{\useparskip}{%
  \setlength{\parskip}{.5\baselineskip plus 2pt}%
  \setlength{\parindent}{0pt}%
}
\newcommand{\useparindent}{%
  \setlength{\parskip}{0pt}%
  \setlength{\parindent}{15pt}%
  \if@twocolumn\setlength\parindent{1em}
  \else\setlength\parindent{1.5em}
  \fi
}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \section{Math}
%
% Load the \software{mathtools} package \cite{mathtools} which loads the \software{amsmath} package \cite{amsmath}.
% Allow page breaks within equations if necessary.
%    \begin{macrocode}
\RequirePackage{mathtools}
\allowdisplaybreaks[1]
%    \end{macrocode}
%
% \begin{macro}{\diag}
% \begin{macro}{\sgn}
% Provide the |\diag| and |\sgn| operators
%    \begin{macrocode}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\sgn}{sgn}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\mathdef}
% Define the |\mathdef|\marg{name}\oarg{arguments}\marg{macro} macro which \prefix{re}{defines} macros in math mode only.
% This macro is implemented using the \software{xparse} package \cite{xparse}.
%    \begin{macrocode}
\RequirePackage{xparse}
\DeclareDocumentCommand{\mathdef}{mO{0}m}{%
  \expandafter\let\csname text\string#1\endcsname=#1
  \expandafter\newcommand\csname math\string#1\endcsname[#2]{#3}
  \DeclareRobustCommand#1{%
    \ifmmode
      \expandafter\let\expandafter\next\csname math\string#1\endcsname
    \else
      \expandafter\let\expandafter\next\csname text\string#1\endcsname
    \fi
    \next
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\i}
% Provide an upright imaginary unit in math mode.
%    \begin{macrocode}
\AtBeginDocument{\mathdef{\i}{\operatorname{i}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\overline}
% Redefine |\overline| to be a text macro using the \software{ulem} package \cite{ulem}.
% Extend it as a math macro with the original definition from the \software{amsmath} package \cite{amsmath}.
%    \begin{macrocode}
\def\overline#1{{\renewcommand{\ULdepth}{-1.9ex}{}\uline{#1}}}
\DeclareRobustCommand{\over@line}[1]{\@@overline{#1}}
\mathdef{\overline}{\over@line}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\left}
% \begin{macro}{\right}
% Load the \software{mleftright} package \cite{mleftright} and adjust the spacing around |\left| and |\right|.
%    \begin{macrocode}
\RequirePackage{mleftright}
\mleftright
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{eqnarray}
% Undefine the |eqnarray| environment if not prevented by package option.
%    \begin{macrocode}
\ifhep@eqnarray\else
  \let\eqnarray\@undefined
  \let\endeqnarray\@undefined
\fi
%    \end{macrocode}
% \end{macro}
%
% \subsection{Math fonts}
%
% Define conditionals based on the |symbols| package option.
%    \begin{macrocode}
\newif\ifhep@symbols
\ifnum\pdf@strcmp{\hep@symbols}{false}=0\else\hep@symbolstrue\fi
\newif\ifhep@ams
\ifnum\pdf@strcmp{\hep@symbols}{ams}=0 \hep@amstrue\fi
\newif\ifhep@minion
\ifnum\pdf@strcmp{\hep@symbols}{minion}=0 \hep@miniontrue\fi
%    \end{macrocode}
%
% Load the \software{fixmath} \cite{fixmath} and \software{alphabeta} \cite{alphabeta} packages ensuring that upper Greek letters in math mode are italic and providing upright Greek letters in text mode, respectively.
% Ensure that this works also after loading other fonts packages such as \software{cfr-lm} using \software{substitutefont} \cite{substitutefont}.
%    \begin{macrocode}
\ifhep@symbols
  \RequirePackage{fixmath}
  \RequirePackage{alphabeta}
  \RequirePackage{substitutefont}
  \substitutefont{LGR}{\rmdefault}{lmr}
  \DeclareFontFamily{LGR}{\rmdefault}{}
  \DeclareFontShape{LGR}{\rmdefault}{b}{n}{<->ssub*lmr/bx/n}{}
  \DeclareFontShape{LGR}{\rmdefault}{b}{sc}{<->ssub*lmr/bx/sc}{}
  \substitutefont{LGR}{\ttdefault}{lmtt}
  \DeclareFontFamily{LGR}{\ttdefault}{}
  \DeclareFontShape{LGR}{\ttdefault}{b}{n}{<->ssub*cmtt/bx/n}{}
  \substitutefont{LGR}{\sfdefault}{lmss}
  \DeclareFontFamily{LGR}{\sfdefault}{}
  \DeclareFontShape{LGR}{\sfdefault}{b}{n}{<->ssub*lmss/bx/n}{}
  \DeclareFontShape{LGR}{\sfdefault}{b}{sc}{<->ssub*lmss/bx/sc}{}
%    \end{macrocode}
%
% Either load the \software{MnSymbol} package \cite{MnSymbol} or the the \software{exscale} package in order to fix Latin Modern |lmex| fonts.
% Additionally, load the \software{amssymb} package \cite{amsfonts} which provides further math symbols and also loads the \software{amsfonts} package \cite{amsfonts}.
%    \begin{macrocode}
  \ifhep@minion
    \RequirePackage{MnSymbol}
  \else
    \RequirePackage{exscale}
    \RequirePackage{amssymb}
  \fi
\fi
%    \end{macrocode}
%
% \begin{macro}{\mathsf}
% If the |sansserif| package option is active use the \software{cmbright} font \cite{cmbright} and code adjusted from the \software{sansmathfonts} package \cite{sansmathfonts}.
% Ensure that |\mathsf| is italic as well as sans serif and sans for sans and sans serif documents, respectively.
%    \begin{macrocode}
\ifhep@serif
  \newcommand\hep@font@sf{cmbrm}
  \DeclareMathAlphabet{\mathsf}{OML}{\hep@font@sf}{m}{it}
  \SetMathAlphabet{\mathsf}{bold}{OML}{\hep@font@sf}{b}{it}
\else
  \newcommand\hep@font@sf{lmr}
  \newcommand\hep@font@text{lmss}
  \newcommand\hep@font@math{cmbrm}
  \newcommand\hep@font@symbol{cmsssy}
  \newcommand\hep@font@extra{cmssex}
  \newcommand\hep@font@amsa{ssmsa}
  \newcommand\hep@font@amsb{ssmsb}
%    \end{macrocode}
% Declare font substitutions.
%    \begin{macrocode}
  \DeclareFontSubstitution{OML}{\hep@font@math}{m}{it}
  \ifhep@symbols\ifhep@minion\else
    \DeclareFontSubstitution{OMS}{\hep@font@symbol}{m}{n}
    \DeclareFontSubstitution{OMX}{\hep@font@extra}{m}{n}
  \fi\fi
%    \end{macrocode}
% Declare the symbol fonts.
%    \begin{macrocode}
  \DeclareSymbolFont{operators}{OT1}{\hep@font@text}{m}{n}
  \DeclareSymbolFont{letters}{OML}{\hep@font@math}{m}{it}
  \ifhep@symbols\ifhep@minion\else
    \DeclareSymbolFont{symbols}{OMS}{\hep@font@symbol}{m}{n}
    \DeclareSymbolFont{largesymbols}{OMX}{\hep@font@extra}{m}{n}
  \fi\fi
%    \end{macrocode}
% Set bold symbol fonts.
%    \begin{macrocode}
  \SetSymbolFont{operators}{bold}{OT1}{\hep@font@text}{b}{n}
  \SetSymbolFont{letters}{bold}{OML}{\hep@font@math}{b}{it}
  \ifhep@symbols\ifhep@minion\else
    \SetSymbolFont{symbols}{bold}{OMS}{\hep@font@symbol}{b}{n}
  \fi\fi
%    \end{macrocode}
% Adjust the fonts loaded by the \software{amsfonts} \cite{amsfonts} and \software{esint} \cite{esint} packages.
%    \begin{macrocode}
  \ifhep@symbols\ifhep@minion\else
    \DeclareSymbolFont{AMSa}{U}{\hep@font@amsa}{m}{n}
    \DeclareSymbolFont{AMSb}{U}{\hep@font@amsb}{m}{n}
  \fi\fi
  \AtBeginDocument{%
    \@ifpackageloaded{esint}{%
      \DeclareSymbolFont{largesymbolsA}{U}{ssesint}{m}{n}
    }{}
  }
%    \end{macrocode}
% Declare the symbol font alphabets.
%    \begin{macrocode}
  \DeclareSymbolFontAlphabet{\mathrm}{operators}
  \DeclareSymbolFontAlphabet{\mathnormal}{letters}
  \ifhep@minion\else
    \DeclareSymbolFontAlphabet{\mathcal}{symbols}
  \fi
%    \end{macrocode}
% Declare |\mathit|.
%    \begin{macrocode}
  \DeclareMathAlphabet{\mathit}{OML}{\hep@font@text}{m}{it}
  \SetMathAlphabet\mathit{bold}{OML}{\hep@font@text}{bx}{it}
%    \end{macrocode}
% Declare |\mathtt|.
%    \begin{macrocode}
  \DeclareMathAlphabet{\mathtt}{OT1}{cmtl}{m}{n}
%    \end{macrocode}
%    \begin{macrocode}
%    \end{macrocode}
% Declare |\mathsf|.
%    \begin{macrocode}
  \DeclareMathAlphabet{\mathsf}{OML}{\hep@font@sf}{m}{it}
  \SetMathAlphabet{\mathsf}{bold}{OML}{\hep@font@sf}{bx}{it}
%    \end{macrocode}
% \end{macro}
% End of |sansserif|.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \begin{macro}{\mathbf}
% Load the \software{bm} package \cite{bm} for superior boldmath.
% Make math symbols bold whenever they appear in bold macros such as |\section|\marg{text}.
%    \begin{macrocode}
\ifhep@symbols
  \RequirePackage{bm}
  \AtBeginDocument{\let\mathbf\bm}
  \g@addto@macro\bfseries{\boldmath}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mathscr}
% Provid the |\mathscr| math script font from the \software{mathrsfs} package \cite{mathrsfs}.
%    \begin{macrocode}
  \DeclareMathAlphabet{\mathscr}{U}{rsfs}{m}{n}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\mathbb}
% Redefine the the |\mathbb| math blackboard style font according to the \prefix{sans}{serif} option with the font from the \software{dsfont} package \cite{dsfont}.
%    \begin{macrocode}
  \ifhep@minion
    \DeclareMathAlphabet{\mathbb}{U}{%
      \ifhep@serif dsrom\else dsss\fi%
    }{m}{n}
  \else
    \ifhep@ams\else
      \SetMathAlphabet{\mathbb}{normal}{U}{%
        \ifhep@serif dsrom\else dsss\fi%
      }{m}{n}
    \fi
  \fi
\fi
%    \end{macrocode}
% \end{macro}

% \subsection{Physics notation}
%
% \begin{macro}{\cancel}
% \begin{macro}{\slashed}
% \begin{macro}{\unit}
% Load the \software{physics} package \cite{physics} which provides macros useful for publications in physics.
% Additionally, load the \software{cancel} \cite{cancel} and \software{slashed} \cite{slashed} packages which provide the |\cancel| and |\slashed| macros.
% Finally, load the \software{units} package \cite{units} which provides the |\units| and |\nicefrac| macros.
%    \begin{macrocode}
\ifhep@physics
\RequirePackage{physics}
\RequirePackage{cancel}
\RequirePackage{slashed}
\RequirePackage{units}
\newcommand{\textfrac}[2]{\ensuremath{\nicefrac{\text{#1}}{\text{#2}}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\inv}
% Provide a macro for the inverse, useful in combination with the unit macro in text mode.
%    \begin{macrocode}
\newcommand{\inv}[2][1]{#2\ensuremath{^{-#1}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\d}
% Provide a differential |\d|.
%    \begin{macrocode}
\AtBeginDocument{\mathdef{\d}{\dd}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\oset}
% Define a new overset macro |\oset|\oarg{offset}\marg{over}\marg{base}
%    \begin{macrocode}
\newcommand{\oset}[3][-1pt]{%
  \text{\raisebox{.2ex}{$\mathop{#3}\limits^{%
    \vbox to#1{\kern-2\ex@\hbox{$\scriptscriptstyle#2$}\vss}%
  }$}}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\overleftright}
% Define a over left right arrow |\overleftright|\marg{base}.
%    \begin{macrocode}
\newcommand{\overleftright}[1]{\oset{\leftrightarrow}{#1}}
%    \end{macrocode}
% End of |physics| conditional.
%    \begin{macrocode}
\fi
%    \end{macrocode}
% \end{macro}

% \section{Floats}
%
% Adjust the \hologo{LaTeX} float placement defaults
%    \begin{macrocode}
\setcounter{bottomnumber}{0} % 1
\setcounter{topnumber}{1} % 2
\setcounter{dbltopnumber}{1} % 2
\renewcommand{\topfraction}{.9} % .7
\renewcommand{\dbltopfraction}{.9} % .7
\renewcommand{\textfraction}{.1} % .2
\renewcommand{\floatpagefraction}{.8} % .5
%    \end{macrocode}
%
% \begin{environment}{figure}
% \begin{environment}{table}
% Center the content of |figure| and |table| environments.
% Ignore the manual placement if the |manualplacement| option is set to false.
%    \begin{macrocode}
\let\@figure@\figure%
\let\@end@figure@\endfigure%
\let\@table@\table%
\let\@end@table@\endtable%
\ifhep@manualplacement%
  \renewenvironment{figure}[1][tbp]{%
    \@figure@[#1]\centering%
    }{\@end@figure@}%
  \renewenvironment{table}[1][tbp]{%
    \@table@[#1]\centering%
  }{\@end@table@}%
\else%
  \renewenvironment{figure}[1][]{%
    \@figure@\centering%
  }{\@end@figure@}%
  \renewenvironment{table}[1][]{%
    \@table@\centering%
  }{\@end@table@}
\fi%
%    \end{macrocode}
% \end{environment}
% \end{environment}

% \subsection{Sub-floats}
%
% \begin{macro}{\ifhep@journal}
% Define a new journal conditional.
%    \begin{macrocode}
\newif\ifhep@journal
\ifhep@sissa\hep@journaltrue
\else
  \ifhep@revtex\hep@journaltrue
  \else
    \ifhep@pos\hep@journaltrue
    \else
      \ifhep@springer\hep@journaltrue
      \else\hep@journalfalse
      \fi
    \fi
  \fi
\fi
%    \end{macrocode}
% \end{macro}
%
% Prevent the \software{caption} package \cite{caption} from complaining about the journal classes and packages.
%    \begin{macrocode}
\ifhep@journal
  \setlength\abovecaptionskip{\f@size\p@}
  \setlength\belowcaptionskip{0\p@}
  \long\def\@makecaption#1#2{%
    \vskip\abovecaptionskip
    \sbox\@tempboxa{#1: #2}%
    \ifdim \wd\@tempboxa >\hsize
      #1: #2\par
    \else
      \global \@minipagefalse
      \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
    \fi
    \vskip\belowcaptionskip%
  }
\fi
%    \end{macrocode}
%
% Load the \software{subcaption} package \cite{subcaption}.
% Provide the old |\subcaption@minipage| macro.
%    \begin{macrocode}
\RequirePackage[subrefformat=parens]{subcaption}
\captionsetup{font=small}
\captionsetup[sub]{font=small}
\providecommand*\subcaption@minipage[2]{%
  \minipage#1{#2}\setcaptionsubtype\relax%
}
%    \end{macrocode}
% \begin{environment}{panels}
% \begin{macro}{\panel}
% Define the |panels| environment and the |\panel| macro.
%    \begin{macrocode}
\newenvironment{panels}[2][b]{%
%    \end{macrocode}
% Define an internal macro for global behaviour.
%    \begin{macrocode}
  \newcommand{\begin@subcaption@minipage}[2][b]{%
    \caption@withoptargs\subcaption@minipage[##1]{##2}%
    \centering\vskip 0pt%
  }
%    \end{macrocode}
% Define the |\panel| macro for the case that the number of panels is given.
%    \begin{macrocode}
  \ifdim#2pt>1pt%
    \newcommand{\panel}[1][b]{%
      \endminipage\hfill\begin@subcaption@minipage[#1]{\linewidth/#2}%
    }%
    \begin@subcaption@minipage[#1]{\linewidth/#2}%
%    \end{macrocode}
% Define the |\panel| macro for the case that the width of the panel is given.
%    \begin{macrocode}
  \else%
    \newcommand{\panel}[2][b]{%
      \endminipage\hfill\begin@subcaption@minipage[#1]{##2\linewidth}%
    }%
    \begin@subcaption@minipage[#1]{#2\linewidth}%
  \fi%
}{\endminipage}
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% Reajust the captions to the revtex class using the \software{ragged2e} package \cite{ragged2e}.
%    \begin{macrocode}
\ifhep@revtex
  \RequirePackage{ragged2e}
  \DeclareCaptionFormat{revtex}{#1#2\justifying{#3}}
  \captionsetup{font=small, format=revtex}
  \captionsetup[sub]{font=footnotesize, format=plain}
  \renewcommand{\figurename}{Figure}
  \renewcommand{\tablename}{Table}
\fi
%    \end{macrocode}

% \subsection{Tables}
%
% \begin{environment}{tabular}
% Enhance tabulars with the \software{booktabs} and \software{multirow} packages \cite{booktabs, multirow}.
%    \begin{macrocode}
\RequirePackage{booktabs}
\RequirePackage{multirow}
%    \end{macrocode}
% \end{environment}

% \subsection{Figures}
%
% \begin{macro}{\graphic}
% Provide the |\graphic| macro for the inclusion of figures using the \software{graphicx} package \cite{graphicx}.
%    \begin{macrocode}
\RequirePackage{graphicx}
\providecommand{\tikzsetnextfilename}[1]{}
\newcommand{\graphic}[2][1]{\tikzsetnextfilename{#2}{%
  \centering\includegraphics[width=#1\linewidth]{#2}\par%
}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\graphics}
% Provide the |\graphics| macro for the inclusion of figures located in a subfolder.
%    \begin{macrocode}
\newcommand{\graphics}[1]{\graphicspath{{./#1/}}}
%    \end{macrocode}
% \end{macro}

% \section{Title page}
%
% Begin of |title| conditional.
%    \begin{macrocode}
\ifhep@title
%    \end{macrocode}
%
% \begin{macro}{\date}
% Allow absent date field.
%    \begin{macrocode}
\date{}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Titles}
%
% Extend the title using the \software{titling} package \cite{titling}.
%    \begin{macrocode}
\RequirePackage{titling}
%    \end{macrocode}
%
% \begin{macro}{\preprintfont}
% \begin{macro}{\titlefont}
% \begin{macro}{\subtitlefont}
% \begin{macro}{\authorfont}
% \begin{macro}{\affiliationfont}
% \begin{macro}{\datefont}
% Allow to change the fontface of the individual parts of the title.
%    \begin{macrocode}
\let\hep@preprint@font\relax
\newcommand{\preprintfont}[1]{\def\hep@preprint@font{#1}}
\let\hep@title@font\relax
\newcommand{\titlefont}[1]{\def\hep@title@font{#1}}
\let\hep@subtitle@font\relax
\newcommand{\subtitlefont}[1]{\def\hep@subtitle@font{#1}}
\let\hep@author@font\relax
\newcommand{\authorfont}[1]{\def\hep@author@font{#1}}
\let\hep@affiliation@font\relax
\newcommand{\affiliationfont}[1]{\def\hep@affiliation@font{#1}}
\let\hep@date@font\relax
\newcommand{\datefont}[1]{\def\hep@date@font{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subtitle}
% Define a subtitle.
%    \begin{macrocode}
\newcommand{\presubtitle}[1]{\def\hep@pre@sub@title{#1}}
\newcommand{\subtitle}[1]{\def\sub@title{#1}}
\newcommand{\postsubtitle}[1]{\def\hep@post@sub@title{#1}}
\renewcommand{\maketitlehookb}{%
  \@ifundefined{sub@title}{}{%
    \hep@pre@sub@title\sub@title\hep@post@sub@title%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% Set standard values mostly taken from the \software{titling} package, add the font hook, and reduce the |date| font size.
%    \begin{macrocode}
\titlefont{\ifhep@serif\tistyle\else\qtstyle\fi}
\pretitle{\begin{center}\LARGE\hep@title@font}
\posttitle{\par\end{center}}
\subtitlefont{\ifhep@serif\tistyle\else\qtstyle\fi}
\presubtitle{\begin{center}\Large\hep@subtitle@font}
\postsubtitle{\par\end{center}}
\preauthor{%
  \begin{center}\large\hep@author@font\lineskip.5em\begin{tabular}[t]{c}%
}
\postauthor{\end{tabular}\par\end{center}}
\predate{\begin{center}\hep@date@font}
\postdate{\par\end{center}}
%    \end{macrocode}
%
% \subsection{Authors}
%
% \begin{macro}{\author}
% Allow absent author field.
% Enable the handling of multiple authors with different affiliations using the \software{authblk} package \cite{authblk}.
%    \begin{macrocode}
\author{}
\RequirePackage{authblk}
\renewcommand{\Affilfont}{\small\hep@affiliation@font}
\renewcommand\Authfont{\hep@author@font}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\email}
% Redefine the email macro to place the email address in a footnote if called from within the |\author| macro |\author{|$\langle name\rangle$ |\email{|$\langle email\rangle$|}}|.
%    \begin{macrocode}
\let\hep@author\author
\def\author{%
  \renewcommand{\email}[1]{\unskip\thanks{\online{mailto:##1}{##1}}}%
  \hep@author
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\affiliation}
% Define the |\affiliation| macro, ensure that linebreaks happen after a comma.
%    \begin{macrocode}
\newcommand\hep@penalty{\if@twocolumn85\else50\fi}
\newcommand\hep@active@comma{,\penalty-\hep@penalty\relax}
\newcommand\hep@cat@comma@active{\catcode`\,\active}
{\hep@cat@comma@active\gdef,{\hep@active@comma}}
\newcommand\hep@affil[1]{%
  \endgroup\@flushglue=0pt plus .5\linewidth\affil{#1}%
}
\def\hep@affil@opt[#1]#2{%
  \endgroup\@flushglue=0pt plus .5\linewidth\affil[#1]{#2}%
}
\DeclareRobustCommand\hep@affiliation{%
  \@ifnextchar[{\hep@affil@opt}{\hep@affil}%
}
\newcommand{\affiliation}{%
  \begingroup\hep@cat@comma@active\hep@affiliation%
}
%    \end{macrocode}
% \end{macro}

% \subsection{Preprint}
%
% \begin{macro}{\preprint}
% Define the |\preprint| macro using the \software{varwidth} package \cite{varwidth}.
%    \begin{macrocode}
\let\hep@preprint\relax
\newcommand\preprint[1]{\def\hep@preprint{#1}}
\RequirePackage{varwidth}
\newcommand{\hep@preprint@box}{%
  \begin{varwidth}{\textwidth}%
    \smaller[.5]\hep@preprint@font\hep@preprint%
  \end{varwidth}%
}
\preprintfont{\scshape}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\placepreprint}
% Places a preprint number in the top right corner of the title page using the \software{atbegshi} \cite{atbegshi} and \software{picture} \cite{picture} packages.
%    \begin{macrocode}
\RequirePackage{atbegshi}
\RequirePackage{picture}
\newcommand{\placepreprint}{%
  \AtBeginShipoutFirst{%
    \put(
      \textwidth+\oddsidemargin-\widthof{\hep@preprint@box},
      -2pt-\topmargin-\heightof{\hep@preprint@box}
    ){\normalfont\hep@preprint@box}
  }
}
\renewcommand{\maketitlehooka}{\placepreprint\vspace{-\bigskipamount}}
%    \end{macrocode}
% \end{macro}

% \subsection{Abstract}
%
% \begin{environment}{abstract}
% Adjust the |abstract| environment to not start with indentation.
%    \begin{macrocode}
\@ifundefined{abstract}{}{%
  \let\hep@abstract\abstract%
  \renewcommand\abstract{\hep@abstract\noindent\ignorespaces}%
}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{abstract*}
% Add a |abstract*| environment for two column mode taking also care of placing the title using the \software{environ} \cite{environ} and \software{abstract} \cite{abstract} packages.
%    \begin{macrocode}
\if@twocolumn
  \RequirePackage{environ}
  \RequirePackage{abstract}
  \renewcommand{\abstitleskip}{-3ex}
  \NewEnviron{abstract*}{%
    \twocolumn[\maketitle\vspace{-1.5cm}%
    \begin{onecolabstract}\noindent\BODY\end{onecolabstract}%
    \vspace{.5cm}]\saythanks%
  }
\else
  \newenvironment{abstract*}{\maketitle\begin{abstract}}{\end{abstract}}
\fi
%    \end{macrocode}
% \end{environment}
% End of |title| conditional.
%    \begin{macrocode}
\fi
%    \end{macrocode}

% \section{Bibliography}
%
% Check if bibliography management is requested.
%    \begin{macrocode}
\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
%    \end{macrocode}
%
% \begin{macro}{\bibliography}
% Load the \software{biblatex} package \cite{biblatex} with the datamodel defined in \cref{sec:data model}.
%    \begin{macrocode}
\RequirePackage[style=\hep@bibliography, datamodel=hep-paper]{biblatex}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hep-paper}
% Provide the |\DeclareSortingTemplate| macro for older |biblatex| installations.
% Define a new sorting template that sorts only multi key |\cite| entries according to their date and leaves the rest of the bibliography entries in the order they appear in the text.
%    \begin{macrocode}
\providecommand{\DeclareSortingTemplate}{\DeclareSortingScheme}
\DeclareSortingTemplate{hep-paper}{
  \sort{\citeorder}
  \sort[final]{\field{sortkey}}
  \sort{\field{sortyear} \field{year} \literal{9999}}
  \sort{\field{month}}
  \sort{\field{eprint} \field{doi}}
  \sort{\field{sorttitle} \field{title}}
  \sort{\field{subtitle} \field{volume}}
}
%    \end{macrocode}
% \end{macro}
%
% Use the new sorting scheme and abbreviat all first names.
%    \begin{macrocode}
\ExecuteBibliographyOptions{
  sorting=hep-paper,
  safeinputenc,
  giveninits=true
}
%    \end{macrocode}
%
%
% Shrink the biblography in two column mode.
%    \begin{macrocode}
\ifhep@journal\else
  \if@twocolumn
    \AtBeginBibliography{\small}
    \setlength\biblabelsep{\labelsep}
  \fi
\fi
%    \end{macrocode}
%
% \begin{macro}{erratum}
% Add new bibliography string \enquote{Erratum} for the use in the |relatedtype| field.
%    \begin{macrocode}
\NewBibliographyString{erratum,erratums}
\DefineBibliographyStrings{english}{erratum={Erratum},erratums={Errata}}
\providecommand{\relateddelimerratum}{\addsemicolon\space}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\printbibliography}
% Allow the bibliography to be printed sloppy
%    \begin{macrocode}
\let\hep@printbibliography\printbibliography
\renewcommand{\printbibliography}{\sloppy\hep@printbibliography}
%    \end{macrocode}
% \end{macro}

% \subsection{Sourcemap}
%
% \begin{macro}{\reg@exp@one}
% \begin{macro}{\reg@exp@two}
% \begin{macro}{\reg@exp@url}
% \begin{macro}{\reg@exp@pmc}
% Define regular expressions in order to deal with inconsistent journal title and volume naming as well as \URL protocols and the PMCID.
%    \begin{macrocode}
\newcommand{\reg@exp@one}{\regexp{\A(\p{L}+)?\d+(\p{L}+)?\Z}}
\newcommand{\reg@exp@two}{\regexp{\A(\p{L}+)?(\d+)(\p{L}+)?\Z}}
\newcommand{\reg@exp@url}{\regexp{\A(ht|f)tp(s)?:\/\/}}
\newcommand{\reg@exp@pmc}{\regexp{\A(PMC)?}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DeclareSourcemap}
% Use the |\DeclareSourcemap| feature.
%    \begin{macrocode}
\DeclareSourcemap{%
  \maps[datatype=bibtex, overwrite=true]{%
%    \end{macrocode}
% \begin{macro}{collaboration}
% Read the collaboration information if present.
%    \begin{macrocode}
    \map{%
      \step[fieldsource=Collaboration, final=true]%
      \step[fieldset=collaboration, origfieldval, final=true]
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{reportnumber}
% Read the pre-print information if present.
%    \begin{macrocode}
    \map{%
      \step[fieldsource=reportNumber, final=true]%
      \step[fieldset=reportnumber, origfieldval, final=true]
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{journal}
% Move letters from the volume field to the journal field.
%    \begin{macrocode}
    \map[overwrite]{
      \step[fieldsource=volume, match=\reg@exp@one, final]
      \step[fieldsource=volume, match=\reg@exp@two, replace={$2}]
      \step[fieldsource=journal, fieldtarget=journaltitle]
      \step[fieldset=journaltitle, fieldvalue={\space$1$2}, append=true]
    }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{url}
% Remove the protocol from \URL.
%    \begin{macrocode}
    \map{
      \step[fieldsource=url, final=true]
      \step[fieldset=protocollessurl, origfieldval, final=true]
      \step[fieldsource=protocollessurl, match=\reg@exp@url, replace={}]
    }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{pmc}
% Remove the PMC from the PMCID.
%    \begin{macrocode}
    \map{
      \step[fieldsource=pmcid, final=true]
      \step[fieldset=pmc, origfieldval, final=true]
      \step[fieldsource=pmc, match=\reg@exp@pmc, replace={}]
    }
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\letbibmacro}
% Provide the |\letbibmacro| macro for old |biblatex| installations.
%    \begin{macrocode}
\providecommand{\letbibmacro}[2]{\csletcs{abx@macro@#1}{abx@macro@#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{collaboration}
% Execute the author macro even if only the collaboration information if present and override the author information with collaboration information if present.
%    \begin{macrocode}
\renewbibmacro*{author/translator+others}{%
  \ifboolexpr{
    test \ifuseauthor and (
      not test {\ifnameundef{author}} or
      not test {\iffieldundef{collaboration}}
    )
  }
  {\usebibmacro{author}}
  {\usebibmacro{translator+others}}
}
\letbibmacro{hep@bib@author}{author}
\renewbibmacro*{author}{%
  \iffieldundef{collaboration}{%
    \usebibmacro{hep@bib@author}}{\textit{\printfield{collaboration}}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{In:}
% Remove spurious \enquote{In:} if no journal is present.
%    \begin{macrocode}
\renewbibmacro*{in:}{%
  \iffieldundef{journaltitle}{}{\printtext{\bibstring{in}\intitlepunct}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{url}
% Show \URLs without the protocol.
%    \begin{macrocode}
\DeclareFieldFormat{url}{%
  \mkbibacro{URL}\addcolon\space\online{#1}{\thefield{protocollessurl}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bib@online}
% Private |\bib@online| macro
%    \begin{macrocode}
\newcommand{\bib@online}[2]{%
  \ifhyperref{\online{#1}{#2}}{\nolinkurl{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{pmid}
% \begin{macro}{pmcid}
% Present PubMed IDs.
%    \begin{macrocode}
\DeclareFieldFormat{pmid}{%
  \mkbibacro{PM}\addcolon\space%
  \bib@online{https://www.ncbi.nlm.nih.gov/pubmed/#1}{#1}%
}
\DeclareFieldFormat{pmc}{%
  \mkbibacro{PMC}\addcolon\space%
  \bib@online{https://www.ncbi.nlm.nih.gov/pmc/articles/PMC#1}{#1}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{pmcid}
% \begin{macro}{pmid}
% \begin{macro}{reportnumber}
% Add the pre-print and PubMed information if present.
%    \begin{macrocode}
\letbibmacro{hep-doi+eprint+url}{doi+eprint+url}
\renewbibmacro*{doi+eprint+url}{%
  \usebibmacro{hep-doi+eprint+url}
  \iffieldundef{pmc}{%
    \iffieldundef{pmid}{}{\printfield{pmid}\newunit}%
  }{\printfield{pmc}\newunit}
  \iffieldundef{reportnumber}{}{%
    \newunitpunct\textnumero\intitlepunct%
    \textsc{\smaller[.5]\printfield{reportnumber}}%
    \newunit%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}

% \subsection{Eprints}
%
% \begin{macro}{\new@eprint}
% Private |\new@eprint| macro
%    \begin{macrocode}
\NewDocumentCommand{\new@eprint}{smm}{
  \DeclareFieldFormat{eprint:#2}{%
    \newcommand{\@path}{\IfBooleanT{#1}{\thefield{eprintclass}/}##1}%
    #2\addcolon\space\bib@online{#3/\@path}{\@path}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CTAN}
% Add CTAN as a eprint option
%    \begin{macrocode}
\new@eprint{CTAN}{https://ctan.org/pkg}
\DeclareFieldAlias{eprint:ctan}{eprint:CTAN}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GitHub}
% Add GitHub as a eprint option
%    \begin{macrocode}
\new@eprint*{GitHub}{https://github.com}
\DeclareFieldAlias{eprint:github}{eprint:GitHub}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GitLab}
% Add GitLab as a eprint option
%    \begin{macrocode}
\new@eprint*{GitLab}{https://gitlab.com}
\DeclareFieldAlias{eprint:gitlab}{eprint:GitLab}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Bitbucket}
% Add Bitbucket as a eprint option
%    \begin{macrocode}
\new@eprint*{Bitbucket}{https://bitbucket.org}
\DeclareFieldAlias{eprint:bitbucket}{eprint:Bitbucket}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Launchpad}
% Add Launchpad as a eprint option
%    \begin{macrocode}
\new@eprint{Launchpad}{https://launchpad.net}
\DeclareFieldAlias{eprint:launchpad}{eprint:Launchpad}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{SourceForge}
% Add SourceForge as a eprint option
%    \begin{macrocode}
\new@eprint{SourceForge}{https://sourceforge.net/projects}
\DeclareFieldAlias{eprint:launchpad}{eprint:SourceForge}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{HEPForge}
% Add HEPForge as a eprint option
%    \begin{macrocode}
\DeclareFieldFormat{eprint:hepforge}{%
  HEPForge\addcolon\space\bib@online{https://#1/hepforge.org}{#1}%
}
\DeclareFieldAlias{eprint:HEPForge}{eprint:hepforge}
%    \end{macrocode}
% \end{macro}
%
%
% End check for bibliography option.
%    \begin{macrocode}
\fi
%    \end{macrocode}

% \section{Hyperlinks, Footnotes and References} \label{sec:hyperlinks}
%
% Load the \software{hyperref} package \cite{hyperref} enable Unicode encoding and hide links.
%
%    \begin{macrocode}
\RequirePackage{hyperref}
\hypersetup{
  pdfencoding=auto, psdextra,
  hidelinks, linktoc=all, breaklinks=true,
  pdfcreator={}, pdfproducer={}
}
%    \end{macrocode}
% Set the \PDF meta data according to the paper information and ensure that unnecessary information is suppressed.
%
%    \begin{macrocode}
\pdfstringdefDisableCommands{\def\varepsilon{\textepsilon}}
\AtBeginDocument{
  \pdfstringdefDisableCommands{\let\ensuremath\@gobble}
  \pdfstringdefDisableCommands{\let\mathsurround\@gobble}
  \pdfstringdefDisableCommands{\let\unskip\@gobble}
  \pdfstringdefDisableCommands{\let\thanks\@gobble}
  \pdfstringdefDisableCommands{\let\footnote\@gobble}
  \pdfstringdefDisableCommands{\let\\\@gobble}
}
\ifhep@revtex
  \AtBeginShipout{\hypersetup{pdftitle={\@title}}}
\else
  \ifhep@beamer\else
    \AtBeginDocument{\hypersetup{pdftitle={\@title}}}
  \fi
\fi
\ifhep@title
  \AtBeginDocument{\hypersetup{pdfauthor=\AB@authlist}}
\else
  \ifhep@beamer\else
    \AtBeginDocument{\hypersetup{pdfauthor={\@author}}}
  \fi
\fi
%    \end{macrocode}

% \subsection{Footnotes}
%
% Place a hyperlink from the footnote back to its referencing label using the \software{footnotebackref} package \cite{footnotebackref}.
%    \begin{macrocode}
\def\BackrefFootnoteTag{}
\RequirePackage{footnotebackref}
%    \end{macrocode}
%
% \begin{macro}{\footnote}
% Ensure that no spaces appear before the footmark or at the beginning of the footnote.
%    \begin{macrocode}
\let\@foot@note\footnote
\renewcommand{\footnote}[1]{\unskip\@foot@note{\ignorespaces#1}}
%    \end{macrocode}
% \end{macro}

% \subsection{References}
%
% Begin of |references| conditional
%    \begin{macrocode}
\ifhep@references
%    \end{macrocode}
%
% \begin{macro}{\cref}
% Improve reference using the \software{cleveref} package \cite{cleveref}.
%
%    \begin{macrocode}
\RequirePackage[noabbrev, nameinlink]{cleveref}
\newcommand{\creflastconjunction}{, and\nobreakspace}
\crefname{enumi}{point}{points}
\crefname{inlinelisti}{point}{points}
%    \end{macrocode}
% \end{macro}
%
%\begin{macro}{\no@break@before}
% Define a macro able to prevent line breaks.
%    \begin{macrocode}
\newcommand\no@break@before{%
  \relax\ifvmode\else%
    \ifhmode%
      \ifdim\lastskip > 0pt%
        \relax\unskip\nobreakspace%
      \fi%
    \fi%
  \fi%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ref}
% Adjust |\ref|\marg{key} in order to prevent preceding line breaks.
%    \begin{macrocode}
\let\hep@ref\ref
\AtBeginDocument{\renewcommand\ref{\no@break@before\hep@ref}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eqref}
% Adjust |\eqref|\marg{key} in order to prevent preceding line breaks.
%    \begin{macrocode}
\renewcommand\eqref{\no@break@before\labelcref}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subref}
% Adjust |\subref|\marg{key} in order to prevent preceding line breaks.
%    \begin{macrocode}
\let\hep@subref\subref
\renewcommand\subref{\no@break@before\hep@subref}
\renewcommand*\subcaption@ref[2]{\begingroup%
  \caption@setoptions{sub}%
  \subcaption@reffmt\p@subref{\hep@ref#1{sub@#2}}%
\endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subcref}
% Provide the |\subcref| macro.
%    \begin{macrocode}
\newcommand{\subcref}[1]{\cref{sub@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eqcrefname}
% Define the |\eqcrefname| macro for named equation types.
%    \begin{macrocode}
\NewDocumentCommand{\eqcrefname}{mmo}{
  \crefname{#1}{#2}{\IfValueTF{#3}{#3}{#2s}}
  \creflabelformat{#1}{(##2##1##3)}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\labelcrefrange}
% Define the missing |\labelcrefrange|\marg{key1}\marg{key2} macro.
%    \begin{macrocode}
\DeclareRobustCommand{\labelcrefrange}[2]{%
  \@crefrangenostar{labelcref}{#1}{#2}%
}
%    \end{macrocode}
% \end{macro}
%
% End of |references| conditional
%    \begin{macrocode}
\fi
%    \end{macrocode}

% \subsection{Citations}
%
% \begin{macro}{\cite}
% Adjust |\cite|\marg{key} in order to prevent preceding line breaks.
%    \begin{macrocode}
\let\hep@cite\cite
\renewcommand\cite{\no@break@before\hep@cite}
%    \end{macrocode}
% \end{macro}
%
% Begin of bibliography if.
%    \begin{macrocode}
\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
%    \end{macrocode}
% Define bibstrings for reference names.
%    \begin{macrocode}
\NewBibliographyString{refname}
\NewBibliographyString{refsname}
\DefineBibliographyStrings{english}{%
  refname = {reference},
  refsname = {references}
}
%    \end{macrocode}
% \begin{macro}{\ccite}
% \begin{macro}{\Ccite}
% Define \emph{clever} citation macros.
% \begin{macrocode}
\DeclareCiteCommand{\ccite}{%
  \ifnum\thecitetotal=1
    \bibstring{refname}%
  \else%
    \bibstring{refsname}%
  \fi%
  \addnbspace\bibopenbracket%
  \usebibmacro{cite:init}\usebibmacro{prenote}%
}{\usebibmacro{citeindex}\usebibmacro{cite:comp}}{}{%
  \usebibmacro{cite:dump}\usebibmacro{postnote}%
  \bibclosebracket%
}

\newrobustcmd*{\Ccite}{\bibsentence\ccite}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% End of biblatex if.
%    \begin{macrocode}
\fi
%    \end{macrocode}

% \section{Acronyms}
%
% Acronyms are implemented with the \software{glossaries-extra} package \cite{glossaries-extra} which is an extension of the \software{glossaries} package \cite{glossaries} and must be loaded after the \software{hyperref} pacakge in \cref{sec:hyperlinks}.
%    \begin{macrocode}
\ifhep@glossaries
\RequirePackage[nostyles]{glossaries-extra}
%    \end{macrocode}
% The entry count feature is used.
%    \begin{macrocode}
\glsenableentrycount
\glssetcategoryattribute{abbreviation}{entrycount}{1}
%    \end{macrocode}
% Provide macros for older |glossaries-extra| installations.
%    \begin{macrocode}
\providecommand{\glsxtrusefield}[2]{\@gls@entry@field{#1}{#2}}
\providecommand{\glsxtrsetfieldifexists}[3]{\glsdoifexists{#1}{#3}}
\providecommand{\gGlsXtrSetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}{%
    \csgdef{glo@\glsdetoklabel{#1}@#2}{#3}%
  }%
}
%    \end{macrocode}
% Hyperlinks from the abbreviation to their definition in the text are set.
%    \begin{macrocode}
\glssetcategoryattribute{abbreviation}{nohyperfirst}{true}
\renewcommand*{\glsdonohyperlink}[2]{{%
  \glsxtrprotectlinks\edef\fieldvalue{%
    \glsxtrusefield{\glslabel}{hastarget}%
  }%
  \ifdefstring\fieldvalue{true}{#2}{%
    \gGlsXtrSetField{\glslabel}{hastarget}{true}%
    \glsdohypertarget{#1}{#2}%
  }%
}}
%    \end{macrocode}
%
% \begin{macro}{\begin@sentence}
% Mark the beginning of a paragraph as if it would follow a full stop using the \software{everyhook} package \cite{everyhook}.
%    \begin{macrocode}
\RequirePackage[excludeor]{everyhook}
\newcommand{\begin@sentence}{1001}
\PushPostHook{par}{{\spacefactor=\begin@sentence}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\frenchspacing}
% Adjust the |\frenchspacing| macro to be compatibel with this idea.
%    \begin{macrocode}
\def\frenchspacing{%
  \sfcode`\.\begin@sentence \sfcode`\?\begin@sentence
  \sfcode`\!\begin@sentence \sfcode`\:\begin@sentence
  \sfcode`\;\@m \sfcode`\,\@m
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@begin@of@sentence}
% Provide a macro checking for the beginning of a sentence by examining the length of the preceeding space.
%    \begin{macrocode}
\newcommand{\if@begin@of@sentence}[2]{\leavevmode\protecting{%
  \ifboolexpr{ test {\ifnumcomp{\spacefactor}{=}{3000}} or%
               test {\ifnumcomp{\spacefactor}{=}{2000}} or%
               test {\ifnumcomp{\spacefactor}{=}{\begin@sentence}}%
  }{#1}{#2}%
}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\acronym}
% The |\acronym|\meta{*}\oarg{typeset abbreviation}\marg{abbreviation}\meta{*}\marg{definition}\oarg{plural\linebreak[4] definition} macro is defined.
% \begin{enumerate}[nosep, label=\#\arabic*]
% \item star for omitting the \enquote{s} in the short plural
% \item optional typeset abbreviation
% \item mandatory abbreviation
% \item star for restoring the \hologo{TeX} default for space after text macros
% \item mandatory long form
% \item optional plural long form
% \end{enumerate}
%    \begin{macrocode}
\NewDocumentCommand{\acronym}{somsmo}{
  \newabbreviation[
    type=\acronymtype,
    sort=#3,
    \glsshortpluralkey=\IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}},
    longplural=\IfNoValueTF{#6}{#5s}{#6}
  ]{#3}{\IfNoValueTF{#2}{#3}{#2}}{#5}
%    \end{macrocode}
% Provide the singular acronym macro.
%    \begin{macrocode}
  \expandafter\newcommand\csname#3\endcsname{%
    \if@begin@of@sentence{%
      \ifglsused{#3}{\cgls{#3}}{\cGls{#3}}%
    }{\cgls{#3}}%
    \ifnum\glsentrycurrcount{#3}>1\relax
      \IfBooleanTF{#4}{}{\@\xspace}%
    \else\@\xspace\fi
  }
%    \end{macrocode}
% Expand the singular acronym macro in \PDF labels.
%    \begin{macrocode}
  \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{%
    \IfNoValueTF{#2}{#3}{#2} }%
  }
%    \end{macrocode}
% Provide the singular acronym macro in math mode.
%    \begin{macrocode}
  \expandafter\mathdef\csname#3\endcsname{%
    \text{\glsxtrshort{#3}}\@gls@increment@currcount{#3}%
  }
%    \end{macrocode}
% Provide the plural acronym macro.
%    \begin{macrocode}
  \expandafter\newcommand\csname#3s\endcsname{%
    \if@begin@of@sentence{\cGlspl{#3}}{\cglspl{#3}}%
    \IfBooleanTF{#4}{}{\@\xspace}%
  }
%    \end{macrocode}
% Expand the plural acronym macro in \PDF labels.
%    \begin{macrocode}
  \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
    \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}} }%
  }
%    \end{macrocode}
% Provide the plural acronym macro in math mode.
%    \begin{macrocode}
  \expandafter\mathdef\csname#3s\endcsname{%
    \text{\glsxtrshortpl{#3}}\@gls@increment@currcount{#3}%
  }
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\shortacronym}
% The |\shortacronym| never expands into the long form.
%    \begin{macrocode}
\NewDocumentCommand{\shortacronym}{somsmo}{
%    \end{macrocode}
% Provide the singular acronym macro.
%    \begin{macrocode}
  \expandafter\newcommand\csname#3\endcsname{%
    \IfNoValueTF{#2}{#3}{#2}\IfBooleanTF{#4}{}{\@\xspace}%
  }
%    \end{macrocode}
% Expand the singular acronym macro in \PDF labels.
%    \begin{macrocode}
  \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{%
    \IfNoValueTF{#2}{#3}{#2} }%
  }
%    \end{macrocode}
% Provide the singular acronym macro in math mode.
%    \begin{macrocode}
  \expandafter\mathdef\csname#3\endcsname{%
    \text{\IfNoValueTF{#2}{#3}{#2}}%
  }
%    \end{macrocode}
% Provide the plural acronym macro.
%    \begin{macrocode}
  \expandafter\newcommand\csname#3s\endcsname{%
    \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}}%
    \IfBooleanTF{#4}{}{\@\xspace}%
  }
%    \end{macrocode}
% Expand the plural acronym macro in \PDF labels.
%    \begin{macrocode}
  \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
    \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}} }%
  }
%    \end{macrocode}
% Provide the plural acronym macro in math mode.
%    \begin{macrocode}
  \expandafter\mathdef\csname#3s\endcsname{%
    \text{\IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}}}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\longacronym}
% The |\longacronym| never shows the abbreviated form.
%    \begin{macrocode}
\NewDocumentCommand{\longacronym}{somsmo}{
%    \end{macrocode}
% Provide the singular acronym macro.
%    \begin{macrocode}
  \expandafter\newcommand\csname#3\endcsname{%
    \if@begin@of@sentence{\MakeUppercase#5}{#5}%
    \IfBooleanTF{#4}{}{\@\xspace}%
  }
%    \end{macrocode}
% Expand the singular acronym macro in \PDF labels.
%    \begin{macrocode}
  \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{#5 }}
%    \end{macrocode}
% Provide the plural acronym macro.
%    \begin{macrocode}
  \expandafter\newcommand\csname#3s\endcsname{%
    \if@begin@of@sentence{%
      \IfNoValueTF{#6}{\MakeUppercase#5s}{\MakeUppercase#6}%
    }{%
      \IfNoValueTF{#6}{#5s}{#6}}\IfBooleanTF{#4}{}{\@\xspace}%
  }
%    \end{macrocode}
% Expand the plural acronym macro in \PDF labels.
%    \begin{macrocode}
  \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
    \IfNoValueTF{#6}{#5s}{#6} }%
  }
}
%    \end{macrocode}
% \end{macro}
% Silence warning if no acronyms are defined.
%    \begin{macrocode}
\renewcommand*{\@gls@write@entrycounts}{%
  \immediate\write\@auxout{%
    \string\providecommand*{\string\@gls@entry@count}[2]{}
  }%
  \count@=0\relax
  \forallglsentries{\@glsentry}{%
    \glshasattribute{\@glsentry}{entrycount}{%
      \ifglsused{\@glsentry}{%
        \immediate\write\@auxout{%
          \string\@gls@entry@count{\@glsentry}{%
            \glsentrycurrcount{\@glsentry}%
          }
        }%
      }{}\advance\count@ by \@ne
    }{}%
  }%
}
%    \end{macrocode}
% \begin{macro}{\resetacronym}
% \begin{macro}{\dummyacronym}
% Add two macros for acronym management.
%    \begin{macrocode}
\newcommand{\resetacronym}[1]{\protect\glsreset{#1}}
\newcommand{\dummyacronym}[1]{\protect\glsunset{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{abstract}
% Adjust the |abstract| environment to reset all acronym counters.
%    \begin{macrocode}
\@ifundefined{endabstract}{}{%
  \let\end@hep@abstract\endabstract%
  \renewcommand\endabstract{\glsresetall\end@hep@abstract}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tableofcontents}
% \begin{macro}{\listoffigures}
% \begin{macro}{\listoftables}
% Adjust the |\tableofcontents| macro to never show the long form of acronyms.
%    \begin{macrocode}
\let\hep@table@of@contents\tableofcontents
\renewcommand\tableofcontents{%
  \glsunsetall\hep@table@of@contents\glsresetall%
}
\let\hep@list@of@figures\listoffigures
\renewcommand\listoffigures{%
  \glsunsetall\hep@list@of@figures\glsresetall%
}
\let\hep@list@of@tables\listoftables
\renewcommand\listoftables{%
  \glsunsetall\hep@list@of@tables\glsresetall%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\acronyms}
% Add a possibility to have different groups of acronyms.
%    \begin{macrocode}
\NewDocumentCommand{\acronyms}{om}{%
  \IfNoValueTF{#1}{
    \newglossary{#2}{#2.in}{#2.out}{#2}%
    \renewcommand{\acronymtype}{#2}%
  }{
    \newglossary{#1}{#1.in}{#1.out}{#2}%
    \renewcommand{\acronymtype}{#1}%
  }
}
%    \end{macrocode}
% \end{macro}
%
% End of glossaries if.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \ifshort
%</package>
%<*datamodel>
% \fi
%
% \section{Biblatex datamodel file} \label{sec:data model}
%
% \begin{macro}{collaboration}
% \begin{macro}{reportnumber}
% \begin{macro}{pmid}
% \begin{macro}{pmcid}
% \begin{macro}{pmc}
% \begin{macro}{protocollessurl}
% Define the |dbx| file containing the |hep-paper| datamodel.
%    \begin{macrocode}
\DeclareDatamodelFields[type=field, datatype=literal]{
  collaboration, reportnumber, pmid, pmcid, pmc,
}
\DeclareDatamodelFields[type=field, datatype=uri]{protocollessurl}
\DeclareDatamodelEntryfields{
  collaboration, reportnumber, pmid, pmcid, pmc, protocollessurl,
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \ifshort
%</datamodel>
% \fi
%
% \Finale

\endinput

% \PrintIndex
% makeindex -s gglo.ist -o hep-paper-implementation.gls hep-paper-implementation.glo
% makeindex -s gglo.ist -o hep-paper-implementation.ind hep-paper-implementation.idx

% \begin{macro}{\refstepcounter@...}
% Adjust the |cleveref| |\refstepcounter@noarg| and |\refstepcounter@optarg| to use the |\@currentlabel| in order to fix problems with |\subref|.
%    \begin{macrocode}
% \def\refstepcounter@noarg#1{%
%   \cref@old@refstepcounter{#1}%
%   \cref@constructprefix{#1}{\cref@result}%
%   \@ifundefined{cref@#1@alias}%
%     {\def\@tempa{#1}}%
%     {\def\@tempa{\csname cref@#1@alias\endcsname}}%
%   \protected@edef\cref@currentlabel{%
%     [\@tempa][\arabic{#1}][\cref@result]%
%     \noexpand\@currentlabel%
%   }% changed
% }
%
% \def\refstepcounter@optarg[#1]#2{%
%   \cref@old@refstepcounter{#2}%
%   \cref@constructprefix{#2}{\cref@result}%
%   \@ifundefined{cref@#1@alias}%
%     {\def\@tempa{#1}}%
%     {\def\@tempa{\csname cref@#1@alias\endcsname}}%
%   \protected@edef\cref@currentlabel{%
%     [\@tempa][\arabic{#2}][\cref@result]%
%     \noexpand\@currentlabel% changed
%   }%
% }
% %    \end{macrocode}
% % \end{macro}
%
%
% \usepackage{contour}
% \renewcommand{\ULdepth}{1.8pt}
% \contourlength{0.8pt}
% \newcommand{\myuline}[1]{%
%   \uline{\phantom{#1}}\llap{\contour{white}{#1}}%
% }

% \begin{macro}{\mathpzc}
% Define the |\mathpzc| math script font based on the Zapf Chancery PostScript font.
%    \begin{macrocode}
% \DeclareFontFamily{OT1}{pzc}{}
% \DeclareFontShape{OT1}{pzc}{m}{it}{<-> s * [1.15] pzcmi7t}{}
% \DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
%    \end{macrocode}
% \end{macro}