summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/apa7/apa7.dtx
blob: 31ec9cb98ba53a6953f6899364d2db46ab3cf42d (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
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
% \iffalse meta-comment
% !TEX program  = pdfLaTeX
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                           %
%    CHANGE THESE VALUES WITH EACH NEW RELEASE:                             %
%                                                                           %
%<class>\ProvidesClass{apa7}[2020/10/11 v2.04 APA formatting (7th edition)]
%                                                                           %
%<*internal>                                                                %
\def\apaSevenVersionDate{2020/10/11}
\def\apaSevenVersionNumber{2.04}
%                                                                           %
%                                                                           %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse
%</internal>
%<*readme>
----------------------------------------------------------------------

apa7 - A LaTeX class for formatting documents in compliance with the
American Psychological Association's Publication Manual, 7th edition

Copyright (C) 2020 by Daniel A. Weiss <daniel.weiss.led at gmail.com>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

Users may freely modify these files without permission, as long as the
copyright line and this statement are maintained intact.

This work is not endorsed by, affiliated with, or probably even known
by, the American Psychological Association.

----------------------------------------------------------------------

The Publication Manual of the American Psychological Association is
widely used in the social sciences.  The most recent update, in 2019,
altered the formatting guidelines and therefore rendered existing
formatting solutions inadequate.  The apa7 class is an update of
older code from the apa6 class (available from CTAN).  The student 
manuscript type has been added. See the documentation for details.
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
----------------------------------------------------------------------

apa7 - A LaTeX class for formatting documents in compliance with the
American Psychological Association's Publication Manual, 7th edition

Copyright (C) 2020 by Daniel A. Weiss <daniel.weiss.led at gmail.com>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

Users may freely modify these files without permission, as long as the
copyright line and this statement are maintained intact.

This work is not endorsed by, affiliated with, or probably even known
by, the American Psychological Association.

----------------------------------------------------------------------

\endpreamble
\postamble

Copyright (C) 2020 by Daniel A. Weiss <daniel.weiss.led at gmail.com>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

Users may freely modify these files without permission, as long as the
copyright line and this statement are maintained intact.

This work is not endorsed by, affiliated with, or probably even known
by, the American Psychological Association.


This work is "maintained" (as per LPPL maintenance status) by
Daniel A. Weiss.

This work consists of the file  apa7.dtx
and the derived files           apa7.ins,
                                apa7.cls,
                                apa7.pdf,
                                README,
                                APA7american.txt,
                                APA7british.txt,
                                APA7dutch.txt,
                                APA7english.txt,
                                APA7french.txt,
                                APA7german.txt,
                                APA7ngerman.txt,
                                APA7greek.txt,
                                APA7czech.txt,
                                APA7turkish.txt,
                                APA7endfloat.cfg,
                                Figure1.pdf,
                                shortsample.tex,
                                longsample.tex, and
                                bibliography.bib.

\endpostamble
\usedir{tex/latex/apa7}
\generate{
  \file{\jobname.cls}{\from{\jobname.dtx}{class}}
}
\usedir{tex/latex/apa7/config}
\generate{
  \file{./config/APA7american.txt}{\from{\jobname.dtx}{american}}
  \file{./config/APA7british.txt}{\from{\jobname.dtx}{british}}
  \file{./config/APA7dutch.txt}{\from{\jobname.dtx}{dutch}}
  \file{./config/APA7english.txt}{\from{\jobname.dtx}{english}}
  \file{./config/APA7french.txt}{\from{\jobname.dtx}{french}}
  \file{./config/APA7german.txt}{\from{\jobname.dtx}{german}}
  \file{./config/APA7ngerman.txt}{\from{\jobname.dtx}{ngerman}}
  \file{./config/APA7greek.txt}{\from{\jobname.dtx}{greek}}
  \file{./config/APA7czech.txt}{\from{\jobname.dtx}{czech}}
  \file{./config/APA7turkish.txt}{\from{\jobname.dtx}{turkish}}
  \file{./config/APA7endfloat.cfg}{\from{\jobname.dtx}{APAendfloat}}
}
\usedir{tex/latex/apa7/samples}
\generate{
  \file{./samples/bibliography.bib}{\from{\jobname.dtx}{bibliography}}
  \file{./samples/shortsample.tex}{\from{\jobname.dtx}{shortsample}}
  \file{./samples/longsample.tex}{\from{\jobname.dtx}{longsample}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/apa7}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/apa7}
\generate{
  \file{README.txt}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%<class>\NeedsTeXFormat{LaTeX2e}
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\RequirePackage{scalerel,tikz} % this is included for ORCID icon
\usetikzlibrary{svg.path}
\definecolor{orcidlogocol}{HTML}{A6CE39}
\tikzset{
  orcidlogo/.pic={
    \fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z};
    \fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z}
                 svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z}
                 svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z};
  }
}
\newcommand{\addORCIDlink}[2]{#1 \href{https://orcid.org/#2}{{\mbox{\scalerel*{
\begin{tikzpicture}[yscale=-1,transform shape]
\pic{orcidlogo};
\end{tikzpicture}
}{|}}} https://orcid.org/#2}}

\usepackage{hyperref}
\hypersetup{%
   colorlinks,
   linkcolor=blue,
   citecolor=blue,
   urlcolor=black,
   pdfauthor   = {Daniel A. Weiss <daniel.weiss.led@gmail.com>},
   pdftitle    = {The apa7 class},
   pdfsubject  = {Documentation of LaTeX class apa7},
   pdfkeywords = {LaTeX, APA}
}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{verbatimbox}
\EnableCrossrefs
\CodelineIndex
\OnlyDescription  % don't publish the full code in the PDF documentation file
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
%\DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
%\DoNotIndex{\@ne}
%\DoNotIndex{\advance,\begingroup,\catcode,\closein}
%\DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
%\DoNotIndex{\newcommand,\renewcommand}
%
%
% \title{^^A
%     Formatting documents in APA style (7th Edition)\\^^A
%     with the \textsf{apa7} \LaTeX\ class^^A
%     \thanks{This file describes version ^^A
%     \apaSevenVersionNumber, last revised \apaSevenVersionDate.}^^A
% }
% \author{Daniel A. Weiss\thanks{E-mail: daniel.weiss.led@gmail.com}}
% \date{Released \apaSevenVersionDate}
%
% \maketitle
%
% \changes{v1.00}{2019/12/26}{Initial release}
%
% \changes{v1.01}{2019/12/29}{Corrected figure caption styles for doc format.}
% \changes{v1.01}{2019/12/29}{Clarified that apacite and natbib are in 6th edition style.}
%
% \changes{v1.02}{2019/12/29}{Fixed filename issue with language localization files.}
%
% \changes{v1.03}{2019/12/29}{Updated class to detect babel package in document and localize accordingly.}
%
% \changes{v1.04}{2019/12/30}{Added table of contents. Updated documentation and added correct license statement to cls for apa6 package.}
%
% \changes{v1.05}{2020/03/27}{Fixed float placement at end for man and stu mode to ensure one correctly placed figure/table per page. Thanks WC.}
%
% \changes{v1.06}{2020/05/04}{Added figurenote command.}
%
% \changes{v1.07}{2020/05/10}{Fixed bug in figurenote command. Fixed figure title formatting in doc mode. Thanks RH.}
%
% \changes{v1.08}{2020/05/27}{Added support for optional running head (shorttitle) in stu mode.}
%
% \changes{v1.09}{2020/06/19}{Fixed note command (will no longer print "Author Note" header).}
%
% \changes{v2.01}{2020/07/18}{Re-wrote author and affiliation to be APA7 compliant. Fixed spacing on Title Page for title and author. }
%
% \changes{v2.02}{2020/08/02}{Added the "and" in multiple author list to translation files. }
%
% \changes{v2.03}{2020/08/12}{Added French localization. }
%
% \changes{v2.04}{2020/10/11}{Updated ORCID link style for jou mode. }
%
% \begin{abstract}
%   The \textit{Publication Manual} of the American Psychological
%   Association is widely used in the social sciences.  The most
%   recent update, in 2019, altered the formatting guidelines and
%   therefore rendered existing formatting solutions inadequate.  The
%   \textsf{apa7} class is an update of older code from the
%   \textsf{apa6} class.  The student manuscript type has been added.
% \end{abstract}
%
% \tableofcontents
%
% \section{Background}
% Most journals in the social sciences require manuscripts to be
% formatted in compliance with the American Psychological
% Association's \textit{Publication Manual}, which is updated
% periodically.  The 7th Edition, released in 2019, substantially
% changed the guidelines for formatting manuscripts; these
% modifications rendered existing formatting solutions (e.g., the
% \textsf{apa6} \LaTeX\ class) inadequate for venues in which 7th
% Edition guidelines are being enforced.  The \textsf{apa7} class
% solves this problem, and provides some new functionality not offered
% by the \textsf{apa6} class.
%
% \section{Disclaimer}
% Great care has been taken to ensure the closest possible match
% between APA requirements and the output of this class.  However, it
% is the sole responsibility of the user to ensure compliance with
% specific journal submission requirements!
%
% \section{\textsf{apa7} Version 2.01 Changes to Authors and Affiliations}
% The way that authors and affiliations work has been changed in 
% version 2.01 to be APA 7th edition compliant. 
% This change will require updating any multiple author and/or 
% multiple affiliation documents to use the new |\authorsnames| and
% |\authorsaffiliations| commands (See Section~\ref{sec:authorsaffiliations}).
%
% \section{Usage}
% \label{sec:usage}
%
% \subsection{Class Options}
% \label{sec:classoptions}
% When loading \textsf{apa7} with
% |\documentclass|\oarg{options}|{apa7}|, the following options are
% available.
%
% \vspace{1em}
% \textbf{Document mode:} Four choices are available.
% \begin{itemize}
% \item \DescribeMacro{jou}|jou| (default): Formats the document with an
%   appearance resembling a printed APA journal (e.g., \textit{Journal
%   of Educational Psychology}.  The text is typeset in two-sided,
%   two-column format.
% \item \DescribeMacro{man}|man|: Formats the document in close (if
%   not complete) compliance with the requirements for submission to
%   an APA journal (e.g., title page, double-spacing, etc.).
% \item \DescribeMacro{stu}|stu|: Formats the document in close (if
%   not complete) compliance with the requirements for student paper
%  (e.g., title page, double-spacing, etc.).
% \item \DescribeMacro{doc}|doc|: Formats the document as a typical
%   \LaTeX\ document (one-sided, single-column, etc.)
% \end{itemize}
%
% \textbf{Other class options:}
% \begin{itemize}
% \item \DescribeMacro{10pt}|10pt|: Typesets the document in 10-point
%   font.
% \item \DescribeMacro{11pt}|11pt|: Typesets the document in 11-point
%   font.
% \item \DescribeMacro{12pt}|12pt|: Typesets the document in 12-point
%   font.
% \item \DescribeMacro{a4paper}|a4paper|: Specifies A4 paper size
%   (letter is default).
% \item \DescribeMacro{nolmodern}|nolmodern|: Suppresses loading of the
%   \textsf{lmodern} package.
% \item \DescribeMacro{nofontenc}|nofontenc|: Suppresses loading of the
%   \textsf{fontenc} package (which is needed for proper hyphenation
%   of accented characters).
% \item \DescribeMacro{babel}|babel|: In all modes, loads
%   \textsf{babel}; the desired language(s) are listed as options
%   immediately following |babel|; the last language listed is the
%   main one.
% \item \DescribeMacro{noextraspace}|noextraspace|: In |man| and |stu| mode,
%   removes some of the vertical space between certain elements (e.g.,
%   headers and text) in an attempt to more closely resemble true
%   double-spacing (use at your own risk).
% \item \DescribeMacro{floatsintext}|floatsintext|: In |man| and |stu| mode,
%   integrates floats (tables and figures) within the body of the text
%   instead of postponing them until after the reference list.
% \item \DescribeMacro{biblatex}|biblatex|: Loads the
%   \textsf{biblatex} package; see Section~\ref{sec:biblatexinfo} for
%   details.
% \item \DescribeMacro{apacite}|apacite|: Loads the \textsf{apacite}
%   package; see Section~\ref{sec:apaciteinfo} for details. \\
%   \textit{\textbf{Note:} at this time, this will produce citations in 6th edition format. }
% \item \DescribeMacro{natbib}|natbib|: See
%   Section~\ref{sec:natbibinfo} for details. \\
%   \textit{\textbf{Note:} at this time, this will produce citations in 6th edition format.}
% \item \DescribeMacro{mask}|mask|: Masks references that are marked
%   as the author's own (for masked peer review); see
%   Section~\ref{sec:masking} for details.
% \item \DescribeMacro{longtable}|longtable|: If you \textit{must} use
%   long tables (exceeding one page in length), try this option (but
%   it may not work in all contexts).  Do \textbf{\textit{not}} load
%   \textsf{longtable} yourself because of precedence requirements
%   with the \textsf{endfloat} package.  Copy the file
%   |APA7endfloat.cfg| from the ``config'' folder of your \textsf{apa}
%   installation to the working folder of your document (not in your
%   |texmf| tree), and rename it to |endfloat.cfg| so that endfloat
%   will recognize it.  The supplied |APA7endfloat.cfg| file will also
%   be necessary in conjunction with the \textsf{rotating} package
%   (and its |\sideways| command) to produce rotated tables; this
%   works for |man| and |stu| mode only.  For rotated tables in |jou| or |doc|
%   mode, the \textsf{rotating} package may be used.  If sideways
%   tables get pushed to the end of your document with the
%   |floatsintext| option, try using the |ph!| placement specifier for
%   your sideways table(s); for example, |\begin{sidewaystable}[ph!]|.
% \item \DescribeMacro{notxfonts}|notxfonts|: In |jou| mode, prevents
%   \textsf{txfonts} from loading, in case \textsf{pslatex} or
%   \textsf{times} is preferable for some reason.
% \item \DescribeMacro{notimes}|notimes|: In |jou| mode, cancels
%   loading \textsf{txfonts} or \textsf{pslatex} or \textsf{times} and
%   uses Computer Modern instead.
% \item \DescribeMacro{notab}|notab|: In |jou| mode, cancels the
%   automatic stretching of tabular environments to the width of their
%   enclosing float.
% \item \DescribeMacro{helv}|helv|: In |man| and |stu| mode,
%   uses Helvetica font instead of Computer Modern.
% \item \DescribeMacro{nosf}|nosf|: In |man| and |stu| mode,
%   neutralizes the |\helvetica| command.
% \item \DescribeMacro{tt}|tt|: In |man| and |stu| mode, uses typewriter-like
%   font.
% \item \DescribeMacro{draftfirst}|draftfirst|: In all modes, places
%   the word ``DRAFT'' as a watermark across the first page.
% \item \DescribeMacro{draftall}|draftall|: In all modes, places the
%   word ``DRAFT'' as a watermark across all pages.
% \end{itemize}
%
% Class options not handled by \textsf{apa7} (e.g., |draft|) will be
% passed on to the \textsf{article} class.
%
% \subsection{Document Preamble}
% \label{sec:preamble}
% The following commands are available within the document preamble
% (i.e., the part of the file preceding |\begin{document}|).
%
% \subsubsection{Document Title and Headers}
% \label{sec:titleheaders}
% \begin{itemize}
% \item \DescribeMacro{\title}|\title|\marg{document-title}: The title of the document
% \item \DescribeMacro{\shorttitle}|\shorttitle|\marg{short-title}: A
%   shortened version of the title (for page headers)
% \item
%   \DescribeMacro{\leftheader}|\leftheader|\marg{author-last-name(s)}:
%   Author last name(s) (for even-page headers in |jou| mode)
% \end{itemize}
% Optional; use if desired:\par
% \begin{itemize}
% \item \DescribeMacro{\journal}|\journal|\marg{journal-name}: Journal
%   name or other note; typeset in the top left header of page 1
%   (|jou| and |doc| modes only); to change the starting page to a
%   number other than 1, insert the following line immediately after
%   |\maketitle|:\\
%   |\setcounter{page}|\marg{custom-page-number}
% \item \DescribeMacro{\volume}|\volume|\marg{journal-volume}: Volume,
%   number, pages; typeset in the top left header in |jou| and |doc|
%   modes, underneath the content of |\journal|
% \item \DescribeMacro{\ccoppy}|\ccoppy|\marg{copright-notice}:
%   Copyright notice, etc.; typeset in the top right header of page 1
%   (|jou| and |doc| modes only)
% \item \DescribeMacro{\copnum}|\copnum|\marg{more-copyright-info}:
%   Any additional text needed; typeset in the top right header in
%   |jou| and |doc| modes, underneath the content of |\ccoppy|
% \end{itemize}
%
% \subsubsection{Authors and Affiliations}
% \label{sec:authorsaffiliations}
% Based on the new APA 7th edition style guide, the previous method for 
% handling multiple authors and multiple affiliations has been deprecated as of version 2.01 of apa7. \par
% \textit{The followings commands have been deprecated and will return an error:} \par
% |\twoauthors{First Author(s)}{Second Author(s)}|\par
% |\threeauthors{John and Jim}{Mary and Sue}{Nick}|\par
% |\fourauthors{Helen}{Dick}{Tracy and Larry}{James Bond}|\par
% |\fiveauthors{...}{...}{...}{...}{...}|\par
% |\sixauthors{...}{...}{...}{...}{...}{...}|\par
% |\twoaffiliations{Affil. of 1st Author(s)}{Affil. 2nd Author(s)}|\par
% |\threeaffiliations{U of A}{U of B}{U of C}|\par
% |\fouraffiliations{My Company}{Your Department}{Heaven}{Earth}|\par
% |\fiveaffiliations{...}{...}{...}{...}{...}|\par
% |\sixaffiliations{...}{...}{...}{...}{...}{...}|\par
% \begin{itemize}
% \item \DescribeMacro{\author}|\author|\marg{author name}: Author name (if only 1 author)
% \item \DescribeMacro{\affiliation}|\affiliation|\marg{author's affiliation}: Author's affiliation (if only 1 affiliation)
% \item \DescribeMacro{\authorsnames}|\authorsnames|\oarg{comma separated list of superscripts}\marg{comma separated list of authors name(s)}: Authors names (if more than 1 author)
% \end{itemize}
%
% Where \marg{authors names} is a comma separated list of authors in display order
% and \oarg{superscripts} is an optional comma separated list of affiliation superscripts. 
% If there are multiple superscripts for one author, put the set of superscripts within |{ }|.
%
% \begin{itemize}
% \item
%   \DescribeMacro{\authorsaffiliations}|\authorsaffiliations|\marg{comma separated list of affiliation(s)}:
%   Author affiliation(s). Put each affiliation within |{ }| and separate each affiliation with a comma.
% \end{itemize}
%
% \noindent \textbf{Examples:} \par
% \noindent One author, one affiliation \par
% |\authorsnames{Maggie C. Leonard}| \par
% |\authorsaffiliations{{Department of Psychology, George Mason University}}| \par
% \noindent One author, two affiliations \par
% |\authorsnames{Andrew K. Jones-Willoughby}| \par
% |\authorsaffiliations{{School of Psychology, University of Sydney},| \par
% |{Center for Behavioral Neuroscience, American University}}| \par
% \noindent Two authors, shared affiliation \par
% |\authorsnames{Mackenzie J. Clement,Talia R. Cummings}| \par
% |\authorsaffiliations{{College of Nursing, Michigan State University}}| \par
% \noindent Two authors, different affiliations \par
% |\authorsnames[1,2]{Wilhelm T. Webber,Latasha P. Jackson}| \par
% |\authorsaffiliations{{Max Planck Institute for Human Development, Berlin, Germany},| \par
% |{College of Education, University of Georgia}}| \par
% \noindent Three or more authors, different affiliations \par
% |\authorsnames[1,{2,3},1]{Savannah C. St. John, Fen-Lei Chang, Carlos O. Vásquez III}| \par
% |\authorsaffiliations{{Education Testing Service, Princeton, New Jersey, ...},| \par
% |{MRC Cognition and Brain Science Unit, Cambridge, England},| \par
% |{Department of Psychology, University of Cambridge}}| \par
%
%
% \subsubsection{Title Page Information}
% \label{sec:titlepageinfo}
% \begin{itemize}
% \item \DescribeMacro{\course}|\course|\marg{course-number-name}: The
%   course number and name (e.g. PSYC 3170: Clinical Psychology)
% \item \DescribeMacro{\professor}|\professor|\marg{professor}: The
%   course professor name.
% \item \DescribeMacro{\duedate}|\duedate|\marg{paper-duedate}: The
%   due date for the paper (e.g. October 1, 2019)
% \item \DescribeMacro{\abstract}|\abstract|\marg{abstract-text}: The
%   abstract of the article
% \item \DescribeMacro{\keywords}|\keywords|\marg{keywords}: Keywords
%   (typeset after the abstract) See Section~\ref{sec:keywords} for
%   details regarding language localization of the ``Keywords'' label.
% \item \DescribeMacro{\authornote}|\authornote|\marg{author-note}:
%   The Author Note, containing contact information, acknowledgements,
%   etc.
% \item \DescribeMacro{\addORCIDlink}|\addORCIDlink|\marg{author-name}\marg{ORCID}: Optionally, use this within the author note to generate the ORCID link. \\
% For example
% \begin{verbatim} \addORCIDlink{First M. Last}{0000-0000-0000-0000} \end{verbatim} \\
% generates \\ \\
% \addORCIDlink{First M. Last}{0000-0000-0000-0000}
% \end{itemize}
%
% Optional; use if desired:\par
% \begin{itemize}
% \item \DescribeMacro{\note}|\note|\marg{note-text}: Notation of
%   manuscript date or other information desired beneath the
%   affiliation line (not part of the APA 7th edition specification for title page)
% \end{itemize}
%
% \subsection{Maketitle}
% The \DescribeMacro{\maketitle}|\maketitle| command formats the
% document title, page headers, author list, author affiliations,
% Author Note (if provided), abstract according to whether |jou|,
% |man|, |stu|, or |doc| mode has been specified.  This command should be
% on the line after |\begin{document}|, with the first line of text
% immediately following the |\maketitle| line (no blank lines).
%
% \subsection{Heading Levels}
% \label{sec:headinglevels}
% Heading levels are automatically formatted using the following
% standard \LaTeX\ commands:
% \begin{itemize}
% \item \DescribeMacro{\section}|\section|\marg{title}
% \item \DescribeMacro{\subsection}|\subsection|\marg{title}
% \item \DescribeMacro{\subsubsection}|\subsubsection|\marg{title}
% \item \DescribeMacro{\paragraph}|\paragraph|\marg{title}
% \item \DescribeMacro{\subparagraph}|\subparagraph|\marg{title}
% \end{itemize}
%
% Please note that sections cannot be |\ref|'d since APA style does
% not use numbered sections.  So |\label| commands are unnecessary
% unless you wish to use |\refname|.
%
% \subsection{Enumeration}
% \label{sec:enumeration}
% Several forms of enumeration are provided, as follows.
%
% \vspace{0.6em}
% \DescribeMacro{\begin\{seriate\}} \DescribeMacro{\end\{seriate\}}
%   |Blah blah blah|\par
%   |\begin{seriate}|\par
%   |  \item first item,|\par
%   |  \item second item.|\par
%   |\end{seriate}|\par
%   |Blah blah blah|\par\vspace{0.6em}
% \noindent results in:\par\vspace{0.6em}
%   |Blah blah blah (a) first item, (b) second item.  Blah blah blah|
%
% \vspace{3em}
% \DescribeMacro{\begin\{APAenumerate\}} \DescribeMacro{\end\{APAenumerate\}}
%   |Blah blah blah|\par
%   |\begin{APAenumerate}|\par
%   |  \item first item ... ... ... continue continue|\par
%   |  \item second item ... ... ... continue continue|\par
%   |\end{APAenumerate}|\par
%   |Blah blah blah|\par\vspace{0.6em}
% \noindent results in:\par\vspace{0.6em}
%   |Blah blah blah|\par
%   |    1. first item ... ... ...|\par
%   |continue continue|\par
%   |    2. second item ... ... ...|\par
%   |continue continue|\par
%   |Blah blah blah|\par
%
% \vspace{3em}
% \DescribeMacro{\begin\{APAitemize\}} \DescribeMacro{\end\{APAitemize\}}
%   |Blah blah blah|\par
%   |\begin{APAitemize}|\par
%   |  \item first item ... ... ... continue continue|\par
%   |  \item second item ... ... ... continue continue|\par
%   |\end{APAitemize}|\par
%   |Blah blah blah|\par\vspace{0.6em}
% \noindent results in:\par\vspace{0.6em}
%   |Blah blah blah|\par
%   |    o first item ... ... ...|\par
%   |continue continue|\par
%   |    o second item ... ... ...|\par
%   |continue continue|\par
%   |Blah blah blah|\par
%
% \vspace{0.6em}
% In addition to the above, all standard \LaTeX\ enumeration
% environments are available (e.g., |enumerate| and |itemize|).
%
% \subsection{Other Macros}
% \label{sec:othermacros}
% \begin{itemize}
% \item \DescribeMacro{\begin\{figure*\}} \DescribeMacro{\end\{figure*\}}
%   \DescribeMacro{\begin\{table*\}} \DescribeMacro{\end\{table*\}}
%   When a figure is too wide for a single column (in |jou| mode), use
%   |\begin{figure*}| and |\end{figure*}| instead of the non-starred
%   version.  The same applies with |\begin{table*}| and |\end{table*}|.
%   When using double-column tables or figures (|jou| mode), use the
%   |\centering| command; for example:\par
%   |\begin{table*}|\par\vspace{-.5em}
%   |  \centering|\par\vspace{-.5em}
%   |    \begin{threeparttable}|\par
% \item
%   \DescribeMacro{\figurenote}|\figurenote|\marg{figure-note-text}:
%   Formats figure note when placed after |\includegraphic|, |\fitfigure|, or similar command within |\begin{figure}| and |\end{figure}|.
% \item
%   \DescribeMacro{\fitfigure}|\fitfigure|\oarg{height}\marg{eps-filename}:
%   Automatically fit a postscript figure; use instead of
%   |\includegraphics|
% \item
%   \DescribeMacro{\fitbitmap}|\fitbitmap|\oarg{height}\marg{eps-filename}:
%   Same as |\fitfigure| but won't scale figure in |\man| mode for
%   best reproduction of bitmap figures
% \item \DescribeMacro{\tabfnm}|\tabfnm{a}|: Place a superscript
%   \textbf{f}oot\textbf{n}ote \textbf{m}ark inside a table cell.  Any
%   series of unique identifiers can be used in place of |a|.
% \item \DescribeMacro{\tabfnt}|\tabfnt{a}|\marg{footnote-text}:
%   Within table footnotes, specify the \textbf{f}oot\textbf{n}ote
%   \textbf{t}ext for |\tabfnm{a}|
% \item \DescribeMacro{\apavector}|\apavector|\marg{symbol}: Format
%   the \marg{symbol} as a vector by APA rules
% \end{itemize}
%
% \subsection{Appendices}
% \label{sec:appendices}
% \begin{itemize}
% \item \DescribeMacro{\appendix}|\appendix|: Begins the appendices
%   portion of the document
% \item \DescribeMacro{\section}|\section|\marg{appendix-title}:
%   Begins each appendix
% \end{itemize}
%
% Because appendices are numbered (with letters!) you may establish a
% label for each appendix (e.g., |\label{app:xxx}|); when there is
% more than one appendix, use |Appendix~\ref{app:xxx}| within the main
% body of the text to refer to that appendix.  (Of course, if there is
% only one appendix, simply refer to it as |the Appendix|.)
%
% \section{Known Limitations}
% \begin{itemize}
% \item The |APAenumerate| environment does not nest properly.
% \end{itemize}
%
% \section{Development of \textsf{apa7}}
% The base code for this class is the \textsf{apa6} class, which in
% turn was based upon other sources.  In order to comply with 7th
% Edition criteria, certain changes had to be made to update the
% \textsf{apa6} code.
%
% \subsection{Section Headings}
% Most prominently, the formatting of section headings had to be
% altered.  The 7th Edition specifies a more straightforward series of
% heading levels than previous editions did.  Briefly, the top-level
% heading is now boldfaced and centered, upper- and lower-case, no
% matter now many levels of heading are in the document; other heading
% levels have similar specifications.  The \textsf{apa7} class
% utilizes code (with permission) from the \textsf{apa6} class to
% comply with all of these specifications.
%
% Because the 7th Edition requires figure captions to be printed on
% the same page as their respective figures, there are no more Figure
% Captions pages.
%
% \subsection{Author Note}
% According to 7th Edition guidelines, Author Notes are now placed "in the bottom half of the title page" on the
% title page of manuscripts per the style guide.
%
% \section{Features}
% The featured implemented in the |apa6| have been included in the |apa7| class for the 7th Edition of the
% \textit{Manual}.
%
% \subsection{Masked References}
% \label{sec:masking}
% When manuscripts are sent out for review, they customarily must have
% all identifying information stripped so that reviewers do not know
% who the author of the manuscript is.  The new
% \DescribeMacro{mask}|mask| option suppresses the output of the
% author's name and affiliation, the author note, and any references
% that are marked as being the author's own.
%
% \begin{table}[htbp]
%   \caption{Supported masking commands}
%   \label{tab:CitationCommandsTable}
%   \begin{tabular}{@{}llll@{}}                                           \toprule
%     Unmasked Result    &  \multicolumn{3}{c}{Masking Commands}      \\ \cmidrule(r){2-4}
%                        &  \textsf{apacite}   &  \textsf{natbib}     &  \textsf{biblatex}  \\ \midrule
%     (van Dijk, 2001)  &  |\maskcite|        &  |\maskcitep|        &  |\maskparencite|   \\
%     (Van Dijk, 2001)  &                     &  |\maskCitep|        &  |\maskParencite|   \\
%     van Dijk, 2001    &  |\maskciteNP|      &  |\maskcitealp|      &  |\maskcite|        \\
%     Van Dijk, 2001    &                     &  |\maskCitealp|      &  |\maskCite|        \\
%     van Dijk (2001)   &  |\maskciteA|       &  |\maskcitet|        &  |\masktextcite|    \\
%     Van Dijk (2001)   &                     &  |\maskCitet|        &  |\maskTextcite|    \\
%     van Dijk          &  |\maskciteauthor|  &  |\maskciteauthor|   &  |\maskciteauthor|  \\
%     Van Dijk          &                     &  |\maskCiteauthor|   &  |\maskCiteauthor|  \\
%     (2001)             &  |\maskciteyear|    &  |\maskciteyearpar|  &                     \\
%     2001               &  |\maskciteyearNP|  &  |\maskciteyear|     &  |\maskciteyear|    \\ \bottomrule
%   \end{tabular}
% \end{table}
%
% To specify a reference that is to be masked with the |mask| option,
% simply prepend |mask| to the desired citation command (e.g.,
% |\maskcite| instead of |\cite|).  Supported bibliography packages
% are \textsf{biblatex}, \textsf{apacite}, and \textsf{natbib}.  The
% specific masking commands are shown in Table
% \ref{tab:CitationCommandsTable}.  Prenotes and postnotes for
% citations are supported with both \textsf{biblatex} and
% \textsf{natbib}; however, they are not supported with the
% \textsf{apacite} package.
%
% To mask citations that have been prepended with |mask| (and the
% corresponding bibliography entries), the name of the bibliography
% package must also be passed in as an option on the |\documentclass|
% line, in addition to the |mask| option.  For example,
% |\documentclass[jou,biblatex,mask]{apa7}|. (But as explained later,
% the |biblatex| option is the default and is therefore not required,
% even with the |mask| option.)
%
% \textbf{Be warned}, however, that if you have previously generated
% .bbl, etc., files without the |mask| option applied, those files
% must be deleted or re-written before \LaTeX-ing with the |mask|
% option---otherwise, you will see the to-be-masked entries showing up
% in the bibliography.
%
% Masked citations are replaced with the text, \textit{(2 citations
% removed for masked review)} (in the case of two masked citations).
% The corresponding entries in the References section are also
% suppressed.
%
% There is no need to revise the masked citations when removing the
% |mask| option for final production.  The citations that were
% previously masked will not be masked in the absence of the |mask|
% option.
%
% The |mask| command does not apply to |stu| type documents.
%
% \subsection{Repositioned Floats}
% When revising and proofreading a manuscript, it is most helpful to
% have the tables and figures readily available (rather than turning
% most of the way to the end of the manuscript to access them).  The
% \DescribeMacro{floatsintext}|floatsintext| option (specified in the
% |\documentclass| line) will integrate tables and figures
% approximately where they are mentioned in the text.  This is
% available only with the |man| and |stu| options, of course, because the other
% formats already have floats integrated with the text.
%
% \subsection{User-defined Font Size}
% \DescribeMacro{10pt} \DescribeMacro{11pt} \DescribeMacro{12pt} Users
% can now select from the font-size options available in standard
% \LaTeX\ (10pt, 11pt, 12pt) by including the appropriate option
% (e.g., |10pt|) in the |\documentclass| line.  The default font size
% is 10pt for |jou| mode, 11pt for |doc| mode, and 12pt for |man|
% mode.
%
% \subsection{Watermark}
% If desired, a ``DRAFT'' watermark can be placed on either the first
% pages or all pages of the document with the
% \DescribeMacro{draftfirst}|draftfirst| and
% \DescribeMacro{draftall}|draftall| options, respectively.  The text,
% font size, angle, and lightness of the text can all be modified
% using commands explained in the \textsf{draftwatermark}
% documentation.  Also loads the \textsf{everypage} package.
%
% \subsection{Flexible Bibliographies}
% The \textsf{apa7} class supports three bibliography packages:
% \textsf{biblatex}, \textsf{apacite}, and \textsf{natbib}. \\ \\
% At this time, only \textsf{biblatex} is updated to support the 7th edition of APA style for citations and references.
%
% \subsubsection{\textsf{biblatex}}
% \label{sec:biblatexinfo}
% \textit{\textbf{Note:} This is the recommended method for 7th edition citations and references.} \\
% Biblatex is the most APA-compliant bibiliography package.  The
% \DescribeMacro{biblatex}|biblatex| option directs \textsf{apa7} to
% load the \textsf{biblatex} package with the following options:
% style=apa,sortcites=true,sorting=nyt; however, the
% |\DeclareLanguageMapping| and |\addbibresource| commands will need
% to be specified by the user within the document preamble.  In the
% absence of bibliographic options, \textsf{apa7} will mask references
% using \textsf{biblatex} commands if the |mask| option is specified.
% In other words, the only reason to use the |biblatex| option is to
% have \textsf{apa7} automatically load the \textsf{biblatex} package.
%
% \subsubsection{\textsf{apacite}}
% \label{sec:apaciteinfo}
% \textit{\textbf{Note:} at this time, this will produce citations in 6th edition format.} \\
% The \textsf{apacite} package is loaded if the
% \DescribeMacro{apacite}|apacite| option is specified.  This option
% also informs \textsf{apa7} to mask references using \textsf{apacite}
% commands if the |mask| option is specified.  \textbf{The
% \textsf{apacite} package is \textit{not} loaded by default.}
%
% \subsubsection{\textsf{natbib}}
% \label{sec:natbibinfo}
% \textit{\textbf{Note:} at this time, this will produce citations in 6th edition format.} \\
% Specifying the \DescribeMacro{natbib}|natbib| option implicitly
% loads \textsf{apacite} and \textsf{natbib} and directs
% \textsf{apa7} to mask references using \textsf{natbib} commands if
% the |mask| option is specified.
%
% \subsection{Keywords}
% \label{sec:keywords}
% Many journals (including APA journals) request authors to provide
% keywords for their manuscripts to facilitate electronic indexing.
% \textsf{apa6} introduced the \DescribeMacro{\keywords}|\keywords|
% command.  If provided, keywords will be displayed on a line beneath
% the abstract.  For languages other than English, the `Keywords'
% label can be localized by modifying the appropriate configuration
% file (in the `config' folder of the \textsf{apa7} installation).
%
% \subsection{Float Placement}
% The 7th Edition (as did the 6th Edition) requires
% that tables and figures (in that order) be placed after the
% references but before the appendices.  This creates a bit of a
% conundrum as to what should happen with tables or figures that are
% ultimately typeset within an appendix.  The choices we are left with
% are to place appendix floats (a) along with the floats from the main
% part of the manuscript, which would mean that appendix floats appear
% prior to the point at which they are mentioned; (b) within the
% appendices themselves, which is not consistent with how floats in
% the main part of the manuscript are handled; or (c) in a separate
% float section that follows the appendices, which results in two
% float sections.  Obviously none of these choices is satisfactory, so
% Brian Beitzel (author of |apa6| package) posed the question to APA's Style Expert.  The style expert responded that at
% least for APA's journals ``it doesn't matter whether appendix tables
% are submitted with text tables or separately, as long as they are
% numbered correctly (e.g., Table A1, Table B1, etc.)''  (J.\
% Hume-Pratuch, personal communication, June 15, 2011).  Therefore,
% \textsf{apa7} takes the same approach as \textsf{apa6}: the most straightforward approach that includes
% all appendix floats within the body of the relevant appendix.  This
% also has the advantage of making appendices more readable.
%
% \section{Dependencies}
% \textsf{apa7} automatically loads the following packages.  If these
% packages are not already installed, producing the first
% \textsf{apa7} document could take a few minutes while these packages
% are downloaded and installed.
%
% \begin{itemize}
% \item \textsf{apacite}: bibliography package; used only if the
%   |apacite| or |natbib| option has been specified
% \item \textsf{biblatex}: bibliographic package; used only if the
%   |biblatex| option has been specified
% \item \textsf{booktabs}:  formats tables that are much more
%   attractive than the standard \LaTeX\ tables.
% \item \textsf{caption}: formats table and figure captions
% \item \textsf{draftwatermark}: includes a ``DRAFT'' watermark; used
%   only if the |draftfirst| or |draftall| options are specified
%   (\textsf{draftwatermark} automatically loads \textsf{everypage}
% \item \textsf{endfloat}: handles placing tables and figures at the
%   end of a manuscript; used only with the |man| and |stu| options
% \item \textsf{etoolbox}: provides low-level hooks needed to detect
%   user-loaded packages
% \item \textsf{fancyhdr}: formats page headers
% \item \textsf{float}: handles floats placed within text; used only
%   when the |man| and |floatsintext| options are both specified
%   \textsf{biblatex} package (when loaded by the user in the document
%   preamble) in time to set the ``References'' heading to
%   non-boldface; used only if no bibliographic options have been
%   specified
% \item \textsf{geometry}: formats margins
% \item \textsf{graphicx}: allows inclusion of figures
% \item \textsf{hyperref}: needed for ORCID link
% \item \textsf{longtable}: formats tables that exceed one page in
%   length; loaded only if the |longtable| option is specified.  Also
%   loads the \textsf{array} package.
% \item \textsf{lmodern}: needed for proper default text size for
%   draft watermark, so used on all documents; may be suppressed from
%   loading with option |nolmodern|.
% \item \textsf{scalerel}: needed for ORCID logo sizing
% \item \textsf{substr}: counts masked references; used only if the
%   |mask| option is specified
% \item \textsf{threeparttable}: produces nicely formatted table notes
%   that comply with APA style.  See |longsample.tex| (in the
%   ``samples'' subfolder of the \textsf{apa7} installation;
%   specifically, Appendix B in that document) for how to set up a
%   table with notes.
% \item \textsf{tikz}: needed for ORCID logo
% \item \textsf{times}: for math definitions
% \end{itemize}
%
%
% \section{Examples}
%
% Sample documents are included with this class; look in the
% ``samples'' subfolder of your installation. The source and output for
% |shortsample.tex| are reproduced on the following pages for quick
% reference.
%
% \newpage
%
% \subsection{shortsample.tex}
% \iffalse
%<*verb>
% \fi
 \begin{verbnobox}[\hspace{-3cm}]
 \documentclass[jou]{apa7}

 \usepackage[american]{babel}

 \usepackage{csquotes}
 \usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
 \DeclareLanguageMapping{american}{american-apa}
 \addbibresource{bibliography.bib}

 \title{Sample APA-Style Document Using the \textsf{apa7} Package}

 \author{Daniel A. Weiss}
 \affiliation{A University Somewhere}

 \leftheader{Weiss}

 \abstract{This demonstration paper uses the \textsf{apa7} \LaTeX\
   class to format the document in compliance with the 7th Edition of
   the American Psychological Assocation's \textit{Publication Manual.}
   The references are managed using \textsf{biblatex}.}

 \keywords{APA style, demonstration}

 \begin{document}
 \maketitle
 We begin with \textcite{Shotton1989}.  We can also cite this work in
 parenthesis, like this: \parencite{Shotton1989}.

 A three-author paper \parencite[e.g.,][]{Lassen2006} lists all
 three authors for the first citation, then only the first author
 on all subsequent citations \parencite{Lassen2006}.

 Note the use of five heading levels throughout this demonstration
 Method section.

 \section{Method}
 \subsection{Participants}
 We had a lot of people in this study.

 \subsection{Materials}
 Several materials were used for this project.  Some of them were
 already created for prior research.

 \subsubsection{Paper-and-Pencil Instrument}
 We used an instrument that we found to be highly successful.

 \paragraph{Reliability}
 The reliability of this instrument is extraordinary.

 \paragraph{Validity}
 We now discuss the validity of our instrument.

 \subparagraph{Face validity} The face validity is exceptionally
 strong.  Everyone should be impressed.

 \subparagraph{Construct validity} Also very strong.

 \subsection{Design}
 This section describes the study's design.

 \subsection{Procedure}
 The procedure was fairly straightforward, yet required
 attention to detail.

 \section{Results}
 Table \ref{tab:ComplexTable} contains some sample data.  Our
 statistical prowess in analyzing these data is unmatched.

 \begin{table}[htbp]
   \vspace*{2em}
   \begin{threeparttable}
     \caption{A Complex Table}
     \label{tab:ComplexTable}
     \begin{tabular}{@{}lrrr@{}}         \toprule
     Distribution type  & \multicolumn{2}{l}{Percentage of} & Total number   \\
                        & \multicolumn{2}{l}{targets with}  & of trials per  \\
                        & \multicolumn{2}{l}{segment in}    & participant    \\ \cmidrule(r){2-3}
                                     &  Onset  &  Coda            &          \\ \midrule
     Categorical -- onset\tabfnm{a}  &    100  &     0            &  196     \\
     Probabilistic                   &     80  &    20\tabfnm{*}  &  200     \\
     Categorical -- coda\tabfnm{b}   &      0  &   100\tabfnm{*}  &  196     \\ \midrule
     \end{tabular}
     \begin{tablenotes}[para,flushleft]
         {\small
             \textit{Note.} All data are approximate.
 
             \tabfnt{a}Categorical may be onset.
             \tabfnt{b}Categorical may also be coda.
 
             \tabfnt{*}\textit{p} < .05.
             \tabfnt{**}\textit{p} < .01.
          }
     \end{tablenotes}
   \end{threeparttable}
 \end{table}

 \section{Discussion}
 This is a lengthy and erudite discussion.  It demonstrates amazing
 skill in interpreting the results for the masses.

 \printbibliography

 \end{document}
 \end{verbnobox}
% \iffalse
%</verb>
% \fi
%
% \subsection{shortsample.pdf}
% \IfFileExists{samples/shortsample.pdf}%
%   {\includegraphics[scale=0.8, trim = 1in 1.5in 1in 0.8in]{samples/shortsample.pdf}}%
%   {PRINTED DOCUMENT WILL BE DISPLAYED HERE \newpage}
%
%
% \StopEventually{^^A
%   \PrintChanges
%   \PrintIndex
% }
%
%    \begin{macrocode}
%<*class>
%    \end{macrocode}
%
%\begin{macro}{apa7.cls}
%    \begin{macrocode}
% % Below is the license statement from the apa class, upon which this
% % apa7 class was built
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% apa6 version 2.33
%
% apa6 - A LaTeX class for formatting documents in compliance with the
% American Psychological Association's Publication Manual, 6th edition
%
% Copyright (C) 2011-2017 by Brian D. Beitzel <brian at beitzel.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License (LPPL), either
% version 1.3c of this license or (at your option) any later
% version.  The latest version of this license is in the file:
%
% http://www.latex-project.org/lppl.txt
%
% Users may freely modify these files without permission, as long as the
% copyright line and this statement are maintained intact.
%
% This work is not endorsed by, affiliated with, or probably even known
% by, the American Psychological Association.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DeclareOption{man}{%
  \def\def@man{\@manmode}
}

\DeclareOption{stu}{%
  \def\def@stu{\@stumode}
  \def\def@man{\@manmode}
}

\DeclareOption{jou}{%
  \def\def@jou{\@joumode}
}

\DeclareOption{doc}{%
  \def\def@doc{\@docmode}
}

\DeclareOption{babel}{%
  \def\def@babel{\@babel}
}

\DeclareOption{notimes}{%
  \@ifundefined{def@jou}{}{\def\def@notimes{\@notimes}}
}

\DeclareOption{notxfonts}{% -- thp 2005/07/23
  \@ifundefined{def@jou}{}{\def\def@notxfonts{\@notxfonts}}
}

\DeclareOption{nosf}{%
  \@ifundefined{def@man}{}{\def\def@nosf{\@nosf}}
}

\DeclareOption{fignum}{%
  \@ifundefined{def@man}{}{\def\fig@num{\relax}}
}

% \DeclareOption{floatmark}{%
%   \@ifundefined{def@man}{}{\def\float@mark{\relax}}
% }

\DeclareOption{longtable}{%
  \def\long@table{\relax}
}

\DeclareOption{tt}{%
  \@ifundefined{def@man}{}{\def\tt@family{\relax}}
}

\DeclareOption{helv}{%
  \@ifundefined{def@man}{}{\def\helv@family{\relax}}
}

\DeclareOption{notab}{\def\no@tab{\relax}}

\DeclareOption{nobf}{\def\no@bf@title{\relax}}

\DeclareOption{nolmodern}{%
  \def\def@nolmodern{\@nolmodernmode}
}

\DeclareOption{nofontenc}{%
  \def\def@nofontenc{\@nofontencmode}
}

% remove extra space around headings, etc., in man mode
\DeclareOption{noextraspace}{%
  \def\def@noextraspace{\@noextraspacemode}
}

% suppress the title at the introduction (in case a different title is desired)
\DeclareOption{donotrepeattitle}{%
  \def\def@donotrepeattitle{\@donotrepeattitlemode}
}

% in order to have tables and figure inside the text, Guillaume Jourjon 19/10/10
\DeclareOption{floatsintext}{%
  \def\def@floatsintext{\@floatsintext}
}

% allow A4 paper size
\DeclareOption{a4paper}{%
  \def\def@aFourPaper{\@aFourPapermode}
}

\DeclareOption{apacite}{% BDB
  \def\def@apacite{\@apacitemode}
}

\DeclareOption{natbib}{% BDB
  \def\def@natbib{\@natbibmode}
}

\DeclareOption{biblatex}{% BDB
  \def\def@biblatex{\@biblatexmode}
}

\DeclareOption{draftfirst}{% BDB
  \def\def@draftfirst{\@draftfirstmode}
}

\DeclareOption{draftall}{% BDB
  \def\def@draftall{\@draftallmode}
}

\DeclareOption{mask}{\def\apaSeven@maskauthoridentity{\relax}}  % BDB

% declare the font-size commands
\newcommand\apaSeven@ptsize{}
\newcommand\apaSeven@noptsize{}
\DeclareOption{10pt}{\renewcommand\apaSeven@ptsize{10pt}}
\DeclareOption{11pt}{\renewcommand\apaSeven@ptsize{11pt}}
\DeclareOption{12pt}{\renewcommand\apaSeven@ptsize{12pt}}


\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ProcessOptions\relax

% make jou the default if no other options have been specified
\@ifundefined{def@man}{%
 \@ifundefined{def@doc}{%
  \@ifundefined{def@jou}{%
   \def\def@jou{\@joumode}
   \ClassInfo{apa7}{Using default mode (jou)}
   %\def\def@man{\@manmode}
   %\def\def@doc{\@docmode}
  }{}
 }{}
}{}

% pass the default font-size to the article class
\@ifundefined{def@man}{%
    \@ifundefined{def@jou}{%
        \@ifundefined{def@doc}{%
        }{% doc
          \ifx\apaSeven@ptsize\apaSeven@noptsize
            \LoadClass[11pt]{article} % default for doc is 11pt
          \else
            \LoadClass[\apaSeven@ptsize]{article}
          \fi
        }
    }{% jou
      \ifx\apaSeven@ptsize\apaSeven@noptsize
        \LoadClass[10pt,twoside]{article} % default for jou is 10pt
      \else
        \LoadClass[\apaSeven@ptsize,twoside]{article}
      \fi
    }
}{% man
  \ifx\apaSeven@ptsize\apaSeven@noptsize
    \LoadClass[12pt,twoside]{article} % default for man is 12pt
  \else
    \LoadClass[\apaSeven@ptsize]{article}
  \fi
}



% determine the bibliography package, and load it if selected through the appropriate \documentclass option
\@ifundefined{def@apacite}{%
  \@ifundefined{def@natbib}{%
    \@ifundefined{def@biblatex}{%
      \def\def@biblatex{\@biblatexmode}%  the default bibliography package is biblatex
      \RequirePackage{etoolbox}
      \AtEndPreamble{%
        \@ifpackageloaded{biblatex}{%  the user has loaded biblatex
          \@ifundefined{def@man}{%
            \defbibheading{bibliography}{\section*{\normalfont\textbf\refname}}%
          }{%
            \defbibheading{bibliography}{\clearpage\section*{\normalfont\textbf\refname}}%
          }
        }{}
      }
      \ClassInfo{apa7}{No bibliography package was specified; defaulting to (but not loading) Biblatex}
    }{%
      \def\def@biblatex{\@biblatexmode}%  the selected bibliography package is Biblatex
      \RequirePackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
      \@ifundefined{def@man}{%
        \defbibheading{bibliography}{\section*{\normalfont\textbf\refname}}%
      }{%
        \defbibheading{bibliography}{\clearpage\section*{\normalfont\textbf\refname}}%
      }
      \ClassInfo{apa7}{The selected bibliography package, biblatex, has been loaded}
    }
  }{%
    \def\def@natbib{\@natbibmode}%  the selected bibliography package is natbib (with apacite)
    \@ifundefined{def@man}{%         -- thp 2005/07/23
      \RequirePackage[natbibapa]{apacite}[2012/02/25]}
      {\RequirePackage[natbibapa,bibnewpage]{apacite}[2012/02/25]}
    \ClassInfo{apa7}{The selected bibliography package, apacite and
      natbib, have been loaded}
  }
}{%
  \def\def@apacite{\@apacitemode}%  the selected bibliography package is apacite
  \@ifundefined{def@man}{%         -- thp 2005/07/23
    \RequirePackage{apacite}[2005/06/08]}
    {\RequirePackage[bibnewpage]{apacite}[2005/06/08]}
  \ClassInfo{apa7}{The selected bibliography package, apacite, has been loaded}
}

% load the lmodern package (needed for proper watermark font size)
\@ifundefined{def@nolmodern}{%
  \RequirePackage{lmodern}
}{}

% load the fontenc package (needed for proper hyphenation of accented characters)
\@ifundefined{def@nofontenc}{%
  \RequirePackage[T1]{fontenc}
}{}

% place a watermark on any pages indicated
\@ifundefined{def@draftall}{%
  \@ifundefined{def@draftfirst}{}{%
    \RequirePackage[firstpage]{draftwatermark}
    \SetWatermarkText{DRAFT}
  }
}{%
% a draft watermark has been requested for all pages
  \RequirePackage{draftwatermark}
  \SetWatermarkText{DRAFT}
}

%\@ifundefined{def@noapacite}%       -- Philip Kime 2008/12/03
%  {\ClassInfo{apa7}{Using BibTeX with apacite for citations and references}}%
%  {\ClassInfo{apa7}{apacite not loaded -- User may load BibLaTeX}}


%==== Conditional compilation macros depending on mode ====

\long\def\ifapamodeman#1#2{\@ifundefined{def@man}{#2}{#1}}
\long\def\ifapamodejou#1#2{\@ifundefined{def@jou}{#2}{#1}}
\long\def\ifapamodedoc#1#2{\@ifundefined{def@doc}{#2}{#1}}
\long\def\ifapamode#1#2#3{%
 \@ifundefined{def@man}{%
   \@ifundefined{def@jou}{%
    \@ifundefined{def@doc}{\ClassError{apa7}{Undefined mode state!}}{#3}%
   }{#2}%
  }{#1}%
}

%=================================================================
\@ifundefined{def@man}{}{%
%
% endnotes and endfloat loaded later
% longtable must be loaded before endfloat
%
\@ifundefined{long@table}{}{%
 \RequirePackage{array}
 \RequirePackage{longtable}
%
% longtable messes with captions too, we need to intervene to match style
% NOTE: the caption package makes the following redundant
%\def\LT@makecaption#1#2#3{%
%  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox{\linewidth}{%
%      \vskip 10pt%
%      #1{#2}%
%      \let\BBAB\table@BBAB%   -- thp 2005/07/23
%      \par\emph{#3}%
%      \let\BBAB\normal@BBAB%  -- thp 2005/07/23
%    \endgraf\vskip\baselineskip}%
%  \hss}}}
}% END of loading longtable
%
% Switch font family for manuscript if required
%
\@ifundefined{tt@family}{}{%
% A typewriter font can be used as in the APA manual example. Since tt has
% no bold (or bold-italic), the cmss font metrics are loaded instead
% \DeclareFontShape{OT1}{cmtt}{bx}{n}{ <-> sub * cmss/bx/n }{} % this fails
 \DeclareFontShape{OT1}{cmtt}{bx}{n}{ <-> cmssbx10 }{}  % probably not the
 \DeclareFontShape{OT1}{cmtt}{bx}{it}{ <-> cmssbxo10}{} % right way to do it
 \renewcommand{\familydefault}{cmtt}
 }
\@ifundefined{helv@family}{}{%
 \renewcommand{\familydefault}{phv}}
}


%
% For jou mode, load times (and related math fonts) if available
% First try txfonts because they are supposed to have better math definitions
%
\@ifundefined{def@jou}{}{%
 \@ifundefined{def@notimes}{%
  \newif\iftxfonts          % -- thp 2005/07/23
  \txfontsfalse             % added checks for txfonts because they may be undesirable
                            % for example, there are no Greek txfonts but there are times
  \IfFileExists{txfonts.sty}{\@ifundefined{def@notxfonts}{\txfontstrue}{}}{}
   \iftxfonts%
    \RequirePackage{txfonts}%
    \typeout{apa7.cls: Using txfonts}% Changed from Warning -- thp 2005/12/28
    %%%
    % According to Erik Meijer, txfonts causes problems if amsmath is loaded later
    % (i.e., via \usepackage by the user); instead of providing yet another option
    % to load amsmath by apa.cls, we adopt Erik's suggestion to undefine temporarily
    % the offending macros -- thp 2005/12/28
    \let\tempiint\iint\let\iint\undefined
    \let\tempiiint\iiint\let\iiint\undefined
    \let\tempiiiint\iiiint\let\iiiint\undefined
    \let\tempidotsint\idotsint\let\idotsint\undefined
    \let\tempopenbox\openbox\let\openbox\undefined
    \AtBeginDocument{%
     \let\iint\tempiint\let\tempiint\undefined
     \let\iiint\tempiiint\let\tempiiint\undefined
     \let\iiiint\tempiiiint\let\tempiiiint\undefined
     \let\idotsint\tempidotsint\let\tempidotsint\undefined
     \let\openbox\tempopenbox\let\tempopenbox\undefined
    }
    %%% end of taking care of txfonts problems
   \else%
    % if txfonts are not available/desirable, try pslatextimes/mathptm
    \IfFileExists{pslatex.sty}
     {\RequirePackage{pslatex}}
     % if pslatex is not available, try times/mathptm
     {\RequirePackage{times}
      \IfFileExists{mathptm.sty}{\RequirePackage{mathptm}}{}}%
   \fi% txfonts not available/desirable
 }{}% def@notimes
}% def@jou


% choose a paper size and set the page margins
\@ifundefined{def@aFourPaper}{
  \RequirePackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}  
}{
  \RequirePackage[top=1in, bottom=1in, left=1in, right=1in,a4paper]{geometry}  
}

\RequirePackage{graphicx}  % this is for including graphics

\RequirePackage{scalerel,tikz,hyperref} % this is included for ORCID icon
\usetikzlibrary{svg.path}
\definecolor{orcidlogocol}{HTML}{A6CE39}
\tikzset{
  orcidlogo/.pic={
    \fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z};
    \fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z}
                 svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z}
                 svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z};
  }
}
\newcommand{\addORCIDlink}[2]{#1 \href{https://orcid.org/#2}{{\mbox{\scalerel*{
\begin{tikzpicture}[yscale=-1,transform shape]
\pic{orcidlogo};
\end{tikzpicture}
}{|}}} https://orcid.org/#2}}

\RequirePackage{booktabs}  % this is for nice-looking tables
\setlength{\abovetopsep}{0pt}  % set the distance between the table title and the table toprule
\setlength{\belowbottomsep}{0pt}  % set the distance between the table bottomrule and any notes

\RequirePackage[para,flushleft]{threeparttable}  % this is for nice-looking table footnotes, etc.
% need to redefine the tablenotes so they hug the bottom line of the table a little closer
% also, the manuscript format needs to have \raggedright
\@ifundefined{def@man}{% BDB
  \def\TPT@doparanotes{\par\vspace{-.5\baselineskip}% BDB
     \prevdepth\z@ \TPT@hsize
     \TPTnoteSettings
     \parindent\z@ \pretolerance 8
     \linepenalty 200
     \renewcommand\item[1][]{\relax\ifhmode \begingroup
         \unskip
         \advance\hsize 10em % \hsize is scratch register, based on real hsize
         \penalty -45 \hskip\z@\@plus\hsize \penalty-19
         \hskip .15\hsize \penalty 9999 \hskip-.15\hsize
         \hskip .01\hsize\@plus-\hsize\@minus.01\hsize
         \hskip 1em\@plus .3em
        \endgroup\fi
        \tnote{##1}\,\ignorespaces}%
     \let\TPToverlap\relax
     \def\endtablenotes{\par}%
  }
}{%
  \def\TPT@doparanotes{\par\vspace{-.4\baselineskip}% BDB
     \prevdepth\z@ \TPT@hsize
     \TPTnoteSettings
     \raggedright
     \parindent\z@ \pretolerance 8
     \linepenalty 200
     \renewcommand\item[1][]{\relax\ifhmode \begingroup
         \unskip
         \advance\hsize 10em % \hsize is scratch register, based on real hsize
         \penalty -45 \hskip\z@\@plus\hsize \penalty-19
         \hskip .15\hsize \penalty 9999 \hskip-.15\hsize
         \hskip .01\hsize\@plus-\hsize\@minus.01\hsize
         \hskip 1em\@plus .3em
        \endgroup\fi
        \tnote{##1}\,\ignorespaces}%
     \let\TPToverlap\relax
     \def\endtablenotes{\par}%
  }
}

%========= Language portability parameters ===========

% Language-specific definition of strings is handled externally -- thp 2005/12/30
% Based on handling of the same issue in apacite.sty

% First define the default American English macros in case no external file is present or needed
\def\lastauthorseparator{and}
\def\acksname{Author Note}
\def\keywordname{Keywords}
\def\notesname{Footnotes}

\AtBeginDocument{% so that we know what language is active in babel

% \typeout{\string\languagename\space is\space\languagename}
% \@ifundefined{iflanguage}% this is defined by babel, so it means babel is loaded
                           % Unfortunately, because babel is built into the format
                           % in modern distributions, \iflanguage is defined and
                           % \languagename contains whichever language happens to be
                           % last in the definition list, whether or not the babel
                           % package is loaded by the current document

\@ifpackageloaded{babel}% this is defined only if the user requested loading babel
  {\def\@apaSeven@langfile{config/APA7\languagename.txt}}
  {\def\@apaSeven@langfile{config/APA7american.txt}}
 \InputIfFileExists{\@apaSeven@langfile}{}{%
  \ClassInfo{apa7}{Language definition file \@apaSeven@langfile\space not found}
 }%
}

%========== Load babel if required ===================

\@ifundefined{def@babel}{}{% -- thp 2005/07/23
 \RequirePackage{babel}    % -- thp 2005/07/23, removed options 2005/12/28
}

\@ifundefined{def@biblatex}{}{% BDB

  % we are using biblatex

    %%%%%%%%%%%% biblatex commands %%%%%%%%%%%%%%%%
    %%
    %%  \cite[e.g.,][p.~11]{vanDijk2001,Ross1987}          =>  e.g., van Dijk, 2001; Ross, 1987, p. 11
    %%  \Cite[e.g.,][p.~11]{vanDijk2001,Ross1987}          =>  e.g., Van Dijk, 2001; Ross, 1987, p. 11
    %%  \parencite[e.g.,][p.~11]{vanDijk2001,Ross1987}     =>  (e.g., van Dijk, 2001; Ross, 1987, p. 11)
    %%  \Parencite[e.g.,][p.~11]{vanDijk2001,Ross1987}     =>  (e.g., Van Dijk, 2001; Ross, 1987, p. 11)
    %%  \textcite[e.g.,][p.~11]{vanDijk2001,Ross1987}      =>  e.g., van Dijk (2001); Ross (1987, p. 11)
    %%  \Textcite[e.g.,][p.~11]{vanDijk2001,Ross1987}      =>  e.g., Van Dijk (2001); Ross (1987, p. 11)
    %%  \citeauthor[e.g.,][p.~11]{vanDijk2001,Ross1987}    =>  e.g., van Dijk (2001); Ross (1987, p. 11)
    %%  \Citeauthor[e.g.,][p.~11]{vanDijk2001,Ross1987}    =>  e.g., Van Dijk (2001); Ross (1987, p. 11)
    %%  \citeyear[e.g.,][p.~11]{vanDijk2001}             =>  e.g., 2001, p. 11)
    %%  \footcite[e.g.,][p.~11]{vanDijk2001,Ross1987}      =>  e.g., van Dijk, 2001; Ross, 1987, p. 11. [as footnote]
    %%  \footcitetext[e.g.,][p.~11]{vanDijk2001,Ross1987}  =>  e.g., van Dijk, 2001; Ross, 1987, p. 11. [as footnotetext]
    %%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \@ifundefined{apaSeven@maskauthoridentity}%  BDB
      {%  change masked references to unmasked
        \providecommand\maskcite\cite
        \providecommand\maskCite\Cite
        \providecommand\maskparencite\parencite
        \providecommand\maskParencite\Parencite
        \providecommand\masktextcite\textcite
        \providecommand\maskTextcite\Textcite
        \providecommand\maskciteauthor\citeauthor
        \providecommand\maskCiteauthor\Citeauthor
        \providecommand\maskciteyear\citeyear
        \providecommand\maskfootcite\footcite
        \providecommand\maskfootcitetext\footcitetext
      }{%  mask references to author

        \RequirePackage{substr}  % to allow counting of masked references
        \newcounter{maskedRefs}

        % \maskcite
        \newcommand\maskcite{\@ifnextchar[{\maskcite@@also}{\maskcite@@also[]}}
        \newcommand\maskcite@@also{}
        \def\maskcite@@also[#1]{\@ifnextchar[{\maskcite@@@also[#1]}{\maskcite@@@also[][#1]}}

        \def\maskcite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskCite
        \newcommand\maskCite{\@ifnextchar[{\maskCite@@also}{\maskCite@@also[]}}
        \newcommand\maskCite@@also{}
        \def\maskCite@@also[#1]{\@ifnextchar[{\maskCite@@@also[#1]}{\maskCite@@@also[][#1]}}

        \def\maskCite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskparencite
        \newcommand\maskparencite{\@ifnextchar[{\maskparencite@@also}{\maskparencite@@also[]}}
        \newcommand\maskparencite@@also{}
        \def\maskparencite@@also[#1]{\@ifnextchar[{\maskparencite@@@also[#1]}{\maskparencite@@@also[][#1]}}

        \def\maskparencite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskParencite
        \newcommand\maskParencite{\@ifnextchar[{\maskParencite@@also}{\maskParencite@@also[]}}
        \newcommand\maskParencite@@also{}
        \def\maskParencite@@also[#1]{\@ifnextchar[{\maskParencite@@@also[#1]}{\maskParencite@@@also[][#1]}}

        \def\maskParencite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskciteauthor
        \newcommand\maskciteauthor{\@ifnextchar[{\maskciteauthor@@also}{\maskciteauthor@@also[]}}
        \newcommand\maskciteauthor@@also{}
        \def\maskciteauthor@@also[#1]{\@ifnextchar[{\maskciteauthor@@@also[#1]}{\maskciteauthor@@@also[][#1]}}

        \def\maskciteauthor@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskCiteauthor
        \newcommand\maskCiteauthor{\@ifnextchar[{\maskCiteauthor@@also}{\maskCiteauthor@@also[]}}
        \newcommand\maskCiteauthor@@also{}
        \def\maskCiteauthor@@also[#1]{\@ifnextchar[{\maskCiteauthor@@@also[#1]}{\maskCiteauthor@@@also[][#1]}}

        \def\maskCiteauthor@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskciteyear
        \newcommand\maskciteyear{\@ifnextchar[{\maskciteyear@@also}{\maskciteyear@@also[]}}
        \newcommand\maskciteyear@@also{}
        \def\maskciteyear@@also[#1]{\@ifnextchar[{\maskciteyear@@@also[#1]}{\maskciteyear@@@also[][#1]}}

        \def\maskciteyear@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskfootcite
        \newcommand\maskfootcite{\@ifnextchar[{\maskfootcite@@also}{\maskfootcite@@also[]}}
        \newcommand\maskfootcite@@also{}
        \def\maskfootcite@@also[#1]{\@ifnextchar[{\maskfootcite@@@also[#1]}{\maskfootcite@@@also[][#1]}}

        \def\maskfootcite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskfootcitetext
        \newcommand\maskfootcitetext{\@ifnextchar[{\maskfootcitetext@@also}{\maskfootcitetext@@also[]}}
        \newcommand\maskfootcitetext@@also{}
        \def\maskfootcitetext@@also[#1]{\@ifnextchar[{\maskfootcitetext@@@also[#1]}{\maskfootcitetext@@@also[][#1]}}

        \def\maskfootcitetext@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \masktextcite
        \newcommand\masktextcite{\@ifnextchar[{\masktextcite@@also}{\masktextcite@@also[]}}
        \newcommand\masktextcite@@also{}
        \def\masktextcite@@also[#1]{\@ifnextchar[{\masktextcite@@@also[#1]}{\masktextcite@@@also[][#1]}}

        \def\masktextcite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

        % \maskTextcite
        \newcommand\maskTextcite{\@ifnextchar[{\maskTextcite@@also}{\maskTextcite@@also[]}}
        \newcommand\maskTextcite@@also{}
        \def\maskTextcite@@also[#1]{\@ifnextchar[{\maskTextcite@@@also[#1]}{\maskTextcite@@@also[][#1]}}

        \def\maskTextcite@@@also%
            [#1][#2]#3{%
                \setcounter{maskedRefs}{0}%
                \SubStringsToCounter{maskedRefs}{,}{#3}%
                \addtocounter{maskedRefs}{1}%
                \ifnum\value{maskedRefs} = 1%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citation removed for masked review})}%
                \else%
                \def\apaSeven@masked@refs{(\textit{\themaskedRefs\ citations removed for masked review})}%
                \fi%
                \apaSeven@masked@refs%
        }

      }

}



%========== APA Section spacing

\newskip\b@level@one@skip   \b@level@one@skip=2.5ex plus 1ex minus .2ex
\newskip\e@level@one@skip   \e@level@one@skip=1.5ex plus .6ex minus .1ex
\newskip\b@level@two@skip   \b@level@two@skip=2.5ex plus 1ex minus .2ex
\newskip\e@level@two@skip   \e@level@two@skip=1.5ex plus .6ex minus .1ex
\newskip\b@level@three@skip \b@level@three@skip=2.0ex plus .8ex minus .2ex
\newskip\e@level@three@skip \e@level@three@skip=1.5ex plus .6ex minus .1ex
\newskip\b@level@four@skip  \b@level@four@skip=1.8ex plus .8ex minus .2ex
\newskip\e@level@four@skip  \e@level@four@skip=1.5ex plus .6ex minus .1ex
\newskip\b@level@five@skip  \b@level@five@skip=1.8ex plus .8ex minus .2ex
\newskip\e@level@five@skip  \e@level@five@skip=0ex

\ifapamodeman{%
  \@ifundefined{def@noextraspace}{}{%
    % redefine the vertical section spacing
    \b@level@one@skip=0.2\baselineskip \@plus 0.2ex \@minus 0.2ex
    \e@level@one@skip=0.2\baselineskip \@plus .2ex
    \b@level@two@skip=0.2\baselineskip \@plus 0.2ex \@minus 0.2ex
    \e@level@two@skip=0.2\baselineskip \@plus 0.2ex
    \b@level@three@skip=0.2\baselineskip \@plus 0.2ex \@minus 0.2ex
    \e@level@three@skip=0.2\baselineskip \@plus 0.2ex
    \b@level@four@skip=0\baselineskip \@plus 0.2ex \@minus 0.2ex
    \e@level@four@skip=-\z@
    \b@level@five@skip=0\baselineskip \@plus 0.2ex \@minus 0.2ex
    \e@level@five@skip=0ex
  }
}{}



%========== APA Section heading & seriation, adapted from class apa6e

% % Below is the license statement from the apa6e class, from which a
% % small bit of code was used (with permission from Nathaniel Smith)
% % Copyright (C) 2011 by Nathaniel J. Smith <njs@pobox.com>
% %
% % Redistribution and use in source and binary forms, with or without
% % modification, are permitted provided that the following conditions are
% % met:
% %
% %    1. Redistributions of source code must retain the above copyright
% %       notice, this list of conditions and the following disclaimer.
% %
% %    2. Redistributions in binary form must reproduce the above
% %       copyright notice, this list of conditions and the following
% %       disclaimer in the documentation and/or other materials provided
% %       with the distribution.
% %
% % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
% % ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
% % LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
% % A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
% % HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
% % SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
% % LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
% % DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
% % THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
% % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
% % OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
% %

\setcounter{secnumdepth}{0}

\renewcommand{\section}{\@startsection {section}{1}{\z@}%
    {\b@level@one@skip}{\e@level@one@skip}%
    {\centering\normalfont\normalsize\bfseries}}

\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
    {\b@level@two@skip}{\e@level@two@skip}%
    {\normalfont\normalsize\bfseries}}


\newcommand*{\typesectitle}[1]{#1\addperi}

\newcommand*{\addperi}{%
  \relax\ifhmode%
    \ifnum\spacefactor>\@m \else.\fi%
  \fi%
}

\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
    {\b@level@three@skip}{\e@level@three@skip}%
    {\normalfont\normalsize\bfseries\itshape}}

\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\parindent}%
    {0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
    {-1em}%
    {\normalfont\normalsize\bfseries\typesectitle}}

\renewcommand{\subparagraph}[1]{\@startsection{subparagraph}{5}{1em}%
    {0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
    {-\z@\relax}%
    {\normalfont\normalsize\bfseries\itshape\hspace{\parindent}{#1}\textit{\addperi}}{\relax}}

% make the References section non-boldface
\AtBeginDocument{\def\st@rtbibsection{\mspart{\refname}}}%  BDB -- this is for apacite
\AtBeginDocument{\def\bibsection{\mspart{\refname}}}%  BDB -- this is for apacite + natbib
\newcommand{\mspart}{{\ifapamodeman{\clearpage}{}}\@startsection {section}{1}{\z@}%
    {\b@level@one@skip}{\e@level@one@skip}%
    {\centering\normalfont\normalsize}}

% format the table and figure captions
\RequirePackage[singlelinecheck=off]{caption}

\ifapamode{% man
   \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright\textbf{#1 #2}}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textbf{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\raggedright\textit{#1}}
    \DeclareCaptionLabelSeparator{apalabelsep}{\\}
}{% jou
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright\textbf{#1 #2}}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textbf{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}}
    \DeclareCaptionLabelSeparator{apalabelsep}{\\ \\} 
}{% doc
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright\textbf{#1 #2}}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textbf{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\raggedright\textit{#1}}
    \DeclareCaptionLabelSeparator{apalabelsep}{\\ \\} 
}
\captionsetup[table]{position=above,skip=0pt,labelformat=tablelabel,labelsep=apalabelsep,textformat=tabletext}
\captionsetup[figure]{position=above,skip=0pt,labelformat=figurelabel,labelsep=apalabelsep,textfont=it}

% space between caption and surrounding document text
% \setlength{\belowcaptionskip}{0pt}


%=============================================================
%
% End of code from apa6e
%
%=============================================================

\newcommand{\figurenote}[1]{\par \small \textit{Note.} {#1}}

% Code from theapa.sty

% Refer to LaTeX book to modify, if you want, spaces before and after of
%  \begin{...} ... \end{...} or spaces between \item-s.
\newcounter{APAenum}
\newskip\@text@par@indent
\def\APAenumerate{\@text@par@indent\parindent\setbox0\hbox{1. }%
    \list{\arabic{APAenum}.}{\usecounter{APAenum}
    \labelwidth\z@\labelsep\z@\leftmargin\z@\parsep\z@
    \rightmargin\z@\itemsep\z@\topsep\z@\partopsep\z@
    \itemindent\@text@par@indent\advance\itemindent by\wd0
    \def\makelabel##1{\hss\llap{##1 }}}}
\let\endAPAenumerate=\endlist

\def\seriate{\@bsphack\begingroup%
   \setcounter{APAenum}{0}%
   \def\item{\addtocounter{APAenum}{1}(\alph{APAenum})\space}%
   \ignorespaces}
\def\endseriate{\endgroup\@esphack}

\def\APAitemize{\@text@par@indent\parindent\setbox0\hbox{$\bullet$}%
    \list{$\bullet$}{%
    \labelwidth\z@\labelsep.5em\leftmargin\z@\parsep\z@
    \rightmargin\z@\itemsep\z@\topsep\z@\partopsep\z@
    \itemindent\@text@par@indent
    \advance\itemindent by\wd0\advance\itemindent by.5em
    \def\makelabel##1{\hss\llap{##1}}}}
\let\endAPAitemize=\endlist

% \let\enumerate=\APAenumerate
% \let\endenumerate=\endAPAenumerate
% \let\itemize=\APAitemize
% \let\enditemize=\endAPAitemize

%=============================================================
%
% End of code from theapa.sty
%
%=============================================================

%===== apa.cls main declarations for title page contents =====

\long\def\title#1{\long\def\@title{#1}}
\long\def\author#1{\authorsnames{#1}}
\long\def\affiliation#1{\ClassWarning{apa7}{Deprecated: see documentation for \string\authorsaffiliations}\authorsaffiliations{#1}}
\long\def\twoauthors#1#2{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\threeauthors#1#2#3{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\onetwoauthors#1#2#3{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\twooneauthors#1#2#3{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\fourauthors#1#2#3#4{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\fiveauthors#1#2#3#4#5{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\sixauthors#1#2#3#4#5#6{\ClassError{apa7}{Deprecated: see documentation for \string\authorsnames}{For multiple authors use \string\authorsnames}}
\long\def\twoaffiliations#1#2{\ClassError{apa7}{Deprecated: see documentation for \string\authorsaffiliations}{For multiple affiliations use \string\authorsaffiliations}}
\long\def\threeaffiliations#1#2#3{\ClassError{apa7}{Deprecated: see documentation for \string\authorsaffiliations}{For multiple affiliations use \string\authorsaffiliations}}
\long\def\fouraffiliations#1#2#3#4{\ClassError{apa7}{Deprecated: see documentation for \string\authorsaffiliations}{For multiple affiliations use \string\authorsaffiliations}}
\long\def\fiveaffiliations#1#2#3#4#5{\ClassError{apa7}{Deprecated: see documentation for \string\authorsaffiliations}{For multiple affiliations use \string\authorsaffiliations}}
\long\def\sixaffiliations#1#2#3#4#5#6{\ClassError{apa7}{Deprecated: see documentation for \string\authorsaffiliations}{For multiple affiliations use \string\authorsaffiliations}}
\long\def\course#1{\long\def\@course{#1}}
\long\def\professor#1{\long\def\@professor{#1}}
\long\def\duedate#1{\long\def\@duedate{#1}}
\long\def\shorttitle#1{\long\def\@shorttitle{#1}}
\long\def\note#1{\long\def\@note{#1}}
\long\def\abstract#1{\long\def\@abstract{#1}}
\long\def\keywords#1{\long\def\@keywords{#1}}
%\long\def\acknowledgements#1{\long\def\@acks{#1}}
\long\def\authornote#1{\long\def\@acks{#1}}
\def\journal#1{\RequirePackage{fancyhdr}\def\@journal{#1}}
\def\volume#1{\def\@vvolume{#1}}
\def\ccoppy#1{\def\@ccoppy{#1}}
\def\copnum#1{\def\@copnum{#1}}

% Combined code from https://tex.stackexchange.com/questions/297507/how-to-apply-a-do-function-to-two-lists and 
% https://www.dickimaw-books.com/latex/admin/html/exercises/oxfordcomma.shtml

% Create etoolbox lists for multiple authors and affiliations
\newcommand*\listauthors{}
\newcommand*\listsuperscripts{}
\newcommand*\listaffiliations{}

\newcommand*{\authorsnames}[2][]{
  \def\def@multipleauthors{\@multipleauthorsmode} %
  \renewcommand*\listauthors{}
  \renewcommand*\listsuperscripts{}
  \newcounter{NumberOfAuthors}
  \newcounter{NumberOfSuperscripts}
  \forcsvlist{\stepcounter{NumberOfAuthors}\listadd\listauthors}{#2}
  \forcsvlist{\stepcounter{NumberOfSuperscripts}\listadd\listsuperscripts}{#1}
  }
  
  \newcommand*{\authorsaffiliations}[1]{
  \def\def@multipleaffils{\@multipleaffilsmode} %
  \renewcommand*\listaffiliations{}
  \newcounter{NumberOfAffiliations}
  \forcsvlist{\stepcounter{NumberOfAffiliations}\listadd\listaffiliations}{#1}
  }

\makeatletter
  \catcode`\|=3
  
\def\looptwo#1#2{%
    \edef\tmp{\noexpand\xtwo%
      \unexpanded\expandafter{#1}\relax  % no added delimiter here
      \unexpanded\expandafter{#2}\relax  % no added delimiter here
    } \tmp%
  }%
  
\def\xtwo#1|#2\relax#3|#4\relax{%
    \dotwo{#1}{#3}%
    \def\tmp{#2}%
    \ifx\empty\tmp%
      \expandafter\@gobble%
    \else%
      \expandafter\@firstofone%
    \fi%
    {\xtwo#2\relax#4\relax}%
  }%

  \catcode`\|=12
\makeatother

\newcommand*{\dotwo}[2]{}

\newcommand*{\authorsep}{}%
\newcommand*{\lastauthor}{}%
\newcommand*{\prelastauthor}{}%
\newcommand*{\prelastauthorsep}{}%

\newcommand{\displayauthors}{%
  \renewcommand*{\authorsep}{}%
  \renewcommand*{\lastauthor}{}%
  \renewcommand*{\prelastauthor}{}%
  \renewcommand*{\prelastauthorsep}{}%
  \ifnum\value{NumberOfSuperscripts}=0% If no superscripts are specified, print authors without superscripts.
	\renewcommand*{\do}[1]{%
      \authorsep%
    \lastauthor%
    \renewcommand{\lastauthor}{%
      \renewcommand{\authorsep}{, 
        \renewcommand*{\prelastauthorsep}{,}}%
      \renewcommand{\prelastauthor}{\prelastauthorsep\ \lastauthorseparator\ }% Terminated commands with \ to preserve following space
      ##1%
    }%
      }%
    \dolistloop{\listauthors}%
  \else
    \renewcommand*{\dotwo}[2]{%
    \authorsep%
    \lastauthor%
    \renewcommand{\lastauthor}{%
      \renewcommand{\authorsep}{, 
        \renewcommand*{\prelastauthorsep}{,}}%
      \renewcommand{\prelastauthor}{\prelastauthorsep\ \lastauthorseparator\ }% Terminated commands with \ to preserve following space
      ##1\textsuperscript{##2}%
    }%
  }%
  \looptwo\listauthors\listsuperscripts%
  \fi
  \prelastauthor \lastauthor%
}

\newcommand{\displayaffiliations}{%
  \ifnum\value{NumberOfSuperscripts}=0% If no superscripts are specified, print affiliations without superscripts.
  \renewcommand*{\do}[1]{%
      ##1\\%
  }%
  \else
  \newcounter{AffiliationNumber}
  \renewcommand*{\do}[1]{%
      \stepcounter{AffiliationNumber}
      \textsuperscript{\arabic{AffiliationNumber}}##1\\%
  }%
  \fi
  \dolistloop{\listaffiliations}%
}

\makeatletter

\def\check@author{%
 \@ifundefined{def@multipleauthors}{%
  \ClassWarningNoLine{apa7}{Author not defined}\authorsnames{Author}}{}
 \@ifundefined{@title}{%
  \ClassWarningNoLine{apa7}{Title not defined}\def\@title{Title}}{}
 \@ifundefined{def@multipleaffils}{%
  \ClassWarningNoLine{apa7}{Affiliation not defined}\authorsaffiliations{Affiliation}}{}
   \@ifundefined{def@stu}{% man mode
   	\@ifundefined{@shorttitle}{%
 	 \ClassWarningNoLine{apa7}{Short title not defined}\def\@shorttitle{INSERT SHORTTITLE COMMAND IN PREAMBLE}}{}
 	\@ifundefined{@abstract}{%
  	\ClassWarningNoLine{apa7}{Abstract not defined}}{}
 	\@ifundefined{@keywords}{%
 	 \ClassInfo{apa7}{Keywords not defined}}{}
	 }{ % stu mode
	 \@ifundefined{@course}{%
 	 \ClassWarningNoLine{apa7}{Course title not defined}\def\@course{Course Title}}{}
 	\@ifundefined{@professor}{%
  	\ClassWarningNoLine{apa7}{Professor not defined}\def\@professor{Professor Name}}{}
 	\@ifundefined{@duedate}{%
 	 \ClassWarningNoLine{apa7}{Due date not defined}\def\@duedate{Due Date}}{}
	 \@ifundefined{@shorttitle}{%
         \def\@shorttitle{}}{}%
	 }
	 \@ifundefined{def@multipleauthors}{}{%
	   \ifnum\value{NumberOfSuperscripts}=0%
	   	% do nothing. If no superscripts are specified, print authors and affiliations without superscripts.
	   \else \ifnum\value{NumberOfAuthors}=\value{NumberOfSuperscripts}%
	         % do nothing
	         \else 
	       		\ClassError{apa7}{Number of Authors does not match number of Superscripts}{Please provide an equal number of authors and superscripts.}
		 \fi
	   \fi
          }%
}

%==== Automatic figure size and orientation determination ====

\newsavebox\gr@box
\newlength\gr@boxwidth
\newlength\gr@boxheight

\newcommand{\fitfigure}[2][0.5]{%
%\ifapamodeman
%{% man
%\sbox\gr@box{\includegraphics[width=\linewidth]{#2}}
%\settowidth{\gr@boxwidth}{\usebox\gr@box}
%\settoheight{\gr@boxheight}{\usebox\gr@box}
%\ifdim\gr@boxheight>\gr@boxwidth{% display upright (h)
% \ifdim\gr@boxheight>\textheight%
%  \centerline{\vspace{\fill}\includegraphics[height=\textheight]{#2}\vspace{\fill}}%
% \else%
%  \usebox\gr@box%
% \fi}
%\else{% display rotated
% \sbox\gr@box{\includegraphics[angle=90,width=\linewidth]{#2}}
% \settoheight{\gr@boxheight}{\usebox\gr@box}
% \ifdim\gr@boxheight>\textheight%
%  \centerline{\vspace{\fill}\includegraphics[angle=90,height=\textheight]{#2}\vspace{\fill}}%
% \else%
%  \usebox\gr@box%
% \fi}%
%\fi
%}{% jou, doc
\sbox\gr@box{\includegraphics[width=\linewidth]{#2}}
\settoheight{\gr@boxheight}{\usebox\gr@box}
\ifdim\gr@boxheight>\textheight%
 \centerline{\includegraphics[height=#1\textheight]{#2}}% need to leave space for caption
\else%
 \usebox\gr@box%
\fi
%}
}

\newcommand{\fitbitmap}[2][0.5]{ % like fitfigure but no scaling in man mode for best quality
%\ifapamodeman
%{% man
%\sbox\gr@box{\includegraphics{#2}}
%\settowidth{\gr@boxwidth}{\usebox\gr@box}
%\settoheight{\gr@boxheight}{\usebox\gr@box}
%\ifdim\gr@boxwidth>\textwidth% display rotated
%  \centerline{\vspace{\fill}\includegraphics[angle=90]{#2}\vspace{\fill}}%
%  \ifdim\gr@boxheight>\textwidth\ClassWarning{apa7}{Figure #2 too high!}\fi% display rotated
%  \ifdim\gr@boxwidth>\textheight\ClassWarning{apa7}{Figure #2 too wide!}\fi% display rotated
%\else% display upright
%  \centerline{\vspace{\fill}\includegraphics{#2}\vspace{\fill}}%
%  \ifdim\gr@boxheight>\textheight\ClassWarning{apa7}{Figure #2 too high!}\fi% display rotated
%\fi}
%{% jou, doc
\sbox\gr@box{\includegraphics[width=\linewidth]{#2}}
\settoheight{\gr@boxheight}{\usebox\gr@box}
\ifdim\gr@boxheight>\textheight%
 \centerline{\includegraphics[height=#1\textheight]{#2}}% need to leave space for caption
\else%
 \centerline{\usebox\gr@box}%
\fi
%}
}

%==== Miscellaneous definitions

\let\normal@BBAB\BBAB                        % -- thp 2005/07/23
\let\table@BBAB\BBAA                         % -- thp 2005/07/23

\setlength{\doublerulesep}{\arrayrulewidth}
\newcommand\thickline{\hline\hline}
\renewcommand\footnoterule{%
  \kern-3\p@
%  \hrule.5\@width.4\columnwidth
  \hrule height0.125pt width.5in
  \kern2.6\p@}

\let\apaSeventabular\tabular
\let\apaSeven@doc@tabular\tabular
%\let\old@tabular\tabular
%\def\apaSeventabular#1{\def\@halignto{to\linewidth}%
% \let\BBAB\table@BBAB%                         -- thp 2005/07/23
% \@tabular{@{\extracolsep{\fill}}#1}}
%\def\apaSeven@doc@tabular{%% thp 2006/01/02
% \let\BBAB\table@BBAB%% Erik Meijer noticed that in doc mode tables weren't centered
% \hfill\old@tabular} %% and that the in-table citation form was incorrect
%%
\let\apaSeven@doc@endtabular\endtabular
%\let\orig@endtabular\endtabular              % -- thp 2005/07/23
%\def\endtabular{%
% \let\BBAB\normal@BBAB%                        -- thp 2005/07/23
% \orig@endtabular\ifapamodedoc{\hfill}{}}% 2006/01/02 \hfill for centering in doc mode
%\def\apaSeven@doc@endtabular{%% thp 2006/01/03
% \let\BBAB\normal@BBAB% %% separate redefinition of tabular/endtabular for doc mode
% \orig@endtabular\hfill}%% to ensure centering, especially in case array.sty is loaded

% Define footnote mark commands for tables that won't mess up vertical alignment
\def\@tab@fn#1{\ensuremath{^{\mbox{{\scriptsize #1}}}}}
\def\tabfnm#1{\rlap{\@tab@fn{#1}}}
%\def\tabfnt#1#2{\par\raggedright\@tab@fn{#1}#2}%BDB
\def\tabfnt#1#2{\raggedright\@tab@fn{#1}#2}

% Provide a command to display vector symbols appropriately in each mode, thp 10/00
% Use improved definition of apaSevenvector provided by Erik Meijer -- 2005/12/28
\def\apaSevenvector#1{{\ensuremath
  \uprightlowercasegreek
  \ifapamodeman
  {\apaSevensmash{\mathop{\kern\z@\mathrm{#1}}\limits_{\scriptscriptstyle\sim}}}%
  {\if@bm@loaded\bm{\mathrm{#1}}\else\mathbf{#1}\fi% in case bm is not available
  }%
}}
% and here are the necessary definitions & packages, as instructed by Erik Meijer
\newcommand{\apaSevensmash}{%
  \def\finsm@sh{\dp\z@\z@ \box\z@}%
  \expandafter\mathpalette\expandafter\mathsm@sh
}%
\newif\if@bm@loaded\@bm@loadedfalse
\IfFileExists{bm.sty}{\RequirePackage{bm}\@bm@loadedtrue}{}% if not, apaSevenvector will fail
\newcommand{\uprightlowercasegreek}{%
  \@ifundefined{alphaup}{}{%
    \def\alpha     {\alphaup     }%
    \def\beta      {\betaup      }%
    \def\gamma     {\gammaup     }%
    \def\delta     {\deltaup     }%
    \def\epsilon   {\epsilonup   }%
    \def\varepsilon{\varepsilonup}%
    \def\zeta      {\zetaup      }%
    \def\eta       {\etaup       }%
    \def\theta     {\thetaup     }%
    \def\vartheta  {\varthetaup  }%
    \def\iota      {\iotaup      }%
    \def\kappa     {\kappaup     }%
    \def\lambda    {\lambdaup    }%
    \def\mu        {\muup        }%
    \def\nu        {\nuup        }%
    \def\xi        {\xiup        }%
    \def\pi        {\piup        }%
    \def\varpi     {\varpiup     }%
    \def\rho       {\rhoup       }%
    \def\varrho    {\varrhoup    }%
    \def\sigma     {\sigmaup     }%
    \def\varsigma  {\varsigmaup  }%
    \def\tau       {\tauup       }%
    \def\upsilon   {\upsilonup   }%
    \def\phi       {\phiup       }%
    \def\varphi    {\varphiup    }%
    \def\chi       {\chiup       }%
    \def\psi       {\psiup       }%
    \def\omega     {\omegaup     }%
  }%
}
\let\apaSevenmatrix\apaSevenvector

%==== Appendix macros added by Michael Erickson 2000/07/11, revised by thp 2000/07/18

\newcounter{appendix}\setcounter{appendix}{0}
\renewcommand{\theappendix}{\@Alph\c@appendix}
\def\apaSevenappfig{%
 \renewcommand\thefigure{\theappendix\@arabic\c@figure}%
 \ifapamodeman{\renewcommand\thepostfig{\theappendix\arabic{postfig}}}{}}
\def\apaSevenapptab{%
 \renewcommand\thetable{\theappendix\@arabic\c@table}%
 \ifapamodeman{\renewcommand\theposttbl{\theappendix\arabic{posttbl}}}{}}
\newif\ifoneappendix
\oneappendixtrue % one appendix by default
\newif\ifappendix
\appendixfalse

\def\appendix{%
%
  \ifapamodeman{\processdelayedfloats}{}%  BDB -- output all tables and figures prior to the appendix
%
  \appendixtrue
  \apaSevenappfig
  \apaSevenapptab
%  \ifapamodejou{}{\clearpage} %% commented out -- thp 2005/07/23
  \let\old@apaSeven@section=\section % This will not work right with five levels in appendix.
                                 % Should go into \section, not \leveltwo but would also require
                                 % changes to section* and section[ (see \def\section above)
                                 % Who uses five level heading appendices anyway?
%  \newlength{\app@t@width}
%  \setlength{\app@t@width}{\columnwidth}
%  \addtolength{\app@t@width}{-8em}%% leveltwo is defined with leftskip=rightskip=4em plus 1fill
  \long\def\section##1{%
                   \makeatletter%
                     \def\@currentlabelname{##1}%
                   \makeatother%
                   \ifapamodeman{%
                    \clearpage
                    \setcounter{postfig}{0}
                    \setcounter{posttbl}{0}
%                    \efloat@condopen{fff}
%                    \efloat@iwrite{fff}{\string\addtocounter{appendix}{1}}
%                    \efloat@iwrite{fff}{\string\setcounter{figure}{0}}
%                    \efloat@condopen{ttt}
%                    \efloat@iwrite{ttt}{\string\addtocounter{appendix}{1}}
%                    \efloat@iwrite{ttt}{\string\setcounter{table}{0}}%
                   }{%
%                    \setcounter{figure}{0}%
%                    \setcounter{table}{0}%
%                    \vskip2.5ex%
%                    %\small% the appendix should be set in smaller type in jou, including headers!
                   }%
                    \setcounter{figure}{0}%
                    \setcounter{table}{0}%
                    \vskip2.5ex%
%                  \addtocounter{appendix}{1}%
                   \refstepcounter{appendix}% 2002/07/20 this takes care of references too
                   \ifnum\c@appendix>1\immediate\write\@auxout{\global\string\oneappendixfalse}\fi%
%                   \old@apaSeven@section{%
%                      \old@tabular[t]{@{}p{\app@t@width}@{}}% tabular may have been redefined
%                         \centering{%
%                          \appendixname\ifoneappendix\else~\theappendix\fi\\
%                          ##1%
%                      }\endtabular
%                   }%
%
                      \centerline{\normalfont\normalsize\textbf\appendixname\ifoneappendix\else~\textbf\theappendix\fi}%
                      \centerline{\normalfont\normalsize\bfseries##1}\par%
                      \setlength{\parindent}{0.5in}
                      \makeatletter%
                        \@afterindentfalse%
                        \@afterheading%
                      \makeatother%
%
                  }%
%
} % end of appendix definition

%==== End of general apa.cls macro definitions ====


%%%%%%%%%%%%%%%%%%%%%%%%%
%%                     %%
%%  MANUSCRIPT FORMAT  %%
%%           AND STUDENT        %%
%%                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%

\@ifundefined{def@man}{}{%

% \def\@@spacing{1.75}
\def\@@spacing{1.655}

\newcommand{\@doublespacing}{\linespread{1.655}}
\@doublespacing

% allow a little more space between captions and floats in man mode
\captionsetup[table]{skip=10pt}
\captionsetup[figure]{skip=10pt}

\def\rightheader#1{\def\r@headr{\protect\MakeUppercase{#1}}}
\def\leftheader#1{\def\r@headl{#1}}
%\def\shorttitle#1{\def\s@title{#1}}%\markright{\hfill #1 \thepage} %% no rm - thp 020227

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\newcommand{\shorttitle}[1]{\def\@shorttitle{#1}}

\raggedright

\RequirePackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}

\fancypagestyle{titlepage}{%
    \lhead{\MakeUppercase{\@shorttitle}}%
    \rhead{\thepage}%
}
\fancypagestyle{otherpage}{%
    \lhead{\MakeUppercase{\@shorttitle}}%
    \rhead{\thepage}%
}
\pagestyle{otherpage}

%========== Alterations to endnotes ===================

%\RequirePackage{endnotes}
%
%% added by BDB to make section heading non-bolface
%\def\enoteheading{\section*{\normalfont\normalsize\notesname
%  \@mkboth{\MakeUppercase{\notesname}}{\MakeUppercase{\notesname}}}%
%  \mbox{}\par\vskip-\baselineskip}
%
%
%\def\@makeenmark{\hbox{$^{\mbox{\small\@ifundefined{hrm}{}{\sf}\@theenmark}}$}}
%\def\enoteformat{\rightskip\z@ \leftskip\z@
%     \raggedright\fussy\hyphenpenalty 10000 \parindent=0.4in
%     \leavevmode\llap{\hbox{$^{\mbox{\small\@ifundefined{hrm}{}{\sf}\@theenmark}}$}}}
%\AtEndDocument{%
% \ifappendix% set section back to no numbering after appendix
%  \appendixfalse\let\section=\old@apaSeven@section%
% \fi
%% \@ifundefined{@acks}{}{\newpage\section{\acksname}\@acks}
% \@ifundefined{hrm}{\def\enotesize{\normalsize}}
%                   {\def\enotesize{\normalsize\@ifundefined{hrm}{}{\sf}}}
% \@ifundefined{NoEndnotes}{\if@enotesopen\newpage\theendnotes\fi}{}
% \let\footnote=\oldfootnote
%}

%========= Alterations to endfloat ====================

% prepare to bypass endfloat for any tables or figures in appendices
\let\@noendfloattab\table% BDB
\let\@noendfloatfig\figure% BDB

% \@ifundefined{float@mark}{% Figure and table in-text markers are no longer required
%  \RequirePackage[notablist,figlist,notabhead,nofighead,tablesfirst,nomarkers]{endfloat}[1995/10/11]}{%
%  \RequirePackage[notablist,figlist,notabhead,nofighead,tablesfirst]{endfloat}[1995/10/11]}

\RequirePackage[notablist,figlist,notabhead,nofighead,tablesfirst,nomarkers]{endfloat}[1995/10/11]

%\renewcommand{\figureplace}{%
%   \par\begin{center}
%   \parbox{\textwidth}
%   {\begin{center}
%   \rule{2.1in}{0.005in}\\
%   Insert \figurename~\thepostfig\ about here\\
%   \rule{2.1in}{0.005in}\\
%   \end{center}}
%   \end{center}\par}
%\renewcommand{\tableplace}{%
%   \par\begin{center}
%   \parbox{\textwidth}
%   {\begin{center}
%   \rule{2.1in}{0.005in}\\
%   Insert \tablename~\theposttbl\ about here\\
%   \rule{2.1in}{0.005in}\\
%   \end{center}}
%   \end{center}\par}

\def\@gobbleuntilnext[#1]{}
\let\eatarg\@gobbleuntilnext
\let\ifnextchar\@ifnextchar

\@ifundefined{def@floatsintext}{%  Guillaume Jourjon 19/10/10
  \def\figure{%
      \ifappendix
          \vspace*{\intextsep}
          \def\fps@figure{!hbt}%
          \@noendfloatfig
      \else
           \efloat@condopen{fff}
           \@nameuse{efloat@separator@fff}%
           \efloat@iwrite{fff}{\string\begin{figure*}[hbt]}%
           \global\def\@figure@written{\relax}% Set a flag that there is at least one figure -- thp 20010705
      %% should be a global declaration to be "visible" at end document
           \ifnextchar[{\gobbleuntilnext[}{}
           \efloat@iwrite{fff}{\string\ifnextchar[{\string\eatarg}{}}
%          \if@domarkers%
%             \addtocounter{postfig}{1}% % bj
%             \figureplace%              % bj
%          \fi%
          \def\@currenvir{efloat@float}%
          \begingroup%
          \let\do\ef@makeinnocent \dospecials%
          \ef@makeinnocent\^^L% and whatever other special cases
          \endlinechar`\^^M \catcode`\^^M=12 \ef@xfigure%
      \fi%
  }%

  \def\table{%
      \ifappendix
          \vspace*{\intextsep}
          \def\fps@table{!hbt}
          \@noendfloattab
      \else
          \efloat@condopen{ttt}
          \@nameuse{efloat@separator@ttt}%
          \efloat@iwrite{ttt}{\string\begin{table*}[hbt]}%
          \ifnextchar[{\gobbleuntilnext[}{}
          \@ifundefined{hrm}{}{%
          \efloat@iwrite{ttt}{\string\sf}}%
          \efloat@iwrite{ttt}{\string\ifnextchar[{\string\eatarg}{}} % bj
%          \if@domarkers
%             \addtocounter{posttbl}{1} % bj
%             \tableplace               % bj
%          \fi
          \def\@currenvir{efloat@float}%
          \begingroup
          \let\do\ef@makeinnocent \dospecials
          \ef@makeinnocent\^^L% and whatever other special cases
          \endlinechar`\^^M \catcode`\^^M=12 \ef@xtable%
      \fi
  }%

% for rotated tables, per Ulrike Fischer:  http://tex.stackexchange.com/a/79843
  \RequirePackage{etoolbox}
  \AtEndPreamble{%
    \@ifpackageloaded{rotating}{%
      \DeclareDelayedFloatFlavor{sidewaystable}{table}
      \DeclareDelayedFloatFlavor{sidewaysfigure}{figure}
      }{}%
  }%

}{%
  \RequirePackage{float}
  \floatplacement{figure}{htb}
  \def\figure{\@float{figure}}
  \def\endfigure{\end@float}

  \floatplacement{table}{htb}
  \def\table{\@float{table}}
  \def\endtable{\end@float}
}

%%%%%%%%%%%%%%\long\def\@@contentsline#1#2#3{ #2 }
%%%%%%%%%%%%%%\long\def\numberline#1#2{\noindent{\em\figurename\ #1.\/} #2\vspace{0.5\baselineskip}\par}
%%%%%%%%%%%%%%\long\def\@@caption{\refstepcounter\@captype \@dblarg{\@@@caption\@captype}}
%%%%%%%%%%%%%%\long\def\@@@caption#1[#2]#3{\addcontentsline{\csname
%%%%%%%%%%%%%%  ext@#1\endcsname}{#1}{\protect\numberline{\csname
%%%%%%%%%%%%%%  the#1\endcsname}{\ignorespaces #2}}}
%\def\listoffigures{\section*{\figurecaptionsname}\@starttoc{lof}}% changed from 'Figure Captions'

%\long\def\figurecaptionsformat{
%  \let\contentsline=\@@contentsline
%  \let\numberline=\@@numberline
%  \def\baselinestretch{\@@spacing}
%}

\def\processfigures{%
 \expandafter\ifnum \csname @ef@fffopen\endcsname>0
  \immediate\closeout\efloat@postfff \ef@setct{fff}{0}
  \clearpage
  \if@figlist
   \@ifundefined{@figure@written}{}{%
%    \figurecaptionsformat
    {\normalsize\@ifundefined{hrm}{}{\sf}%
%     \let\BBAB\table@BBAB% -- thp 2005/07/23
%     \listoffigures%
%     \let\BBAB\normal@BBAB% -- thp 2005/07/23
    }
%    \clearpage
   }
  \fi
%  \if@fighead
%     \section*{\figuresection}
%     \suppressfloats[t]
%  \fi
  \@ifundefined{fig@num}{%
%  \markboth{}{}
   \pagestyle{otherpage}
%  \pagestyle{empty}%
  }{%
  \setcounter{page}{1}
%  \markright{\rm\hfill \s@title, Figure}
   \def\@oddhead{\rightmark}                                    % changed by Michael Erickson
   \markright{\hfill \s@title, \figurename\ \protect\thefigure} % to include appendix numbering
                                                                % remove rm - thp 020227
  }
%  \let\caption=\@@caption
  \def\baselinestretch{\@@spacing}\normalsize\@ifundefined{hrm}{}{\sf}
  \processfigures@hook \@input{\jobname.fff}
 \fi}

\def\processtables{%
  \expandafter\ifnum \csname @ef@tttopen\endcsname>0
  \immediate\closeout\efloat@postttt \ef@setct{ttt}{0}
  \clearpage
  \if@tabhead
      \section*{\tablesection}
      \suppressfloats[t]
  \fi
  \def\baselinestretch{\@@spacing}
  \processtables@hook \@ifundefined{hrm}{}{\sf}%
  \tiny\normalsize%
% We need to deal with citation alterations here because otherwise we either
% lose the definition through the .ttt diversion or we miss the table*
  \let\BBAB\table@BBAB%  -- thp 2005/07/23
  \@input{\jobname.ttt}%
  \let\BBAB\normal@BBAB% -- thp 2005/07/23
 \fi}



%========== Alterations to captions (BDB) ===================

\captionsetup{justification=raggedright}


%========= Maketitle, margins, lengths, etc. ==========

\def\maketitle{
\@ifundefined{hrm}{}{\hrm}
 \check@author
% \@ifundefined{s@title}{\ClassInfo{apa7}{Using title for short title}
%                        \def\s@title{\@title}
%                        \markright{\hfill\@title}}%\protect\thepage}}  %% removed rm
%                       {\markright{\hfill\s@title}}%\protect\thepage}} %% thp 020227
% \@ifundefined{r@headr}{\ClassInfo{apa7}{Using short title for running head}
%                        \def\r@headr{\protect\MakeUppercase{\s@title}}}{}


  \begin{center}
  
%  \makebox[\linewidth][l]{\rheadname\hspace{0.1in}\MakeUppercase{\r@headr}}\\ %thp090298

  \vspace*{4\baselineskip}
  \textbf\@title%
  \ifapamodeman{%
    \@ifundefined{def@noextraspace}{%
      \vspace{\baselineskip}\\
    }{}
  }{%
    \vspace{\baselineskip}\\
  }
\@ifundefined{def@stu}{ %Professional manuscript
  \@ifundefined{apaSeven@maskauthoridentity}{%  BDB
      
      \displayauthors \\
      \displayaffiliations

      \@ifundefined{@note}
       {\vspace*{\baselineskip} }
       {\@note}

  }{%  mask author identity -- show nothing in the author or author note space
  }

  \end{center}

  \@ifundefined{apaSeven@maskauthoridentity}{
      \@ifundefined{@acks}
       {}
       {%
         \vfill%
        \section{\normalfont\normalsize\textbf\acksname}
         \raggedright
         \setlength{\parindent}{0.5in}
         \indent\@acks\par%
       }
  }{%  mask author identity -- show nothing in the author or author note space
  }}{% Student Manuscript
      \displayauthors \\
      
      \displayaffiliations
      
      \@course \\ 
      \@professor \\ 
      \@duedate \\ 
      
      \@ifundefined{@note}
       {\vspace*{\baselineskip} }
       {\@note}
       
        \end{center}
       
       \@ifundefined{@acks}
       {}
       {%
         \vfill%
        \section{\normalfont\normalsize\textbf\acksname}
         \raggedright
         \setlength{\parindent}{0.5in}
         \indent\@acks\par%
       }
  
  }
  \newpage
  %BDB\hyphenpenalty 10000
  \fussy
  \@ifundefined{@abstract}{}{%
    \section{\normalfont\normalsize\textbf\abstractname}% BDB
    \noindent\@abstract\par% BDB
    \@ifundefined{@keywords}{}{%
      \setlength{\parindent}{0.5in}% BDB
      \indent\textit{\keywordname:} \@keywords%
    }%
    \newpage
  }

  \@ifundefined{def@donotrepeattitle}{
    \section{\protect\normalfont\textbf{\@title}}
  }{}%
  \raggedright%
  \setlength{\parindent}{0.5in}%
%  \indent%
}

\thispagestyle{titlepage}

%\ThreeLevelHeading
% \def\baselinestretch{\@@spacing}

% footnote issues: separate multiple footnotes on the same page:
\setlength{\footnotesep}{16pt}

% make footnotes ragged-right (credit to Mako Hill):
\renewcommand\@makefntext[1]{\raggedright\textsuperscript{\@thefnmark}~#1}

%\setlength{\topmargin}{0in}
%\setlength{\oddsidemargin}{0.25in}
%\setlength{\evensidemargin}{0.25in}
%\setlength{\textwidth}{6in}
%\setlength{\textheight}{8.5in}
%\setcounter{secnumdepth}{0}
%
%\def\ps@myheadings{
% \let\@mkboth\@gobbletwo
% \def\@oddhead{\hbox{}\rightmark\hfil\hspace{0.1in}\thepage} %% removed rm - thp 020227
% \def\@oddfoot{}
% \def\@evenhead{}
% \def\@evenfoot{}
% \def\sectionmark##1{}
% \def\subsectionmark##1{}}

%\pagestyle{myheadings}
%\raggedright
%BDB\hyphenpenalty 10000
\newcommand{\footmark}[1]{${}^{\mbox{\normalsize #1}}$}

%\long\def\@makecaption#1#2{%
% \let\BBAB\table@BBAB % thp 2005/07/23
% \vskip10pt%
% \setbox\@tempboxa\hbox{\parbox{\columnwidth}{#1\cap@line{\cap@style #2}}}%
% \ifdim\wd\@tempboxa>\hsize\parbox{\columnwidth}{#1\cap@line{\cap@style #2}}\par%
% \else\hbox to\hsize{\box\@tempboxa\hfil}\par%
% \fi%
% \let\BBAB\normal@BBAB % thp 2005/07/23
% \vskip\baselineskip}
%
%\long\def\@caption#1[#2]#3{\par\addcontentsline{\csname
%  ext@#1\endcsname}{#1}{\protect\numberline{\csname
%  the#1\endcsname}{\ignorespaces #2}}\begingroup
%    \@parboxrestore
%    \normalsize\@ifundefined{hrm}{}{\hrm}
%    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3 } \par
%  \endgroup}
%
%\def\caption{\refstepcounter\@captype \@dblarg{\@caption\@captype}}
%
%\def\centeredcaption#1{\caption}
%
%\def\fnum@figure{\def\cap@style{}\def\cap@line{}{\em\figurename\ {\thefigure}}. }
%% added second set of braces around \em  to get citations in man mode -- tp 17/7/2000
%% then removed them again because they were cancelling application of em to the caption
%\long\def\fnum@table{\def\cap@style{\em}\def\cap@line{\\ }\tablename\ \thetable }

\setcounter{topnumber}{1}
\def\topfraction{.7}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.6}
\setcounter{totalnumber}{1}
\def\textfraction{0}
\def\floatpagefraction{.7}
\setcounter{dbltopnumber}{1}
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.7}
\def\dbltextfloatsep{\textfloatsep}

\fussy
%\setlength{\parindent}{0.4in}
%\let\oldfootnote=\footnote % 3/10/00
%\let\footnote=\endnote
%\def\footnotesize{\normalsize\rm}

\@ifundefined{def@nosf}{%
\def\helvetica{%
\ClassWarning{apa7}{ignored \string\helvetica\space (use helv option)}
}}{\def\helvetica{\relax}}

%==== Appendix definitions added by Michael Erickson 2000/07/11

%\efloat@condopen{fff}
%\efloat@iwrite{fff}{\string\apaSevenappfig}
%\efloat@iwrite{fff}{\string\setcounter{appendix}{0}}
%\efloat@condopen{ttt}
%\efloat@iwrite{ttt}{\string\apaSevenapptab}
%\efloat@iwrite{ttt}{\string\setcounter{appendix}{0}}

}% end of man mode (manuscript format)


%%%%%%%%%%%%%%%%%%%%
%%                %%
%% JOURNAL FORMAT %%
%%                %%
%%%%%%%%%%%%%%%%%%%%

\@ifundefined{def@jou}{}{%

\renewcommand{\addORCIDlink}[2]{\href{https://orcid.org/#2}{{\mbox{\scalerel*{
\begin{tikzpicture}[yscale=-1,transform shape]
\pic{orcidlogo};
\end{tikzpicture}
}{|}}} #1}}

%========== balance last-page columns =================

% need the `keeplastbox' option to allow final reference to be
% properly indented on the final line
% https://tex.stackexchange.com/questions/198287/reference-and-biography-indentation-issue
\IfFileExists{flushend.sty}{\RequirePackage[keeplastbox]{flushend}}{}

%========== ftnright and alterations ==================

\IfFileExists{ftnright.sty}{
 \let\savefootnoterule\footnoterule
 \let\save@makefntext\@makefntext
 \RequirePackage{ftnright}
 \let\footnoterule\savefootnoterule
 \let\@makefntext\save@makefntext
}{}

%======================================================

\def\rightheader#1{\def\r@headr{\protect\MakeUppercase{\protect\scriptsize #1}}}
\def\leftheader#1{\def\r@headl{\protect\MakeUppercase{\protect\scriptsize #1}}}
\def\r@headr{\protect\MakeUppercase{\protect\scriptsize\@shorttitle}}% BDB
%%%%%%%%%%%%%%%%%%%%%%%\def\shorttitle#1{\def\r@headr{\protect\MakeUppercase{\protect\scriptsize #1}}}% BDB

\def\maketitle{
 \check@author
 \@ifundefined{r@headr}{\def\r@headr{\protect\MakeUppercase{\protect\scriptsize\@title}}}{}
 \@ifundefined{r@headl}{\def\r@headl{ADD \\LEFTHEADER COMMAND}}{}

\twocolumn[  % anything appearing within the brackets is set in one-column mode
  \vspace{0.03in}
  \begin{center}
% title
  {\LARGE \@title}\\
  \vspace{-0.05in}

  \@ifundefined{apaSeven@maskauthoridentity}{%  BDB

	\parbox[t]{\textwidth}{\begin{center}{\large \displayauthors\vspace{0in}}%

	{\displayaffiliations\vspace{0.05in}}\end{center}}
	
      \@ifundefined{@note}
       {\vspace{0.07in}}
       {\vspace{0.07in}\\ {\large\@note\vspace{0.07in}}}

  }{%  mask author identity -- show nothing in the author or author space
    \vspace{0.32in}
  }


  \@ifundefined{@abstract}
  {\par }
  {\par \parbox{4.6875in}
   {\small \noindent \@abstract
     \@ifundefined{@keywords}{}{%
      \par\vspace{0.12in}\raggedright\textit{\keywordname:} \@keywords%
     }%
   }
   \vspace{0.24in}%
  }
  \end{center}
 ] % end of \twocolumn[]

 \pagenumbering{arabic}
 \@ifundefined{@journal}{\thispagestyle{empty}}{%
  \@ifundefined{@vvolume}{\def\@vvolume{\strut}}{}%
  \@ifundefined{@copnum}{\def\@copnum{\strut}}{}%
  \@ifundefined{@ccoppy}{\def\@ccoppy{\strut}}{}%
  \fancyhead{}
  \fancyhead[LO]{\stiny{\@journal}\vspace{-0.15\baselineskip}\\
                 \stiny{\@vvolume}}
  \fancyhead[RO]{\stiny{\@ccoppy}\vspace{-0.15\baselineskip}\\
                 \stiny{\@copnum}}
  \fancyfoot[CO]{\small\rm\thepage}
  % the following are needed if the starting page number is changed to
  % an even number:
  \fancyhead[LE]{\stiny{\@journal}\vspace{-0.15\baselineskip}\\
                 \stiny{\@vvolume}}
  \fancyhead[RE]{\stiny{\@ccoppy}\vspace{-0.15\baselineskip}\\
                 \stiny{\@copnum}}
  \fancyfoot[CE]{\small\rm\thepage}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  \thispagestyle{fancy}
 }

  \@ifundefined{apaSeven@maskauthoridentity}{%  BDB
     \@ifundefined{@acks}
      {}
      {\begin{figure}[b]
       \parbox{\columnwidth}{\setlength{\parindent}{0.18in}
       \noindent\makebox[\columnwidth]{\vrule height0.125pt width\columnwidth}\vspace*{0.05in}\par
       {\footnotesize\hspace{-0.04in}\@acks\par}}
       \end{figure}}
  }{%  mask author identity -- show nothing in the author note space
  }

  \@ifundefined{apaSeven@maskauthoridentity}{%  BDB
     \markboth{\hfill\r@headl\hfill}{\hfill\r@headr\hfill}
  }{%  mask author identity -- show the short title for both the left and right headers
     \markboth{\hfill\r@headr\hfill}{\hfill\r@headr\hfill}
  }
 \@ifundefined{no@tab}{\let\tabular\apaSeventabular}{}
 %\noindent
}

\newcommand\stiny{\@setfontsize\stiny\@vipt\@viipt}

%\ThreeLevelHeading
%\def\baselinestretch{0.923}
%\def\refname{References}
\setlength{\footnotesep}{0.2813in}
\setlength{\topmargin}{-0.275in}
\addtolength{\headheight}{0.02in}
\addtolength{\headsep}{-0.156in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\evensidemargin}{-0.25in}
\setlength{\textwidth}{6.94in}
\setlength{\textheight}{8.9in}
\setlength{\columnwidth}{8.5cm}
\setlength{\columnsep}{0.25in}
\setlength{\parindent}{0.15625in}
%%\setlength{\parskip}{0in}
\setlength{\textfloatsep}{0.35in}
%\flushbottom

\setcounter{secnumdepth}{0}

\def\ps@myheadings{%
  \let\@mkboth\@gobbletwo
  \def\@oddhead{\hbox{}\rightmark \hfil\rm\thepage}
  \def\@oddfoot{}
  \def\@evenhead{\rm\thepage\hfil\leftmark\hbox{}}
  \def\@evenfoot{}
  \def\sectionmark##1{}
  \def\subsectionmark##1{}
}
\pagestyle{myheadings}

%\long\def\@makecaption#1#2{%
%  \let\BBAB\table@BBAB % thp 2005/07/23
%  \vskip\abovecaptionskip
%  \sbox\@tempboxa{#1 #2}%
%  \ifdim \wd\@tempboxa >\hsize
%    #1 #2\par
%  \else
%    \global \@minipagefalse
%    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
%  \fi
%  \let\BBAB\normal@BBAB % thp 2005/07/23
%  \vskip\belowcaptionskip}
%
%\long\def\@makeccaption#1#2#3{
% \let\BBAB\table@BBAB % thp 2005/07/23
% \vskip\abovecaptionskip
% \setbox\@tempboxa\hbox{#1 #2}
% \ifdim \wd\@tempboxa > \hsize
%    \hbox to\hsize{\hfil\parbox[t]{#3}{#1 #2}\hfil}
%  \else
%    \ifdim \wd\@tempboxa > #3
%      \hbox to\hsize{\hfil\parbox[t]{#3}{#1 #2}\hfil}
%    \else
%      \hbox to\hsize{\hfil\mbox{#1 #2}\hfil}
%    \fi
% \fi
% \let\BBAB\normal@BBAB % thp 2005/07/23
% \vskip\belowcaptionskip}
%
%\long\def\@caption#1[#2]#3{\par\addcontentsline{\csname
%  ext@#1\endcsname}{#1}{\protect\numberline{\csname
%  the#1\endcsname}{\ignorespaces #2}}\begingroup
%    \@parboxrestore
%    \normalsize
%    \csname setcskip@#1\endcsname
%    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%  \endgroup}
%
%\long\def\@ccaption#1[#2]#3#4{\def\@ccwidth{#3} \par\addcontentsline{\csname
%  ext@#1\endcsname}{#1}{\protect\numberline{\csname
%  the#1\endcsname}{\ignorespaces #2}}\begingroup
%    \@parboxrestore
%    \normalsize
%    \@makeccaption{\csname fnum@#1\endcsname}{\ignorespaces #4}{\@ccwidth}\par
%  \endgroup}
%
%\def\caption{\refstepcounter\@captype \@dblarg{\@caption\@captype}}
%
%\long\def\centeredcaption{\refstepcounter\@captype \@dblarg{\@ccaption\@captype}}
%
%\def\setcskip@table{\setlength{\abovecaptionskip}{3.2pt}\setlength{\belowcaptionskip}{2pt}}
%\def\setcskip@figure{\setlength{\abovecaptionskip}{-0.04in}\setlength{\belowcaptionskip}{-1.9pt}}
%
%\def\fnum@figure{\small{\em\figurename\ {\thefigure}}.\hspace{0.07in}}
%\long\def\fnum@table{\makebox[\linewidth][l]{\tablename\ \thetable} \\ \em }
%
%\def\@makefnmark{\hbox{\@textsuperscript{\normalfont{\scriptsize\@thefnmark}}}}%
%\long\def\@makefntext#1{\parindent 1em\noindent
%           \hb@xt@1.8em{%
%           \hss\@textsuperscript{\normalfont{\tiny\@thefnmark}\hspace{1.5pt}}}#1}%


\setcounter{topnumber}{2}
\def\topfraction{.85}
\setcounter{bottomnumber}{2}
\def\bottomfraction{.75}
\setcounter{totalnumber}{3}
\def\textfraction{.10}
\def\floatpagefraction{.85}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.85}
\def\dblfloatpagefraction{.85}
\def\dbltextfloatsep{0.8\textfloatsep}
\let\footnotesize=\small

\def\helvetica{\relax}

\doublehyphendemerits5000
\hfuzz0pt
\tolerance=9999
\pretolerance=-1
\emergencystretch=25pt
\hbadness=30000
\hyphenpenalty=100


\@ifundefined{def@apacite}{}{% -- Philip Kime 2008/12/03
  % Removed some bibliography redefinitions as per the instructions of Erik Meijer
  \bibleftmargin=1.2em        % left these in because the default is too big
  \bibindent=-\bibleftmargin  % and this is apparently not refefined each time
  \renewcommand{\bibliographytypesize}{\footnotesize}}
\@ifundefined{def@natbib}{}{% -- Philip Kime 2008/12/03
  % Removed some bibliography redefinitions as per the instructions of Erik Meijer
  \bibleftmargin=1.2em        % left these in because the default is too big
  \bibindent=-\bibleftmargin  % and this is apparently not refefined each time
  \renewcommand{\bibliographytypesize}{\footnotesize}}



%\@ifundefined{def@noapacite}{% -- Philip Kime 2008/12/03
%  % Removed some bibliography redefinitions as per the instructions of Erik Meijer
%  \bibleftmargin=1.2em        % left these in because the default is too big
%  \bibindent=-\bibleftmargin  % and this is apparently not refefined each time
%  \renewcommand{\bibliographytypesize}{\footnotesize}}{}

}% end of jou mode (journal format)

%%%%%%%%%%%%%%%%%%%%
%%                %%
%% REGULAR FORMAT %%
%%                %%
%%%%%%%%%%%%%%%%%%%%

\@ifundefined{def@doc}{}{%

%\pagestyle{myheadings}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\renewcommand{\shorttitle}[1]{\def\@shorttitle{#1}}

\def\leftheader#1{\def\r@headl{#1}}

\RequirePackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}

\fancypagestyle{otherpage}{%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \lhead{\MakeUppercase{\@shorttitle}}%
    \rhead{\thepage}%
}
\pagestyle{otherpage}

\def\maketitle{
 \global\@topnum\z@  % to prevent tables before the title   %% Erik Meijer, 2006/01/03
 \@ifundefined{@acks}{% if there acknowledgements they make up a "float" on the 1st page
 \global\@botnum\z@}{% to prevent tables on the first page  %% Erik Meijer, 2006/01/03
 \global\@botnum\@ne}% to prevent tables below the footnote -- thp 2006/01/10
 \check@author
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \@ifundefined{r@headr}{\typeout{Using title for running head}
                        \def\r@headr{\protect\MakeUppercase{\@title}}
                        \markright{\rm \@title \protect\\ \thepage}}{}
 \@ifundefined{r@headl}{\let\r@headl\r@headr}{}
 \@ifundefined{s@title}{\let\s@title\r@headr}{}
  \sloppy
  \setlength{\parindent}{0.5in}
  \begin{center}
   \@ifundefined{@journal}{}{%
    \@ifundefined{@vvolume}{\def\@vvolume{}}{}%
    \@ifundefined{@copnum}{\def\@copnum{}}{}%
    \@ifundefined{@ccoppy}{\def\@ccoppy{}}{}%
    {\scriptsize{\@journal}}\hspace{\fill}{\scriptsize{\@ccoppy}}\vspace{-0.3\baselineskip}\\
    {\scriptsize{\@vvolume}}\hspace{\fill}{\scriptsize{\@copnum}}\vspace{0.1in}\\
   }
  \vspace*{0.3in}

  {\LARGE \@title}\\

  \vspace{0.3in}
  \@ifundefined{apaSeven@maskauthoridentity}{%  BDB

      {\Large \displayauthors} \\

      \displayaffiliations \vspace{0.1in}

  }{%  mask author identity -- show nothing in the author note space
  }

  \@ifundefined{@abstract}{}{%
   {\abstractname}\vspace{0.1in}% BDB

   \parbox{5in}{\@abstract%
     \@ifundefined{@keywords}{}{%
       \par\vspace{0.12in}\textit{\keywordname:} \@keywords%
     }%
   }\vspace{0.25in}%
  }
  \end{center}
 \pagenumbering{arabic}
 \thispagestyle{empty}

  \@ifundefined{apaSeven@maskauthoridentity}{%  BDB

     \@ifundefined{@acks}
      {}
      {\begin{figure}[b]
       \parbox{\textwidth}{ \setlength{\parindent}{0.2in}
       \noindent \makebox[\linewidth]{\vrule height0.125pt width\linewidth}

       \vspace*{0.05in}
       {\footnotesize
       \indent \@acks

       }}
       \end{figure}}

  }{%  mask author identity -- show nothing in the author note space
  }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \markboth{\hfill \r@headl \hfill}{\hfill \r@headr \hfill}
 \let\tabular\apaSeven@doc@tabular% -- thp 2006/01/02
 \let\endtabular\apaSeven@doc@endtabular% -- thp 2006/01/03
% \noindent
}

%\ThreeLevelHeading
%\def\refname{References}
\setlength{\topmargin}{-0.25in}
\setlength{\oddsidemargin}{0.25in}
\setlength{\evensidemargin}{0.25in}
\setlength{\textwidth}{6in}
\setlength{\textheight}{8.5in}
\setcounter{secnumdepth}{0}
\flushbottom

% fix headwidth for even-numbered pages
% suggestion from http://tex.stackexchange.com/questions/42798/apa7-package-heading-line-exceeds-textwidth
\setlength{\headwidth}{\textwidth}

\setcounter{topnumber}{2}
\def\topfraction{.7}
\setcounter{bottomnumber}{2}
\def\bottomfraction{.6}
\setcounter{totalnumber}{3}
\def\textfraction{.2}
\def\floatpagefraction{.7}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.8}
\def\dblfloatpagefraction{.8}
\def\dbltextfloatsep{0.8\textfloatsep}

\def\helvetica{\relax}
%%\def\timesroman{\relax}%    Commented out all \timesroman -- thp 2005/07/23
%\def\centeredcaption#1{\caption}
%
%\long\def\@makecaption#1#2{
% \let\BBAB\table@BBAB% thp 2005/07/23
% \vskip 10pt
% \setbox\@tempboxa\hbox{#1 #2}
% \ifdim \wd\@tempboxa >\hsize #1 #2\par \else \hbox
%to\hsize{\hfil\box\@tempboxa\hfil}
% \fi
% \let\BBAB\normal@BBAB% thp 2005/07/23
% \vskip 4pt}
%
%\long\def\@caption#1[#2]#3{\par\addcontentsline{\csname
%  ext@#1\endcsname}{#1}{\protect\numberline{\csname
%  the#1\endcsname}{\ignorespaces #2}}\begingroup
%    \@parboxrestore
%    \normalsize
%    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%  \endgroup}
%
%\def\fnum@figure{\small {\em\figurename\ {\thefigure}}.\hspace{0.07in}}
%\long\def\fnum@table{\small\tablename\ {\thetable}:}


\@ifundefined{def@apacite}{}{% -- Philip Kime 2008/12/03
  % Removed defs as per the instructions of Erik Meijer -- thp 2005/07/23
  \renewcommand{\bibliographytypesize}{\small}}
\@ifundefined{def@natbib}{}{% -- Philip Kime 2008/12/03
  % Removed defs as per the instructions of Erik Meijer -- thp 2005/07/23
  \renewcommand{\bibliographytypesize}{\small}}

%\@ifundefined{def@noapacite}{% -- Philip Kime 2008/12/03
%  % Removed defs as per the instructions of Erik Meijer -- thp 2005/07/23
%  \renewcommand{\bibliographytypesize}{\small}}{}


}% end of doc mode (regular LaTeX format)

%---------- end of mode specific definitions -----------

% =======================================================
%       Some final definitions for all modes
% =======================================================

\let\ignore\@gobble


\@ifundefined{def@apacite}{}{% -- Philip Kime 2008/12/03
  \bibliographystyle{apacite}
  %
  % Thanks to Donald Arsenau for the right way to ignore \bibliographystyle
  %
  \def\bibliographystyle#1{\ClassWarning{apa7}{\string\bibliographystyle\space
      command ignored}}}

\@ifundefined{def@natbib}{}{% -- Philip Kime 2008/12/03
  \bibliographystyle{apacite}
  %
  % Thanks to Donald Arsenau for the right way to ignore \bibliographystyle
  %
  \def\bibliographystyle#1{\ClassWarning{apa7}{\string\bibliographystyle\space
      command ignored}}}

%\@ifundefined{def@noapacite}{% -- Philip Kime 2008/12/03
%  \bibliographystyle{apacite}
%  %
%  % Thanks to Donald Arsenau for the right way to ignore \bibliographystyle
%  %
%  \def\bibliographystyle#1{\ClassWarning{apa7}{\string\bibliographystyle\space
%      command ignored}}}{}




%    \end{macrocode}
%\end{macro}
%
%    \begin{macrocode}
%</class>
%    \end{macrocode}
%
%
% %%%%%%%%%%%  SAMPLE FILES  %%%%%%%%%%%%
%
%\begin{macro}{bibliography.bib}
%    \begin{macrocode}
%<*bibliography>

@ARTICLE{Borst2011a,
  author = {Borst, Gr\'{e}goire and Kosslyn, Stephen M. and Kievit, Rogier A. and  Thompson, William L.},
  title = {A fictitious entry to demonstrate complicated bibliographies},
  journal = {Journal of Nothingness},
  year = {2011},
  volume = {1},
  pages = {2--3}
}

@ARTICLE{Borst2011b,
  author = {Borst, Gr\'{e}goire and Kievit, Rogier A. and Thompson, William L. and
    Kosslyn, Stephen M.},
  title = {Mental rotation is not easily cognitively penetrable},
  journal = {Journal of Cognitive Psychology},
  year = {2011},
  volume = {23},
  pages = {60--75}
}

@ARTICLE{Borst2011c,
  author = {Borst, Gr\'{e}goire and Thompson, William L. and Kosslyn, Stephen M.},
  title = {Understanding the dorsal and ventral systems of the human cerebral
	cortex: {B}eyond dichotomies},
  journal = {American Psychologist},
  year = {2011},
  volume = {66},
  pages = {624--632}
}

@ARTICLE{deWaal2009,
  author = {de Waal, Elda and Grosser, M. M.},
  title = {Safety and security at school: {A} pedagogical perspective},
  journal = {Teaching and Teacher Education},
  year = {2009},
  volume = {25},
  pages = {697--706}
}

@ARTICLE{Franklin2010,
  author = {Franklin, Jr., Robert G. and Adams, Jr., Reginald B.},
  title = {The two sides of beauty: {L}aterality and the duality of facial attractiveness},
  journal = {Brain and Cognition},
  year = {2010},
  volume = {72},
  pages = {300--305}
}

@ARTICLE{Gilbert2004,
  author = {Gilbert, David and McClernon, Joseph and Rabinovich, Norka and Sugai, Chihiro
    and Plath, Louisette and Asgaard, Greg and Zuo, Yantao and	Huggenvik, Jodi and Botros, Nazeih},
  title = {Effects of quitting smoking on {EEG} activation and attention last for more than 31
    days and are more severe with stress, dependence,	{DRD2 A1} allele, and depressive traits},
  journal = {Nicotine \& Tobacco Research},
  year = {2004},
  volume = {6},
  pages = {249--267},
  number = {2},
  doi = {10.1080/14622200410001676305}
}

@INBOOK{Haybron2008,
  author = {Haybron, Daniel M.},
  title = {Philosophy and the science of subjective well-being},
  editor = {Eid, Michael and Larsen, Randy J.},
  booktitle = {The science of subjective well-being},
  year = {2008},
  pages = {17--43},
  publisher = {Guilford Press},
  address = {New York, NY}
}

@ARTICLE{Herbst-Damm2005,
  author = {Herbst-Damm, Kathryn L. and Kulik, James A.},
  title = {Volunteer support, marital status, and the survival times of terminally ill patients},
  journal = {Health Psychology},
  year = {2005},
  volume = {24},
  pages = {225--229},
  number = {2}
}

@ARTICLE{Lassen2006,
  author = {Lassen, Stephen R. and Steele, Michael M. and Sailor, Wayne},
  title = {The relationship of school-wide positive behavior support to academic achievement in
    an urban middle school},
  journal = {Psychology in the Schools},
  year = {2006},
  volume = {43},
  pages = {701--712},
  number = {6}
}

@ARTICLE{JRLevin2000,
  author = {Levin, Joel R. and O'Donnell, Angela M.},
  title = {What to do about educational research's credibility gaps?},
  journal = {Journal of Cognitive Education and Psychology},
  year = {2000},
  volume = {1},
  pages = {201--256}
}

@ARTICLE{MLevin1990,
  author = {Levin, Mary E. and Levin, Joel R.},
  title = {Scientific mnemonomies: {M}ethods for maximizing more than memory},
  journal = {American Educational Research Journal},
  year = {1990},
  volume = {27},
  pages = {301--321}
}

@ARTICLE{MayerInPressA,
  author = {Mayer, Richard E.},
  title = {Fake article to illustrate in-press citations},
  journal = {Journal of Cognitive Psychology},
  year = {in press}
}

@ARTICLE{MayerInPressB,
  author = {Mayer, Richard E.},
  title = {Second fake article to illustrate in-press citations},
  journal = {Journal of Educational Psychology},
  year = {in press}
}

@ARTICLE{Mayer2008a,
  author = {Mayer, Richard E.},
  title = {Applying the science of learning: {E}vidence-based principles for
	the design of multimedia instruction},
  journal = {American Psychologist},
  year = {2008},
  volume = {63},
  pages = {760--769}
}

@ARTICLE{Mayer2008b,
  author = {Mayer, Richard E.},
  title = {Old advice for new researchers},
  journal = {Educational Psychology Review},
  year = {2008},
  volume = {20},
  pages = {19--28}
}

@BOOK{Shotton1989,
  author = {Shotton, Margaret A.},
  title = {Computer addiction? {A} study of computer dependency},
  publisher = {Taylor \& Francis},
  year = {1989},
  location = {London, England}
}

@ARTICLE{vonDavier2011,
  author = {von Davier, Matthias and Xu, Xueli and Carstensen, Claus H.},
  title = {Measuring growth in a longitudinal large-scale assessment with a
    general latent variable model},
  journal = {Psychometrika},
  year = {2011},
  volume = {76},
  pages = {318--336}
}

%</bibliography>
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{shortsample.tex}
%    \begin{macrocode}
%<*shortsample>
\documentclass[jou]{apa7}

\usepackage[american]{babel}

\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bibliography.bib}

\title{Sample APA-Style Document Using the \textsf{apa7} Package}

\authorsnames{Daniel A. Weiss}
\authorsaffiliations{Departement of Psychology, A University Somewhere}

\leftheader{Weiss}

\abstract{This demonstration paper uses the \textsf{apa7} \LaTeX\
  class to format the document in compliance with the 7th Edition of
  the American Psychological Assocation's \textit{Publication Manual.}
  The references are managed using \textsf{biblatex}.}

\keywords{APA style, demonstration}

\authornote{\addORCIDlink{Daniel A. Weiss}{0000-0000-0000-0000}, Department of Psychology, A University Somewhere

Changes of Affiliations and other info here to describe what needs to be said}

\begin{document}
\maketitle
We begin with \textcite{Shotton1989}.  We can also cite this work in
parenthesis, like this: \parencite{Lassen2006}.

Note the use of five heading levels throughout this demonstration
Method section.

\section{Method}
\subsection{Participants}
We had a lot of people in this study, show in Figure \ref{fig:Figure1}.

\begin{figure}[!htp]
    \caption{This is my figure caption.}
    \includegraphics[bb=0in 0in 2.5in 2.5in, height=1.4in, width=1.4in]{Figure1.pdf}
    \figurenote{This is an awesome figure.}
    \label{fig:Figure1}
\end{figure}

\subsection{Materials}
Several materials were used for this project.  Some of them were
already created for prior research.

\subsubsection{Paper-and-Pencil Instrument}
We used an instrument that we found to be highly successful.

\paragraph{Reliability}
The reliability of this instrument is extraordinary.

\paragraph{Validity}
We now discuss the validity of our instrument.

\subparagraph{Face validity} The face validity is exceptionally
strong.  Everyone should be impressed.

\subparagraph{Construct validity} Also very strong.

\subsection{Design}
This section describes the study's design.

\subsection{Procedure}
The procedure was fairly straightforward, yet required
attention to detail.

\section{Results}
Table \ref{tab:ComplexTable} contains some sample data.  Our
statistical prowess in analyzing these data is unmatched.

\begin{table}[htbp]
  \vspace*{2em}
  \begin{threeparttable}
    \caption{A Complex Table}
    \label{tab:ComplexTable}
    \begin{tabular}{@{}lrrr@{}}         \toprule
    Distribution type  & \multicolumn{2}{l}{Percentage of} & Total number   \\
                       & \multicolumn{2}{l}{targets with}  & of trials per  \\
                       & \multicolumn{2}{l}{segment in}    & participant    \\ \cmidrule(r){2-3}
                                    &  Onset  &  Coda            &          \\ \midrule
    Categorical -- onset\tabfnm{a}  &    100  &     0            &  196     \\
    Probabilistic                   &     80  &    20\tabfnm{*}  &  200     \\
    Categorical -- coda\tabfnm{b}   &      0  &   100\tabfnm{*}  &  196     \\ \midrule
    \end{tabular}
    \begin{tablenotes}[para,flushleft]
        {\small
            \textit{Note.} All data are approximate.

            \tabfnt{a}Categorical may be onset.
            \tabfnt{b}Categorical may also be coda.

            \tabfnt{*}\textit{p} < .05.
            \tabfnt{**}\textit{p} < .01.
         }
    \end{tablenotes}
  \end{threeparttable}
\end{table}

\section{Discussion}
This is a lengthy and erudite discussion.  It demonstrates amazing
skill in interpreting the results for the masses.

\printbibliography

\end{document}

%</shortsample>
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{longsample.tex}
%    \begin{macrocode}
%<*longsample>
\documentclass[man]{apa7}

\usepackage{lipsum}

\usepackage[american]{babel}

\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bibliography.bib}

\title{Sample APA-Style Document Using the \textsf{apa7} Package}
\shorttitle{Sample Document}

\authorsnames{Daniel A. Weiss}
\authorsaffiliations{A University Somewhere}

\leftheader{Weiss}

\abstract{\lipsum[1]}

\keywords{APA style, demonstration}

\authornote{
   \addORCIDlink{Daniel A. Weiss}{0000-0000-0000-0000}

  Correspondence concerning this article should be addressed to Daniel A. Weiss, Department of Educational Psychology, Counseling and
  Special Education, A University Somewhere, 123 Main St., Oneonta, NY
  13820.  E-mail: daniel.weiss.led@gmail.com}


\begin{document}
\maketitle
\lipsum[2]

\Textcite{vonDavier2011} said this,
too \parencite{vonDavier2011,Lassen2006}.  Further evidence comes from
other sources \parencite{Shotton1989,Lassen2006}.  \lipsum[3]

\section{Method}
\subsection{Participants}
\lipsum[4]

\subsection{Materials}
\lipsum[5]

\subsection{Design}
\lipsum[6]

\subsection{Procedure}
\lipsum[7]

\subsubsection{Instrument \#1}
\lipsum[8]

\paragraph{Reliability}
\lipsum[9]

\subparagraph{Inter-rater reliability}
\lipsum[10]

\subparagraph{Test-retest reliability}
\lipsum[11]

\paragraph{Validity}
\lipsum[12]

\subparagraph{Face validity}
\lipsum[13]

\subparagraph{Construct validity}
\lipsum[14]


\section{Results}
Table~\ref{tab:BasicTable} summarizes the data. \lipsum[15]

\begin{table}
  \caption{Sample Basic Table}
  \label{tab:BasicTable}
  \begin{tabular}{@{}llr@{}}         \toprule
  \multicolumn{2}{c}{Item}        \\ \cmidrule(r){1-2}
  Animal    & Description & Price \\ \midrule
  Gnat      & per gram    & 13.65 \\
            & each        &  0.01 \\
  Gnu       & stuffed     & 92.50 \\
  Emu       & stuffed     & 33.33 \\
  Armadillo & frozen      &  8.99 \\ \bottomrule
  \end{tabular}
\end{table}

\begin{figure}
    \caption{This is my first figure caption.}
    \includegraphics[bb=0in 0in 2.5in 2.5in, height=2.5in, width=2.5in]{Figure1.pdf}
    \figurenote{This is a great figure.}
    \label{fig:Figure1}
\end{figure}

Figure~\ref{fig:Figure1} shows this trend. \lipsum[16]

\section{Discussion}
\lipsum[17]

\lipsum[18]

\lipsum[19]


\printbibliography

\appendix

\section{Instrument}
\label{app:instrument}

As shown in Figure~\ref{fig:Figure2}, these results are impressive. \lipsum[20]

\begin{figure}
    \caption{This is my second figure caption.}
    \includegraphics[bb=0in 0in 2.5in 2.5in, height=2.5in, width=2.5in]{Figure1.pdf}
    \figurenote{This is a great appendix figure.}
    \label{fig:Figure2}
\end{figure}

\lipsum[21]
\section{Pilot Data}
\label{app:surveydata}

The detailed results are shown in Table~\ref{tab:DeckedTable}. \lipsum[22]

\begin{table}
  \begin{threeparttable}
    \caption{A More Complex Decked Table}
    \label{tab:DeckedTable}
    \begin{tabular}{@{}lrrr@{}}         \toprule
    Distribution type  & \multicolumn{2}{l}{Percentage of} & Total number   \\
                       & \multicolumn{2}{l}{targets with}  & of trials per  \\
                       & \multicolumn{2}{l}{segment in}    & participant    \\ \cmidrule(r){2-3}
                                    &  Onset  &  Coda            &          \\ \midrule
    Categorical -- onset\tabfnm{a}  &    100  &     0            &  196     \\
    Probabilistic                   &     80  &    20\tabfnm{*}  &  200     \\
    Categorical -- coda\tabfnm{b}   &      0  &   100\tabfnm{*}  &  196     \\ \midrule
    \end{tabular}
    \begin{tablenotes}[para,flushleft]
        {\small
            \textit{Note.} All data are approximate.

            \tabfnt{a}Categorical may be onset.
            \tabfnt{b}Categorical may also be coda.

            \tabfnt{*}\textit{p} < .05.
            \tabfnt{**}\textit{p} < .01.
         }
    \end{tablenotes}
  \end{threeparttable}
\end{table}

\lipsum[23]

\end{document}

%</longsample>
%    \end{macrocode}
%\end{macro}
%
% %%%%%%%%%%%  CONFIGURATION FILES  %%%%%%%%%%%%
%
%\begin{macro}{APA7american.txt}
%    \begin{macrocode}
%<*american>
\ProvidesFile{APA7american.txt}[2020/08/02 v1.01 apa7 configuration for American English]

\renewcommand{\lastauthorseparator}{and}
\renewcommand{\acksname}{Author Note}
\renewcommand{\keywordname}{Keywords}
\renewcommand{\notesname}{Footnotes}


%</american>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7british.txt}
%    \begin{macrocode}
%<*british>
\ProvidesFile{APA7british.txt}[2020/08/02 v1.01 apa7 configuration for British English]

\renewcommand{\lastauthorseparator}{and}
\renewcommand{\acksname}{Author Note}
\renewcommand{\keywordname}{Keywords}
\renewcommand{\notesname}{Footnotes}


%</british>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7english.txt}
%    \begin{macrocode}
%<*english>
\ProvidesFile{APA7english.txt}[2020/08/02 v1.01 apa7 configuration for non-American English]

\renewcommand{\lastauthorseparator}{and}
\renewcommand{\acksname}{Author Note}
\renewcommand{\keywordname}{Keywords}
\renewcommand{\notesname}{Footnotes}

%</english>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7french.txt}
%    \begin{macrocode}
%<*french>
\ProvidesFile{APA7french.txt}[2020/08/12 v1.01 apa7 configuration for French] % translation by lejun[at]gmx.fr

\renewcommand{\lastauthorseparator}{et}% and
\renewcommand{\acksname}{Note de l'auteur}% Author Note
\renewcommand{\keywordname}{Mots Clés}% Keywords
\renewcommand{\notesname}{Notes de bas de page}% Footnotes

%</french>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7dutch.txt}
%    \begin{macrocode}
%<*dutch>
\ProvidesFile{APA7dutch.txt}[2020/08/02 v1.01 apa7 configuration for Dutch]

\renewcommand{\lastauthorseparator}{en}% and
\renewcommand{\acksname}{Auteursnoot}% Author Note
\renewcommand{\keywordname}{Trefwoorden}% Keywords
\renewcommand{\notesname}{Voetnoten}% Footnotes

%</dutch>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7german.txt}
%    \begin{macrocode}
%<*german>
\ProvidesFile{APA7german.txt}[2020/08/02 v1.01 apa7 configuration for German]

\renewcommand{\lastauthorseparator}{und}% and
\renewcommand{\acksname}{Autorenhinweis}% Author Note
\renewcommand{\keywordname}{Schl\"usselw\"orter}% Keywords
\renewcommand{\notesname}{Fußnoten}% Footnotes

%</german>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7ngerman.txt}
%    \begin{macrocode}
%<*ngerman>
\ProvidesFile{APA7ngerman.txt}[2020/08/02 v1.01 apa7 configuration for "new" German]

\renewcommand{\lastauthorseparator}{und}% and
\renewcommand{\acksname}{Autorenhinweis}% Author Note
\renewcommand{\keywordname}{Schl\"usselw\"orter}% Keywords
\renewcommand{\notesname}{Fußnoten}% Footnotes

%</ngerman>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7greek.txt}
%    \begin{macrocode}
%<*greek>
\ProvidesFile{APA7greek.txt}[2020/08/02 v1.01 apa7 configuration for Greek]

\renewcommand{\lastauthorseparator}{και}% and
\renewcommand{\acksname}{Shmei'wseis tou suggraf'ea}% Author Note
\renewcommand{\keywordname}{L'exeis kleidi'a}% Keywords
\renewcommand{\notesname}{Uposhmei'wseis}% Footnotes

%</greek>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7czech.txt}
%    \begin{macrocode}
%<*czech>
\ProvidesFile{APA7czech.txt}[2020/08/02 v1.01 apa7 configuration for Czech]

\renewcommand{\lastauthorseparator}{a}% and
\renewcommand{\acksname}{Poznámka~autora}% Author Note
\renewcommand{\keywordname}{Klícová~1slova}% Keywords
\renewcommand{\notesname}{Poznámky}% Footnotes

%</czech>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7turkish.txt}
%    \begin{macrocode}
%<*turkish>
\ProvidesFile{APA7turkish.txt}[2020/08/02 v1.01 apa7 configuration for Turkish]

\renewcommand{\lastauthorseparator}{ve}% and
\renewcommand{\acksname}{Yazar Notu}% Author Note
\renewcommand{\keywordname}{Anahtar Kelimeler}% Keywords
\renewcommand{\notesname}{Dipnotlar}% Footnotes

%</turkish>
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{APA7endfloat.cfg}
%    \begin{macrocode}
%<*APAendfloat>
%%
%% This is file `endfloat.cfg',
%% modifed from the original supplied with the endfloat package
%% to handle both sideways floats and longtable
%%
%% Athanassios Protopapas <protopap@ilsp.gr>
%% July 2005
%%
%% Original authors: James Darrell McCauley <jdm5548@diamond.tamu.edu>,
%% Jeff Goldberg <j.goldberg@cranfield.ac.uk>
%% Original version: Version 2.4i <October 1995>
%%
\RequirePackage{rotating}
\let\efsaved@sidewaysfigure\sidewaysfigure
\let\efsaved@sidewaystable\sidewaystable
\let\efsaved@longtable\longtable
\AtBeginTables{\let\sidewaystable=\efsaved@sidewaystable\relax}
\AtBeginTables{\let\longtable=\efsaved@longtable\relax}
\AtBeginFigures{\let\sidewaysfigure=\efsaved@sidewaysfigure\relax}
\def\sidewaystable{\efloat@condopen{ttt}
    \efloat@iwrite{ttt}{\string\begin{sidewaystable}}%
%    \if@domarkers
%       \addtocounter{posttbl}{1}
%       \tableplace
%    \fi
    \def\@currenvir{efloat@float}%
    \begingroup
    \let\do\ef@makeinnocent \dospecials
    \ef@makeinnocent\^^L% and whatever other special cases
    \endlinechar`\^^M \catcode`\^^M=12 \ef@xsidetable}
{\catcode`\^^M=12 \endlinechar=-1 %
 \gdef\ef@xsidetable#1^^M{\def\test{#1}
      \ifx\test\ef@endsidetabletest
          \efloat@foundend{ttt}{sidewaystable}
      \else
          \efloat@iwrite{ttt}{#1}%
          \let\next\ef@xsidetable
      \fi \next}
}
\def\sidewaysfigure{\efloat@condopen{fff}
    \efloat@iwrite{fff}{\string\begin{sidewaysfigure}}%
%    \if@domarkers
%       \addtocounter{postfig}{1}
%       \figureplace
%    \fi
    \def\@currenvir{efloat@float}%
    \begingroup
    \let\do\ef@makeinnocent \dospecials
    \ef@makeinnocent\^^L% and whatever other special cases
    \endlinechar`\^^M \catcode`\^^M=12 \ef@xsidefigure}
{\catcode`\^^M=12 \endlinechar=-1 %
 \gdef\ef@xsidefigure#1^^M{\def\test{#1}
      \ifx\test\ef@endsidefiguretest
          \efloat@foundend{fff}{sidewaysfigure}
      \else
          \efloat@iwrite{fff}{#1}%
          \let\next\ef@xsidefigure
      \fi \next}
}
\def\longtable{\efloat@condopen{ttt}
    \efloat@iwrite{ttt}{\string\begin{longtable}}%
%    \if@domarkers
%       \addtocounter{posttbl}{1}
%       \tableplace
%    \fi
    \def\@currenvir{efloat@float}%
    \begingroup
    \let\do\ef@makeinnocent \dospecials
    \ef@makeinnocent\^^L% and whatever other special cases
    \endlinechar`\^^M \catcode`\^^M=12 \ef@xlongtable}
{\catcode`\^^M=12 \endlinechar=-1 %
 \gdef\ef@xlongtable#1^^M{\def\test{#1}
      \ifx\test\ef@endlongtabletest
          \efloat@foundend{ttt}{longtable}
      \else
          \efloat@iwrite{ttt}{#1}%
          \let\next\ef@xlongtable
      \fi \next}
}
{\escapechar=-1%
 \xdef\ef@endsidefiguretest{\string\\end\string\{sidewaysfigure\string\}}%
 \xdef\ef@endsidetabletest{\string\\end\string\{sidewaystable\string\}}
 \xdef\ef@endlongtabletest{\string\\end\string\{longtable\string\}}}%
\endinput

%</APAendfloat>
%    \end{macrocode}
%\end{macro}
%
%
%\Finale