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
|
% \iffalse meta-comment
%
% notespages.dtx
% Copyright 2016 Mike Kaufmann
% m.km@gmx.de
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Mike Kaufmann.
%
% This work consists of the files notespages.dtx and notespages.ins
% and the derived files notespages.sty and np-test.tex.
% \fi
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
% \CheckSum{1360}
%
% \iffalse meta-comment
%
%<*package>
%%
\def\fileversion{0.8.1}
\def\filedate{2016/08/21}
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{hypdoc}
\usepackage{graphicx}
\hypersetup{colorlinks,linkcolor=blue}
\usepackage[all]{hypcap}
\setcounter{IndexColumns}{2}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\makeatletter
% new, like ...Env... commands from doc.sty)
\let\PrintDescribeOpt\PrintDescribeEnv
\let\PrintOptName\PrintEnvName
\def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
\Describe@Opt}
\def\Describe@Opt#1{\endgroup
\marginpar{\raggedleft\PrintDescribeOpt{#1}}%
\SpecialOptIndex{#1}\@esphack\ignorespaces}
\def\SpecialOptIndex#1{\@bsphack
\index{#1\actualchar{\protect\ttfamily#1}
(option)\encapchar usage}%
\index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
usage}\@esphack}
% new (like \SpecialEnvIndex from hypdoc.sty)
\let\HDorg@SpecialOptIndex\SpecialOptIndex
\renewcommand*\SpecialOptIndex[1]{%
\@bsphack
\begingroup
\HD@target
\let\HDorg@encapchar\encapchar
\edef\encapchar usage{%
\HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
}%
\HDorg@SpecialOptIndex{#1}%
\endgroup
\@esphack
}
% redefinition (from doc.sty)
\def\macro{\begingroup
\catcode`\\12
\MakePrivateLetters \m@cro@ \z@}
\def\environment{\begingroup
\catcode`\\12
\MakePrivateLetters \m@cro@ \@ne}
% new, environment 'option', like 'environment', but index entries with
% '(option)'
\def\option{\begingroup
\catcode`\\12
\MakePrivateLetters \m@cro@ \tw@}
% redefinition (from doc.sty)
\long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
\edef\saved@macroname{\string#2}%
\def\makelabel##1{\llap{##1}}%
\if@inlabel
\let\@tempa\@empty \count@\macro@cnt
\loop \ifnum\count@>\z@
\edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
\edef\makelabel##1{\llap{\vtop to\baselineskip
{\@tempa\hbox{##1}\vss}}}%
\advance \macro@cnt \@ne
\else \macro@cnt\@ne \fi
\edef\@tempa{\noexpand\item[%
\ifcase #1%
\noexpand\PrintMacroName
\or
\noexpand\PrintEnvName
\or
\noexpand\PrintOptName
\fi
{\string#2}]}%
\@tempa
\global\advance\c@CodelineNo\@ne
\ifcase #1%
\SpecialMainIndex{#2}\nobreak
\DoNotIndex{#2}%
\or
\SpecialMainEnvIndex{#2}\nobreak
\or
\SpecialMainOptIndex{#2}\nobreak
\fi
\global\advance\c@CodelineNo\m@ne
\ignorespaces}
% new
\let\endoption\endmacro
\def\SpecialMainOptIndex#1{\@bsphack\special@index{%
#1\actualchar
{\string\ttfamily\space#1}
(option)%
\encapchar main}%
\special@index{options:\levelchar#1\actualchar{%
\string\ttfamily\space#1}\encapchar
main}\@esphack}
\makeatother
\begin{document}
\DocInput{notespages.dtx}
\end{document}
%</driver>
%
%<*package>
% \fi
%
% \DoNotIndex{\',\@auxout,\@gobble}
% \DoNotIndex{\@ifclassloaded,\@ifpackageloaded,\@ifpackagewith,\@ifundefined}
% \DoNotIndex{\@ne,\@temptokena,\@themark,\@writefile}
% \DoNotIndex{\addto,\advance}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\begin,\begingroup}
% \DoNotIndex{\c@page,\centering,\chapter}
% \DoNotIndex{\clearpage,\color,\csname}
% \DoNotIndex{\def,\definecolor,\divide}
% \DoNotIndex{\define@boolkey,\define@choicekey,\define@cmdkey,\define@key}
% \DoNotIndex{\edef,\else,\end,\endgroup,\endcsname}
% \DoNotIndex{\expandafter}
% \DoNotIndex{\fi,\filedate,\fileversion}
% \DoNotIndex{\gdef,\global,\glossary}
% \DoNotIndex{\hbox,\hrule,\@height}
% \DoNotIndex{\if@filesw,\if@nobreak}
% \DoNotIndex{\if,\ifcase,\ifcat,\ifdim,\ifnum,\ifvmode,\ifx}
% \DoNotIndex{\immediate,\index,\InputIfFileExists}
% \DoNotIndex{\jobname}
% \DoNotIndex{\key@ifundefined}
% \DoNotIndex{\label,\let,\line,\lineskip,\long,\loop}
% \DoNotIndex{\MakeUppercase,\MessageBreak,\m@ne,\mark,\markboth,\markright}
% \DoNotIndex{\maxdimen,\minisec,\multiply,\multiput}
% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newdimen,\newif,\newtoks}
% \DoNotIndex{\newpage,\newwrite,\nobreak,\noindent,\number}
% \DoNotIndex{\openout}
% \DoNotIndex{\PackageError,\PackageWarning,\PackageWarningNoLine}
% \DoNotIndex{\PackageInfo,\ProvidesPackage,\ProcessOptionsX}
% \DoNotIndex{\p@,\pagegoal,\pagetotal,\par,\parfillskip,\phantom,\protect}
% \DoNotIndex{\protected@write,\providecolor}
% \DoNotIndex{\raggedleft,\raggedright,\relax,\repeat,\rule,\RequirePackage}
% \DoNotIndex{\setkeys,\space,\string,\section,\subsection,\subsubsection}
% \DoNotIndex{\textfraction,\textheight,\textwidth,\the,\thispagestyle,\tw@}
% \DoNotIndex{\unitlength,\unrestored@protected@xdef,\vfill,\vspace}
% \DoNotIndex{\xdef,\z@}
%
% \newcommand{\NP}{\textsf{NotesPages}}
% \newcommand{\pkg}[1]{\textsf{#1}}
% \newcommand{\opt}[1]{\textsf{#1}}
% \newcommand{\choice}[1]{\textsf{\textsl{#1}}}
% \newcommand{\bs}{\textbackslash}
% \newcommand{\since}[2][changed]{\marginpar{\hfill\textsf{\textit{\textcolor[rgb]{0,0.3,0}{#1 #2}}}}}
%
% \changes{0.8}{2016/08/10}{initial release}
%
% \title{The \NP\ Package\\[1ex]
% Filling documents, so the total number of pages is a multiple of a given number.}
% \author{Mike Kaufmann\\\href{mailto:m.km@gmx.de}{\texttt{m.km@gmx.de}}}
% \date{\filedate\ (v\fileversion)}
% ^^A--------------------------------------------------------------------------
% \maketitle
% \begin{abstract}
% The \NP\ package provides one macro to insert a single notes page and another
% to fill the document with multiple notes pages, until the total number of pages
% (so far) is a multiple of a given number. A third command can be used to fill
% half empty pages with a notes area.
% \end{abstract}
%
% \tableofcontents
%
% ^^A--------------------------------------------------------------------------
% \section{Introduction}
% \subsection{Why this Package}
% Well, sometimes I have to write short manuals, which are then printed as a booklet.
% Therefore their number of pages has to be dividable by 4. And since it's tiresome
% to check the number of pages after every change and add or remove notes pages
% manually, I automated this work. In this, I had to take into account that there
% are a number of fixed pages at the end of the booklet.
%
% In order to make it useful for others, options for formating a notes page were
% added.
%
% ^^A---------------------------------------------
% \subsection{Feeback and Testing}
% The \NP\ package was tested with the example file provided with this package.
% There may be documents, where the algorithm for calculating the number of pages
% needed to fill a document may not work properly. Or there may be other issues.
% If you have such a document, please send me an example, which shows the problem,
% so I can try to fix it.
%
% ^^A---------------------------------------------
% \subsection{Dependencies}
% \subsubsection{Necessary Packages}
% The \NP\ package needs the \pkg{xkeyval} package for processing the options.
%
% ^^A-------------------------
% \subsubsection{Babel}
% The package makes use of \pkg{babel}, if it is loaded, but it doesn't depend
% on it. The order, in which the package is loaded in regard to the \NP\ package,
% is of no consequence. More on supporting languages can be found in
% \autoref{sec:babel}.
%
% ^^A-------------------------
% \subsubsection{Color}
% The package also makes use of the package \pkg{color} or \pkg{xcolor}, if loaded,
% without depending either one. Again, the order, in which the package is loaded
% in regard to the \NP\ package, is of no consequence. More on supporting color
% can be found in \autoref{sec:color}.
%
% ^^A---------------------------------------------
% \subsection{Legal Stuff}
% This program is provided under the terms of the
% \LaTeX\ Project Public License distributed from CTAN
% \href{http://www.ctan.org/license/lppl1.3}{http://www.ctan.org/license/lppl1.3}
%
% ^^A--------------------------------------------------------------------------
% \section{Using the Packages}
% \subsection{Loading}
% The package is loaded as usual.
%
% \vspace{1ex}
% |\usepackage|\oarg{options}|{notepages}|
%
% \vspace{1ex}
% \noindent
% The options are described in \autoref{sec:options}.
%
% ^^A---------------------------------------------
% \subsection{The basic commands}
% \label{sec:cmd}
% \DescribeMacro\setnotespages
% With |\setnotespages|\marg{options} all the settings possible with the options
% described in \autoref{sec:options} can be changed globaly. This will overwrite
% the settings made with the options provided on loading the package or the
% defaults.
%
% \DescribeMacro\notespage
% With |\notespage|\oarg{options} a single notes page will be inserted into the
% document. For this, a new page will be started at the place of its occurrence.
% The command has one optional parameter, which can contain all the options
% described in \autoref{sec:options}. But the options of \autoref{sec:optmultiple}
% and \autoref{sec:optfill} are ignored, because they are of no use for |\notespage|.
%
% The options are local to the command, i.e.\ they will not change the settings
% done with |\setnotespages|, made at loading the package, or the defaults. Thus,
% if the next notes page should have the same appearance, the same options must
% be given.
%
% \DescribeMacro\notespages
% With |\notespages|\oarg{options} the document can be filled with notes pages, so the
% total number of pages so far is a multiple of a given number. Depending on the
% settings done with the options described in \autoref{sec:optmultiple}, this
% may result in anything from 0 to 199 notes pages.
%
% All options described in \autoref{sec:options} can be used in the optional
% parameter. But the options in \autoref{sec:optfill} are ignored, because they
% are of no use for |\notespages|.
%
% The command first sets up everything according to the given options. It then
% calculates the amount of pages needed and inserts them.
%
% For |\notespages| the options are also local to the command.
%
% \DescribeMacro\notesfill
% With |\notesfill|\oarg{options} a page can be filled with a notes area preceeded by
% the notes tile. It is formated similar to a notes page, but no new page is
% started, the pagestyle can not be changed and so can't the text in the header .
%
% All options described in \autoref{sec:options} can be used in the optional
% parameter. But the options of \autoref{sec:optmultiple} are useless to
% |\notesfill| and therefore ignored. Also the options \opt{startnotes},
% \opt{pagestyle}, \opt{mark}, \opt{marktext}, and \opt{markuppercase} from
% \autoref{sec:optsingle} are ignored.
%
% With the options described in \autoref{sec:optfill} it is possible to set a
% minimum height for |\notesfill|, i.e. no notes title plus notes area will
% be generated, if the remaining space on the page is less then the minimum.
% Also a maximum height for the notes title plus the notes area can be defined.
% If there is more space left on the page, the notes title plus notes area
% will be moved to the bottom of the page by default.
%
% And again, the options given to |\notesfill| are local to the command.
%
% There is an restriction to |\notesfill| regarding bottom floats and footnotes:
% they will appear below it.
%
% ^^A---------------------------------------------
% \subsection{Layout}
% \autoref{fig:layoutpage} shows the layout of a notes page and \autoref{fig:layoutfill}
% the layout of a notes fill, together with some of the layout options described in
% \autoref{sec:options}. The dimension |\remainingtextheight| is described in
% \autoref{sec:advanced}.
%
% \begin{figure}[htb]
% \setlength{\unitlength}{1mm}
% \begin{minipage}{0.49\textwidth}
% \centering
% \begin{picture}(60,90)
% \thicklines
% \put( 0,85){\framebox(60, 5){header\quad\textsf{marktext/mark/pagestyle}}}
% \put( 0, 0){\framebox(60, 5){footer\qquad\textsf{pagestyle}}}
% \put( 0,78){\framebox(60, 5){notes title\qquad\textsf{titletext/titlestyle}}}
% \put( 0, 7){\framebox(60,66){\parbox{60mm}{\centering notes area\\\textsf{notesstyle}\\\textsf{hparts/vparts}}}}
% \thinlines
% \put( 5,15){\vector(0, 1){58}}
% \put( 5,15){\vector(0,-1){8}}
% \put( 6,10){\makebox(0,5)[l]{\texttt{\bs remainingtextheight}}}
% \put( 5,75){\vector(0, 1){3}}
% \put( 5,75){\vector(0,-1){2}}
% \put( 6,73){\makebox(0,5)[l]{\textsf{titleskip}}}
% \put(25,73){\makebox(0,0){\textbullet}}
% \put(26,73){\makebox(0,5)[l]{\textsf{titlenotesfill}}}
% \end{picture}
% \caption{Layout notes page}\label{fig:layoutpage}
% \end{minipage}
% \hspace{\fill}
% \begin{minipage}{0.49\textwidth}
% \centering
% \capstart
% \begin{picture}(60,90)
% \thicklines
% \put( 0,85){\framebox(60,5){header}}
% \put( 0, 0){\framebox(60,5){footer}}
% \put( 0,56){\makebox(60,27){text}}
% \put( 0,83){\line(1,0){60}}
% \put( 0,53){\line(0,1){30}}
% \put( 0,53){\line(1,0){40}}
% \put(40,53){\line(0,1){3}}
% \put(40,56){\line(1,0){20}}
% \put(60,56){\line(0,1){27}}
% \put( 0,43){\framebox(60, 5){notes title\qquad\textsf{titletext/titlestyle}}}
% \put( 0, 7){\framebox(60,31){\parbox{60mm}{\centering notes area\\\textsf{notesstyle}\\\textsf{hparts/vparts}\\~\\~}}}
% \thinlines
% \put( 5,15){\vector(0, 1){23}}
% \put( 5,15){\vector(0,-1){8}}
% \put( 6,10){\makebox(0,5)[l]{\texttt{\bs remainingtextheight}}}
% \put( 5,40){\vector(0, 1){3}}
% \put( 5,40){\vector(0,-1){2}}
% \put( 6,38){\makebox(0,5)[l]{\textsf{titleskip}}}
% \put( 5,50){\vector(0, 1){3}}
% \put( 5,50){\vector(0,-1){2}}
% \put( 6,48){\makebox(0,5)[l]{\textsf{filltopskip}}}
% \put(25,48){\makebox(0,0){\textbullet}}
% \put(26,48){\makebox(0,5)[l]{\textsf{filltopfill}}}
% \put(25,38){\makebox(0,0){\textbullet}}
% \put(26,38){\makebox(0,5)[l]{\textsf{titlenotesfill}}}
% \end{picture}
% \caption{Layout notes fill}\label{fig:layoutfill}
% \end{minipage}
% \end{figure}
%
% ^^A---------------------------------------------
% \subsection{Package and Command Options}
% \label{sec:options}
% \subsubsection{Setting Options}
% If options are used without a value, they will be set to their defaults. The
% exception are the boolean options \opt{allowfloats}, \opt{usenotesareaheight},
% \opt{titlenotesfill}, \opt{markuppercase}, and \opt{filltopfill}, which are
% set to \choice{true}.
%
% ^^A-------------------------
% \subsubsection{Options for \texttt{\bs notespage}}
% \label{sec:optsingle}
% The following options affect the style and layout of a single notes page.
% They are all used by |\notespage| and |\notespages|. And most of them are
% also used by |\notesfill| (the exceptions are \opt{startnotes},
% \opt{pagestyle}, \opt{mark}, \opt{marktext}, and \opt{markuppercase}).
%
% \DescribeOpt{startnotes}
% The option \opt{startnotes} defines, how the new page for |\notespage| is
% started. The choices are \choice{newpage} and \choice{clearpage}. The default
% is \choice{clearpage}.
%
% With \choice{newpage} the command |\newpage| is used and therefore remaining floats
% are not given out by default, which can be changed with the option \opt{allowfloats}.
% With \choice{clearpage} |\clearpage| is used and remaining floats are given out
% before the notes page.
%
% \DescribeOpt{allowfloats}
% If the boolean \opt{allowfloats} is set to \choice{true} floats are allowed to
% be placed on a notes page, if \choice{newpage} is used for the option
% \opt{startnotes}. Caution: the header will be changed on such pages. The default
% is \choice{false}.
%
% \DescribeOpt{pagestyle}
% With \opt{pagestyle} the pagestyle for a notes page can be defined. All possible
% pagestyles (\choice{empty}, \choice{plain}, \choice{headings}, \choice{myheadings},
% and what ever is defined for the document) can be use as value. Additionally,
% \choice{current} can be used to denote to not change the pagestyle. This is the
% default. Internally |\thispagestyle| is used, but not for the value \choice{current}.
%
% A pagestyle must have been defined, before it can be chosen. If a nonexisting
% pagestyle is chosen, a warning will be given and the value will be set to the
% default. Therefore, |\setnotespages| must appear after defining a page style
% to be used for notes pages in the preamble.
%
% \DescribeOpt{notesstyle}
% With \opt{notesstyle} the way the notes area is filled can be chosen. Possible
% are \choice{plain}, \choice{lines}, \choice{vlines}, \choice{grid}, and \choice{text}.
% The default is \choice{grid}.
%
% With \choice{plain} the notes area is left empty, \choice{lines} will fill the
% notes area with horizonal lines, \choice{vlines} with vertical lines, \choice{grid}
% will fill it with a grid, and \choice{text} will give out a short text.
%
% It is possible to add your own \opt{notesstyle}. This is described in
% \autoref{sec:advanced}.
%
% \DescribeOpt{hparts}
% The option \opt{hparts} divides the notes area into the given number $n_x$
% horizontal parts, which will be seperated by vertical lines. There will always
% be $n_x + 1$ lines. The default value is 25.
%
% The option applies to the \opt{notesstyle}s \choice{vlines} and \choice{grid}.
% The value may be in the range from 1 to 200. If the given number is smaller or
% larger, a warning is given out and it's set to either 1 or 200 respectively.
%
% \DescribeOpt{vparts}
% The option \opt{vparts} divides the |\textheight| into the given number $n_y$
% vertical parts. The calculation is based on |\textheight| by default (see
% below, option \opt{usenotesareaheight}), in order to achieve same height
% vertical parts, independent of the actual height of the notes area. The
% option applies to the \opt{notesstyle}s \choice{lines} and \choice{grid}.
%
% The value may be in the range from 0 to 300. If the given number is smaller or
% larger, a warning is given out and it's set to either 0 or 300 respectively.
%
% The values 0 and 1 have special meaning. With 0 for the \opt{notesstyle}
% \choice{grid} the length of a vertical part will be the same as for a horizontal
% part, thus resulting in a square grid. For the \opt{notesstyle} \choice{lines}
% a warning will be given and the notes area is left empty. A value of 1 will lead
% to one line at the bottom and one at the top of the notes area, regardless of
% its height, thus making it possible to put a rectangle around the notes area.
%
% For values of 2 or greater only lines for full vertical parts are drawn. For
% example, if the height of a notes area is 20.5 times the length of a vertical
% part, for \choice{lines} 20 lines are drawn and 21 for \choice{grid}. For small
% values there may be no lines in the notes area of a |\notesfill|.
%
% The default value is 0, so for the \opt{notesstyle} \choice{lines} it has
% to be changed.
%
% \DescribeOpt{usenotesareaheight}
% With the option \opt{usenotesareaheight} the calculation of the height of a
% vertical part (see above, option \opt{vparts}) is based on the height of the
% notes area instead of |\textheight|. This enables the user to vertically divide
% the notes area into the exact number given to \opt{vparts}. Of course with this,
% for a |\notesfill| the height of a vertical part can differ each time. The default
% is \choice{false}.
%
% \DescribeOpt{titlestyle}
% With the option \opt{titlestyle} a layout for the notes title can be chosen.
% Possible are \choice{none}, \choice{text}, \choice{section}, \choice{subsection},
% \choice{subsubsection}, and, if available, \choice{minisec}. The default is
% \choice{section}.
%
% With \choice{none} no title is set. And \choice{text} formats it as simple text.
% With \choice{section}, \choice{subsection}, or \choice{subsubsection} one of
% the commands |\section*|, |\subsection*|, or |\subsubsection*| is used. The
% choice \choice{minisec} is only available, if |\minisec| is defined (before
% loading the \NP\ package). Then, if chosen, |\minisec| is used to format the
% title.
%
% It is possible to add your own \opt{titlestyle}. This is described in
% \autoref{sec:advanced}.
%
% \DescribeOpt{titletext}
% With \opt{titletext} an arbitrary text can be chosen as new a notes title. If
% the new text contains more then one word, it is recommended to put the text in
% braces, e.g.\ |titletext={My new notes title}|. If the text contains a comma (``,'')
% or an equality sign (``=''), it must be given in braces! The default is |\npnotesname|,
% which is ``Notes'' without \pkg{babel} or language dependend with \pkg{babel}
% (see \autoref{sec:babel} for details).
%
% The option \opt{titletext} will automatically also set \opt{marktext} to
% its value, if \opt{marktext} is not given, but not otherwise, regardless
% which option comes first. So if a long text is set with \opt{titletext},
% it is recommended to also use \opt{marktext} to set a shorter text suitable
% for the headers. Of course, if \opt{mark} is set to \choice{keep}, this is
% not necessary.
%
% \DescribeOpt{titleskip}
% With \opt{titleskip} the distance between the notes title and the notes area
% can be set. The value can be everything accepted as a length by \TeX. The default
% is 0pt. For the default title style this is ok, because |\section*| adds some
% space after the title. But for the title style \choice{text} it is recommended
% to set a \opt{titleskip} greater then 0pt.
%
% \DescribeOpt{titlenotesfill}
% If the boolean \opt{titlenotesfill} is set to \choice{true}, a |\vfill| will be
% inserted between notes title and notes area, moving the latter to the bottom
% of the page. The default is \choice{false}.
%
% Most of the provided notes styles always use the whole remaining space of a page,
% so the option is of no use for them. The exception is the notes style \choice{text},
% which has the height of the text. But this option would move the text to the end
% of the page. It may be useful for a custom notes style, which doesn't use all
% the available space, and the notes area should be moved down to the end
% of the page.
%
% \DescribeOpt{notestext}
% With \opt{notestext} an arbitrary text can be chosen as a new text for the
% notes style \choice{text}. If the text contains more then one word, it is
% recommended to put the text in braces, e.g.\ |notestext={This page is empty.}|.
% If the text contains a comma (``,'') or an equality sign (``=''), it must be
% given in braces! The default is |\npnotestext|, which is ``This page is
% intentionally left blank.'' without \pkg{babel} or language dependend with
% \pkg{babel} (see \autoref{sec:babel} for details).
%
% \DescribeOpt{notestextalign}
% With \opt{notestextalign} the horizontal alignement for the text of the notes
% style \opt{text} can be choosen. Possible are \choice{right}, \choice{left},
% \choice{center}, and \choice{none}. The default is \choice{center}.
%
% For \choice{none} no alignement is set. Thus the text is aligned the same as
% normal text in the document.
%
% Vertical alignment can be done using the option \opt{titleskip}. For the notes
% style \choice{text} is is also inserted, if the title style is \choice{none}.
%
% \DescribeOpt{mark}
% With \opt{mark} the way the notes title is put into the header can be chosen.
% Possible are \choice{both}, \choice{right}, \choice{left}, and \choice{keep}.
% The default is \choice{both}.
%
% For \choice{both}, \choice{right}, and \choice{left} the command |\markboth|
% is used, but for \choice{right} and \choice{left} the original mark is set for
% the other side. With the choice \choice{keep} the headers are not changed.
%
% Note, in order to get the header marks right, it is necessary to run
% \LaTeX\ twice.
%
% \DescribeOpt{marktext}
% The option \opt{marktext} can be used the set an arbitrary text for the
% headers, which differs from the notes title. The latter is the default.
% Here too, the text should be given in braces if it contains more then one word
% and it must be given in braces, if it contains a comma (``,'') or an equality
% sign (``='').
%
% Note, if \opt{notestitle} is given locally, it will also set \opt{marktext}
% locally. Therefore, if both texts should be different, both options must be
% used.
%
% \DescribeOpt{markuppercase}
% If the option \opt{markuppercase} is used, the text for the header marks set by
% a notes page is converted to upper case letters. The default depends on the
% class used. For the standard classes and \pkg{memoir} the option is set to
% \choice{true}, for others to \choice{false}.
%
% ^^A-------------------------
% \subsubsection{Options for \texttt{\bs notespages}}
% \label{sec:optmultiple}
% The following options are only used by |\notespages| to determie the number of
% notes pages to be inserted.
%
% \DescribeOpt{multiple}
% With \opt{multiple} the number of pages, the total number of pages of a
% document (so far) should be a multiple of, can be defined. For example, with
% |multiple=4|, |\notepages| will insert enough pages to make the total number of
% pages (so far) 4, 8, 12, 16, 20 and so on. The value can be in the range from
% 1 to 100. If the given number is below or above that, a warning will be given
% and the value will be set to either the minimum or maximum respectively. The
% default is 4.
%
% \DescribeOpt{minpages}
% With \opt{minpages} the minimum number of notes pages to be inserted can be
% defined. For example, with |multiple=4|, |minpages=1| and |\notespages| appearing
% on (the not empty) page 20, one page will be added to fulfill the minimum and
% an additional 3 to make the number of pages a multiple of 4 again, leading to
% a total of 24 pages. The value can be in the range from 0 to 100. If the given
% number is below or above that, a warning will be given and the value will be
% set to either the minimum or maximum respectively. The default is 0.
%
% \DescribeOpt{endpages}
% With \opt{endpages} the number of pages at the end of a document, which are
% not notes pages, can be defined. For example, the last page of a booklet has to
% contain contact information and therefore shouldn't be a notes page. By setting
% |endpages=1| this is taken into account and |\notespages| will fill the document
% only up to, for example, page 19 instead of 20, thus leaving page 20 free for
% the desired content. The value can be in the range from 0 to 100. If the given
% number is below or above that, a warning will be given and the value will be
% set to either the minimum or maximum respectively. The default is 0.
%
% ^^A-------------------------
% \subsubsection{Options for \texttt{\bs notesfill}}
% \label{sec:optfill}
% The following options are only used by |\notesfill|.
%
% \DescribeOpt{fillminspace}
% With \opt{fillminspace} the minimum height for a notes fill can be defined,
% i.e. if the remaining space on a page is less than the given length, no notes
% fill will appear. The value can be anything accepted as a length by \TeX. The
% default is |0.25\textheight|.
%
% The value given to the option \opt{filltopskip} is taken into account for the
% calculation of the remaining space, meaning, it is subtracted from the space
% left, before the decision is made to insert a notes fill or not.
%
% \DescribeOpt{fillmaxspace}
% With \opt{fillmaxspace} the maximum height for a notes fill can be defined,
% i.e. if the remaining space on a page is greater than the given length, the
% height of a notes fill is limited to this length. The value can be anything
% accepted as a length by \TeX. The default is |\textheight|.
%
% \DescribeOpt{filltopskip}
% With \opt{filltopskip} the distance between the text and the notes title can
% be defined. The value can be anything accepted as a length by \TeX. The default
% is 0pt. For the default value of \opt{titlestyle} 0pt is ok, since |\section*|
% inserts some space before the notes title. But for |titlestyle=text| it is
% recommended to set a \opt{filltopskip} greater then 0pt.
%
% \DescribeOpt{filltopfill}
% If the boolean \opt{filltopfill} is set to \choice{true}, a |\vfill| will be
% inserted between the text and the notes title, moving the notes fill to the
% bottom of the page. The default is \choice{true}. This is useful, if the notes fill
% is not as high as the remaining space on the page, because it was limited by
% \opt{fillmaxspace}.
%
% ^^A-------------------------
% \subsubsection{Meta Option}
% \label{sec:optmeta}
% Basically meta options are option, which set some or all the options described
% so far. There are three of them.
%
% \DescribeOpt{empty}
% The option \opt{empty} sets |pagestyle=empty,notesstyle=plain,titlestyle=| |none|,
% which will lead to totally empty pages.
%
% \DescribeOpt{vacant}
% The option \opt{vacant} sets |pagestyle=empty,notesstyle=text,titlestyle=|
% |none,titleskip=0.3\textheight|, which will lead to pages with only the text
% ``This page is intentionally left blank.'' on it at about 1/3 of the height
% from the top.
%
% \DescribeOpt{default}
% With \opt{default} all options are set back to their default values. This is
% useful in |\setnotespages| and all |\notes...| commands to get a defined
% starting point.
%
% It is possible to define your own meta option (see \autoref{sec:advanced} for
% details).
%
% ^^A-------------------------
% \subsubsection{Order of Options}
% The order of options is important, if one options is given more then once. In
% this case the last occurence wins. For example, writing
%
% \vspace{1ex}
% \noindent
% |\notespage[hparts=30,vparts=30,hparts=20]|
%
% \vspace{1ex}
% \noindent
% will be the same as writing
%
% \vspace{1ex}
% \noindent
% |\notespage[vparts=30,hparts=20]|,
%
% \vspace{1ex}
% \noindent
% because \opt{hparts} appeared twice and |hparts=20| overwrote |hparts=30|.
%
% This is especially important when using meta options, because they set other
% option, which would overwrite options given before.
%
% ^^A---------------------------------------------
% \subsection{Advanced commands}
% \label{sec:advanced}
% \DescribeMacro\definenotesoption
% With |\definenotesoption|\marg{newopt}\marg{options} it is possible to define a new meta
% option \meta{newopt}, which can then be used as an option for the commands described
% in \autoref{sec:cmd}. For \meta{newopt} only a single word can be used. In \meta{options}
% all options described so far can be used. For example, with
%
% \vspace{1ex}
% \noindent
% |\definenotesoption{box}{titlestyle=none,vparts=1,hparts=1}|\\
% |\notespages[box]|
%
% \vspace{1ex}
% \noindent
% notes pages with only a box on them could be produced. The command is especially
% useful, if you want to switch between different layouts occasionally throughout
% the document.
%
% \DescribeMacro\definenotesstyle
% \DescribeMacro\remainingtextheight
% \DescribeMacro\notesareatext
% With |\definenotesstyle|\marg{newnotesstyle}\marg{commands} a new notes style can be
% defined. After that, \meta{newnotesstyle} can be used as a new choice for the
% \opt{notesstyle} option and \meta{commands} is used to produce the notes area.
% For \meta{newnotesstyle} only a single word can be used. For \meta{commands} the length
% |\remainingtextheight| is available, containing the height remaining on the page
% usable for the notes area (see \autoref{fig:layoutpage} and \autoref{fig:layoutfill}).
% And if the notes style should contain the text given to the option \opt{notestext},
% the macro |\notesareatext| has to be used.
%
% For example, after
%
% \vspace{1ex}
% \noindent
% |\definenotesstyle{yellow}{\color{LightYellow}%|\\
% | \rule{\textwidth}{\remainingtextheight}}|
%
% \vspace{1ex}
% \noindent
% it is possible to get notes pages with a yellow box, covering the whole notes
% area, by typing
%
% \vspace{1ex}
% \noindent
% |\notespages[notesstyle=yellow]|
%
% \vspace{1ex}
% \DescribeMacro\definetitlestyle
% \DescribeMacro\notestitletext
% With |\definetitlestyle|\marg{newtitlestyle}\marg{commands} a new style for the notes
% title can be defined. After that, \meta{newnotesstyle} can be used as a new choice
% for the \opt{titlestyle} option and \meta{commands} is used to produce the notes
% title. For \meta{newnotesstyle} only single word can be used. For \meta{commands} the
% command |\notestitletext| has to be used to get the title text set with the
% option \opt{titletext}. The commands should start with |\noindent|, in order
% to prevent the indentation done for a first line of a paragraph. And it must
% end with |\par| to start a new paragraph for the notes area, unless the used
% commands already contain it somehow (like, e.g.\ |\section*|). For example,
% after
%
% \vspace{1ex}
% \noindent
% |\definetitlestyle{boldred}{\noindent\textcolor{red}%|\\
% | {\textbf{\notestitletext}}\par}|
%
% \vspace{1ex}
% \noindent
% it is possible to get a boldface red notes title, by typing
%
% \vspace{1ex}
% \noindent
% |\notespages[titlestyle=boldred]|
%
% \vspace{1ex}
% Please note, the styles or options defined with the commands described here,
% must have been defined before they can be used. It is recommended to use these
% commands only in the preamble.
%
% \DescribeMacro\nppatchchapter
% With |\nppatchchapter|\marg{options} the command |\chapter| is patched, so it
% works as if one writes |\notespages[|\meta{options}|]| followed by |\chapter|.
% By this, the occasional empty page before a new chapter is converted into a
% notes page.
%
% It is recommended to add at least |multiple=2|. Otherwise there may be
% up to three notes pages before a new chapter (with the default value). If other
% notes pages in the document should be formated differently, one can start with
% the option \opt{default}. If the argument is left empty, the notes page will
% be formated with the current settings (the defaults, the package options, or
% the last options set with |\setnotespages|).
%
% \changes{0.8.1}{2016/08/21}{corrected manual section for \texttt{\bs nppatchchapter}}%
% This macro should not be used, if the class uses the option \opt{openany},
% because it will suppress the effect of this class option. Any\since{0.8.1}
% redefinition of |\chapter|, either by loading a package or manually, must be
% done before the \NP\ package is loaded, otherwise the redefinition and/or the
% patching may not be effective.
%
% The command can be used anywhere in the document and it can be used multiple
% time. This way, the apperance of a notes page before a new chapter can be
% changed where ever wanted.
%
% The |\chapter| command is only patched, if it exists, so no errors will occur
% for a class without it.
%
% \DescribeMacro\npunpatchchapter
% \changes{0.8.1}{2016/08/21}{added \texttt{\bs npunpatchchapter}}%
% With\since[added]{0.8.1} |\npunpatchchapter| the command |\chapter| is restored
% to its original meaning, thus there will be no more notes pages before a new
% chapter after issuing this command.
%
% ^^A---------------------------------------------
% \subsection{Supporting Babel}
% \label{sec:babel}
% \DescribeMacro\npnotesname
% The \NP\ package defines the macro |\npnotesname| to contain the default title
% ``Notes''. If \pkg{babel} is used, commands will be added to redefine |\npnotesname|
% to the appropriate translation for the chosen language (if available).
%
% \DescribeMacro\npnotestext
% Also, \NP\ defines the macro |\npnotestext| to contain the default text
% ``This page is intentionally left blank.'', which will be redefined to the
% appropriate translation, if \pkg{babel} is used.
%
% Currently, only the languages English (english, USenglish, american, UKeng\-lish,
% british, canadian, australian, newzealand), French (french, francais, canadien,
% acadian), and German (austrian, german, germanb, ngerman, naustrian) are supported.
% Additional languages will be supported as users provide a translation for the
% word ``Notes'' (plural of note, as in ``make a note'', German: ``Notizen'') and
% the sentence ``This page is intentionally left blank.'' (German: ``Diese Seite
% wurde absichtlich leer gelassen.''; French: ``Cette page est laiss\'{e}e
% intentionnellement vide.'').
%
% Until then, you can put
%
% \vspace{1ex}
% \noindent
% |\addto{\extras|\meta{yourlang}|}{\def\npnotesname|\marg{``Notes'' translated}|%|\\
% | \def\npnotestext|\marg{``This page ...'' translated}|}|
%
% \vspace{1ex}
% \noindent
% in the preamble of a multilingual document. For documents in one language one
% could simply put
%
% \vspace{1ex}
% \noindent
% |\setnotespages{titletext=|\marg{``Notes'' translated}|,notestext=|\\
% | |\marg{``This page ...'' translated}|}|
%
% \vspace{1ex}
% \noindent
% in the preamble. But this would be overwritten, if the option \opt{default} is
% used. To circumvent this, one can redefine the macros |\npnotesname|
% and |\npnotestext| instead:
%
% \vspace{1ex}
% \noindent
% |\renewcommand{\npnotesname}|\marg{``Notes'' translated}\\
% |\renewcommand{\npnotestext}|\marg{``This page ...'' translated}
%
% ^^A---------------------------------------------
% \subsection{Supporting Color}
% \label{sec:color}
% The \NP\ package uses the colors \textsf{NotesHColor}, \textsf{NotesVColor},
% and \textsf{NotesTextColor} for horizontal and vertical lines and the text
% in the notes area of notes style \choice{text}. They are defined in the
% |\AtBeginDocument| hook, but only, if the package \pkg{color} or \pkg{xcolor}
% is loaded and the colors where not defined yet. This way, it is possible to
% define them with your own settings in the preamble. The default for all colors
% is |{gray}{0.7}|.
%
% ^^A---------------------------------------------
% \subsection{Warnings and Errors}
% There are 7 package warnings for the options. In most cases wrong values will
% be set to a resonable value, so compiling the document will work. But of course
% the result won't be as expected.
%
% If one of the keys is already defined, an error message will be given out.
% There are two possible reasons for this: a) another package uses the same key
% or b) \NP\ was loaded twice.
%
% If for a number or a length something illegal is given, there will be the usual
% error messages from \TeX.
%
% If for a choice key an undefined value is given, there will be an error message
% from the \pkg{xkeyval} package.
%
% Another Warning will be given out, if \LaTeX\ should be run again in order to
% get saving and restoring header marks correct.
%
% ^^A--------------------------------------------------------------------------
% \section{Example File}
% \label{sec:example}
% Since examples for the \NP\ package would fill this document with a lot of
% pages, they are outsourced to an example file \texttt{np-test.tex} provided with
% this package. But beware, the resulting file will be very long. The file also
% contains some examples for defining own title styles and notes styles.
%
% ^^A--------------------------------------------------------------------------
% \section{Restrictions}
% \label{sec:restrictions}
% The only known restriction applies to |\notesfill|s. If there are bottom floats
% or footnotes on the page, they will appear below it. This is shown in the example
% file. Fixing this, will be at least difficult, as it may require rewriting or
% patching the output routine. And there are many reasons not doing this.
%
% Of course, there may be other restrictions or incompatibility with some packages,
% but none were noticed with the packages used for the example file.
%
% ^^A--------------------------------------------------------------------------
% \section{Testing}
% The example file (see \autoref{sec:example}) was also used for testing. It was
% compiled several times with different lines commented out. Please refer to the
% comments in the example for further information.
%
% ^^A--------------------------------------------------------------------------
% \section{ToDo}
% There is just two items on the todo list:
% \begin{itemize}
% \item add support for other languages, as translations drop in, and
% \item find a way to circumvent the restriction described in \autoref{sec:restrictions}
% (if feasible).
% \end{itemize}
% If there are good ideas for additional features from users, I may add them
% to the todo list. And of course, reported bugs will be added.
%
% ^^A--------------------------------------------------------------------------
% \StopEventually{\newpage\PrintIndex\PrintChanges}
%
% ^^A--------------------------------------------------------------------------
% \newpage
% \section{The Code}
% \subsection{The Usual}
% First the usual things.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{notespages}[\filedate\space
v\fileversion\space filling documents, so the total number of pages
is a multiple of a given number]
% \end{macrocode}
%
% ^^A---------------------------------------------
% \subsection{Loading required packages}
% The only package required by \NP\ is \pkg{xkeyval} to process the options of
% the package and the commands.
% \begin{macrocode}
\RequirePackage{xkeyval}
% \end{macrocode}
%
% ^^A---------------------------------------------
% \subsection{``Variables''}
% \subsubsection{``Variables'' useful for the user}
% \begin{macro}{\npnotesname}
% First, |\npnotesname| is set to its default.
% \begin{macrocode}
\newcommand*{\npnotesname}{Notes}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\npnotestext}
% And then the default for |\npnotestext| is set.
% \begin{macrocode}
\newcommand*{\npnotestext}{This page is intentionally left blank.}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\remainingtextheight}
% This dimen will hold the height remaining on a page for the notes area.
% But first, it is checked, if the name is already defined.
% \begin{macrocode}
\newcommand*{\remainingtextheight}{}
\newdimen\remainingtextheight
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\notestitletext}
% This macro will hold the value given to the option \opt{titletext}. It should
% be used for defining a custom title style with |\definetitlestyle|, in order
% to get the title given with the \opt{titletext} option.
% \begin{macrocode}
\newcommand*{\notestitletext}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\notesareatext}
% This macro will hold the value given to the option \opt{notestext}. It can be
% used for own notes styles, if they should contain the text.
% \begin{macrocode}
\newcommand*{\notesareatext}{}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{``Variables'' for \texttt{\bs notespage}}
% \begin{macro}{\np@startnotes}
% This macro will hold the value given to the option \opt{startnotes}.
% \begin{macrocode}
\newcommand*{\np@startnotes}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@pagestyle}
% This macro will hold the value given to the option \opt{pagestyle}.
% \begin{macrocode}
\newcommand*{\np@pagestyle}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@notesstyle}
% This macro will hold the value given to the option \opt{notesstyle}.
% \begin{macrocode}
\newcommand*{\np@notesstyle}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@titlestyle}
% This macro will hold the value given to the option \opt{titlestyle}.
% \begin{macrocode}
\newcommand*{\np@titlestyle}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@titleskip}
% This dimen will be set to the length given to the option \opt{titleskip}.
% \begin{macrocode}
\newcommand*{\np@titleskip}{}
\newdimen\np@titleskip
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@notesalign}
% This macro will hold the value given to the option \opt{notestextalign}.
% \begin{macrocode}
\newcommand*{\np@notesalign}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@mark}
% This macro will hold the value given to the option \opt{mark}.
% \begin{macrocode}
\newcommand*{\np@mark}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@marktext}
% This macro will hold the value given to the option \opt{marktext}.
% \begin{macrocode}
\newcommand*{\np@marktext}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@hparts}
% This counter will be set to the number given to the option \opt{hparts}.
% \begin{macrocode}
\newcommand*{\np@hparts}{}
\newcount\np@hparts
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@vparts}
% This counter will be set to the number given to the option \opt{vparts}.
% \begin{macrocode}
\newcommand*{\np@vparts}{}
\newcount\np@vparts
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@height}
% In the commands for the notes styles \choice{lines} and \choice{grid} this dimen
% will be set to the distance between two horizontal lines.
% \begin{macrocode}
\newcommand*{\np@height}{}
\newdimen\np@height
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@width}
% In the commands for the notes styles \choice{vlines} and \choice{grid} this dimen
% will be set to the distance between two vertical lines.
% \begin{macrocode}
\newcommand*{\np@width}{}
\newdimen\np@width
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@save@marks@tokens}
% This token register is used to save the original marks for the header, so they
% can be changed and later restored.
% \begin{macrocode}
\newcommand*{\np@save@marks@tokens}{}
\newtoks\np@save@marks@tokens
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifnp@marktext@set}
% \begin{macro}{\np@marktext@setfalse}
% \begin{macro}{\np@marktext@settrue}
% This boolean is used to prevent the option \opt{titletext} from also setting
% \opt{marktext} in case the latter option was already given in the current key
% list. It is initialised to false.
% \begin{macrocode}
\newcommand*{\ifnp@marktext@set}{}
\newif\ifnp@marktext@set\np@marktext@setfalse
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifnp@mark@new}
% \begin{macro}{\np@mark@newfalse}
% \begin{macro}{\np@mark@newtrue}
% This boolean is used to generate a warning, if new notes pages were inserted
% and therefore \LaTeX\ should be run again. It is initialised to false.
% \begin{macrocode}
\newcommand*{\ifnp@mark@new}{}
\newif\ifnp@mark@new\np@mark@newfalse
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifnp@std@class}
% \begin{macro}{\np@std@classfalse}
% \begin{macro}{\np@std@classtrue}
% This boolean is set to true, if a standard class or \pkg{memoir} was loaded.
% It is initialised depending on the used class. Currently this boolean is only
% used to set the default for the option \opt{markuppercase}.
% \begin{macrocode}
\newcommand*{\ifnp@std@class}{}
\newif\ifnp@std@class\np@std@classfalse
\@ifclassloaded{article}{\np@std@classtrue}{}
\@ifclassloaded{report}{\np@std@classtrue}{}
\@ifclassloaded{book}{\np@std@classtrue}{}
\@ifclassloaded{memoir}{\np@std@classtrue}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{``Variables'' for \texttt{\bs notespages}}
% \begin{macro}{\np@minpages}
% This counter will be set to the number given to the option \opt{minpages}.
% \begin{macrocode}
\newcommand*{\np@minpages}{}
\newcount\np@minpages
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@endpages}
% This counter will be set to the number given to the option \opt{endpages}.
% \begin{macrocode}
\newcommand*{\np@endpages}{}
\newcount\np@endpages
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@multiple}
% This counter will be set to the number given to the option \opt{multiple}.
% \begin{macrocode}
\newcommand*{\np@multiple}{}
\newcount\np@multiple
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@notepages}
% This counter will hold the number of notes pages, which have to be inserted by
% |\notespages|. It is decremented after every page.
% \begin{macrocode}
\newcommand*{\np@notepages}{}
\newcount\np@notepages
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifnp@started@on@new@page}
% \begin{macro}{\np@started@on@new@pagefalse}
% \begin{macro}{\np@started@on@new@pagetrue}
% In |\notespages| this boolean is set to true, if the command started on a new
% page. It is needed to calculate the number of pages to be inserted.
% \begin{macrocode}
\newcommand*{\ifnp@started@on@new@page}{}
\newif\ifnp@started@on@new@page
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifnp@started@on@full@page}
% \changes{0.8.1}{2016/08/21}{added for calculating the number of notes pages}%
% \begin{macro}{\np@started@on@full@pagefalse}
% \begin{macro}{\np@started@on@full@pagetrue}
% In |\notespages| this boolean is set to true, if the current page is already
% full. It is needed to calculate the number of pages to be inserted.
% \since[~\\~\\\null\hfill added]{0.8.1}
% \begin{macrocode}
\newcommand*{\ifnp@started@on@full@page}{}
\newif\ifnp@started@on@full@page
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{``Variables'' for \texttt{\bs notesfill}}
% \begin{macro}{\np@fill@minspace}
% This dimen is set to the length given to the option \opt{fillminspace}.
% \begin{macrocode}
\newcommand*{\np@fill@minspace}{}
\newdimen\np@fill@minspace
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@fill@maxspace}
% This dimen is set to the length given to the option \opt{fillmaxspace}.
% \begin{macrocode}
\newcommand*{\np@fill@maxspace}{}
\newdimen\np@fill@maxspace
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@fill@topskip}
% This dimen is set to the length given to the option \opt{filltopskip}.
% \begin{macrocode}
\newcommand*{\np@fill@topskip}{}
\newdimen\np@fill@topskip
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Temporary ``Variables''}
% \begin{macro}{\np@tempcnta}
% \begin{macro}{\np@tempcntb}
% \begin{macro}{\np@tempdima}
% \begin{macro}{\np@tempa}
% These three registers and the macro are used as temporary variables in some
% commands.
% \begin{macrocode}
\newcommand*{\np@tempcnta}{}
\newcount\np@tempcnta
\newcommand*{\np@tempcntb}{}
\newcount\np@tempcntb
\newcommand*{\np@tempdima}{}
\newdimen\np@tempdima
\newcommand*{\np@tempa}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Options}
% \subsubsection{Checking numbers}
% \begin{macro}{\np@check@num@range}
% This command checks the range of a number given to some options. If the number
% is too small or too large, a warning is given out and the number is set to either
% the minimum or maximum respectively. The parameters are |#1| the name of option,
% |#2| the counter containing the number to check, |#3| the minimum, and |#4| the
% maximum.
% \begin{macrocode}
\newcommand*{\np@check@num@range}[4]{\relax
\ifnum#2<#3\relax
\PackageWarning{notespages}{%
Value for #1 to small, set to #3\MessageBreak}#2=#3\relax
\else\ifnum#2>#4\relax
\PackageWarning{notespages}{%
Value for #1 to large, set to #4\MessageBreak}#2=#4\relax
\fi\fi}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Error message for already defined option}
% \begin{macro}{\np@err@defined}
% This command gives out an error for already defined keys. This is checked before
% defining keys. There are two possible reasons for this: a) another package uses
% the same family and the same key or b) \NP\ was loaded twice.
% \begin{macrocode}
\newcommand*{\np@err@defined}[1]{%
\PackageError{notespages}%
{Key #1 is already defined.\MessageBreak}%
{The key #1 may have been defined by some other package\MessageBreak
or the NotesPages package was loaded twice.}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Options for \texttt{\bs notespage}}
% \label{sec:optnotespage}
% \begin{option}{startnotes}
% The key is used to define, if a notes page should be started with |\newpage| or
% |\clearpage|. It stored the value in |\np@startnotes|. Before defining the key
% it is checked, if the key already exists. If so, an error is given out.
% \begin{macrocode}
\key@ifundefined{np}{startnotes}{}{\np@err@defined{startnotes}}
\define@choicekey{np}{startnotes}[\np@startnotes]%
{clearpage,newpage}[clearpage]{}
% \end{macrocode}
% \end{option}
%
% \begin{option}{allowfloats}
% The boolean key is used decide if floats may appear on a notes page started with
% |startnotes=newpage|. The default is set to \choice{true} here so it's possible
% to just give the option without a value. It will later be set to it's real default
% \choice{false} by initialising the keys.
% \begin{macrocode}
\key@ifundefined{np}{allowfloats}{}{\np@err@defined{allowfloats}}
\define@boolkey{np}{allowfloats}[true]{}
% \end{macrocode}
% \end{option}
%
% \begin{option}{pagestyle}
% The key is used to define the page style for a notes page. The value given is
% stored in |\np@pagestyle|. After that, it is tested, if the given pagestyle is
% defined. If not, a warning is given out and the default is set.
% \begin{macrocode}
\key@ifundefined{np}{pagestyle}{}{\np@err@defined{pagestyle}}
\define@cmdkey{np}[np@]{pagestyle}[current]{%
\def\np@tempa{current}\ifx\np@tempa\np@pagestyle\else
\@ifundefined{ps@#1}{%
\PackageWarning{notespages}{%
`#1' is not a valid pagestyle, set to default\MessageBreak}%
\def\np@pagestyle{current}}{}\fi}
% \end{macrocode}
% \end{option}
%
% \begin{option}{notesstyle}
% The key is used to define the style for the notes area. The value given is
% stored in |\np@notesstyle|.
% \begin{macrocode}
\key@ifundefined{np}{notesstyle}{}{\np@err@defined{notesstyle}}
\define@choicekey{np}{notesstyle}[\np@notesstyle]%
{plain,lines,vlines,grid,text}[grid]{}
% \end{macrocode}
% \end{option}
% \begin{macro}{\np@notesstyle@nominations}
% In order to make the choices expandable, the list is stored here.
% \begin{macrocode}
\newcommand*{\np@notesstyle@nominations}{plain,lines,vlines,grid,text}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@def@notesstyle@key}
% And with this command the option \opt{notesstyle} can be redifined with a new
% list of choices. The command is first defined with |\newcommand| to ensure it is
% not defined yet. The command is later used in |\definenotesstyle| (see
% \autoref{sec:newnotesstyle}).
% \begin{macrocode}
\newcommand*{\np@def@notesstyle@key}{}
\def\np@def@notesstyle@key#1\np@end{%
\define@choicekey{np}{notesstyle}[\np@notesstyle]{#1}[grid]{}}
% \end{macrocode}
% \end{macro}
%
% \begin{option}{titlestyle}
% The key is used to define the style for the notes title. The value given is
% stored in |\np@titlestyle|. But first the command |\minisec| is checked, so the
% choice \choice{minisec} is only added, if the command exists.
% \begin{macro}{\np@titlestyle@nominations}
% Also, in order to make the choices expandable, the list is stored here.
% \begin{macrocode}
\key@ifundefined{np}{titlestyle}{}{\np@err@defined{titlestyle}}
\@ifundefined{minisec}{%
\define@choicekey{np}{titlestyle}[\np@titlestyle]%
{none,text,section,subsection,subsubsection}[section]{}%
\newcommand*{\np@titlestyle@nominations}%
{none,text,section,subsection,subsubsection}}{%
\define@choicekey{np}{titlestyle}[\np@titlestyle]%
{none,text,section,subsection,subsubsection,minisec}[section]{}%
\newcommand*{\np@titlestyle@nominations}%
{none,text,section,subsection,subsubsection,minisec}}
% \end{macrocode}
% \end{macro}
% \end{option}
% \begin{macro}{\np@def@titlestyle@key}
% And with this command the option \opt{titlestyle} can be redifined with a new
% list of choices. The command is first defined with |\newcommand| to ensure it is
% not defined yet. The command is later used in |\definetitlestyle| (see
% \autoref{sec:newtitlestyle}).
% \begin{macrocode}
\newcommand*{\np@def@titlestyle@key}{}
\def\np@def@titlestyle@key#1\np@end{%
\define@choicekey{np}{titlestyle}[\np@titlestyle]{#1}[section]{}}
% \end{macrocode}
% \end{macro}
%
% \begin{option}{titletext}
% The key is used to define a new text for the notes title. The value given is
% stored in |\notestitletext|. The callback also sets |\np@marktext| to the same
% value, if \opt{marktext} wasn't used so far.
% \begin{macrocode}
\key@ifundefined{np}{titletext}{}{\np@err@defined{titletext}}
\define@key{np}{titletext}[\npnotesname]%
{\ifnp@marktext@set\else\def\np@marktext{#1}\fi
\def\notestitletext{#1}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{titleskip}
% The key is used to define the distance between the notes title and the notes
% area. The length given is stored in |\np@titleskip|.
% \begin{macrocode}
\key@ifundefined{np}{titleskip}{}{\np@err@defined{titleskip}}
\define@key{np}{titleskip}[0pt]{\np@titleskip=#1}
% \end{macrocode}
% \end{option}
%
% \begin{option}{titlenotesfill}
% This key is used to decide, if a |\vfill| should be added between notes title
% and notes area. Again, \choice{true} is set as the default here to make it
% possible to use the option without a value. The real default is set during
% initialisation.
% \begin{macrocode}
\key@ifundefined{np}{titlenotesfill}{}{\np@err@defined{titlenotesfill}}
\define@boolkey{np}{titlenotesfill}[true]{}
% \end{macrocode}
% \end{option}
%
% \begin{option}{notestext}
% The key is used to define a new text for the notes style \choice{text}. The value
% given is stored in |\notesareatext|.
% \begin{macrocode}
\key@ifundefined{np}{notestext}{}{\np@err@defined{notestext}}
\define@key{np}{notestext}[\npnotestext]{\def\notesareatext{#1}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{notestextalign}
% The key is used to set the alignment for the text of the notes style \choice{text}.
% The value given is stored in |\np@notesalign|.
% \begin{macrocode}
\key@ifundefined{np}{notestextalign}{}{\np@err@defined{notestextalign}}
\define@choicekey{np}{notestextalign}[\np@notesalign]%
{left,right,center,none}[center]{}
% \end{macrocode}
% \end{option}
%
% \begin{option}{mark}
% The key is used to select were the notes title should be put in the header. The
% value given is stored in |\np@mark|.
% \begin{macrocode}
\key@ifundefined{np}{mark}{}{\np@err@defined{mark}}
\define@choicekey{np}{mark}[\np@mark]{both,right,left,keep}[both]{}
% \end{macrocode}
% \end{option}
%
% \begin{option}{marktext}
% With this key an alternative text for the header can be set. The new text is
% stored in |\np@marktext|. The callback sets |\np@marktext@settrue|, in order
% to prevent a later occurence of \opt{titletext} to overwrite \opt{marktext}.
% \begin{macrocode}
\key@ifundefined{np}{marktext}{}{\np@err@defined{marktext}}
\define@cmdkey{np}[np@]{marktext}[\npnotesname]{\np@marktext@settrue}
% \end{macrocode}
% \end{option}
%
% \begin{option}{markuppercase}
% This key is used to convert the text for the header marks of a notes pages to
% upper case letters. The real default is set during initialisation, depending
% on the class used.
% \begin{macrocode}
\key@ifundefined{np}{markuppercase}{}{\np@err@defined{markuppercase}}
\define@boolkey{np}{markuppercase}[true]{}
% \end{macrocode}
% \end{option}
%
% \begin{macro}{\np@init@markuppercase}
% The macro sets the option \opt{markuppercase} according to the class loaded.
% \begin{macrocode}
\newcommand*{\np@init@markuppercase}{%
\ifnp@std@class
\setkeys{np}{markuppercase=true}%
\else
\setkeys{np}{markuppercase=false}%
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{option}{hparts}
% With this key the number of horizontal parts is defined. The number is stored in
% |\np@hparts| and then the range is checked.
% \begin{macrocode}
\key@ifundefined{np}{hparts}{}{\np@err@defined{hparts}}
\define@key{np}{hparts}[25]%
{\np@hparts=#1\np@check@num@range{hparts}{\np@hparts}{1}{200}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{vparts}
% With this key the number of vertical parts is defined. The number is stored in
% |\np@vparts| and then the range is checked.
% \begin{macrocode}
\key@ifundefined{np}{vparts}{}{\np@err@defined{vparts}}
\define@key{np}{vparts}[0]%
{\np@vparts=#1\np@check@num@range{vparts}{\np@vparts}{0}{300}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{usenotesareaheight}
% With this key the height of a vertical part can be based on the height of the
% notes area (|\remainingtextheight|) instead of |\textheight|. Here too, true
% is set as the default to make it possible to use the option without a value.
% The real default is set during initialisation.
% \begin{macrocode}
\key@ifundefined{np}{usenotesareaheight}{}%
{\np@err@defined{usenotesareaheight}}
\define@boolkey{np}{usenotesareaheight}[true]{}
% \end{macrocode}
% \end{option}
%
% ^^A-------------------------
% \subsubsection{Options for \texttt{\bs notespages}}
% \begin{option}{multiple}
% With this key the number, the total number of pages of a document (so far) should
% be dividable by, is defined. The number is stored in |\np@multiple| and then the
% range is checked.
% \begin{macrocode}
\key@ifundefined{np}{multiple}{}{\np@err@defined{multiple}}
\define@key{np}{multiple}[4]%
{\np@multiple=#1\np@check@num@range{multiple}{\np@multiple}{1}{100}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{minpages}
% With this key the minimum number of notes pages to be given out is defined. The
% number is stored in |\np@minpages| and then the range is checked.
% \begin{macrocode}
\key@ifundefined{np}{minpages}{}{\np@err@defined{minpages}}
\define@key{np}{minpages}[0]%
{\np@minpages=#1\np@check@num@range{minpages}{\np@minpages}{0}{100}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{endpages}
% With this key the number of pages, which will appear after the notes pages,
% is defined. The number is stored in |\np@endpages| and then the range is
% checked.
% \begin{macrocode}
\key@ifundefined{np}{endpages}{}{\np@err@defined{endpages}}
\define@key{np}{endpages}[0]%
{\np@endpages=#1\np@check@num@range{endpages}{\np@endpages}{0}{100}}
% \end{macrocode}
% \end{option}
%
% ^^A-------------------------
% \subsubsection{Options for \texttt{\bs notesfill}}
% \begin{option}{fillminspace}
% With this key the the minimum space is defined, which has to be left on a page
% to insert a notes fill. The length is stored in |\np@fill@minspace|.
% \begin{macrocode}
\key@ifundefined{np}{fillminspace}{}{\np@err@defined{fillminspace}}
\define@key{np}{fillminspace}[0.25\textheight]{\np@fill@minspace=#1}
% \end{macrocode}
% \end{option}
%
% \begin{option}{fillmaxspace}
% With this key the maximum height of a notes fill is defined. The length is
% stored in |\np@fill@maxspace|.
% \begin{macrocode}
\key@ifundefined{np}{fillmaxspace}{}{\np@err@defined{fillmaxspace}}
\define@key{np}{fillmaxspace}[\textheight]{\np@fill@maxspace=#1}
% \end{macrocode}
% \end{option}
%
% \begin{option}{filltopskip}
% With this key the distance between the text and the notes fill is defined. The
% length is stored in |\np@fill@topskip|.
% \begin{macrocode}
\key@ifundefined{np}{filltopskip}{}{\np@err@defined{filltopskip}}
\define@key{np}{filltopskip}[0pt]{\np@fill@topskip=#1}
% \end{macrocode}
% \end{option}
%
% \begin{option}{filltopfill}
% This key is used to decide, if a |\vfill| should be added between the text and
% notes title of a notes fill.
% \begin{macrocode}
\key@ifundefined{np}{filltopfill}{}{\np@err@defined{filltopfill}}
\define@boolkey{np}{filltopfill}[true]{}
% \end{macrocode}
% \end{option}
%
% ^^A-------------------------
% \subsubsection{Meta option}
% \begin{option}{empty}
% This option sets all necessary keys to the values needed to produce completely
% empty notes pages.
% \begin{macrocode}
\key@ifundefined{np}{empty}{}{\np@err@defined{empty}}
\define@key{np}{empty}[]{\setkeys{np}{%
pagestyle=empty,notesstyle=plain,titlestyle=none}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{vacant}
% This option sets all necessary keys to the values needed to produce notes pages
% with only the text given to the option \opt{notetext}.
% \begin{macrocode}
\key@ifundefined{np}{vacant}{}{\np@err@defined{vacant}}
\define@key{np}{vacant}[]{\setkeys{np}{pagestyle=empty,
notesstyle=text,titlestyle=none,titleskip=0.3\textheight}}
% \end{macrocode}
% \end{option}
%
% \begin{option}{default}
% This option sets all keys back to their default values. Since \pkg{xkeyval} sets
% the default value, if no value in given, most options don't have values here.
% Just some boolean options are set to \choice{false}. The option \opt{markuppercase}
% is set with |\np@init@markuppercase|, thus depending on the class loaded.
% \begin{macrocode}
\key@ifundefined{np}{default}{}{\np@err@defined{default}}
\define@key{np}{default}[]{\setkeys{np}{%
startnotes,allowfloats=false,pagestyle,notesstyle,
titlestyle,titletext,titleskip,titlenotesfill=false,
notestext,notestextalign,
mark,marktext,
hparts=25,vparts=0,usenotesareaheight=false,
minpages,endpages,multiple=4,
fillminspace,fillmaxspace,filltopskip,filltopfill}%
\np@init@markuppercase}
% \end{macrocode}
% \end{option}
%
% ^^A-------------------------
% \subsubsection{Initialisation}
% The keys are now initialised, i.e.\ set to thier defaults. After that, the
% options passed on loading are processed.
% \begin{macrocode}
\setkeys{np}{default}
\ProcessOptionsX<np>
% \end{macrocode}
%
% ^^A---------------------------------------------
% \subsection{Commands}
% \subsubsection{Header marks}
% Changing and restoring the header marks works as follows: first the original
% marks are saved with |\np@savemark|. Then the header marks for the notes page
% are set with |\np@setmark|. And finally, the original header makrs are restored
% with |\np@restoremark|.
%
% But there are several conditions to that:
% \begin{enumerate}
% \item The original header marks can only be saved on the first notes page of
% a group of successive notes pages, regardless if they where generated
% with one |\notespages| command or several |\notespage| or |\notespages|
% commands. If done on following pages, this would overwrite the already
% saved original header marks.
% \item Saving, setting, and restoring the header marks should only be done
% if necessary, i.e. if \opt{mark} is not \choice{keep}.
% \item Setting the header marks can be done on every notes page, but of course
% only according to the value given to \opt{mark}.
% \item When setting only the left or the right mark, for the other the original
% mark must be set, so in case the value for \opt{mark} is changed on
% successive notes pages, the marks don't mixed up.
% \item Restoring the original header marks can only be done on the last of a
% group of successive notes pages. Otherwise, this would mix up the header
% marks.
% \item All |\mark...| commands always set both marks, |\markright| just sets
% the current other mark again (stored in \LaTeX{}s |\@themark|).
% \item The left mark must not be restored on the notes page, because |\botmark|
% is used for this. This would result in the restored left mark on the last
% notes page.
% \item The right mark must be restored before the page after the last notes page,
% because here |\firstmark| is used. Otherwise, a new section after the notes
% page would not reflect in the header.
% \end{enumerate}
%
% The first condition could easily be met with a simple flag, but for condition 5
% it is necessary to look ahead. Therefore, some information is written to the
% |.aux| file for every notes page, where \opt{mark} is not \choice{keep}. When
% the file is reread at the end of the document, these informations will be written
% to a file |\jobname.npm|. The latter is then read in |\AtBeginDocument| during
% the second \LaTeX\ run, defining special macros for each notes page. These macros
% are then used to look back and ahead to meet conditions 1 and 5.
%
% The last three conditions result is a conflict. Due to condition 6, regarding
% condition 7 would violate condition 8 and vice versa. This problem is solved
% by setting a mark in the form |\ifnum| \meta{page number after notes page} $=$
% \meta{current page number} \meta{original left mark} |\else| \meta{left mark
% for notes page} |\fi| on the last notes page.
%
% \begin{macro}{\npnpinfo}
% The macro |\npnpinfo| is written to the file |\jobname.npm| via the |.aux| file.
% The argument is the page number of the notes page. It will define a macro
% |\np@np@info.|\meta{page number}, which will later just be checked
% for existence to determine, if the previous or next page is a notes page.
% \begin{macrocode}
\newcommand*{\npnpinfo}[1]{%
\expandafter\def\csname np@np@info.#1\endcsname{}}
% \end{macrocode}
% \end{macro}
%
% The file |\jobname.npm| must be opened in |\AtEndDocument|, so \LaTeX\ can
% write it while rereading the |.aux| file. The |\nofiles| switch is observed.
% Here also the warning to rerun \LaTeX\ is given out, if new notes pages were
% added.
% \begin{macrocode}
\AtEndDocument{\if@filesw\newwrite\tf@npm
\immediate\openout\tf@npm\jobname.npm\fi
\ifnp@mark@new
\PackageWarningNoLine{notespage}{%
New notes pages were added.
Please rerun LaTeX to get header marks right.}%
\fi}
% \end{macrocode}
%
% \begin{macro}{\tracingnpmarks}
% For saving, setting, and restoring the header marks, some tracing can be done.
% By setting the counter |\tracingnpmarks| to a value greater then 0, informations
% about the reasons for doing or not doing things are stored to the log file. It
% is switched off by default.
% \begin{macrocode}
\newcommand*{\tracingnpmarks}{}
\newcount\tracingnpmarks
\tracingnpmarks\z@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@tracing@marks}
% This macro is used for adding the tracing information to the log file if
% tracing is enabled.
% \begin{macrocode}
\newcommand{\np@tracing@marks}[3]{%
\ifnum\tracingnpmarks>\z@
\PackageInfo{notespages}{#1 header marks: #2 done\MessageBreak
#3\MessageBreak}%
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifnp@page@has@np}
% \begin{macro}{\np@page@has@nptrue}
% \begin{macro}{\np@page@has@npfalse}
% \begin{macro}{\np@page@has@np}
% This boolean and the macro are used to determine, if a page is a notes page. The
% page number is given as argument to |\np@page@has@np|.
% \begin{macrocode}
\newcommand*{\ifnp@page@has@np}{}
\newif\ifnp@page@has@np
\newcommand*{\np@page@has@np}[1]{%
\@ifundefined{np@np@info.#1}%
{\np@page@has@npfalse}{\np@page@has@nptrue}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\np@mark@keep}
% This macro simply checks, if |mark=keep| was given.
% \begin{macrocode}
\newcommand*{\np@mark@keep}{TT\fi
\def\np@tempa{keep}\ifx\np@tempa\np@mark}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@savemark}
% This command saves the current header marks in the token register\linebreak
% |\np@save@marks@tokens|. But this is only done, if \opt{mark} is not \choice{keep}
% and the previous page is not a notes page. The messages for tracing are numbered,
% so it's easier to find the corresponding parts in the code.
% \begin{macrocode}
\newcommand*{\np@savemark}{%
\if\np@mark@keep
\np@tracing@marks{save}{not}{mark=keep (1)}%
\else
\np@tempcnta\c@page\advance\np@tempcnta\m@ne
\np@page@has@np{\the\np@tempcnta}\ifnp@page@has@np
\np@tracing@marks{save}{not}{np on previous page (2)}%
\else
\np@tracing@marks{save}{}{mark not keep (3)}%
\global\np@save@marks@tokens\expandafter{\@themark}%
\fi
\fi}
% \end{macrocode}
% \end{macro}
%
% Setting the header marks is not as easy as it seems at first. In order to make
% it possible to switch between the possible choices on consecutive pages, both
% header marks must always be set. For \choice{both} this is easily done with
% |\markboth|. For \choice{left} and \choice{right} it is necessary to set the
% other mark to the original, because they may have been changed on the page
% before.
%
% \begin{macro}{\np@@markleft}
% \begin{macro}{\np@@markright}
% These commands take three arguments, |#1|: the original left header mark, |#2|:
% the original right header mark, and |#3|: the header mark for the notes page.
% The latter is used for the appropriate side and for the other the original is
% used.
% \begin{macrocode}
\newcommand*{\np@@markleft}[3]{\markboth{#3}{#2}}
\newcommand*{\np@@markright}[3]{\markboth{#1}{#3}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\np@markleft}
% \begin{macro}{\np@@markright}
% These commands take the header mark for the notes page as their argument and
% pass it to |\np@@markleft| or |\np@@markright| together with the original
% header marks.
% \begin{macrocode}
\newcommand*{\np@markleft}[1]{%
\expandafter\np@@markleft\the\np@save@marks@tokens{#1}}
\newcommand*{\np@markright}[1]{%
\expandafter\np@@markright\the\np@save@marks@tokens{#1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\np@setmark}
% This command sets the header marks for a notes page depending on the value given
% to the option \opt{mark}. For the choice \choice{keep} nothing is done, leading
% to unchanged headers. Additionally, |\np@mark@newtrue| is set, if the notes page
% is new in this \LaTeX\ run.
% \begin{macrocode}
\newcommand*{\np@setmark}{
\if\np@mark@keep
\np@tracing@marks{set}{not}{mark=keep (4)}%
\else
\np@page@has@np{\the\c@page}\ifnp@page@has@np\else
\global\np@mark@newtrue
\fi
\def\np@tempa{both}\ifx\np@tempa\np@mark
\np@tracing@marks{set}{}{mark=both (5)}%
\ifKV@np@markuppercase
\markboth{\MakeUppercase{\np@marktext}}%
{\MakeUppercase{\np@marktext}}%
\else
\markboth{\np@marktext}{\np@marktext}%
\fi
\else
\def\np@tempa{right}\ifx\np@tempa\np@mark
\np@tracing@marks{set}{}{mark=right (6)}%
\ifKV@np@markuppercase
\np@markright{\MakeUppercase{\np@marktext}}%
\else
\np@markright{\np@marktext}%
\fi
\else
\def\np@tempa{left}\ifx\np@tempa\np@mark
\np@tracing@marks{set}{}{mark=left (7)}%
\ifKV@np@markuppercase
\np@markleft{\MakeUppercase{\np@marktext}}%
\else
\np@markleft{\np@marktext}%
\fi
\fi
\fi
\fi
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@restore@@mark}
% This macro restores the header marks. It basically works like |\markboth|, but
% with four arguments. Here |#1| and |#2| are the left and right marks for the notes
% page and |#3| and |#4| are the original left and right marks. Argument |#2| is
% not needed, but it can't be avoided. Additionally the counter |\np@tempcnta|
% has to contain the number of the next page, which is calculated in |\np@restoremark|.
%
% \LaTeX{}s |\@themark| is set twice. The first time the left mark is set as an
% |\if| construct. Then, after |\mark|, |\@themark| is set again, but this time
% with only the original marks. Without this the |\if| construct would be nested
% in another one in case a notes page would be followed by normal pages and then
% a notes page again, without anything setting the left mark, e.g.\ a new chapter.
% \begin{macrocode}
\newcommand*{\np@restore@@mark}[4]{%
\begingroup
\let\label\relax \let\index\relax \let\glossary\relax
\@temptokena {#4}%
\unrestored@protected@xdef\@themark{%
{\protect\ifnum\the\np@tempcnta=\c@page
#3\protect\else #1\protect\fi}%
{\the\@temptokena}}%
\@temptokena \expandafter{\@themark}%
\mark{\the\@temptokena}%
\@temptokena {#4}%
\unrestored@protected@xdef\@themark{{#3}{\the\@temptokena}}%
\endgroup
\if@nobreak\ifvmode\nobreak\fi\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@restore@mark}
% This macro is only used to get the correct arguments for |\np@restore@@mark|.
% \begin{macrocode}
\newcommand*{\np@restore@mark}[2]{%
\expandafter\np@restore@@mark\@themark{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@restoremark}
% This command is used to restore the header makrs from before a notes page.
% It only does this, if \opt{mark} is not \choice{keep} and the next page
% isn't a notes page.
% \begin{macrocode}
\newcommand*{\np@restoremark}{%
\if\np@mark@keep
\np@tracing@marks{restore}{not}{mark=keep (8)}%
\else
\np@tempcnta\c@page\advance\np@tempcnta\@ne
\np@page@has@np{\the\np@tempcnta}\ifnp@page@has@np
\np@tracing@marks{restore}{not}{np on next page (9)}%
\else
\np@tracing@marks{restore}{}{(10)}%
\expandafter\np@restore@mark\the\np@save@marks@tokens
\fi
\fi}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Page stuff}
% \begin{macro}{\np@startnotespage}
% This macro starts a new page for a notes page by just calling the values given
% to the option \opt{startnotes} as a command.
% \begin{macrocode}
\newcommand*{\np@startnotespage}{%
\expandafter\csname \np@startnotes\endcsname}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@setpagestyle}
% This macro sets the page style for a notes page by using the value given to the
% option \opt{pagestyle} as a parameter for |\thispagestyle|, if it is not
% \choice{current}.
% \begin{macrocode}
\newcommand*{\np@setpagestyle}{%
\def\np@tempa{current}\ifx\np@tempa\np@pagestyle\else
\thispagestyle{\np@pagestyle}\fi}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Notes title}
% \begin{macro}{\np@ts@section}
% \begin{macro}{\np@ts@subsection}
% \begin{macro}{\np@ts@subsubsection}
% \begin{macro}{\np@ts@minisec}
% \begin{macro}{\np@ts@text}
% \begin{macro}{\np@ts@none}
% The following macros just provide the commands for the choices of the option
% \opt{titlestyle}. For \choice{text} the |\par| at the end is necessary to
% start a new paragraph for the notes area.
% \begin{macrocode}
\newcommand*{\np@ts@section}{\section*{\notestitletext}}
\newcommand*{\np@ts@subsection}{\subsection*{\notestitletext}}
\newcommand*{\np@ts@subsubsection}{\subsubsection*{\notestitletext}}
\newcommand*{\np@ts@minisec}{\minisec{\notestitletext}}
\newcommand*{\np@ts@text}{\noindent\notestitletext\par}
\newcommand*{\np@ts@none}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\np@maketitle}
% This macro calls the macro for the selected notes title style.
% \begin{macrocode}
\newcommand*{\np@maketitle}{\csname np@ts@\np@titlestyle\endcsname}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Remaining height}
% \begin{macro}{\np@calcheight}
% This macro calculates the height remaining on the page and stores the result in
% |\remainingtextheight|. If a page was just started, |\pagegoal| is |\maxdimen|
% and |\pagetotal| 0pt. If there is already something on the page, like the notes
% title or the text on a page with a notes fill, it is necessary, to subtract
% |\lineskip| to get the right height.
% \begin{macrocode}
\newcommand*{\np@calcheight}{%
\ifdim\pagegoal=\maxdimen
\remainingtextheight\textheight
\else
\remainingtextheight\pagegoal
\advance\remainingtextheight by -\pagetotal
\advance\remainingtextheight by -\lineskip
\fi}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Dividing dimen by dimen}
% The following macros are use to divide a dimen register by another dimen
% register, resulting in a real number as a string in |\np@result|.
% \begin{macro}{\np@Tc}
% This is used as a temporary counter.
% \begin{macrocode}
\newcommand*{\np@Tc}{}
\newcount\np@Tc
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@Zc}
% This counter is used for the numerator in sp (scaled points) at first and later
% for computing decimal places.
% \begin{macrocode}
\newcommand*{\np@Zc}{}
\newcount\np@Zc
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@Nc}
% This counter is used for the denominator in sp. It is set to its absolute value
% and not changed afterwards.
% \begin{macrocode}
\newcommand*{\np@Nc}{}
\newcount\np@Nc
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@Z}
% This dimen will hold the numerator in pt. It is set but not changed.
% \begin{macrocode}
\newcommand*{\np@Z}{}
\newdimen\np@Z
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@N}
% This dimen will hold the denominator in pt. It is set but not changed.
% \begin{macrocode}
\newcommand*{\np@N}{}
\newdimen\np@N
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@result}
% In this macro the result is build as a string without a unit.
% \begin{macrocode}
\newcommand*{\np@result}{}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@calcnextdigit}
% This macro computes one decimal place of the result. It expects |\np@Tc| to hold
% the result of the last division and |\np@Zc| the remainder of the nominator
% multiplied with $10^d$ ($d$: number of decimal places computed so far). Both
% counters are left prepared for computing the next decimal place.
% \begin{macrocode}
\newcommand*{\np@calcnextdigit}{%
\multiply\np@Tc\np@Nc
\advance\np@Zc-\np@Tc
\multiply\np@Zc10\relax
\np@Tc\np@Zc
\divide\np@Tc\np@Nc
\xdef\np@result{\np@result\number\np@Tc}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@divide}
% This macro does the divison. First, |\np@result|, |\np@Zc|, and |\np@Nc| are
% initialised. Then the counters are set to their absolute values and, if necessary,
% a minus sign is added to the result. Because\TeX\ interprets ``$--$'' as ``$+$'',
% it can be done for both, numerator and denominator. Then the first division is
% done, leading to an integer result representing the digits before the decimal
% point. This number is appended to |\np@result|. After this, 6 decimal places are
% computed.
% \begin{macrocode}
\newcommand*{\np@divide}{%
\gdef\np@result{}%
\global\np@Zc\np@Z\global\np@Nc\np@N
\ifnum\np@Zc<\z@\np@Zc-\np@Zc\gdef\np@result{-}\fi
\ifnum\np@Nc<\z@\np@Nc-\np@Nc\xdef\np@result{\np@result-}\fi
\np@Tc\np@Zc
\divide\np@Tc\np@Nc
\xdef\np@result{\np@result\number\np@Tc.}%
\np@calcnextdigit\np@calcnextdigit\np@calcnextdigit
\np@calcnextdigit\np@calcnextdigit\np@calcnextdigit}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@dddivide}
% This macro is used by the package to divide two dimens. It just sets |\np@Z|
% and |\np@N| and calls |\np@divide|. The macro can be adapted to work with
% real numbers provided as strings, by just adding |\p@| after |#1| and/or |#2|.
% \begin{macrocode}
\newcommand*{\np@dddivide}[2]{\global\np@Z#1\global\np@N#2\np@divide}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Truncating a dimen}
% \begin{macro}{\np@truncate}
% This macro simply cuts of everything after the decimal point. Since |\the| always
% produces a decimal point for dimen registers, no special treatment for whole
% numbers is required.
% \begin{macrocode}
\newcommand*{\np@truncate}{}
\def\np@truncate#1.#2\np@end{#1}
% \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Notes styles}
% \subsubsection{Plain}
% \begin{macro}{\np@ns@plain}
% The macro for the \opt{notesstyle} \choice{plain} simply produces an invisible
% box the size of the notes area.
% \begin{macrocode}
\newcommand{\np@ns@plain}{%
\phantom{\rule{\textwidth}{\remainingtextheight}}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Lines}
% \begin{macro}{\np@calc@vheight}
% This macro calculates the height of a vertical part in |\np@height|. Depending
% on the value for \opt{usenotesareaheight} it is based on |\textheight| or
% |\remainingtextheight|. The number of times |\np@height| fits into the notes
% area as a whole is also calculated and stored in |\np@tempcntb|.
% \begin{macrocode}
\newcommand{\np@calc@vheight}{%
\ifKV@np@usenotesareaheight
\np@height\remainingtextheight\divide\np@height\np@vparts
\np@tempcntb\np@vparts
\else
\np@height\textheight\divide\np@height\np@vparts
% \end{macrocode}
% Here the number of lines, which fit in the notes area, is calculated as a real
% number and stored in |\np@tempdima|.
% \begin{macrocode}
\np@dddivide\remainingtextheight\np@height
\expandafter\np@tempdima\np@result\p@
% \end{macrocode}
% In order to get rid of rounding errors (a result of 3 may be something like 2.99998)
% a small length is added to |\np@tempdima|, before it is truncated and the result
% stored in |\np@tempcntb|. This is the number of times |\np@height| fits into the
% notes area as a whole.
% \begin{macrocode}
\advance\np@tempdima0.01\p@
\edef\np@tempa{\expandafter\np@truncate\the\np@tempdima\np@end}%
\np@tempcntb\np@tempa\relax
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@ns@lines}
% This macro is used to produce the notes area for the \opt{notesstyle} \choice{lines}.
% First the special cases are handled. For |vparts=0| a warning is given and
% \choice{plain} is used as \opt{notesstyle}.
% \begin{macrocode}
\newcommand{\np@ns@lines}{%
\ifnum\np@vparts=\z@\relax
\PackageWarning{notespages}{vparts is 0, there are no lines
\MessageBreak}%
\np@ns@plain
% \end{macrocode}
% For |vparts=1| a line on the top and the bottom of the notes area is
% drawn. Here the trick of setting |\unitlength| to |\relax| is used to make the
% \textsf{picture} environment use dimens. For this to work, the optional second
% coordinates must be given too. There is no harm in not restoring |\unitlength|,
% because |\np@ns@lines| is executed within a group, keeping the change local.
% \begin{macrocode}
\else\ifnum\np@vparts=\@ne\relax
\let\unitlength\relax
\begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
\color{NotesHColor}%
\multiput(\z@,\z@)(\z@,\remainingtextheight){2}%
{\line(1,0){\textwidth}}%
\end{picture}%
\else
% \end{macrocode}
% For all other values of \opt{vparts}, the distance between two horizontal lines
% (in |\np@height|) and the number of lines (in |\np@tempcntb|) are calculated.
% \begin{macrocode}
\np@calc@vheight
% \end{macrocode}
% And finally, the lines are drawn, using the same trick for the \textsf{picture}
% environment as above, to make it take lengths.
% \begin{macrocode}
\let\unitlength\relax
\begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
\color{NotesHColor}%
\multiput(\z@,\z@)(\z@,\np@height){\np@tempcntb}%
{\line(1,0){\textwidth}}%
\end{picture}%
\fi\fi}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Vlines}
% \begin{macro}{\np@ns@vlines}
% This macro is used to produce the notes area for the \opt{notesstyle} \choice{vlines}.
% First the distance between two vertical lines is calculated and stored in |\np@width|.
% Then |\np@tempcnta| is set to |\np@hparts| $+$ 1, to always draw the line on the
% right side of the notes area. And finally, the lines are drawn, using the trick
% from |\np@ns@lines| again.
% \begin{macrocode}
\newcommand{\np@ns@vlines}{%
\np@width\textwidth\divide\np@width\np@hparts
\np@tempcnta\np@hparts\advance\np@tempcnta\@ne\relax
\let\unitlength\relax
\begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
\color{NotesVColor}%
\multiput(\z@,\z@)(\np@width,\z@){\np@tempcnta}%
{\line(0,1){\remainingtextheight}}%
\end{picture}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Grid}
% \begin{macro}{\np@ns@grid}
% This macro is used to produce the notes area for the \opt{notesstyle} \choice{grid}.
% First the distance between two vertical lines (in |\np@width|) and their number
% (in |\np@tempcnta|) are calculated.
% \begin{macrocode}
\newcommand{\np@ns@grid}{%
\np@width\textwidth\divide\np@width\np@hparts
\np@tempcnta\np@hparts\advance\np@tempcnta\@ne\relax
% \end{macrocode}
% Then the distance between two horizontal lines (in |\np@height|) and their number
% (in |\np@tempcntb|) are calculated. Again, special cases must be handled. For
% |vparts=0| the grid should be made from squares. Therefore |\np@height|
% is set to |\np@width|. The following calculation of the number of whole \opt{hparts}
% is calculated similar to |\np@ns@lines|. The number of lines is stored in
% |\np@tempcntb|.
% \begin{macrocode}
\ifnum\np@vparts=\z@\relax
\np@height\np@width
\np@dddivide\remainingtextheight\np@height
\expandafter\np@tempdima\np@result\p@
\advance\np@tempdima0.01\p@
\edef\np@tempa{\expandafter\np@truncate\the\np@tempdima\np@end}%
\np@tempcntb\np@tempa\relax
% \end{macrocode}
% The height needed for vertical lines is calculated and stored in |\np@tempdima|.
% And the number of horizontal lines is incremented, in order to also draw the
% top most line.
% \begin{macrocode}
\np@tempdima\np@height\multiply\np@tempdima\np@tempcntb
\advance\np@tempcntb\@ne\relax
% \end{macrocode}
% For |vparts=1| a line on the top and the bottom should be drawn. The
% values |\np@height|, |\np@tempcntb|, and |\np@tempdima| are set accordingly.
% \begin{macrocode}
\else\ifnum\np@vparts=\@ne\relax
\np@height\remainingtextheight
\np@tempcntb\tw@\relax
\np@tempdima\np@height
\else
% \end{macrocode}
% For other values of \opt{vparts} the necessary values are calculated the same
% way as for |\np@ns@lines|.
% \begin{macrocode}
\np@calc@vheight
% \end{macrocode}
% And then, the height needed for vertical lines (|\np@tempdima|) is calculated
% and the number of horizontal lines (|\np@tempcntb|) is incremented.
% \begin{macrocode}
\np@tempdima\np@height\multiply\np@tempdima\np@tempcntb
\advance\np@tempcntb\@ne
\fi\fi
% \end{macrocode}
% Finally, all lines are drawn, using the trick from |\np@ns@lines| again.
% \begin{macrocode}
\let\unitlength\relax
\begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
\color{NotesVColor}%
\multiput(\z@,\z@)(\np@width,\z@){\np@tempcnta}%
{\line(0,1){\np@tempdima}}%
\color{NotesHColor}%
\multiput(\z@,\z@)(\z@,\np@height){\np@tempcntb}%
{\line(1,0){\textwidth}}%
\end{picture}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Text}
% \label{sec:ns-text}
% \begin{macro}{\np@ns@text}
% This macro is used to produce the notes area for the \opt{notesstyle} \choice{text}.
% Since |\np@titleskip| is not inserted for |titlestyle=none|, it is inserted here to
% enable shifting the text vertically. For some unknown reason this doesn't work
% without the invisible |\hrule|. After that, the alignement is set. For
% |notestextalign=none| nothing is done, thus using the alignement active before
% the notes page. For the text color |\color| is used so the user can easily set an
% own color by using |notestext=\textcolor{mycolor}{my notes text}|.
% \begin{macrocode}
\newcommand{\np@ns@text}{%
\def\np@tempa{none}\ifx\np@tempa\np@titlestyle
\hrule\@height\z@
\vspace*{\np@titleskip}%
\fi
\def\np@tempa{left}\ifx\np@tempa\np@notesalign
%% \typeout{notespages debug: notestextalign=left}%
\raggedright
\else
\def\np@tempa{right}\ifx\np@tempa\np@notesalign
%% \typeout{notespages debug: notestextalign=right}%
\raggedleft
\else
\def\np@tempa{center}\ifx\np@tempa\np@notesalign
%% \typeout{notespages debug: notestextalign=center}%
\centering
\fi
\fi
\fi
% \end{macrocode}
% \changes{0.8.1}{2016/08/21}{added \texttt{\bs par} to make alignement work again}%
% The\since{0.8.1} |\par| had to be added, to make the alignement set with
% \opt{notesalign} work again after the group was added in |\np@inner@notespage|
% (see \autoref{sec:use-ns}).
% \begin{macrocode}
\color{NotesTextColor}\notesareatext\par}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Using notes styles}
% \label{sec:use-ns}
% \begin{macro}{\np@inner@notespage}
% This macro calls the command for the \opt{notesstyle} seclected. Before that,
% |\parfillskip| is set to avoid an |overfull hbox| error, in case some class
% or package set it to a different value (example: \pkg{KOMA-Script} classes with
% the option \opt{parskip}).
%
% \changes{0.8.1}{2016/08/21}{bug fixed regarding \texttt{\bs unitlength} and \pkg{eso-pic}}%
% The\since{0.8.1} group around |\csname ...\endcsname| had to be added, because
% otherwise packages like \pkg{eso-pic} (which uses a \textsf{picture} environment
% to put something into the background of a page) will fail. The reason for the
% latter is the |\newpage| at the end of |\np@notespage| (see \autoref{sec:build-np})
% and the fact, that |\unitlength| would still be disabled at this point without
% the group.
% \begin{macrocode}
\newcommand{\np@inner@notespage}{\parfillskip\z@ plus 1fil%
\begingroup
\csname np@ns@\np@notesstyle\endcsname
\endgroup}
% \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{User commands}
% \subsubsection{Building a notes page}
% \label{sec:build-np}
% \begin{macro}{\np@notespage}
% This macro builds a single notes page. If \opt{allowfloats} is \choice{false}
% and \opt{startnotes} is \choice{newpage}, |\textfraction| is temporarily set to
% 1 in order to prevent floats from being placed on the notes page.
% \begin{macrocode}
\newcommand*{\np@notespage}{%
\ifKV@np@allowfloats\else
\def\np@tempa{newpage}\ifx\np@tempa\np@startnotes
\edef\np@orig@textfraction{\textfraction}%
\gdef\textfraction{1}%
\fi
\fi
\np@startnotespage
\np@savemark
\np@setmark
% \end{macrocode}
% Here the information about the notes pages needed for saving and restoring the
% header marks is written to the |.aux| file. Note pages with |mark=keep|
% are excluded here, because otherwise they would mix up the header marks if used
% within a couple of notes pages with different values for \opt{mark}.
% \begin{macrocode}
\if\np@mark@keep\else
\protected@write\@auxout{}%
{\string\@writefile{npm}{\string\npnpinfo{\the\c@page}}}%
\fi
\np@setpagestyle
\np@maketitle
% \end{macrocode}
% If there is no notes title, |\np@titleskip| is not used. Without this, the notes
% area wouldn't have the correct height.
% \begin{macrocode}
\def\np@tempa{none}\ifx\np@tempa\np@titlestyle\else
\vspace*{\np@titleskip}%
\fi
\noindent\np@calcheight
\ifKV@np@titlenotesfill\vfill\noindent\fi
\np@inner@notespage
\np@restoremark
% \end{macrocode}
% At the end, |\textfraction| is restored and a new page is started. The latter
% is necessary to prevent occasional problems with page breaks.
% \begin{macrocode}
\ifKV@np@allowfloats\else
\def\np@tempa{newpage}\ifx\np@tempa\np@startnotes
\xdef\textfraction{\np@orig@textfraction}%
\fi
\fi
\newpage}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Single notes page}
% \begin{macro}{\notespage}
% In |\notespage| everything is done within a group, in order to keep settings done
% with the keys in the optional argument local to the macro. Before the keys are
% set, the boolean |\ifnp@marktext@set| is set to false, so the option \opt{titletext}
% will also set \opt{marktext}.
% \begin{macrocode}
\newcommand*{\notespage}[1][]{%
\begingroup
\np@marktext@setfalse\setkeys{np}{#1}%
\np@notespage
\endgroup}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Multiple notes pages}
% \begin{macro}{\notespages}
% Also, in |\notespages| everything is done in a group to keep it local. After
% setting the keys, the number of pages needed is calculated as follows ($p$:
% page, $d$: \opt{multiple}, $m$: \opt{minpages}, $e$: \opt{endpages}, $n$: notes
% pages).
% \begin{macrocode}
\newcommand*{\notespages}[1][]{%
\begingroup
\np@marktext@setfalse\setkeys{np}{#1}%
% \end{macrocode}
% If started on a new page, set the boolean |\ifnp@started@on@new@page| to true,
% else to false.
% \begin{macrocode}
%% \typeout{notespages debug:\space\the\pagetotal\space\the\pagegoal}%
\ifdim\pagetotal=\z@
\np@started@on@new@pagetrue\else\np@started@on@new@pagefalse\fi
% \end{macrocode}
% \changes{0.8.1}{2016/08/21}{bug fixed for calculating the number of notes pages}%
% If\since[added]{0.8.1} the |\pagetotal| is already greater or equal than |\pagegoal|,
% the notes page will be shifted to a new page, but the calculation would be done
% based on the current page number. For this, |\ifnp@started@on@full@page| is set.
% \begin{macrocode}
\ifdim\pagetotal<\pagegoal
\np@started@on@full@pagefalse\else\np@started@on@full@pagetrue\fi
% \end{macrocode}
% $n = p$, if(started on new page) $n = n - 1$
% \begin{macrocode}
\np@notepages\c@page
\ifnp@started@on@new@page\advance\np@notepages\m@ne\fi
% \end{macrocode}
% This\since[added]{0.8.1} correction is needed in case |\notespages| started on
% an already full page.
% \begin{macrocode}
\ifnp@started@on@full@page\advance\np@notepages\@ne\fi
% \end{macrocode}
% This is basically $n = d - (n \bmod d)$, but with a correction, if started on
% a new page or an already full page.\since[added]{0.8.1} This will lead to
% $n = d$ in case $n \bmod d = 0$, which is corrected by not adding $d$ at the
% end.
% \begin{macrocode}
\divide\np@notepages\np@multiple
\multiply\np@notepages\np@multiple
\advance\np@notepages-\c@page
\ifnp@started@on@new@page\advance\np@notepages\@ne\fi
\ifnp@started@on@full@page\advance\np@notepages\m@ne\fi
\ifnum\np@notepages<\z@
\advance\np@notepages\np@multiple\fi
% \end{macrocode}
% The next step is $n = n - (e \bmod d)$, because the amount of \opt{endpages}
% fully dividable by $d$ is of no significance for calculating $n$.
% \begin{macrocode}
\np@tempcnta\np@endpages
\np@tempcntb\np@endpages
\divide\np@tempcnta\np@multiple
\multiply\np@tempcnta\np@multiple
\advance\np@tempcntb-\np@tempcnta
\advance\np@notepages-\np@tempcntb
% \end{macrocode}
% And finally, $m$ is taken into account by $n = n + (m \div d) \cdot d$, if($n < m$)
% $n = n + d$, leading to the value for $n$.
% \begin{macrocode}
\np@tempcnta\np@minpages
\divide\np@tempcnta\np@multiple
\multiply\np@tempcnta\np@multiple
\advance\np@notepages\np@tempcnta
\ifnum\np@notepages<\np@minpages
\advance\np@notepages\np@multiple\relax\fi
% \end{macrocode}
% If there are notes pages to be given out, this is done in a loop.
% \begin{macrocode}
\ifnum\np@notepages>\z@\relax
\loop\ifnum\np@notepages>\z@\relax
\np@notespage\advance\np@notepages\m@ne\relax
\repeat
\fi
\endgroup}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Notes fill}
% \begin{macro}{\notesfill}
% And again, things in |\notesfill| are done in a group to keep stuff local. Since
% the option \opt{marktext} is ignored here, it is not necessary to set
% |\np@marktext@setfalse|, before setting the keys.
% \begin{macrocode}
\newcommand*{\notesfill}[1][]{%
\begingroup
\setkeys{np}{#1}%
% \end{macrocode}
% Next, the remaining height is calculated and \opt{filltopskip} is subtracted,
% so it's not taken into account. Only if the remaining height now is at least
% \opt{fillminspace}, the notes fill is generated.
% \begin{macrocode}
\np@calcheight
\advance\remainingtextheight-\np@fill@topskip
\ifdim\remainingtextheight<\np@fill@minspace\else
% \end{macrocode}
% If the remaining height is greater than \opt{fillmaxspace}, the space to be left
% empty is calculated and stored in |\np@tempdima|.
% \begin{macrocode}
\ifdim\remainingtextheight>\np@fill@maxspace
\np@tempdima\remainingtextheight
\advance\np@tempdima-\np@fill@maxspace
\else
\np@tempdima=\z@
\fi
% \end{macrocode}
% Now the title is generated together with the spaces before and after it.
% \begin{macrocode}
\vspace*{\np@fill@topskip}
\ifKV@np@filltopfill\vfill\fi
\np@maketitle
\def\np@tempa{none}\ifx\np@tempa\np@titlestyle\else
\vspace*{\np@titleskip}%
\fi
% \end{macrocode}
% And finally, the remaining height for the notes area is calculated and reduced
% by the space to be left empty, before the notes area is generated.
% \begin{macrocode}
\noindent\np@calcheight
\advance\remainingtextheight-\np@tempdima
\ifKV@np@titlenotesfill\vfill\noindent\fi
\np@inner@notespage\newpage
\fi
\endgroup}
% \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Advanced commands}
% \subsubsection{Setting options}
% \begin{macro}{\setnotespages}
% This macro takes a key value list and sets them with |\setkeys|.
% \begin{macrocode}
\newcommand*{\setnotespages}[1]{%
\np@marktext@setfalse\setkeys{np}{#1}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{New meta option}
% \begin{macro}{\definenotesoption}
% This macro defines a new key given as the first parameter, which will set the
% keys to the values provided in the key value list given as the second parameter.
% \begin{macrocode}
\newcommand*{\definenotesoption}[2]{%
\key@ifundefined{np}{#1}{\define@key{np}{#1}[]{\setkeys{np}{#2}}}%
{\PackageError{notespages}%
{Key #1 is already defined.\MessageBreak}%
{The key #1 may have been defined by some package\MessageBreak
or you tried to redefine this key.}}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{New notes style}
% \label{sec:newnotesstyle}
% \begin{macro}{\definenotesstyle}
% This macro defines a new notes style. The name is given in |#1| and the commands
% for the new style in |#2|. First, the list of choices in |\np@notesstyle@nominations|
% (see \autoref{sec:optnotespage}) is extended and then the key \opt{notesstyle} is
% redefined with |\np@def@notesstyle@key|. Finally the command for the notes style
% itself is defined.
% \begin{macrocode}
\newcommand{\definenotesstyle}[2]{%
\edef\np@notesstyle@nominations{\np@notesstyle@nominations,#1}%
\expandafter\np@def@notesstyle@key\np@notesstyle@nominations\np@end
\long\expandafter\def\csname np@ns@#1\endcsname{#2}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{New title style}
% \label{sec:newtitlestyle}
% \begin{macro}{\definetitlestyle}
% This macros defines a new title style. It works similar to the command
% |\definenotesstyle|.
% \begin{macrocode}
\newcommand{\definetitlestyle}[2]{%
\edef\np@titlestyle@nominations{\np@titlestyle@nominations,#1}%
\expandafter\np@def@titlestyle@key\np@titlestyle@nominations\np@end
\long\expandafter\def\csname np@ts@#1\endcsname{#2}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Patching \texttt{\bs chapter}}
% \begin{macro}{\nppatchchapter}
% This macros patches |\chapter| by adding |\notespages| in front off it. The
% argument is used as the optional argument for the latter. Patching will only
% be done, if |\chapter| exists.
% \begin{macrocode}
\let\np@orig@chapter\chapter
\newcommand{\nppatchchapter}[1]{%
\@ifundefined{chapter}{}{%
\def\chapter{\notespages[#1]\np@orig@chapter}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\npunpatchchapter}
% \changes{0.8.1}{2016/08/21}{added command}%
% This macros restores the original meaning of |\chapter|, which is only done,
% if it exists.\since[added]{0.8.1}
% \begin{macrocode}
\newcommand{\npunpatchchapter}{%
\@ifundefined{chapter}{}{\let\chapter\np@orig@chapter}}
% \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Support for other packages}
% \subsubsection{Babel}
% The method of supporting \pkg{babel} was taken from Heiko Oberdieks package
% \pkg{hyperref}.
%
% \begin{macro}{\np@lang@german}
% This macro defines |\npnotesname| and |\npnotestext| for variations of the German
% language.
% \begin{macrocode}
\newcommand*{\np@lang@german}{\def\npnotesname{Notizen}%
\def\npnotestext{Diese Seite wurde absichtlich leer gelassen.}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@lang@english}
% This macro defines |\npnotesname| and |\npnotestext| for variations of the English
% language.
% \begin{macrocode}
\newcommand*{\np@lang@english}{\def\npnotesname{Notes}%
\def\npnotestext{This page is intentionally left blank.}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@lang@french}
% This macro defines |\npnotesname| and |\npnotestext| for variations of the French
% language.
% \begin{macrocode}
\newcommand*{\np@lang@french}{\def\npnotesname{Notes}%
\def\npnotestext{Cette page est laiss\'{e}e intentionnellement vide.}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@declarelang}
% This macro adds one of the macros defining |\npnotesname| and |\npnotestext| (|#2|)
% to a language supported by \pkg{babel} (|#1|), if the language loaded.
% \begin{macrocode}
\newcommand*{\np@declarelang}[2]{%
\@ifpackagewith{babel}{#1}{%
\expandafter\addto
\csname extras#1\expandafter\endcsname
\csname np@lang@#2\endcsname}{}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\np@supportbabel}
% This macro adds one of the macros defining |\npnotesname| and |\npnotestext| to all
% languages supported by \NP\ so far.
% \begin{macrocode}
\newcommand*{\np@supportbabel}{%
\@ifpackageloaded{babel}{%
\np@declarelang{english}{english}%
\np@declarelang{USenglish}{english}%
\np@declarelang{american}{english}%
\np@declarelang{UKenglish}{english}%
\np@declarelang{british}{english}%
\np@declarelang{canadian}{english}%
\np@declarelang{australian}{english}%
\np@declarelang{newzealand}{english}%
\np@declarelang{austrian}{german}%
\np@declarelang{german}{german}%
\np@declarelang{germanb}{german}%
\np@declarelang{ngerman}{german}%
\np@declarelang{naustrian}{german}%
\np@declarelang{french}{french}%
\np@declarelang{francais}{french}%
\np@declarelang{canadien}{french}%
\np@declarelang{acadian}{french}}{}}
% \end{macrocode}
% \end{macro}
%
% The macro is used in the |\AtBeginDocument| hook, but it also has to be called
% here, in case \pkg{babel} was loaded before \NP.
% \begin{macrocode}
\np@supportbabel
% \end{macrocode}
%
% ^^A-------------------------
% \subsubsection{(X)Color}
% \begin{macro}{\np@setcolors}
% This macro defines the colors used by \NP\ for the package \pkg{color}. It first
% checks, if the colors are already defined, in order to make it possible for the
% user to define the colors in the preamble.
% \begin{macrocode}
\newcommand*{\np@setcolors}{%
\@ifundefined{\string\color @NotesHColor}%
{\definecolor{NotesHColor}{gray}{0.7}}{}%
\@ifundefined{\string\color @NotesVColor}%
{\definecolor{NotesVColor}{gray}{0.7}}{}%
\@ifundefined{\string\color @NotesTextColor}%
{\definecolor{NotesTextColor}{gray}{0.7}}{}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@setxcolors}
% This macro defines the colors used by \NP\ for the package \pkg{xcolor}. For this,
% |\providecolor| is used, which defines a color only, if it is not defined yet.
% \begin{macrocode}
\newcommand*{\np@setxcolors}{%
\providecolor{NotesHColor}{gray}{0.7}%
\providecolor{NotesVColor}{gray}{0.7}%
\providecolor{NotesTextColor}{gray}{0.7}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\np@supportcolor}
% This macro checks, if one of the packages \pkg{color} or \pkg{xcolor} is loaded,
% and calls either |\np@setcolors| or |\np@setxcolors| respectively. In case none
% is loaded, the macro |\color| is set to |\@gobble|, so it can be used by
% \NP\ without harm. |\np@supportcolor| is used in the |\AtBeginDocument| hook.
% \begin{macrocode}
\newcommand*{\np@supportcolor}{%
\@ifpackageloaded{xcolor}{\np@setxcolors}{%
\@ifpackageloaded{color}{\np@setcolors}{\let\color\@gobble}}}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Initialisation}
% Finally, the file |\jobname.npm| is loaded and the macros |\np@supportbabel| and
% |\np@supportcolor| are called in the |\AtBeginDocument| hook, so the order of
% loading packages is without consequences.
% \begin{macrocode}
\AtBeginDocument{\InputIfFileExists{\jobname.npm}{}{}%
\np@supportbabel\np@supportcolor}
% \end{macrocode}
%
% \newpage
% \Finale\endinput
%</package>
% ^^A--------------------------------------------------------------------------
% ^^A Now the source of the example
%<*example>
%% this document is intended to be compiled with the class scrbook, other classes
%% will not produce a logically correct result (some notes fills are missing,
%% pages are different, a lot of overful hboxes, and so on), they where just
%% used for testing
%%\documentclass[11pt,a4paper]{article}
%%\documentclass[11pt,a4paper]{report}
%%\documentclass[11pt,a4paper]{book}
\documentclass[11pt,a4paper]{scrbook}
%%\documentclass[11pt,a4paper]{scrartcl}
%%\documentclass[11pt,a4paper]{scrreprt}
%%\documentclass[11pt,a4paper,article]{memoir}
%%\documentclass[11pt,a4paper]{memoir}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[italian,ngerman,french,english]{babel}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{lipsum}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usepackage{afterpage}
\usepackage{eso-pic}
\usepackage{notespages}
%% CAUTION: do not use this with the class memoir
%% it will not work, because memoir has its
%% own methods to set the header and footer
%% this is meant to be used with KOMA-Script classes
\usepackage{scrpage2}
\lehead[]{\leftmark}
\cehead[]{}
\rehead[]{\rightmark}
\lohead[]{\leftmark}
\cohead[]{}
\rohead[]{\rightmark}
\lefoot[\pagemark]{\pagemark}
\cefoot[]{}
\refoot[]{\textsf{NotesPages}}
\lofoot[]{\textsf{NotesPages}}
\cofoot[]{}
\rofoot[\pagemark]{\pagemark}
\pagestyle{scrheadings}
%% this is meant to be used with all other classes
%%\pagestyle{headings}
%% only use this for classes book, scrbook and memoir without option article
\nppatchchapter{default,vacant,multiple=2,
notestext={An empty page before a new chapter.}}
%% this has to be used with classes article and scrartcl
%%\let\secleveli{\section}
%%\let\seclevelii\subsection
%% this has to be used with all other classes
\def\secleveli{\chapter}
\let\seclevelii\section
%%\tracingnpmarks1
\newcommand{\fillit}[1][]{\minisec{Fill it}\lipsum[#1]}
\begin{document}
\thispagestyle{empty}
\begin{center}
\vspace*{\fill}
\textsf{\Huge The \textbf{NotesPages} Package}\\[5ex]
\textsf{\textbf{\Large Example File}}\\[5ex]
Mike Kaufmann\\[2ex]
\href{mailto:m.km@gmx.de}{\texttt{m.km@gmx.de}}\\[2ex]
2016/08/21 (v0.8.1)\\[10ex]
\textsf{\textbf{\LARGE Warning: do not print!}}\\[2ex]
You would waste over a hundred pages!
\vspace*{\fill}
\vspace*{\fill}
\end{center}
\tableofcontents
\secleveli{Layout variations}
\seclevelii{Default settings}
First let's start with the default settings. The next three and a half pages are
filled with \verb|\notesfill|, \verb|\notespage|, and \verb|\notespages|. The
latter will produce two pages, in order to fill up the document to a multiple
of 4 pages.
Btw.: In the lower left corner of this page and the next three is a bit of text,
put there with \textsf{eso-pic}, to check, if the bug from version 0.8 is gone.
It's in yellow, so barely visible.
The commands are:
\begin{verbatim}
\notesfill
\notespage
\notespages
\end{verbatim}
%% testing eso-pic
\AddToShipoutPictureBG{\AtPageLowerLeft{\makebox(0,0)[bl]{\textcolor{yellow}{eos-pic test}}}}
\notesfill
\notespage
\notespages
%% testing eso-pic
\ClearShipoutPictureBG
\seclevelii{The options \textsf{startnotes} and \textsf{allowfloats}}
To show the effect of these options, some text and a float, which doesn't fit on
this page, is needed. For the float the positioning \verb|[htb]| was used. After
the float \verb|\notespage| was used once.
Test for referencing: \autoref{fig:rect} on \autopageref{fig:rect}.
\fillit[1-3]
\begin{figure}[htb]
\centering
\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
\caption{Just a rectangle}\label{fig:rect}
\end{figure}
\notespage
Now let's do this again, but this time using \verb|\notespage[startnotes=newpage]|.
Test for referencing: \autoref{fig:rect2} on \autopageref{fig:rect2}.
\fillit[1-3]
\begin{figure}[htb]
\centering
\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
\caption{Another rectangle}\label{fig:rect2}
\end{figure}
\notespage[startnotes=newpage]
Ok, now lets add the option \textsf{allowfloats} and see what happens. This time
\verb|\notespages| \verb|[startnotes=newpage,allowfloats]| is used, filling the document
up to page 16. Note: the header is already changed on the next page.
Test for referencing: \autoref{fig:rect3} on \autopageref{fig:rect3}.
\begin{figure}[htb]
\centering
\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
\caption{A third rectangle}\label{fig:rect3}
\end{figure}
\notespages[startnotes=newpage,allowfloats]
\seclevelii{The option \textsf{pagestyle}}
The next 3 pages show notes pages with different page styles. The commands are:
\begin{verbatim}
\notespage[pagestyle=empty]
\notespage[pagestyle=plain]
\notespage[pagestyle=useheadings]
\end{verbatim}
Btw.: The pagestyle for this document was defined deliberately this way to see
both header marks as often as possible. For this, the package \textsf{scrpage2}
from \textsf{KOMA-Script} was used.
\notespage[pagestyle=empty]
\notespage[pagestyle=plain]
\notespage[pagestyle=useheadings]
\seclevelii{The option \textsf{notesstyle}}
Up until now, the default \textsf{notesstyle} (\textsf{\textit{grid}}) was used.
The next example shows the other four. The commands are:
\begin{verbatim}
\notespage[notesstyle=plain]
\notespage[vparts=35,notesstyle=lines]
\notespage[notesstyle=vlines]
\notespage[notesstyle=text]
\notespage[vacant]
\end{verbatim}
For the second page \texttt{vparts=35} was used, because the default is 0 and
therefore the notes area would be empty. The fourth page doesn't realy make sense,
because the notes style \textsf{text} was meant to be used for otherwise empty
pages. For this the meta option \textsf{vacant} was introduced. Its effect can be
seen on the fifth page.
\notespage[notesstyle=plain]
\notespage[vparts=35,notesstyle=lines]
\notespage[notesstyle=vlines]
\notespage[notesstyle=text]
\notespage[vacant]
\seclevelii{The options \textsf{hparts}, \textsf{vparts}, and \textsf{usenotesareaheight}}
Now let's play around a little with the options \textsf{hparts} and \textsf{vparts}.
As mentioned in the manual, a value of 1 will always draw two lines. Let's take a
look. The commands are:
\begin{verbatim}
\notesfill[vparts=1,notesstyle=lines]
\notespage[hparts=1,notesstyle=vlines]
\notespage[hparts=1,vparts=1]
\end{verbatim}
\notesfill[vparts=1,notesstyle=lines]
\notespage[hparts=1,notesstyle=vlines]
\notespage[hparts=1,vparts=1]
With the same values for both, one gets rectangles with the same aspect ratio
as the text body. The command:
\begin{verbatim}
\notesfill[hparts=30,vparts=30]
\end{verbatim}
\notesfill[hparts=30,vparts=30]
With the option \textsf{usenotesareaheight} the height of a vertical part will
be calculated based on the height of the notes area instead of \verb|\textheight|.
Thus, there will be the exact number of parts given to \textsf{vparts}.
But first, lets see it without \textsf{usenotesareaheight}. The command:
\begin{verbatim}
\notesfill[hparts=2,vparts=2]
\end{verbatim}
\notesfill[hparts=2,vparts=2]
And now, the same command, but this time with the option \textsf{usenotesareaheight}.
The command is:
\begin{verbatim}
\notesfill[hparts=2,vparts=2,usenotesareaheight]
\end{verbatim}
\notesfill[hparts=2,vparts=2,usenotesareaheight]
But with the same command the height of a vertical part can be different each
time, as can be seen below.
\fillit[1-2]
\notesfill[hparts=2,vparts=2,usenotesareaheight]
\seclevelii{The option \textsf{titlestyle}}
The following pages show the possible \textsf{titlestyle}s. Since the top most
rectangles for the default appearance of the notes area will only be shown, if they
fit completely into the notes area, the latter was change to be just a rectangle.
Without this, the real distance between notes title and notes area couldn't be seen.
The choice \textsf{minisec} wasn't used here, so this file can be compiled with
classes, which don't support the command \verb|\minisec|. The commands are:
\begin{verbatim}
\notesfill[hparts=1,vparts=1]
\notespage[hparts=1,vparts=1,titlestyle=subsection]
\notespage[hparts=1,vparts=1,titlestyle=subsubsection]
\notespage[hparts=1,vparts=1,titlestyle=text]
\notespage[hparts=1,vparts=1,titlestyle=none]
\end{verbatim}
\notesfill[hparts=1,vparts=1]
\notespage[hparts=1,vparts=1,titlestyle=subsection]
\notespage[hparts=1,vparts=1,titlestyle=subsubsection]
\notespage[hparts=1,vparts=1,titlestyle=text]
\notespage[hparts=1,vparts=1,titlestyle=none]
\seclevelii{The option \textsf{titletext}}
With the option \textsf{titletext} a new text for the notes title can be given.
If the new text is not just a single word, it should be given in braces. And if
it contains a comma or an equality sign it must be given in braces.
The new text is also used as the text for the header mark, if the option
\textsf{marktext} is not used. The commands are:
\begin{verbatim}
\notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
\notespage[hparts=1,vparts=1,titletext={Scribble page}]
\end{verbatim}
\notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
\notespage[hparts=1,vparts=1,titletext={Scribble page}]
\seclevelii{The option \textsf{titleskip}}
Especially if \texttt{titlestyle=text} is given, the option \textsf{titleskip}
is useful. With it, some space can be put between the notes title and the notes
area. This is shown here. Compare it to page 37. The command is:
\begin{verbatim}
\notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
\end{verbatim}
\notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
\seclevelii{The option \textsf{titlenotesfill}}
The option \textsf{titlenotesfill} will move the notes area down to the end of
the page. This can only be shown with the \textsf{notesstyle} \textsf{\textit{text}},
for whitch it doesn't realy make sense. But if someone defines a custom notes style,
which doesn't use the whole notes area, the option can be used to move it down.
The command is:
\begin{verbatim}
\notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
\end{verbatim}
\notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
\seclevelii{The option \textsf{mark}}
Up unitl now, \textsf{mark} was set to \textsf{both}. The next pages will show
the other choices. The commands are:
\begin{verbatim}
\notespage[mark=keep,titletext={Notes (keep)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[mark=left,titletext={Notes (left)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[titletext={Notes (both)}]
\notespage[mark=left,titletext={Notes (left)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[mark=left,titletext={Notes (left)}]
\notespage[titletext={Notes (both)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[mark=left,titletext={Notes (left)}]
\end{verbatim}
The additional pages were put in to test, if switching between the choices of
\textsf{mark} works.
\notespage[mark=keep,titletext={Notes (keep)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[mark=left,titletext={Notes (left)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[titletext={Notes (both)}]
\notespage[mark=left,titletext={Notes (left)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[mark=left,titletext={Notes (left)}]
\notespage[titletext={Notes (both)}]
\notespage[mark=right,titletext={Notes (right)}]
\notespage[mark=left,titletext={Notes (left)}]
\seclevelii{The options \textsf{marktext} and \textsf{markuppercase}}
The option \textsf{marktext} is used the set a text for the header mark. This is
useful, if the title text is to long for the header. Again, if the text contains
more then one word it should be given in braces, and if it contains a comma or an
equality sign it must be given in braces.
Some classes set the header marks in uppercase letters. To do this for the header
marks of a notes page, the option \textsf{markuppercase} exists. It is set
automatically for the standard classes, the \textsf{KOMA-Script} classes and
\textsf{memoir}. For other classes, the default is \textsf{\textit{false}}.
The setting can be changed with this option, as shown in the next example.
The command is:
\begin{verbatim}
\notespage[marktext=Scribbel,markuppercase,titlestyle=text,
titletext={This is a very long text for a scribble page. And it
doesn't just end after one sentence, so it is realy too long for
the header.}]
\end{verbatim}
\notespage[marktext=Scribbel,markuppercase,titlestyle=text,
titletext={This is a very long text for a scribble page. And it
doesn't just end after one sentence, so it is realy too long for
the header.}]
\secleveli{Controlling the number of notes pages}
\seclevelii{The options \textsf{multiple}, \textsf{minpages}, and \textsf{endpages}}
The way to set these options is to think as follows: the number of pages must be
a multiple of $d$, at least $m$ notes pages are needed, and at the end $e$ pages
are needed for other purposes. Then just set \textsf{multiple} $=d$, \textsf{minpages}
$=m$, and \textsf{endpages} $=e$.
As an example, lets assume the number of pages should be a multiple of 4, at least
one notes page should appear and one page is needed after the notes pages. The
options for this are \verb|multiple=4,minpages=1,endpages=1| (\textsf{multiple}
could be omitted, because 4 is the default value).
Now this is page 57, therefore three pages are needed to fill the document to a
multiple of 4. But there should be one page at the end for other stuff. So only
two pages will be inserted to fulfill \verb|endpages=1|. Since there are already
two notes pages, \verb|minpages=1| is fullfilled.
If this would have been page 55, there would be 4 notes pages. Page 56 would be a
notes page to fulfill \verb|minpages=1|, which would also fulfill \verb|multiple=4|
but violate \verb|endpages=1|. Because of that, three additional notes pages would
be inserted, so all three conditions are met.
\notespages[multiple=4,minpages=1,endpages=1]
Here we are on page 60, the page for other purposes (like for example contact
information on the back of a manual).
With \verb|minpages=0| nothing would change here. And with \verb|endpages=0|
this page would be a notes page too.
Besides the maximum and minimum values for the options, there are no limits on
the values and there are no dependencies between them. For example, \textsf{endpages}
may be greater than \textsf{multiple}.
\seclevelii{Other examples}
Since this is page 60 and it's a multiple of 4, a \verb|\notespages| here with
the default setting (\verb|multiple=4,minpages=0,endpages=0|) will do nothing.
Let's try it:
\notespages
Look into the source of this file, there is a \verb|\notespages| command between
this paragraph and the former one.
Inserting an exact number $n$ of notes pages can be done with
\verb|multiple=1,minpages=|$n$. Here any value for \textsf{endpages} would have
no effect.
\secleveli{Controlling notes fills}
\seclevelii{The option \textsf{fillminspace} and \textsf{fillmaxspace}}
The length given to \textsf{fillminspace} is only used to decide, if a notes fill
should appear on a page, while \textsf{fillmaxspace} only limits its height. They
are indepentent from each other. so it's possible to set \textsf{fillminspace} to
a value greater than \textsf{fillmaxspace}. For example,
\begin{verbatim}
\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
\end{verbatim}
\noindent
will insert a notes fill on this page, but not on the next one. But
\begin{verbatim}
\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
\end{verbatim}
\noindent
will insert a notes fill on the page after that, allthough it has the same amount
of text.
\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
\fillit[1-3]
\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
\newpage
\fillit[1-3]
\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
\seclevelii{The options \textsf{filltopskip}}
The option \textsf{filltopskip} is used to get a minimum distance between the text
and the notes fill. In order to show its effect the \textsf{titlestyle} is changed
\textsf{\textit{text}}. The commands are
\begin{verbatim}
\notesfill[titlestyle=text]
\notesfill[titlestyle=text,filltopskip=2ex]
\end{verbatim}
Just compare this page to the next one.
\fillit[3]
\notesfill[titlestyle=text]
The different space between the notes title and the nots area here is due to
the fact, that only full vertical parts are drawn.
\fillit[3]
\notesfill[titlestyle=text,filltopskip=2ex]
\seclevelii{The option \textsf{filltopfill}}
As can be seen on page 61, the notes fill is moved to the bottom of the page.
This is due to the fact, that by default \textsf{filltopfill} is set to
\textsf{\textit{true}}. With the command
\begin{verbatim}
\notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
\end{verbatim}
\noindent
the notes fill is not moved down, as can be seen here.
\notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
\seclevelii{The restriction regarding \textsf{notesfill}}
As mentioned in the manual, footnotes and bottom floats will appear below the
notes fill, as shown here.\footnote{Unfortunately, this is not easy to fix.}
But at least, it has the right height.
\begin{figure}[b]
\centering
\textcolor{lightgray}{\rule{0.8\textwidth}{0.2\textheight}}
\caption{Again, a rectangle}\label{fig:rect4}
\end{figure}
\notesfill
\secleveli{Advanced commands}
\seclevelii{The command \texttt{\textbackslash setnotespages}}
This command is used to change the settings globally. It takes a key value list,
where all options can be used. It is possible to use the command everywhere in the
document, changing the settings from the point of its appearance on. For example,
instead of writing
\begin{verbatim}
\notesfill[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
\notespage[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
\end{verbatim}
\noindent
it is easier to write
\begin{verbatim}
\setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
\notesfill
\notespage
\setnotespages{default}
\end{verbatim}
\noindent
Note, that on the next page the formatting for the \textsf{titletext} is used
for the header too. This can be circumvented by a) also setting \textsf{marktext}
or b) defining your own title style (see \autoref{sec:deftitlestyle}).
At the end, the package defaults are restored, so following examles start from
there.
\setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
\notesfill
\notespage
\setnotespages{default}
\seclevelii{The command \texttt{\textbackslash definenotesoption}}
This command is used to define a new meta option. It is similar to \verb|\setnotespages|,
but instead of changing the settings, the settings are assigned to a name, which
can then be used as an option for the commands of this package. With this, the
last example can be realised with
\begin{verbatim}
\definenotesoption{scribblepage}{default,hparts=1,vparts=1,
titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
titleskip=1ex,marktext=Scribble}
\notesfill[scribblepage]
\notespage[scribblepage]
\end{verbatim}
\noindent
Here the option \textsf{default} was used, in order to always keep the same
appearance, even if the settings were changed with \verb|\setnotespages|. And
the problem with the header marks in the previous example was solved using
\textsf{marktext}.
After its definition, the new option \textsf{scribblepage} can also be used in
\verb|\setnotespages| or another \verb|\definenotesoption|.
\definenotesoption{scribblepage}{default,hparts=1,vparts=1,
titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
titleskip=1ex,marktext=Scribble}
\notesfill[scribblepage]
\notespage[scribblepage]
\seclevelii{The command \texttt{\textbackslash definetitlestyle}}
\label{sec:deftitlestyle}
With this command a new title style can be defined. The first argument is the
name for the new style, which can be used as a new choice for the option
\textsf{titlestyle} after the definition. The second argument contains the macros
to format the title.
In order to get the text set with the option \textsf{titletext} the command
\verb|\notestitletext| must be used where the title should appear. But of course,
it is possible to put in some text. If the indentation by \verb|\parindent| is
unwanted, the definition should start with \verb|\noindent|. And finally, there
has to be a \verb|\par| at the end. That said, if a predefined command is used,
which somehow uses \verb|\noindent| and \verb|\par|, they are no longer necessary.
For example, the title styles \textsf{\textit{section}} and \textsf{\textit{text}}
could have been defined with
\begin{verbatim}
\definetitlestyle{section}{\section*{\notestitletext}}
\definetitlestyle{text}{\noindent\notestitletext\par}
\end{verbatim}
Btw.: existing title styles should not be redifined, as this may cause problems.
Now lets define a new title style. Here is the example from the manual:
\begin{verbatim}
\definetitlestyle{boldred}{\noindent\textcolor{red}%
{\textbf{\notestitletext}}\par}
\notesfill[scribblepage,titletext={Bold Red Note},
titlestyle=boldred,fillminspace=0.1\textheight]
\end{verbatim}
Here the option \textsf{scribblepage} from the last example was used. And then
\textsf{titletext} and \textsf{titlestyle} were added, overwriting some of the
settings done with \textsf{scribblepage}. This shows the importance of the order
of options. Putting \textsf{scribblepage} at the end would have overwritten the
other options.
Now, it is possible to put some text directly into the definition. But keep in
mind, this text will not appear in the headers. Here an example:
\begin{verbatim}
\definetitlestyle{prefix}{\noindent Note on:
\textcolor{blue}{\notestitletext}\par}
\notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
titlestyle=prefix]
\end{verbatim}
\definetitlestyle{boldred}{\noindent\textcolor{red}%
{\textbf{\notestitletext}}\par}
\notesfill[scribblepage,titletext={Bold Red Note},
titlestyle=boldred,fillminspace=0.1\textheight]
\definetitlestyle{prefix}{\noindent Note on:
\textcolor{blue}{\notestitletext}\par}
\notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
titlestyle=prefix]
\seclevelii{The command \texttt{\textbackslash definenotestyle}}
\label{sec:defnotesstyle}
The notes style provided with \textsf{NotesPages} are just basic ones. With this
command it is possible to define your own styles, which can be quite fancy. But
lets start with the simple example from the manual:
\begin{verbatim}
\definenotesstyle{yellow}{\color{LightYellow}%
\rule{\textwidth}{\remainingtextheight}}
\notesfill[notesstyle=yellow]
\end{verbatim}
Again, the first argument is the name of the new style, which can then be used as
a new choice for the option \textsf{notesstyle}. And the second argument contains
the macros to create the notes area. Here \verb|\remainingtextheight| has to be
used to get the height of the notes area.
\definenotesstyle{yellow}{\color{LightYellow}%
\rule{\textwidth}{\remainingtextheight}}
\notesfill[notesstyle=yellow]
For the next example lets create a double frame around the notes area, using the
\LaTeX\ \textsf{picture} environment:
\begin{verbatim}
\newdimen\innerwidth
\newdimen\innerheight
\definenotesstyle{dframe}{%
\innerwidth\textwidth\advance\innerwidth-10mm\relax
\innerheight\remainingtextheight\advance\innerheight-10mm\relax
\let\unitlength\relax
\begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
\color{lightgray}
\put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
\put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
\end{picture}}
\notesfill[notesstyle=dframe]
\end{verbatim}
Here first two dimens are needed to calculate the height and width of the inner
frame. These length are calculated first. Then a trick is used to make the
\textsf{picture} environment work with lengths: \verb|\unitlength| is set to
\verb|\relax|, thus disabling it. Caution: this requires to give the optional
argument for an offset as \verb|(0pt,0pt)|, otherwise an error will occur.
Additionally, a color for the frames is set. Since the new notes style is used
within a group, disabling \verb|\unitlength| and setting a color without resetting
them has no repercussions outside the \verb|\notesfill|.
\newdimen\innerwidth
\newdimen\innerheight
\definenotesstyle{dframe}{%
\innerwidth\textwidth\advance\innerwidth-10mm\relax
\innerheight\remainingtextheight\advance\innerheight-10mm\relax
\let\unitlength\relax
\begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
\color{lightgray}
\put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
\put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
\end{picture}}
\notesfill[notesstyle=dframe]
It is also possible to use \textsf{TikZ} to define notes styles. Here the bounding
box is used to keep the size of the picture to the exact size of the notes area.
For the text \verb|\notesareatext| is used, thus using the text passed to the option
\textsf{notestext}.
\begin{verbatim}
\definenotesstyle{slash}{%
\begin{tikzpicture}[color=gray!25]
\useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
\clip (0,0) rectangle (\textwidth,\remainingtextheight);
\draw[line width=2cm]
(0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
(\textwidth,\remainingtextheight);
\end{tikzpicture}}
\notesfill[notesstyle=slash]
\end{verbatim}
\definenotesstyle{slash}{%
\begin{tikzpicture}[color=gray!25]
\useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
\clip (0,0) rectangle (\textwidth,\remainingtextheight);
\draw[line width=2cm]
(0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
(\textwidth,\remainingtextheight);
\end{tikzpicture}}
\notesfill[notesstyle=slash]
Here is another example using \textsf{TikZ}. It defines a mm graph paper, which
always has a whole number of cm in both direction and is centered in the notes
area.
\begin{verbatim}
\newdimen\xoffset
\newdimen\yoffset
\definenotesstyle{mmgp}{%
\begin{tikzpicture}[color=gray!25]
\pgfmathsetlength{\xoffset}{
(\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
\pgfmathsetlength{\yoffset}{
(\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
\useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
\draw[xshift=\xoffset,yshift=\yoffset,very thin]
(0,0) grid [step=1mm]
(\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
\draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
(0,0) grid [step=5mm]
(\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
\draw[xshift=\xoffset,yshift=\yoffset,thick]
(0,0) grid [step=1cm]
(\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
\end{tikzpicture}}
\notesfill[notesstyle=mmgp]
\end{verbatim}
\newdimen\xoffset
\newdimen\yoffset
\definenotesstyle{mmgp}{%
\begin{tikzpicture}[color=gray!25]
\pgfmathsetlength{\xoffset}{
(\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
\pgfmathsetlength{\yoffset}{
(\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
\useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
\draw[xshift=\xoffset,yshift=\yoffset,very thin]
(0,0) grid [step=1mm]
(\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
\draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
(0,0) grid [step=5mm]
(\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
\draw[xshift=\xoffset,yshift=\yoffset,thick]
(0,0) grid [step=1cm]
(\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
\end{tikzpicture}}
\notesfill[notesstyle=mmgp]
The next example is just for showing the effect of the option \textsf{titlenotesfill}.
It is not realy useful (unless you want to torture your readers for scribbling in
your painfully worded masterpiece by making them write in circles). Here the
bounding box is set to a square.
Caution: since the height is fixed, this notes style is not realy suitable for a
notes fill. If it doesn't fit on the page, it will be moved to the next.
\begin{verbatim}
\definenotesstyle{spiral}{%
\begin{tikzpicture}[color=gray!25]
\useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
(0.5\textwidth,0.5\textwidth);
\draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
\end{tikzpicture}}
\notespage[notesstyle=spiral,titletext={Write in Circles}]
\notespage[notesstyle=spiral,titletext={Write in Circles},
titlenotesfill]
\end{verbatim}
\definenotesstyle{spiral}{%
\begin{tikzpicture}[color=gray!25]
\useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
(0.5\textwidth,0.5\textwidth);
\draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
\end{tikzpicture}}
\notespage[notesstyle=spiral,titletext={Write in Circles}]
\notespage[notesstyle=spiral,titletext={Write in Circles},
titlenotesfill]
\seclevelii{The command \texttt{\textbackslash nppatchchapter}}
Page 68 (among others) would be empty here, if a book class is used. This is,
because a new chapter normally starts on a right hand page and so a left hand page
may be left empty. To put a notes page there, one could manually add a line like
\begin{verbatim}
\notespages[vacant,multiple=2,
notestext={An empty page before a new chapter.}]
\end{verbatim}
before every new chapter. But with \verb|\nppatchchapter| this can be automated.
It changes \verb|\chapter| so it behaves like
\begin{verbatim}
\notespages[...]
\chapter
\end{verbatim}
The optional argument for \verb|\notespages| is the argument passed to
\verb|\nppatchchapter|. And the new \verb|\chapter| can just be used like the
original one.
In the preamble of this document the lines
\begin{verbatim}
\nppatchchapter{default,vacant,multiple=2,
notestext={An empty page before a new chapter.}}
\end{verbatim}
were added to make the empty pages before a new chapter into a notes pages. The
option \textsf{default} asures, that no changes of the settings (this includes
packages options and settings done with \verb|\setnotespages|) will change their
apperance. And with \verb|multiple=2| there will be no more then one notes
page before a new chapter instead of up to three with the default value of 4.
The command \verb|\nppatchchapter| can be used multiple times in a document,
enabling the user to change the apperance of a notes page before a new chapter.
The command is:
\begin{verbatim}
\nppatchchapter{default,vacant,multiple=2,
notestext={Another notes page\\
automatically inserted\\
before a new chapter.}}
\end{verbatim}
\nppatchchapter{default,vacant,multiple=2,
notestext={Another notes page\\
automatically inserted\\
before a new chapter.}}
\fillit[1-3]
\secleveli{Colors and Languages}
\seclevelii{Colors}
The \textsf{NotesPages} package uses three colors.
\begin{itemize}
\item \textsf{NotesHColor} for horizontal lines in the notes styles
\textsf{\textit{lines}} and \textsf{\textit{grid}},
\item \textsf{NotesVColor} for vertical lines in the notes styles
\textsf{\textit{vlines}} and \textsf{\textit{grid}}, and
\item \textsf{NotesTextColor} for the text in the notes style
\textsf{\textit{text}}.
\end{itemize}
Colors can be redefined, so it's possible to change them at any time. To make the
changes local, they are put in a group here.
\begin{verbatim}
{\definecolor{NotesHColor}{rgb}{0,0,1}
\definecolor{NotesVColor}{rgb}{0,1,0}
\definecolor{NotesTextColor}{rgb}{1,0,0}
\notesfill
\notespage[notestyle=text]}
\end{verbatim}
{\definecolor{NotesHColor}{rgb}{0,0,1}
\definecolor{NotesVColor}{rgb}{0,1,0}
\definecolor{NotesTextColor}{rgb}{1,0,0}
\notesfill
\notespage[notesstyle=text]}
\seclevelii{Languages}
So far, only English, French, and German are supported. Up unitl now English was
used in this document. Here are examples for the other ones.
\begin{verbatim}
\selectlanguage{french}
\notespage[notesstyle=text]
\selectlanguage{ngerman}
\notespage[notesstyle=text]
\selectlanguage{english}
\end{verbatim}
New languages will be supported, as users provide the translations. But naturally,
this will take some time. So if your language is not supported yet and you can't
wait, you can add the following to the preamble of your document (of course with
the correct translations):
\begin{verbatim}
\setnotespages{titletext={No Clue},
notestext={No clue what this is in your language.}}
\end{verbatim}
This is sufficient for documents in one language. But caution, using the option
\textsf{default} will reset these texts. That can be solved by redefining
\verb|\npnotesname| and \verb|\npnotestext| instead. For multilingual documents
you can add for example
\begin{verbatim}
\addto{\extrasitalian}{\def\npnotesname{No Clue}%
\def\npnotestext{No clue what this is in Italian.}}
\end{verbatim}
to the preamble (again, for your language and with the correct translations).
After that you can use
\begin{verbatim}
\selectlanguage{italian}
\notespage[notesstyle=text]
\end{verbatim}
to get a notes page in the new language.
\selectlanguage{french}
\notespage[notesstyle=text]
\selectlanguage{ngerman}
\notespage[notesstyle=text]
\addto{\extrasitalian}{\def\npnotesname{No Clue}%
\def\npnotestext{No clue what this is in Italian.}}
\selectlanguage{italian}
\notespage[notesstyle=text]
\selectlanguage{english}
\secleveli{Other Stuff}
\seclevelii{The Package \textsf{afterpage}}
\textsf{NotesPages} can be used with the package \textsf{afterpage}. This makes
it possible to put a notes page on the next page without leaving the page it was
invoked half empty. So here the line
\begin{verbatim}
\afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
marktext=Notes]}
\end{verbatim}
is inserted to get a notes page on the next page, without wasting the remaining
space on this one (look into the source, here it comes):
\afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
marktext=Notes]}
Ok, lets fill this page, so the effect of the example can be seen. You could also
start a new section here.
\fillit[1-4]
\seclevelii{The command \texttt{\textbackslash npunpatchchapter}}
With \verb|\npunpatchchapter| the original meaning of \verb|\chapter| can be
restored. After that, there may be the usual empty before a new chapter, as can
be seen on the next page. The command:
\begin{verbatim}
\npunpatchchapter
\end{verbatim}
\npunpatchchapter
\secleveli{The End}
Now this is the end of this example file. But I just can't resist to add one more
example:
\begin{verbatim}
\notespages[multiple=100,minpages=100,endpages=1]
\end{verbatim}
See you on page 200.
\notespages[multiple=100,minpages=100,endpages=1]
\noindent
\vspace*{\fill}
\begin{center}
\sffamily\bfseries
Welcome on page 200.\\~\\
You just scrolled through over a hundred notes pages.\\~\\
Hey, come on, I had to test this.
\end{center}
\vspace*{\fill}
\vspace*{\fill}
\end{document}
%</example>
|