1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
|
% \iffalse meta-comment
%
% File: thumbs.dtx
% Version: 2014/03/09 v1.0q
%
% Copyright (C) 2010 - 2014 by
% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any later
% version. See http://www.ctan.org/license/lppl1.3 for the details.
%
% This work has the LPPL maintenance status "maintained".
% The Current Maintainer of this work is H.-Martin Muench.
%
% This work consists of the main source file thumbs.dtx,
% the README, and the derived files
% thumbs.sty, thumbs.pdf,
% thumbs.ins, thumbs.drv,
% thumbs-example.tex, thumbs-example.pdf.
%
% Distribution:
% http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.dtx
% http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.pdf
% http://mirror.ctan.org/install/macros/latex/contrib/thumbs.tds.zip
%
% see http://www.ctan.org/pkg/thumbs (catalogue)
%
% Unpacking:
% (a) If thumbs.ins is present:
% tex thumbs.ins
% (b) Without thumbs.ins:
% tex thumbs.dtx
% (c) If you insist on using LaTeX
% latex \let\install=y\input{thumbs.dtx}
% (quote the arguments according to the demands of your shell)
%
% Documentation:
% (a) If thumbs.drv is present:
% (pdf)latex thumbs.drv
% makeindex -s gind.ist thumbs.idx
% (pdf)latex thumbs.drv
% makeindex -s gind.ist thumbs.idx
% (pdf)latex thumbs.drv
% (b) Without thumbs.drv:
% (pdf)latex thumbs.dtx
% makeindex -s gind.ist thumbs.idx
% (pdf)latex thumbs.dtx
% makeindex -s gind.ist thumbs.idx
% (pdf)latex thumbs.dtx
%
% The class ltxdoc loads the configuration file ltxdoc.cfg
% if available. Here you can specify further options, e.g.
% use DIN A4 as paper format:
% \PassOptionsToClass{a4paper}{article}
%
% Installation:
% TDS:tex/latex/thumbs/thumbs.sty
% TDS:doc/latex/thumbs/thumbs.pdf
% TDS:doc/latex/thumbs/thumbs-example.tex
% TDS:doc/latex/thumbs/thumbs-example.pdf
% TDS:source/latex/thumbs/thumbs.dtx
%
%<*ignore>
\begingroup
\catcode123=1 %
\catcode125=2 %
\def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
\ifx\csname processbatchFile\endcsname\relax\else1\fi
\ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex
\Msg{**************************************************************************}
\Msg{* Installation *}
\Msg{* Package: thumbs 2014/03/09 v1.0q Thumb marks and overview page(s) (HMM)*}
\Msg{**************************************************************************}
\keepsilent
\askforoverwritefalse
\let\MetaPrefix\relax
\preamble
This is a generated file.
Project: thumbs
Version: 2014/03/09 v1.0q
Copyright (C) 2010 - 2014 by
H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
The usual disclaimer applies:
If it doesn't work right that's your problem.
(Nevertheless, send an e-mail to the maintainer
when you find an error in this package.)
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3c of this license or (at your option) any later
version. This version of this license is in
http://www.latex-project.org/lppl/lppl-1-3c.txt
and the latest version of this license is in
http://www.latex-project.org/lppl.txt
and version 1.3c or later is part of all distributions of
LaTeX version 2005/12/01 or later.
This work has the LPPL maintenance status "maintained".
The Current Maintainer of this work is H.-Martin Muench.
This work consists of the main source file thumbs.dtx,
the README, and the derived files
thumbs.sty, thumbs.pdf,
thumbs.ins, thumbs.drv,
thumbs-example.tex, thumbs-example.pdf.
In memoriam Tommy Muench + 2014/01/02.
\endpreamble
\let\MetaPrefix\DoubleperCent
\generate{%
\file{thumbs.ins}{\from{thumbs.dtx}{install}}%
\file{thumbs.drv}{\from{thumbs.dtx}{driver}}%
\usedir{tex/latex/thumbs}%
\file{thumbs.sty}{\from{thumbs.dtx}{package}}%
\usedir{doc/latex/thumbs}%
\file{thumbs-example.tex}{\from{thumbs.dtx}{example}}%
}
\catcode32=13\relax% active space
\let =\space%
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{* thumbs.sty}
\Msg{*}
\Msg{* To produce the documentation run the file `thumbs.drv'}
\Msg{* through (pdf)LaTeX, e.g.}
\Msg{* pdflatex thumbs.drv}
\Msg{* makeindex -s gind.ist thumbs.idx}
\Msg{* pdflatex thumbs.drv}
\Msg{* makeindex -s gind.ist thumbs.idx}
\Msg{* pdflatex thumbs.drv}
\Msg{*}
\Msg{* At least three runs are necessary e.g. to get the}
\Msg{* references right!}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}
\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%
% \section{The documentation driver file}
%
% The next bit of code contains the documentation driver file for
% \TeX{}, i.\,e., the file that will produce the documentation you
% are currently reading. It will be extracted from this file by the
% \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip}
% and specify the \texttt{driver} option when \texttt{docstrip}
% asks for options.
%
% \begin{macrocode}
%<*driver>
\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\ProvidesFile{thumbs.drv}%
[2014/03/09 v1.0q Thumb marks and overview page(s) (HMM)]
\documentclass[landscape]{ltxdoc}[2007/11/11]% v2.0u
\usepackage[maxfloats=20]{morefloats}[2012/01/28]% v1.0f
\usepackage{geometry}[2010/09/12]% v5.6
\usepackage{holtxdoc}[2012/03/21]% v0.24
%% thumbs may work with earlier versions of LaTeX2e and those
%% class and packages, but this was not tested.
%% Please consider updating your LaTeX, class, and packages
%% to the most recent version (if they are not already the most
%% recent version).
\hypersetup{%
pdfsubject={Thumb marks and overview page(s) (HMM)},%
pdfkeywords={LaTeX, thumb, thumbs, thumb index, thumbs index, index, H.-Martin Muench},%
pdfencoding=auto,%
pdflang={en},%
breaklinks=true,%
linktoc=all,%
pdfstartview=FitH,%
pdfpagelayout=OneColumn,%
bookmarksnumbered=true,%
bookmarksopen=true,%
bookmarksopenlevel=3,%
pdfmenubar=true,%
pdftoolbar=true,%
pdfwindowui=true,%
pdfnewwindow=true%
}
\CodelineIndex
\hyphenation{printing docu-ment docu-menta-tion}
\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}%
\begin{document}
\DocInput{thumbs.dtx}%
\end{document}
%</driver>
% \end{macrocode}
%
% \fi
%
% \CheckSum{2779}
%
% \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 \~}
%
% \GetFileInfo{thumbs.drv}
%
% \begingroup
% \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}%
% \makeatletter
% \@onelevel@sanitize\x
% \expandafter\endgroup
% \expandafter\DoNotIndex\expandafter{\x}
% \expandafter\DoNotIndex\expandafter{\string\ }
% \begingroup
% \makeatletter
% \lccode`9=32\relax
% \lowercase{%^^A
% \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A
% }%^^A
% \expandafter\endgroup\x
%
% \DoNotIndex{\\}
% \DoNotIndex{\documentclass,\usepackage,\ProvidesPackage,\begin,\end}
% \DoNotIndex{\MessageBreak}
% \DoNotIndex{\NeedsTeXFormat,\DoNotIndex,\verb}
% \DoNotIndex{\def,\edef,\gdef,\xdef,\global}
% \DoNotIndex{\ifx,\listfiles,\mathord,\mathrm}
% \DoNotIndex{\kvoptions,\SetupKeyvalOptions,\ProcessKeyvalOptions}
% \DoNotIndex{\smallskip,\bigskip,\space,\thinspace,\ldots}
% \DoNotIndex{\indent,\noindent,\newline,\linebreak,\pagebreak,\newpage}
% \DoNotIndex{\textbf,\textit,\textsf,\texttt,\textsc,\textrm}
% \DoNotIndex{\textquotedblleft,\textquotedblright}
% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
% \DoNotIndex{\chapter,\section}
% \DoNotIndex{\Huge,\Large,\large}
% \DoNotIndex{\arabic,\the,\value,\ifnum,\setcounter,\addtocounter,\advance,\divide}
% \DoNotIndex{\setlength,\textbackslash,\,}
% \DoNotIndex{\csname,\endcsname,\color,\copyright,\frac,\null}
% \DoNotIndex{\@PackageInfoNoLine,\thumbsinfo,\thumbsinfoa,\thumbsinfob}
% \DoNotIndex{\hspace,\thepage,\do,\empty,\ss}
%
% \title{The \xpackage{thumbs} package}
% \date{2014/03/09 v1.0q}
% \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}}
%
% \maketitle
%
% \begin{abstract}
% This \LaTeX{} package allows to create one or more customizable thumb index(es),
% providing a quick and easy reference method for large documents.
% It must be loaded after the page size has been set,
% when printing the document \textquotedblleft shrink to
% page\textquotedblright{} should not be used, and a printer capable of
% printing up to the border of the sheet of paper is needed
% (or afterwards cutting the paper).
% \end{abstract}
%
% \bigskip
%
% \noindent Disclaimer for web links: The author is not responsible for any contents
% referred to in this work unless he has full knowledge of illegal contents.
% If any damage occurs by the use of information presented there, only the
% author of the respective pages might be liable, not the one who has referred
% to these pages.
%
% \bigskip
%
% \noindent {\color{green} Save per page about $200\unit{ml}$ water,
% $2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\\
% Therefore please print only if this is really necessary.}
%
% \newpage
%
% \tableofcontents
%
% \newpage
%
% \section{Introduction}
% \indent This \LaTeX{} package puts running, customizable thumb marks in the outer
% margin, moving downward as the chapter number (or whatever shall be marked
% by the thumb marks) increases. Additionally an overview page/table of thumb
% marks can be added automatically, which gives the respective names of the
% thumbed objects, the page where the object/thumb mark first appears,
% and the thumb mark itself at the respective position. The thumb marks are
% probably useful for documents, where a quick and easy way to find
% e.\,g.~a~chapter is needed, for example in reference guides, anthologies,
% or quite large documents.\\
% \xpackage{thumbs} must be loaded after the page size has been set,
% when printing the document \textquotedblleft shrink to
% page\textquotedblright\ should not be used, a printer capable of
% printing up to the border of the sheet of paper is needed
% (or afterwards cutting the paper).\\
% Usage with |\usepackage[landscape]{geometry}|,
% |\documentclass[landscape]{|\ldots|}|, |\usepackage[landscape]{geometry}|,
% |\usepackage{lscape}|, or |\usepackage{pdflscape}| is possible.\\
% There \emph{are} already some packages for creating thumbs, but because
% none of them did what I wanted, I wrote this new package.\footnote{Probably%
% this holds true for the motivation of the authors of quite a lot of packages.}
%
% \section{Usage}
%
% \subsection{Loading}
% \indent Load the package placing
% \begin{quote}
% |\usepackage[<|\textit{options}|>]{thumbs}|
% \end{quote}
% \noindent in the preamble of your \LaTeXe\ source file.\\
% The \xpackage{thumbs} package takes the dimensions of the page
% |\AtBeginDocument| and does not react to changes afterwards.
% Therefore this package must be loaded \emph{after} the page dimensions
% have been set, e.\,g. with package \xpackage{geometry}
% (\url{http://ctan.org/pkg/geometry}). Of course it is also OK to just keep
% the default page/paper settings, but when anything is changed, it must be
% done before \xpackage{thumbs} executes its |\AtBeginDocument| code.\\
% The format of the paper, where the document shall be printed upon,
% should also be used for creating the document. Then the document can
% be printed without adapting the size, like e.\,g. \textquotedblleft shrink
% to page\textquotedblright . That would add a white border around the document
% and by moving the thumb marks from the edge of the paper they no longer appear
% at the side of the stack of paper. (Therefore e.\,g. for printing the example
% file to A4 paper it is necessary to add |a4paper| option to the document class
% and recompile it! Then the thumb marks column change will occur at another
% point, of course.) It is also necessary to use a printer
% capable of printing up to the border of the sheet of paper. Alternatively
% it is possible after the printing to cut the paper to the right size.
% While performing this manually is probably quite cumbersome,
% printing houses use paper, which is slightly larger than the
% desired format, and afterwards cut it to format.\\
% Some faulty \xfile{pdf}-viewer adds a white line at the bottom and
% right side of the document when presenting it. This does not change
% the printed version. To test for this problem, a page of the example
% file has been completely coloured. (Probably better exclude that page from
% printing\ldots)\\
% When using the thumb marks overview page, it is necessary to |\protect|
% entries like |\pi| (same as with entries in tables of contents, figures,
% tables,\ldots).\\
%
% \subsection{Options}
% \DescribeMacro{options}
% \indent The \xpackage{thumbs} package takes the following options:
%
% \subsubsection{linefill\label{sss:linefill}}
% \DescribeMacro{linefill}
% \indent Option |linefill| wants to know how the line between object
% (e.\,g.~chapter name) and page number shall be filled at the overview
% page. Empty option will result in a blank line, |line| will fill the distance
% with a line, |dots| will fill the distance with dots.
%
% \subsubsection{minheight\label{sss:minheight}}
% \DescribeMacro{minheight}
% \indent Option |minheight| wants to know the minimal vertical extension
% of each thumb mark. This is only useful in combination with option |height=auto|
% (see below). When the height is automatically calculated and smaller than
% the |minheight| value, the height is set equal to the given |minheight| value
% and a new column/page of thumb marks is used. The default value is
% $47\unit{pt}$\ $(\approx 16.5\unit{mm} \approx 0.65\unit{in})$.
%
% \subsubsection{height\label{sss:height}}
% \DescribeMacro{height}
% \indent Option |height| wants to know the vertical extension of each thumb mark.
% The default value \textquotedblleft |auto|\textquotedblright\ calculates
% an appropriate value automatically decreasing with increasing number of thumb
% marks (but fixed for each document). When the height is smaller than |minheight|,
% this package deems this as too small and instead uses a new column/page of thumb
% marks. If smaller thumb marks are really wanted, choose a smaller |minheight|
% (e.\,g.~$0\unit{pt}$).
%
% \subsubsection{width\label{sss:width}}
% \DescribeMacro{width}
% \indent Option |width| wants to know the horizontal extension of each thumb mark.
% The default option-value \textquotedblleft |auto|\textquotedblright\ calculates
% a width-value automatically: (|\paperwidth| minus |\textwidth|), which is the
% total width of inner and outer margin, divided by~$4$. Instead of this, any
% positive width given by the user is accepted. (Try |width={\paperwidth}|
% in the example!) Option |width={autoauto}| leads to thumb marks, which are
% just wide enough to fit the widest thumb mark text.
%
% \subsubsection{distance\label{sss:distance}}
% \DescribeMacro{distance}
% \indent Option |distance| wants to know the vertical spacing between
% two thumb marks. The default value is $2\unit{mm}$.
%
% \subsubsection{topthumbmargin\label{sss:topthumbmargin}}
% \DescribeMacro{topthumbmargin}
% \indent Option |topthumbmargin| wants to know the vertical spacing between
% the upper page (paper) border and top thumb mark. The default (|auto|)
% is 1 inch plus |\th@bmsvoffset| plus |\topmargin|. Dimensions (e.\,g. $1\unit{cm}$)
% are also accepted.
%
% \pagebreak
%
% \subsubsection{bottomthumbmargin\label{sss:bottomthumbmargin}}
% \DescribeMacro{bottomthumbmargin}
% \indent Option |bottomthumbmargin| wants to know the vertical spacing between
% the lower page (paper) border and last thumb mark. The default (|auto|) for the
% position of the last thumb is\\
% |1in+\topmargin-\th@mbsdistance+\th@mbheighty+\headheight+\headsep+\textheight|
% |+\footskip-\th@mbsdistance|\newline
% |-\th@mbheighty|.\\
% Dimensions (e.\,g. $1\unit{cm}$) are also accepted.
%
% \subsubsection{eventxtindent\label{sss:eventxtindent}}
% \DescribeMacro{eventxtindent}
% \indent Option |eventxtindent| expects a dimension (default value: $5\unit{pt}$,
% negative values are possible, of course),
% by which the text inside of thumb marks on even pages is moved away from the
% page edge, i.e. to the right. Probably using the same or at least a similar value
% as for option |oddtxtexdent| makes sense.
%
% \subsubsection{oddtxtexdent\label{sss:oddtxtexdent}}
% \DescribeMacro{oddtxtexdent}
% \indent Option |oddtxtexdent| expects a dimension (default value: $5\unit{pt}$,
% negative values are possible, of course),
% by which the text inside of thumb marks on odd pages is moved away from the
% page edge, i.e. to the left. Probably using the same or at least a similar value
% as for option |eventxtindent| makes sense.
%
% \subsubsection{evenmarkindent\label{sss:evenmarkindent}}
% \DescribeMacro{evenmarkindent}
% \indent Option |evenmarkindent| expects a dimension (default value: $0\unit{pt}$,
% negative values are possible, of course),
% by which the thumb marks (background and text) on even pages are moved away from the
% page edge, i.e. to the right. This might be usefull when the paper,
% onto which the document is printed, is later cut to another format.
% Probably using the same or at least a similar value as for option |oddmarkexdent|
% makes sense.
%
% \subsubsection{oddmarkexdent\label{sss:oddmarkexdent}}
% \DescribeMacro{oddmarkexdent}
% \indent Option |oddmarkexdent| expects a dimension (default value: $0\unit{pt}$,
% negative values are possible, of course),
% by which the thumb marks (background and text) on odd pages are moved away from the
% page edge, i.e. to the left. This might be usefull when the paper,
% onto which the document is printed, is later cut to another format.
% Probably using the same or at least a similar value as for option |oddmarkexdent|
% makes sense.
%
% \subsubsection{evenprintvoffset\label{sss:evenprintvoffset}}
% \DescribeMacro{evenprintvoffset}
% \indent Option |evenprintvoffset| expects a dimension (default value: $0\unit{pt}$,
% negative values are possible, of course),
% by which the thumb marks (background and text) on even pages are moved downwards.
% This might be usefull when a duplex printer shifts recto and verso pages
% against each other by some small amount, e.g. a~millimeter or two, which
% is not uncommon. Please do not use this option with another value than $0\unit{pt}$
% for files which you submit to other persons. Their printer probably shifts the
% pages by another amount, which might even lead to increased mismatch
% if both printers shift in opposite directions. Ideally the pdf viewer
% would correct the shift depending on printer (or at least give some option
% similar to \textquotedblleft shift verso pages by
% \hbox{$x\unit{mm}$\textquotedblright{}.}
%
% \subsubsection{thumblink\label{sss:thumblink}}
% \DescribeMacro{thumblink}
% \indent Option |thumblink| determines, what is hyperlinked at the thumb marks
% overview page (when the \xpackage{hyperref} package is used):
%
% \begin{description}
% \item[- |none|] creates \emph{none} hyperlinks
%
% \item[- |title|] hyperlinks the \emph{titles} of the thumb marks
%
% \item[- |page|] hyperlinks the \emph{page} numbers of the thumb marks
%
% \item[- |titleandpage|] hyperlinks the \emph{title and page} numbers of the thumb marks
%
% \item[- |line|] hyperlinks the whole \emph{line}, i.\,e. title, dots%
% (or line or whatsoever) and page numbers of the thumb marks
%
% \item[- |rule|] hyperlinks the whole \emph{rule}.
% \end{description}
%
% \subsubsection{nophantomsection\label{sss:nophantomsection}}
% \DescribeMacro{nophantomsection}
% \indent Option |nophantomsection| globally disables the automatical placement of a
% |\phantomsection| before the thumb marks. Generally it is desirable to have a
% hyperlink from the thumbs overview page to lead to the thumb mark and not to some
% earlier place. Therefore automatically a |\phantomsection| is placed before each
% thumb mark. But for example when using the thumb mark after a |\chapter{...}|
% command, it is probably nicer to have the link point at the top of that chapter's
% title (instead of the line below it). When automatical placing of the
% |\phantomsection|s has been globally disabled, nevertheless manual use of
% |\phantomsection| is still possible. The other way round: When automatical placing
% of the |\phantomsection|s has \emph{not} been globally disabled, it can be disabled
% just for the following thumb mark by the command |\thumbsnophantom|.
%
% \subsubsection{ignorehoffset, ignorevoffset\label{sss:ignoreoffset}}
% \DescribeMacro{ignorehoffset}
% \DescribeMacro{ignorevoffset}
% \indent Usually |\hoffset| and |\voffset| should be regarded,
% but moving the thumb marks away from the paper edge probably
% makes them useless. Therefore |\hoffset| and |\voffset| are ignored
% by default, or when option |ignorehoffset| or |ignorehoffset=true| is used
% (and |ignorevoffset| or |ignorevoffset=true|, respectively).
% But in case that the user wants to print at one sort of paper
% but later trim it to another one, regarding the offsets would be
% necessary. Therefore |ignorehoffset=false| and |ignorevoffset=false|
% can be used to regard these offsets. (Combinations
% |ignorehoffset=true, ignorevoffset=false| and
% |ignorehoffset=false, ignorevoffset=true| are also possible.)\\
%
% \subsubsection{verbose\label{sss:verbose}}
% \DescribeMacro{verbose}
% \indent Option |verbose=false| (the default) suppresses some messages,
% which otherwise are presented at the screen and written into the \xfile{log}~file.
% Look for\\
% |************** THUMB dimensions **************|\\
% in the \xfile{log} file for height and width of the thumb marks as well as
% top and bottom thumb marks margins.
%
% \subsubsection{draft\label{sss:draft}}
% \DescribeMacro{draft}
% \indent Option |draft| (\emph{not} the default) sets the thumb mark width to
% $2\unit{pt}$, thumb mark text colour to black and thumb mark background colour
% to grey (|gray|). Either do not use this option with the \xpackage{thumbs} package at all,
% or use |draft=false|, or |final|, or |final=true| to get the original appearance
% of the thumb marks.\\
%
% \subsubsection{hidethumbs\label{sss:hidethumbs}}
% \DescribeMacro{hidethumbs}
% \indent Option |hidethumbs| (\emph{not} the default) prevents \xpackage{thumbs}
% to create thumb marks (or thumb marks overview pages). This could be useful
% when thumb marks were placed, but for some reason no thumb marks (and overview pages)
% shall be placed. Removing |\usepackage[...]{thumbs}| would not work but
% create errors for unknown commands (e.\,g. |\addthumb|, |\addtitlethumb|,
% |\thumbnewcolumn|, |\stopthumb|, |\continuethumb|, |\addthumbsoverviewtocontents|,
% |\thumbsoverview|, |\thumbsoverviewback|, |\thumbsoverviewverso|, and
% |\thumbsoverviewdouble|). (A~|\jobname.tmb| file is created nevertheless.)~--
% Either do not use this option with the \xpackage{thumbs}
% package at all, or use |hidethumbs=false| to get the original appearance
% of the thumb marks.\\
%
% \subsubsection{pagecolor (obsolete)\label{sss:pagecolor}}
% \DescribeMacro{pagecolor}
% \indent Option |pagecolor| is obsolete. Instead the \xpackage{pagecolor}
% package is used.\\
% Use |\pagecolor{...}| \emph{after} |\usepackage[...]{thumbs}|
% and \emph{before} |\begin{document}| to define a background colour of the pages.\\
%
% \subsubsection{evenindent (obsolete)\label{sss:evenindent}}
% \DescribeMacro{evenindent}
% \indent Option |evenindent| is obsolete and was replaced by |eventxtindent|.\\
%
% \subsubsection{oddexdent (obsolete)\label{sss:oddexdent}}
% \DescribeMacro{oddexdent}
% \indent Option |oddexdent| is obsolete and was replaced by |oddtxtexdent|.\\
%
% \pagebreak
%
% \subsection{Commands to be used in the document}
% \subsubsection{\textbackslash addthumb}
% \DescribeMacro{\addthumb}
% To add a thumb mark, use the |\addthumb| command, which has these four parameters:
% \begin{enumerate}
% \item a title for the thumb mark (for the thumb marks overview page,
% e.\,g. the chapter title),
%
% \item the text to be displayed in the thumb mark (for example the chapter
% number: |\thechapter|),
%
% \item the colour of the text in the thumb mark,
%
% \item and the background colour of the thumb mark
% \end{enumerate}
% (parameters in this order) at the page where you want this thumb mark placed
% (for the first time).\\
%
% \subsubsection{\textbackslash addtitlethumb}
% \DescribeMacro{\addtitlethumb}
% When a thumb mark shall not or cannot be placed on a page, e.\,g.~at the title page or
% when using |\includepdf| from \xpackage{pdfpages} package, but the reference in the thumb
% marks overview nevertheless shall name that page number and hyperlink to that page,
% |\addtitlethumb| can be used at the following page. It has five arguments. The arguments
% one to four are identical to the ones of |\addthumb| (see above),
% and the fifth argument consists of the label of the page, where the hyperlink
% at the thumb marks overview page shall link to. The \xpackage{thumbs} package does
% \emph{not} create that label! But for the first page the label
% \texttt{pagesLTS.0} can be use, which is already placed there by the used
% \xpackage{pageslts} package.\\
%
% \subsubsection{\textbackslash stopthumb and \textbackslash continuethumb}
% \DescribeMacro{\stopthumb}
% \DescribeMacro{\continuethumb}
% When a page (or pages) shall have no thumb marks, use the |\stopthumb| command
% (without parameters). Placing another thumb mark with |\addthumb| or |\addtitlethumb|
% or using the command |\continuethumb| continues the thumb marks.\\
%
% \subsubsection{\textbackslash thumbsoverview/back/verso/double}
% \DescribeMacro{\thumbsoverview}
% \DescribeMacro{\thumbsoverviewback}
% \DescribeMacro{\thumbsoverviewverso}
% \DescribeMacro{\thumbsoverviewdouble}
% The commands |\thumbsoverview|, |\thumbsoverviewback|, |\thumbsoverviewverso|, and/or
% |\thumbsoverviewdouble| is/are used to place the overview page(s) for the thumb marks.
% Their single parameter is used to mark this page/these pages (e.\,g. in the page header).
% If these marks are not wished, |\thumbsoverview...{}| will generate empty marks in the
% page header(s). |\thumbsoverview| can be used more than once (for example at the
% beginning and at the end of the document, or |\thumbsoverview| at the beginning and
% |\thumbsoverviewback| at the end). The overviews have labels |TableOfThumbs1|,
% |TableOfThumbs2|, and so on, which can be referred to with e.\,g. |\pageref{TableOfThumbs1}|.
% The reference |TableOfThumbs| (without number) aims at the last used Table of Thumbs
% (for compatibility with older versions of this package).
% \begin{description}
% \item[-] |\thumbsoverview| prints the thumb marks at the right side
% and (in |twoside| mode) skips left sides (useful e.\,g. at the beginning
% of a document)
%
% \item[-] |\thumbsoverviewback| prints the thumb marks at the left side
% and (in |twoside| mode) skips right sides (useful e.\,g. at the end
% of a document)
%
% \item[-] |\thumbsoverviewverso| prints the thumb marks at the right side
% and (in |twoside| mode) repeats them at the next left side and so on
% (useful anywhere in the document and when one wants to prevent empty
% pages)
%
% \item[-] |\thumbsoverviewdouble| prints the thumb marks at the left side
% and (in |twoside| mode) repeats them at the next right side and so on
% (useful anywhere in the document and when one wants to prevent empty
% pages)
% \end{description}
% \smallskip
%
% \subsubsection{\textbackslash thumbnewcolumn}
% \DescribeMacro{\thumbnewcolumn}
% With the command |\thumbnewcolumn| a new column can be started, even if the current one
% was not filled. This could be useful e.\,g. for a dictionary, which uses one column for
% translations from language A to language B, and the second column for translations
% from language B to language A. But in that case one probably should increase the
% size of the thumb marks, so that $26$~thumb marks (in~case of the Latin alphabet)
% fill one thumb column. Do not use |\thumbnewcolumn| on a page where |\addthumb| was
% already used, but use |\addthumb| immediately after |\thumbnewcolumn|.\\
%
% \subsubsection{\textbackslash addthumbsoverviewtocontents}
% \DescribeMacro{\addthumbsoverviewtocontents}
% |\addthumbsoverviewtocontents| with two arguments is a replacement for
% |\addcontentsline{toc}{<level>}{<text>}|, where the first argument of
% |\addthumbsoverviewtocontents| is for |<level>| and the second for |<text>|.
% If an entry of the thumbs mark overview shall be placed in the table of contents,
% |\addthumbsoverviewtocontents| with its arguments should be used immediately before
% |\thumbsoverview|.
%
% \subsubsection{\textbackslash thumbsnophantom}
% \DescribeMacro{\thumbsnophantom}
% When automatical placing of the |\phantomsection|s has \emph{not} been globally
% disabled by using option |nophantomsection| (see subsection~\ref{sss:nophantomsection}),
% it can be disabled just for the following thumb mark by the command |\thumbsnophantom|.
%
% \pagebreak
%
% \section{Alternatives\label{sec:Alternatives}}
%
% \begin{description}
% \item[-] \xpackage{chapterthumb}, 2005/03/10, v0.1, by \textsc{Markus Kohm}, available at\\
% \url{http://mirror.ctan.org/info/examples/KOMA-Script-3/Anhang-B/source/chapterthumb.sty};\\
% unfortunately without documentation, which is probably available in the book:\\
% Kohm, M., \& Morawski, J.-U. (2008): KOMA-Script. Eine Sammlung von Klassen und Paketen f\"{u}r \LaTeX2e,
% 3.,~\"{u}berarbeitete und erweiterte Auflage f\"{u}r KOMA-Script~3,
% Lehmanns Media, Berlin, Edition dante, ISBN-13:~978-3-86541-291-1,
% \url{http://www.lob.de/isbn/3865412912}; in German.
%
% \item[-] \xpackage{eso-pic}, 2010/10/06, v2.0c by \textsc{Rolf Niepraschk}, available at
% \url{http://www.ctan.org/pkg/eso-pic}, was suggested as alternative. If I understood its code right,
% |\AtBeginShipout{\AtBeginShipoutUpperLeft{\put(...| is used there, too. Thus I do not see
% its advantage. Additionally, while compiling the \xpackage{eso-pic} test documents with
% \TeX Live2010 worked, compiling them with \textsl{Scientific WorkPlace}{}\ 5.50 Build 2960\ %
% (\copyright~MacKichan Software, Inc.) led to significant deviations of the placements
% (also changing from one page to the other).
%
% \item[-] \xpackage{fancytabs}, 2011/04/16 v1.1, by \textsc{Rapha\"{e}l Pinson}, available at
% \url{http://www.ctan.org/pkg/fancytabs}, but requires TikZ from the
% \href{http://www.ctan.org/pkg/pgf}{pgf} bundle.
%
% \item[-] \xpackage{thumb}, 2001, without file version, by \textsc{Ingo Kl\"{o}ckel}, available at\\
% \url{ftp://ftp.dante.de/pub/tex/info/examples/ltt/thumb.sty},
% unfortunately without documentation, which is probably available in the book:\\
% Kl\"{o}ckel, I. (2001): \LaTeX2e.\ Tips und Tricks, Dpunkt.Verlag GmbH,
% \href{http://amazon.de/o/ASIN/3932588371}{ISBN-13:~978-3-93258-837-2}; in German.
%
% \item[-] \xpackage{thumb} (a completely different one), 1997/12/24, v1.0,
% by \textsc{Christian Holm}, available at\\
% \url{http://www.ctan.org/pkg/thumb}.
%
% \item[-] \xpackage{thumbindex}, 2009/12/13, without file version, by \textsc{Hisashi Morita},
% available at\\
% \url{http://hisashim.org/2009/12/13/thumbindex.html}.
%
% \item[-] \xpackage{thumb-index}, from the \xpackage{fancyhdr} package, 2005/03/22 v3.2,
% by~\textsc{Piet van Oostrum}, available at\\
% \url{http://www.ctan.org/pkg/fancyhdr}.
%
% \item[-] \xpackage{thumbpdf}, 2010/07/07, v3.11, by \textsc{Heiko Oberdiek}, is for creating
% thumbnails in a \xfile{pdf} document, not thumb marks (and therefore \textit{no} alternative);
% available at \url{http://www.ctan.org/pkg/thumbpdf}.
%
% \item[-] \xpackage{thumby}, 2010/01/14, v0.1, by \textsc{Sergey Goldgaber},
% \textquotedblleft is designed to work with the \href{http://www.ctan.org/pkg/memoir}{memoir}
% class, and also requires \href{http://www.ctan.org/pkg/perltex}{Perl\TeX} and
% \href{http://www.ctan.org/pkg/pgf}{tikz}\textquotedblright\ %
% (\url{http://www.ctan.org/pkg/thumby}), available at \url{http://www.ctan.org/pkg/thumby}.
% \end{description}
%
% \bigskip
%
% \noindent Newer versions might be available (and better suited).
% You programmed or found another alternative,
% which is available at \url{CTAN.org}?
% OK, send an e-mail to me with the name, location at \url{CTAN.org},
% and a short notice, and I will probably include it in the list above.
%
% \newpage
%
% \section{Example}
%
% \begin{macrocode}
%<*example>
\documentclass[twoside,british]{article}[2007/10/19]% v1.4h
\usepackage{lipsum}[2011/04/14]% v1.2
\usepackage{eurosym}[1998/08/06]% v1.1
\usepackage[extension=pdf,%
pdfpagelayout=TwoPageRight,pdfpagemode=UseThumbs,%
plainpages=false,pdfpagelabels=true,%
hyperindex=false,%
pdflang={en},%
pdftitle={thumbs package example},%
pdfauthor={H.-Martin Muench},%
pdfsubject={Example for the thumbs package},%
pdfkeywords={LaTeX, thumbs, thumb marks, H.-Martin Muench},%
pdfview=Fit,pdfstartview=Fit,%
linktoc=all]{hyperref}[2012/11/06]% v6.83m
\usepackage[thumblink=rule,linefill=dots,height={auto},minheight={47pt},%
width={auto},distance={2mm},topthumbmargin={auto},bottomthumbmargin={auto},%
eventxtindent={5pt},oddtxtexdent={5pt},%
evenmarkindent={0pt},oddmarkexdent={0pt},evenprintvoffset={0pt},%
nophantomsection=false,ignorehoffset=true,ignorevoffset=true,final=true,%
hidethumbs=false,verbose=true]{thumbs}[2014/03/09]% v1.0q
\nopagecolor% use \pagecolor{white} if \nopagecolor does not work
\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}
\makeatletter
\ltx@ifpackageloaded{hyperref}{% hyperref loaded
}{% hyperref not loaded
\usepackage{url}% otherwise the "\url"s in this example must be removed manually
}
\makeatother
\listfiles
\begin{document}
\pagenumbering{arabic}
\section*{Example for thumbs}
\addcontentsline{toc}{section}{Example for thumbs}
\markboth{Example for thumbs}{Example for thumbs}
This example demonstrates the most common uses of package
\textsf{thumbs}, v1.0q as of 2014/03/09 (HMM).
The used options were \texttt{thumblink=rule}, \texttt{linefill=dots},
\texttt{height=auto}, \texttt{minheight=\{47pt\}}, \texttt{width={auto}},
\texttt{distance=\{2mm\}}, \newline
\texttt{topthumbmargin=\{auto\}}, \texttt{bottomthumbmargin=\{auto\}}, \newline
\texttt{eventxtindent=\{5pt\}}, \texttt{oddtxtexdent=\{5pt\}},
\texttt{evenmarkindent=\{0pt\}}, \texttt{oddmarkexdent=\{0pt\}},
\texttt{evenprintvoffset=\{0pt\}},
\texttt{nophantomsection=false},
\texttt{ignorehoffset=true}, \texttt{ignorevoffset=true}, \newline
\texttt{final=true},\texttt{hidethumbs=false}, and \texttt{verbose=true}.
\noindent These are the default options, except \texttt{verbose=true}.
For more details please see the documentation!\newline
\textbf{Hyperlinks or not:} If the \textsf{hyperref} package is loaded,
the references in the overview page for the thumb marks are also hyperlinked
(except when option \texttt{thumblink=none} is used).\newline
\bigskip
{\color{teal} Save per page about $200\unit{ml}$ water, $2\unit{g}$ CO$_{2}$
and $2\unit{g}$ wood:\newline
Therefore please print only if this is really necessary.}\newline
\bigskip
\textbf{%
For testing purpose page \pageref{greenpage} has been completely coloured!
\newline
Better exclude it from printing\ldots \newline}
\bigskip
Some thumb mark texts are too large for the thumb mark by intention
(especially when the paper size and therefore also the thumb mark size
is decreased). When option \texttt{width=\{autoauto\}} would be used,
the thumb mark width would be automatically increased.
Please see page~\pageref{HugeText} for details!
\bigskip
For printing this example to another format of paper (e.\,g. A4)
it is necessary to add the according option (e.\,g. \verb|a4paper|)
to the document class and recompile it! (In that case the
thumb marks column change will occur at another point, of course.)
With paper format equal to document format the document can be printed
without adapting the size, like e.\,g.
\textquotedblleft shrink to page\textquotedblright .
That would add a white border around the document
and by moving the thumb marks from the edge of the paper they no longer appear
at the side of the stack of paper. It is also necessary to use a printer
capable of printing up to the border of the sheet of paper. Alternatively
it is possible after the printing to cut the paper to the right size.
While performing this manually is probably quite cumbersome,
printing houses use paper, which is slightly larger than the
desired format, and afterwards cut it to format.
\newpage
\addtitlethumb{Frontmatter}{0}{white}{gray}{pagesLTS.0}
At the first page no thumb mark was used, but we want to begin with thumb marks
at the first page, therefore a
\begin{verbatim}
\addtitlethumb{Frontmatter}{0}{white}{gray}{pagesLTS.0}
\end{verbatim}
was used at the beginning of this page.
\newpage
\tableofcontents
\newpage
To include an overview page for the thumb marks,
\begin{verbatim}
\addthumbsoverviewtocontents{section}{Thumb marks overview}%
\thumbsoverview{Table of Thumbs}
\end{verbatim}
is used, where \verb|\addthumbsoverviewtocontents| adds the thumb
marks overview page to the table of contents.
\smallskip
Generally it is desirable to have a hyperlink from the thumbs overview page
to lead to the thumb mark and not to some earlier place. Therefore automatically
a \verb|\phantomsection| is placed before each thumb mark. But for example when
using the thumb mark after a \verb|\chapter{...}| command, it is probably nicer
to have the link point at the top of that chapter's title (instead of the line
below it). The automatical placing of the \verb|\phantomsection| can be disabled
either globally by using option \texttt{nophantomsection}, or locally for the next
thumb mark by the command \verb|\thumbsnophantom|. (When disabled globally,
still manual use of \verb|\phantomsection| is possible.)
% \end{macrocode}
% \pagebreak
% \begin{macrocode}
\addthumbsoverviewtocontents{section}{Thumb marks overview}%
\thumbsoverview{Table of Thumbs}
That were the overview pages for the thumb marks.
\newpage
\section{The first section}
\addthumb{First section}{\space\Huge{\textbf{$1^ \textrm{st}$}}}{yellow}{green}
\begin{verbatim}
\addthumb{First section}{\space\Huge{\textbf{$1^ \textrm{st}$}}}{yellow}{green}
\end{verbatim}
A thumb mark is added for this section. The parameters are: title for the thumb mark,
the text to be displayed in the thumb mark (choose your own format),
the colour of the text in the thumb mark,
and the background colour of the thumb mark (parameters in this order).\newline
Now for some pages of \textquotedblleft content\textquotedblright\ldots
\newpage
\lipsum[1]
\newpage
\lipsum[1]
\newpage
\lipsum[1]
\newpage
\section{The second section}
\addthumb{Second section}{\Huge{\textbf{\arabic{section}}}}{green}{yellow}
For this section, the text to be displayed in the thumb mark was set to
\begin{verbatim}
\Huge{\textbf{\arabic{section}}}
\end{verbatim}
i.\,e. the number of the section will be displayed (huge \& bold).\newline
Let us change the thumb mark on a page with an even number:
\newpage
\section{The third section}
\addthumb{Third section}{\Huge{\textbf{\arabic{section}}}}{blue}{red}
No problem!
And you do not need to have a section to add a thumb:
\newpage
\addthumb{Still third section}{\Huge{\textbf{\arabic{section}b}}}{red}{blue}
This is still the third section, but there is a new thumb mark.
On the other hand, you can even get rid of the thumb marks
for some page(s):
\newpage
\stopthumb
The command
\begin{verbatim}
\stopthumb
\end{verbatim}
was used here. Until another \verb|\addthumb| (with parameters) or
\begin{verbatim}
\continuethumb
\end{verbatim}
is used, there will be no more thumb marks.
\newpage
Still no thumb marks.
\newpage
Still no thumb marks.
\newpage
Still no thumb marks.
\newpage
\continuethumb
Thumb mark continued (unchanged).
\newpage
Thumb mark continued (unchanged).
\newpage
Time for another thumb,
\addthumb{Another heading}{Small text}{white}{black}
and another.
\addthumb{Huge Text paragraph}{\Huge{Huge\\ \ Text}}{yellow}{green}
\bigskip
\textquotedblleft {\Huge{Huge Text}}\textquotedblright\ is too large for
the thumb mark. When option \texttt{width=\{autoauto\}} would be used,
the thumb mark width would be automatically increased. Now the text is
either split over two lines (try \verb|Huge\\ \ Text| for another format)
or (in case \verb|Huge~Text| is used) is written over the border of the
thumb mark. When the text is too wide for the thumb mark and cannot
be split, \LaTeX{} might nevertheless place the text into the next line.
By this the text is placed too low. Adding a
\hbox{\verb|\protect\vspace*{-| some lenght \verb|}|} to the text could help,
for example\\
\verb|\addthumb{Huge Text}{\protect\vspace*{-3pt}\Huge{Huge~Text}}...|.
\label{HugeText}
\addthumb{Huge Text}{\Huge{Huge~Text}}{red}{blue}
\addthumb{Huge Bold Text}{\Huge{\textbf{HBT}}}{black}{yellow}
\bigskip
When there is more than one thumb mark at one page, this is also no problem.
\newpage
Some text
\newpage
Some text
\newpage
Some text
\newpage
\section{xcolor}
\addthumb{xcolor}{\Huge{\textbf{xcolor}}}{magenta}{cyan}
It is probably a good idea to have a look at the \textsf{xcolor} package
and use other colours than used in this example.
(About automatically increasing the thumb mark width to the thumb mark text
width please see the note at page~\pageref{HugeText}.)
\newpage
\addthumb{A mark}{\Huge{\textbf{A}}}{lime}{darkgray}
I just need to add further thumb marks to get them reaching the bottom of the page.
Generally the vertical size of the thumb marks is set to the value given in the
height option. If it is \texttt{auto}, the size of the thumb marks is decreased,
so that they fit all on one page. But when they get smaller than \texttt{minheight},
instead of decreasing their size further, a~new thumbs column is started
(which will happen here).
\newpage
\addthumb{B mark}{\Huge{\textbf{B}}}{brown}{pink}
There! A new thumb column was started automatically!
\newpage
\addthumb{C mark}{\Huge{\textbf{C}}}{brown}{pink}
You can, of course, keep the colour for more than one thumb mark.
\newpage
\addthumb{$1/1.\,955\,83$\, EUR}{\Huge{\textbf{D}}}{orange}{violet}
I am just adding further thumb marks.
If you are curious why the thumb mark between
\textquotedblleft C mark\textquotedblright\ and \textquotedblleft E mark\textquotedblright\ has
not been named \textquotedblleft D mark\textquotedblright\ but
\textquotedblleft $1/1.\,955\,83$\, EUR\textquotedblright :
$1\unit{DM}=1\unit{D\ Mark}=1\unit{Deutsche\ Mark}$\newline
$=\frac{1}{1.\,955\,83}\,$\euro $\,=1/1.\,955\,83\unit{Euro}=1/1.\,955\,83\unit{EUR}$.
\newpage
Let us have a look at \verb|\thumbsoverviewverso|:
\addthumbsoverviewtocontents{section}{Table of Thumbs, verso mode}%
\thumbsoverviewverso{Table of Thumbs, verso mode}
\newpage
And, of course, also at \verb|\thumbsoverviewdouble|:
\addthumbsoverviewtocontents{section}{Table of Thumbs, double mode}%
\thumbsoverviewdouble{Table of Thumbs, double mode}
\newpage
\addthumb{E mark}{\Huge{\textbf{E}}}{lightgray}{black}
I am just adding further thumb marks.
\newpage
\addthumb{F mark}{\Huge{\textbf{F}}}{magenta}{black}
Some text.
\newpage
\thumbnewcolumn
\addthumb{New thumb marks column}{\Huge{\textit{NC}}}{magenta}{black}
There! A new thumb column was started manually!
\newpage
Some text.
\newpage
\addthumb{G mark}{\Huge{\textbf{G}}}{orange}{violet}
I just added another thumb mark.
\newpage
\pagecolor{green}
\makeatletter
\ltx@ifpackageloaded{hyperref}{% hyperref loaded
\phantomsection%
}{% hyperref not loaded
}%
\makeatother
% \end{macrocode}
% \pagebreak
% \begin{macrocode}
\label{greenpage}
Some faulty pdf-viewer sometimes (for the same document!)
adds a white line at the bottom and right side of the document
when presenting it. This does not change the printed version.
To test for this problem, this page has been completely coloured.
(Probably better exclude this page from printing!)
\textsc{Heiko Oberdiek} wrote at Tue, 26 Apr 2011 14:13:29 +0200
in the \newline
comp.text.tex newsgroup (see e.\,g. \newline
\url{http://groups.google.com/group/de.comp.text.tex/msg/b3aea4a60e1c3737}):\newline
\textquotedblleft Der Ursprung ist 0 0,
da gibt es nicht viel zu runden; bei den anderen Seiten
werden pt als bp in die PDF-Datei geschrieben, d.h.
der Balken ist um 72.27/72 zu gro\ss{}, das
sollte auch Rundungsfehler abdecken.\textquotedblright
(The origin is 0 0, there is not much to be rounded;
for the other sides the $\unit{pt}$ are written as $\unit{bp}$ into
the pdf-file, i.\,e. the rule is too large by $72.27/72$, which
should cover also rounding errors.)
The thumb marks are also too large - on purpose! This has been done
to assure, that they cover the page up to its (paper) border,
therefore they are placed a little bit over the paper margin.
Now I red somewhere in the net (should have remembered to note the url),
that white margins are presented, whenever there is some object outside
of the page. Thus, it is a feature, not a bug?!
What I do not understand: The same document sometimes is presented
with white lines and sometimes without (same viewer, same PC).\newline
But at least it does not influence the printed version.
\newpage
\pagecolor{white}
It is possible to use the Table of Thumbs more than once (for example
at the beginning and the end of the document) and to refer to them via e.\,g.
\verb|\pageref{TableOfThumbs1}, \pageref{TableOfThumbs2}|,... ,
here: page \pageref{TableOfThumbs1}, page \pageref{TableOfThumbs2},
and via e.\,g. \verb|\pageref{TableOfThumbs}| it is referred to the last used
Table of Thumbs (for compatibility with older package versions).
If there is only one Table of Thumbs, this one is also the last one, of course.
Here it is at page \pageref{TableOfThumbs}.\newline
Now let us have a look at \verb|\thumbsoverviewback|:
\addthumbsoverviewtocontents{section}{Table of Thumbs, back mode}%
\thumbsoverviewback{Table of Thumbs, back mode}
\newpage
Text can be placed after any of the Tables of Thumbs, of course.
\end{document}
%</example>
% \end{macrocode}
%
% \pagebreak
%
% \StopEventually{}
%
% \section{The implementation}
%
% We start off by checking that we are loading into \LaTeXe{} and
% announcing the name and version of this package.
%
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\ProvidesPackage{thumbs}[2014/03/09 v1.0q
Thumb marks and overview page(s) (HMM)]
% \end{macrocode}
%
% A short description of the \xpackage{thumbs} package:
%
% \begin{macrocode}
%% This package allows to create a customizable thumb index,
%% providing a quick and easy reference method for large documents,
%% as well as an overview page.
% \end{macrocode}
%
% For possible SW(P) users, we issue a warning. Unfortunately, we cannot check
% for the used software (Can we? \xfile{tcilatex.tex} is \emph{probably} exactly there
% when SW(P) is used, but it \emph{could} also be there without SW(P) for compatibility
% reasons.), and there will be a stack overflow when using \xpackage{hyperref}
% even before the \xpackage{thumbs} package is loaded, thus the warning might not
% even reach the users. The options for those packages might be changed by the user~--
% I~neither tested all available options nor the current \xpackage{thumbs} package,
% thus first test, whether the document can be compiled with these options,
% and then try to change them according to your wishes
% (\emph{or just get a current \TeX{} distribution instead!}).
%
% \begin{macrocode}
\IfFileExists{tcilatex.tex}{% Quite probably SWP/SW/SN
\PackageWarningNoLine{thumbs}{%
When compiling with SWP 5.50 Build 2960\MessageBreak%
(copyright MacKichan Software, Inc.)\MessageBreak%
and using an older version of the thumbs package\MessageBreak%
these additional packages were needed:\MessageBreak%
\string\usepackage[T1]{fontenc}\MessageBreak%
\string\usepackage{amsfonts}\MessageBreak%
\string\usepackage[math]{cellspace}\MessageBreak%
\string\usepackage{xcolor}\MessageBreak%
\string\pagecolor{white}\MessageBreak%
\string\providecommand{\string\QTO}[2]{\string##2}\MessageBreak%
especially before hyperref and thumbs,\MessageBreak%
but best right after the \string\documentclass!%
}%
}{% Probably not SWP/SW/SN
}
% \end{macrocode}
%
% For the handling of the options we need the \xpackage{kvoptions}
% package of \textsc{Heiko Oberdiek} (see subsection~\ref{ss:Downloads}):
%
% \begin{macrocode}
\RequirePackage{kvoptions}[2011/06/30]% v3.11
% \end{macrocode}
%
% as well as some other packages:
%
% \begin{macrocode}
\RequirePackage{atbegshi}[2011/10/05]% v1.16
\RequirePackage{xcolor}[2007/01/21]% v2.11
\RequirePackage{picture}[2009/10/11]% v1.3
\RequirePackage{alphalph}[2011/05/13]% v2.4
% \end{macrocode}
%
% For the total number of the current page we need the \xpackage{pageslts}
% package of myself (see subsection~\ref{ss:Downloads}). It also loads
% the \xpackage{undolabl} package, which is needed for |\overridelabel|:
%
% \begin{macrocode}
\RequirePackage{pageslts}[2014/01/19]% v1.2c
\RequirePackage{pagecolor}[2012/02/23]% v1.0e
\RequirePackage{rerunfilecheck}[2011/04/15]% v1.7
\RequirePackage{infwarerr}[2010/04/08]% v1.3
\RequirePackage{ltxcmds}[2011/11/09]% v1.22
\RequirePackage{atveryend}[2011/06/30]% v1.8
% \end{macrocode}
%
% A last information for the user:
%
% \begin{macrocode}
%% thumbs may work with earlier versions of LaTeX2e and those packages,
%% but this was not tested. Please consider updating your LaTeX contribution
%% and packages to the most recent version (if they are not already the most
%% recent version).
% \end{macrocode}
% See subsection~\ref{ss:Downloads} about how to get them.\\
%
% \LaTeXe{} 2011/06/27 changed the |\enddocument| command and thus
% broke the \xpackage{atveryend} package, which was then fixed.
% If new \LaTeXe{} and old \xpackage{atveryend} are combined,
% |\AtVeryVeryEnd| will never be called.
% |\@ifl@t@r\fmtversion| is from |\@needsf@rmat| as in
% \texttt{File L: ltclass.dtx Date: 2007/08/05 Version v1.1h}, line~259,
% of The \LaTeXe{} Sources
% by \textsc{Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, %
% Frank Mittelbach, Chris Rowley, and Rainer Sch\"{o}pf}
% as of 2011/06/27, p.~464.
%
% \begin{macrocode}
\@ifl@t@r\fmtversion{2011/06/27}% or possibly even newer
{\@ifpackagelater{atveryend}{2011/06/29}%
{% 2011/06/30, v1.8, or even more recent: OK
}{% else: older package version, no \AtVeryVeryEnd
\PackageError{thumbs}{Outdated atveryend package version}{%
LaTeX 2011/06/27 has changed \string\enddocument\space and thus broken the\MessageBreak%
\string\AtVeryVeryEnd\space command/hooking of atveryend package as of\MessageBreak%
2011/04/23, v1.7. Package versions 2011/06/30, v1.8, and later work with\MessageBreak%
the new LaTeX format, but some older package version was loaded.\MessageBreak%
Please update to the newer atveryend package.\MessageBreak%
For fixing this problem until the updated package is installed,\MessageBreak%
\string\let\string\AtVeryVeryEnd\string\AtEndAfterFileList\MessageBreak%
is used now, fingers crossed.%
}%
\let\AtVeryVeryEnd\AtEndAfterFileList%
\AtEndAfterFileList{% if there is \AtVeryVeryEnd inside \AtEndAfterFileList
\let\AtEndAfterFileList\ltx@firstofone%
}
}
}{% else: older fmtversion: OK
% \end{macrocode}
%
% In this case the used \TeX{} format is outdated, but when\\
% |\NeedsTeXFormat{LaTeX2e}[2011/06/27]|\\
% is executed at the beginning of \xpackage{regstats} package,
% the appropriate warning message is issued automatically
% (and \xpackage{thumbs} probably also works with older versions).
%
% \begin{macrocode}
}
% \end{macrocode}
%
% The options are introduced:
%
% \begin{macrocode}
\SetupKeyvalOptions{family=thumbs,prefix=thumbs@}
\DeclareStringOption{linefill}[dots]% \thumbs@linefill
\DeclareStringOption[rule]{thumblink}[rule]
\DeclareStringOption[47pt]{minheight}[47pt]
\DeclareStringOption{height}[auto]
\DeclareStringOption{width}[auto]
\DeclareStringOption{distance}[2mm]
\DeclareStringOption{topthumbmargin}[auto]
\DeclareStringOption{bottomthumbmargin}[auto]
\DeclareStringOption[5pt]{eventxtindent}[5pt]
\DeclareStringOption[5pt]{oddtxtexdent}[5pt]
\DeclareStringOption[0pt]{evenmarkindent}[0pt]
\DeclareStringOption[0pt]{oddmarkexdent}[0pt]
\DeclareStringOption[0pt]{evenprintvoffset}[0pt]
\DeclareBoolOption[false]{txtcentered}
\DeclareBoolOption[true]{ignorehoffset}
\DeclareBoolOption[true]{ignorevoffset}
\DeclareBoolOption{nophantomsection}% false by default, but true if used
\DeclareBoolOption[true]{verbose}
\DeclareComplementaryOption{silent}{verbose}
\DeclareBoolOption{draft}
\DeclareComplementaryOption{final}{draft}
\DeclareBoolOption[false]{hidethumbs}
% \end{macrocode}
%
% \DescribeMacro{obsolete options}
% The options |pagecolor|, |evenindent|, and |oddexdent| are obsolete now,
% but for compatibility with older documents they are still provided
% at the time being (will be removed in some future version).
%
% \begin{macrocode}
%% Obsolete options:
\DeclareStringOption{pagecolor}
\DeclareStringOption{evenindent}
\DeclareStringOption{oddexdent}
\ProcessKeyvalOptions*
% \end{macrocode}
%
% \pagebreak
%
% The (background) page colour is set to |\thepagecolor| (from the
% \xpackage{pagecolor} package), because the \xpackage{xcolour} package
% needs a defined colour here (it~can be changed later).
%
% \begin{macrocode}
\ifx\thumbs@pagecolor\empty\relax
\pagecolor{\thepagecolor}
\else
\PackageError{thumbs}{Option pagecolor is obsolete}{%
Instead the pagecolor package is used.\MessageBreak%
Use \string\pagecolor{...}\space after \string\usepackage[...]{thumbs}\space and\MessageBreak%
before \string\begin{document}\space to define a background colour\MessageBreak%
of the pages}
\pagecolor{\thumbs@pagecolor}
\fi
\ifx\thumbs@evenindent\empty\relax
\else
\PackageError{thumbs}{Option evenindent is obsolete}{%
Option "evenindent" was renamed to "eventxtindent",\MessageBreak%
the obsolete "evenindent" is no longer regarded.\MessageBreak%
Please change your document accordingly}
\fi
\ifx\thumbs@oddexdent\empty\relax
\else
\PackageError{thumbs}{Option oddexdent is obsolete}{%
Option "oddexdent" was renamed to "oddtxtexdent",\MessageBreak%
the obsolete "oddexdent" is no longer regarded.\MessageBreak%
Please change your document accordingly}
\fi
% \end{macrocode}
%
% \DescribeMacro{ignorehoffset}
% \DescribeMacro{ignorevoffset}
% Usually |\hoffset| and |\voffset| should be regarded, but moving the
% thumb marks away from the paper edge probably makes them useless.
% Therefore |\hoffset| and |\voffset| are ignored by default, or
% when option |ignorehoffset| or |ignorehoffset=true| is used
% (and |ignorevoffset| or |ignorevoffset=true|, respectively).
% But in case that the user wants to print at one sort of paper
% but later trim it to another one, regarding the offsets would be
% necessary. Therefore |ignorehoffset=false| and |ignorevoffset=false|
% can be used to regard these offsets. (Combinations
% |ignorehoffset=true, ignorevoffset=false| and
% |ignorehoffset=false, ignorevoffset=true| are also possible.)
%
% \begin{macrocode}
\ifthumbs@ignorehoffset
\PackageInfo{thumbs}{%
Option ignorehoffset NOT =false:\MessageBreak%
hoffset will be ignored.\MessageBreak%
To make thumbs regard hoffset use option\MessageBreak%
ignorehoffset=false}
\gdef\th@bmshoffset{0pt}
\else
\PackageInfo{thumbs}{%
Option ignorehoffset=false:\MessageBreak%
hoffset will be regarded.\MessageBreak%
This might move the thumb marks away from the paper edge}
\gdef\th@bmshoffset{\hoffset}
\fi
\ifthumbs@ignorevoffset
\PackageInfo{thumbs}{%
Option ignorevoffset NOT =false:\MessageBreak%
voffset will be ignored.\MessageBreak%
To make thumbs regard voffset use option\MessageBreak%
ignorevoffset=false}
\gdef\th@bmsvoffset{-\voffset}
\else
\PackageInfo{thumbs}{%
Option ignorevoffset=false:\MessageBreak%
voffset will be regarded.\MessageBreak%
This might move the thumb mark outside of the printable area}
\gdef\th@bmsvoffset{\voffset}
\fi
% \end{macrocode}
%
% \DescribeMacro{linefill}
% We process the |linefill| option value:
%
% \begin{macrocode}
\ifx\thumbs@linefill\empty%
\gdef\th@mbs@linefill{\hspace*{\fill}}
\else
\def\th@mbstest{line}%
\ifx\thumbs@linefill\th@mbstest%
\gdef\th@mbs@linefill{\hrulefill}
\else
\def\th@mbstest{dots}%
\ifx\thumbs@linefill\th@mbstest%
\gdef\th@mbs@linefill{\dotfill}
\else
\PackageError{thumbs}{Option linefill with invalid value}{%
Option linefill has value "\thumbs@linefill ".\MessageBreak%
Valid values are "" (empty), "line", or "dots".\MessageBreak%
"" (empty) will be used now.\MessageBreak%
}
\gdef\th@mbs@linefill{\hspace*{\fill}}
\fi
\fi
\fi
% \end{macrocode}
%
% \pagebreak
%
% We introduce new dimensions for width, height, position of and vertical distance
% between the thumb marks and some helper dimensions.
%
% \begin{macrocode}
\newdimen\th@mbwidthx
\newdimen\th@mbheighty% Thumb height y
\setlength{\th@mbheighty}{\z@}
\newdimen\th@mbposx
\newdimen\th@mbposy
\newdimen\th@mbposyA
\newdimen\th@mbposyB
\newdimen\th@mbposytop
\newdimen\th@mbposybottom
\newdimen\th@mbwidthxtoc
\newdimen\th@mbwidthtmp
\newdimen\th@mbsposytocy
\newdimen\th@mbsposytocyy
% \end{macrocode}
%
% Horizontal indention of thumb marks text on odd/even pages
% according to the choosen options:
%
% \begin{macrocode}
\newdimen\th@mbHitO
\setlength{\th@mbHitO}{\thumbs@oddtxtexdent}
\newdimen\th@mbHitE
\setlength{\th@mbHitE}{\thumbs@eventxtindent}
% \end{macrocode}
%
% Horizontal indention of whole thumb marks on odd/even pages
% according to the choosen options:
%
% \begin{macrocode}
\newdimen\th@mbHimO
\setlength{\th@mbHimO}{\thumbs@oddmarkexdent}
\newdimen\th@mbHimE
\setlength{\th@mbHimE}{\thumbs@evenmarkindent}
% \end{macrocode}
%
% Vertical distance between thumb marks on odd/even pages
% according to the choosen option:
%
% \begin{macrocode}
\newdimen\th@mbsdistance
\ifx\thumbs@distance\empty%
\setlength{\th@mbsdistance}{1mm}
\else
\setlength{\th@mbsdistance}{\thumbs@distance}
\fi
% \end{macrocode}
%
% \begin{macrocode}
\ifthumbs@verbose% \relax
\else
\PackageInfo{thumbs}{%
Option verbose=false (or silent=true) found:\MessageBreak%
You will lose some information}
\fi
% \end{macrocode}
%
% We create a new |Box| for the thumbs and make some global definitions.
%
% \begin{macrocode}
\newbox\ThumbsBox
\gdef\th@mbs{0}
\gdef\th@mbsmax{0}
\gdef\th@umbsperpage{0}% will be set via .aux file
\gdef\th@umbsperpagecount{0}
\gdef\th@mbtitle{}
\gdef\th@mbtext{}
\gdef\th@mbtextcolour{\thepagecolor}
\gdef\th@mbbackgroundcolour{\thepagecolor}
\gdef\th@mbcolumn{0}
\gdef\th@mbtextA{}
\gdef\th@mbtextcolourA{\thepagecolor}
\gdef\th@mbbackgroundcolourA{\thepagecolor}
\gdef\th@mbprinting{1}
\gdef\th@mbtoprint{0}
\gdef\th@mbonpage{0}
\gdef\th@mbonpagemax{0}
\gdef\th@mbcolumnnew{0}
\gdef\th@mbs@toc@level{}
\gdef\th@mbs@toc@text{}
\gdef\th@mbmaxwidth{0pt}
\gdef\th@mb@titlelabel{}
\gdef\th@mbstable{0}% number of thumb marks overview tables
% \end{macrocode}
%
% It is checked whether writing to \jobname.tmb is allowed.
%
% \begin{macrocode}
\if@filesw% \relax
\else
\PackageWarningNoLine{thumbs}{No auxiliary files allowed!\MessageBreak%
It was not allowed to write to files.\MessageBreak%
A lot of packages do not work without access to files\MessageBreak%
like the .aux one. The thumbs package needs to write\MessageBreak%
to the \jobname.tmb file. To exit press\MessageBreak%
Ctrl+Z\MessageBreak%
.\MessageBreak%
}
\fi
% \end{macrocode}
%
% \begin{macro}{\th@mb@txtBox}
% |\th@mb@txtBox| writes its second argument (most likely |\th@mb@tmp@text|)
% in normal text size. Sometimes another text size could
% \textquotedblleft leak\textquotedblright{} from the respective page,
% |\normalsize| prevents this. If another text size is whished for,
% it can always be changed inside |\th@mb@tmp@text|.
% The colour given in the first argument (most likely |\th@mb@tmp@textcolour|)
% is used and either |\centering| (depending on the |txtcentered| option) or
% |\raggedleft| or |\raggedright| (depending on the third argument).
% The forth argument determines the width of the |\parbox|.
%
% \begin{macrocode}
\newcommand{\th@mb@txtBox}[4]{%
\parbox[c][\th@mbheighty][c]{#4}{%
\settowidth{\th@mbwidthtmp}{\normalsize #2}%
\addtolength{\th@mbwidthtmp}{-#4}%
\ifthumbs@txtcentered%
{\centering{\color{#1}\normalsize #2}}%
\else%
\def\th@mbstest{#3}%
\def\th@mbstestb{r}%
\ifx\th@mbstest\th@mbstestb%
\ifdim\th@mbwidthtmp >0sp\relax\hspace*{-\th@mbwidthtmp}\fi%
{\raggedleft\leftskip 0sp minus \textwidth{\hfill\color{#1}\normalsize{#2}}}%
\else% \th@mbstest = l
{\raggedright{\color{#1}\normalsize\hspace*{1pt}\space{#2}}}%
\fi%
\fi%
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setth@mbheight}
% In |\setth@mbheight| the height of a thumb mark
% (for automatical thumb heights) is computed as\\
% \textquotedblleft |((Thumbs extension) / (Number of Thumbs)) - (2|
% $\times $\ |distance between Thumbs)|\textquotedblright.
%
% \begin{macrocode}
\newcommand{\setth@mbheight}{%
\setlength{\th@mbheighty}{\z@}
\advance\th@mbheighty+\headheight
\advance\th@mbheighty+\headsep
\advance\th@mbheighty+\textheight
\advance\th@mbheighty+\footskip
\@tempcnta=\th@mbsmax\relax
\ifnum\@tempcnta>1
\divide\th@mbheighty\th@mbsmax
\fi
\advance\th@mbheighty-\th@mbsdistance
\advance\th@mbheighty-\th@mbsdistance
}
% \end{macrocode}
% \end{macro}
%
% \pagebreak
%
% At the beginning of the document |\AtBeginDocument| is executed.
% |\th@bmshoffset| and |\th@bmsvoffset| are set again, because
% |\hoffset| and |\voffset| could have been changed.
%
% \begin{macrocode}
\AtBeginDocument{%
\ifthumbs@ignorehoffset
\gdef\th@bmshoffset{0pt}
\else
\gdef\th@bmshoffset{\hoffset}
\fi
\ifthumbs@ignorevoffset
\gdef\th@bmsvoffset{-\voffset}
\else
\gdef\th@bmsvoffset{\voffset}
\fi
\xdef\th@mbpaperwidth{\the\paperwidth}
\setlength{\@tempdima}{1pt}
\ifdim \thumbs@minheight < \@tempdima% too small
\setlength{\thumbs@minheight}{1pt}
\else
\ifdim \thumbs@minheight = \@tempdima% small, but ok
\else
\ifdim \thumbs@minheight > \@tempdima% ok
\else
\PackageError{thumbs}{Option minheight has invalid value}{%
As value for option minheight please use\MessageBreak%
a number and a length unit (e.g. mm, cm, pt)\MessageBreak%
and no space between them\MessageBreak%
and include this value+unit combination in curly brackets\MessageBreak%
(please see the thumbs-example.tex file).\MessageBreak%
When pressing Return, minheight will now be set to 47pt.\MessageBreak%
}
\setlength{\thumbs@minheight}{47pt}
\fi
\fi
\fi
\setlength{\@tempdima}{\thumbs@minheight}
% \end{macrocode}
%
% Thumb height |\th@mbheighty| is treated. If the value is empty,
% it is set to |\@tempdima|, which was just defined to be $47\unit{pt}$
% (by default, or to the value chosen by the user with package option
% |minheight={...}|):
%
% \begin{macrocode}
\ifx\thumbs@height\empty%
\setlength{\th@mbheighty}{\@tempdima}
\else
\def\th@mbstest{auto}
\ifx\thumbs@height\th@mbstest%
% \end{macrocode}
%
% If it is not empty but \texttt{auto}(matic), the value is computed
% via |\setth@mbheight| (see above).
%
% \begin{macrocode}
\setth@mbheight
% \end{macrocode}
%
% When the height is smaller than |\thumbs@minheight| (default: $47\unit{pt}$),
% this is too small, and instead a now column/page of thumb marks is used.
%
% \begin{macrocode}
\ifdim \th@mbheighty < \thumbs@minheight
\PackageWarningNoLine{thumbs}{Thumbs not high enough:\MessageBreak%
Option height has value "auto". For \th@mbsmax\space thumbs per page\MessageBreak%
this results in a thumb height of \the\th@mbheighty.\MessageBreak%
This is lower than the minimal thumb height, \thumbs@minheight,\MessageBreak%
therefore another thumbs column will be opened.\MessageBreak%
If you do not want this, choose a smaller value\MessageBreak%
for option "minheight"%
}
\setlength{\th@mbheighty}{\z@}
\advance\th@mbheighty by \@tempdima% = \thumbs@minheight
\fi
\else
% \end{macrocode}
%
% When a value has been given for the thumb marks' height, this fixed value is used.
%
% \begin{macrocode}
\ifthumbs@verbose
\edef\thumbsinfo{\the\th@mbheighty}
\PackageInfo{thumbs}{Now setting thumbs' height to \thumbsinfo .}
\fi
\setlength{\th@mbheighty}{\thumbs@height}
\fi
\fi
% \end{macrocode}
%
% Read in the |\jobname.tmb|-file:
%
% \begin{macrocode}
\newread\@instreamthumb%
% \end{macrocode}
%
% Inform the users about the dimensions of the thumb marks (look in the \xfile{log} file):
%
% \begin{macrocode}
\ifthumbs@verbose
\message{^^J}
\@PackageInfoNoLine{thumbs}{************** THUMB dimensions **************}
\edef\thumbsinfo{\the\th@mbheighty}
\@PackageInfoNoLine{thumbs}{The height of the thumb marks is \thumbsinfo}
\fi
% \end{macrocode}
%
% Setting the thumb mark width (|\th@mbwidthx|):
%
% \begin{macrocode}
\ifthumbs@draft
\setlength{\th@mbwidthx}{2pt}
\else
\setlength{\th@mbwidthx}{\paperwidth}
\advance\th@mbwidthx-\textwidth
\divide\th@mbwidthx by 4
\setlength{\@tempdima}{0sp}
\ifx\thumbs@width\empty%
\else
% \end{macrocode}
% \pagebreak
% \begin{macrocode}
\def\th@mbstest{auto}
\ifx\thumbs@width\th@mbstest%
\else
\def\th@mbstest{autoauto}
\ifx\thumbs@width\th@mbstest%
\@ifundefined{th@mbmaxwidtha}{%
\if@filesw%
\gdef\th@mbmaxwidtha{0pt}
\setlength{\th@mbwidthx}{\th@mbmaxwidtha}
\AtEndAfterFileList{
\PackageWarningNoLine{thumbs}{%
\string\th@mbmaxwidtha\space undefined.\MessageBreak%
Rerun to get the thumb marks width right%
}
}
\else
\PackageError{thumbs}{%
You cannot use option autoauto without \jobname.aux file.%
}
\fi
}{%\else
\setlength{\th@mbwidthx}{\th@mbmaxwidtha}
}%\fi
\else
\ifdim \thumbs@width > \@tempdima% OK
\setlength{\th@mbwidthx}{\thumbs@width}
\else
\PackageError{thumbs}{Thumbs not wide enough}{%
Option width has value "\thumbs@width".\MessageBreak%
This is not a valid dimension larger than zero.\MessageBreak%
Width will be set automatically.\MessageBreak%
}
\fi
\fi
\fi
\fi
\fi
\ifthumbs@verbose
\edef\thumbsinfo{\the\th@mbwidthx}
\@PackageInfoNoLine{thumbs}{The width of the thumb marks is \thumbsinfo}
\ifthumbs@draft
\@PackageInfoNoLine{thumbs}{because thumbs package is in draft mode}
\fi
\fi
% \end{macrocode}
%
% \pagebreak
%
% Setting the position of the first/top thumb mark. Vertical (y) position
% is a little bit complicated, because option |\thumbs@topthumbmargin| must be handled:
%
% \begin{macrocode}
% Thumb position x \th@mbposx
\setlength{\th@mbposx}{\paperwidth}
\advance\th@mbposx-\th@mbwidthx
\ifthumbs@ignorehoffset
\advance\th@mbposx-\hoffset
\fi
\advance\th@mbposx+1pt
% Thumb position y \th@mbposy
\ifx\thumbs@topthumbmargin\empty%
\def\thumbs@topthumbmargin{auto}
\fi
\def\th@mbstest{auto}
\ifx\thumbs@topthumbmargin\th@mbstest%
\setlength{\th@mbposy}{1in}
\advance\th@mbposy+\th@bmsvoffset
\advance\th@mbposy+\topmargin
\advance\th@mbposy-\th@mbsdistance
\advance\th@mbposy+\th@mbheighty
\else
\setlength{\@tempdima}{-1pt}
\ifdim \thumbs@topthumbmargin > \@tempdima% OK
\else
\PackageWarning{thumbs}{Thumbs column starting too high.\MessageBreak%
Option topthumbmargin has value "\thumbs@topthumbmargin ".\MessageBreak%
topthumbmargin will be set to -1pt.\MessageBreak%
}
\gdef\thumbs@topthumbmargin{-1pt}
\fi
\setlength{\th@mbposy}{\thumbs@topthumbmargin}
\advance\th@mbposy-\th@mbsdistance
\advance\th@mbposy+\th@mbheighty
\fi
\setlength{\th@mbposytop}{\th@mbposy}
\ifthumbs@verbose%
\setlength{\@tempdimc}{\th@mbposytop}
\advance\@tempdimc-\th@mbheighty
\advance\@tempdimc+\th@mbsdistance
\edef\thumbsinfo{\the\@tempdimc}
\@PackageInfoNoLine{thumbs}{The top thumb margin is \thumbsinfo}
\fi
% \end{macrocode}
%
% \pagebreak
%
% Setting the lowest position of a thumb mark, according to option |\thumbs@bottomthumbmargin|:
%
% \begin{macrocode}
% Max. thumb position y \th@mbposybottom
\ifx\thumbs@bottomthumbmargin\empty%
\gdef\thumbs@bottomthumbmargin{auto}
\fi
\def\th@mbstest{auto}
\ifx\thumbs@bottomthumbmargin\th@mbstest%
\setlength{\th@mbposybottom}{1in}
\ifthumbs@ignorevoffset% \relax
\else \advance\th@mbposybottom+\th@bmsvoffset
\fi
\advance\th@mbposybottom+\topmargin
\advance\th@mbposybottom-\th@mbsdistance
\advance\th@mbposybottom+\th@mbheighty
\advance\th@mbposybottom+\headheight
\advance\th@mbposybottom+\headsep
\advance\th@mbposybottom+\textheight
\advance\th@mbposybottom+\footskip
\advance\th@mbposybottom-\th@mbsdistance
\advance\th@mbposybottom-\th@mbheighty
\else
\setlength{\@tempdima}{\paperheight}
\advance\@tempdima by -\thumbs@bottomthumbmargin
\advance\@tempdima by -\th@mbposytop
\advance\@tempdima by -\th@mbsdistance
\advance\@tempdima by -\th@mbheighty
\advance\@tempdima by -\th@mbsdistance
\ifdim \@tempdima > 0sp \relax
\else
\setlength{\@tempdima}{\paperheight}
\advance\@tempdima by -\th@mbposytop
\advance\@tempdima by -\th@mbsdistance
\advance\@tempdima by -\th@mbheighty
\advance\@tempdima by -\th@mbsdistance
\advance\@tempdima by -1pt
\PackageWarning{thumbs}{Thumbs column ending too high.\MessageBreak%
Option bottomthumbmargin has value "\thumbs@bottomthumbmargin ".\MessageBreak%
bottomthumbmargin will be set to "\the\@tempdima".\MessageBreak%
}
\xdef\thumbs@bottomthumbmargin{\the\@tempdima}
\fi
% \end{macrocode}
% \pagebreak
% \begin{macrocode}
\setlength{\@tempdima}{\thumbs@bottomthumbmargin}
\setlength{\@tempdimc}{-1pt}
\ifdim \@tempdima < \@tempdimc%
\PackageWarning{thumbs}{Thumbs column ending too low.\MessageBreak%
Option bottomthumbmargin has value "\thumbs@bottomthumbmargin ".\MessageBreak%
bottomthumbmargin will be set to -1pt.\MessageBreak%
}
\gdef\thumbs@bottomthumbmargin{-1pt}
\fi
\setlength{\th@mbposybottom}{\paperheight}
\advance\th@mbposybottom-\thumbs@bottomthumbmargin
\fi
\ifthumbs@verbose%
\setlength{\@tempdimc}{\paperheight}
\advance\@tempdimc by -\th@mbposybottom
\edef\thumbsinfo{\the\@tempdimc}
\@PackageInfoNoLine{thumbs}{The bottom thumb margin is \thumbsinfo}
\@PackageInfoNoLine{thumbs}{**********************************************}
\message{^^J}
\fi
% \end{macrocode}
%
% |\th@mbposyA| is set to the top-most vertical thumb position~(y). Because it will be increased
% (i.\,e.~the thumb positions will move downwards on the page), |\th@mbsposytocyy| is used
% to remember this position unchanged.
%
% \begin{macrocode}
\advance\th@mbposy-\th@mbheighty% because it will be advanced also for the first thumb
\setlength{\th@mbposyA}{\th@mbposy}% \th@mbposyA will change.
\setlength{\th@mbsposytocyy}{\th@mbposy}% \th@mbsposytocyy shall not be changed.
}
% \end{macrocode}
%
% \begin{macro}{\th@mb@dvance}
% The internal command |\th@mb@dvance| is used to advance the position of the current
% thumb by |\th@mbheighty| and |\th@mbsdistance|. If the resulting position
% of the thumb is lower than the |\th@mbposybottom| position (i.\,e.~|\th@mbposy|
% \emph{higher} than |\th@mbposybottom|), a~new thumb column will be started by the next
% |\addthumb|, otherwise a blank thumb is created and |\th@mb@dvance| is calling itself
% again. This loop continues until a new thumb column is ready to be started.
%
% \begin{macrocode}
\newcommand{\th@mb@dvance}{%
\advance\th@mbposy+\th@mbheighty%
\advance\th@mbposy+\th@mbsdistance%
\ifdim\th@mbposy>\th@mbposybottom%
\advance\th@mbposy-\th@mbheighty%
\advance\th@mbposy-\th@mbsdistance%
\else%
\advance\th@mbposy-\th@mbheighty%
\advance\th@mbposy-\th@mbsdistance%
\thumborigaddthumb{}{}{\string\thepagecolor}{\string\thepagecolor}%
\th@mb@dvance%
\fi%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thumbnewcolumn}
% With the command |\thumbnewcolumn| a new column can be started, even if the current one
% was not filled. This could be useful e.\,g. for a dictionary, which uses one column for
% translations from language~A to language~B, and the second column for translations
% from language~B to language~A. But in that case one probably should increase the
% size of the thumb marks, so that $26$~thumb marks (in~case of the Latin alphabet)
% fill one thumb column. Do not use |\thumbnewcolumn| on a page where |\addthumb| was
% already used, but use |\addthumb| immediately after |\thumbnewcolumn|.
%
% \begin{macrocode}
\newcommand{\thumbnewcolumn}{%
\ifx\th@mbtoprint\pagesLTS@one%
\PackageError{thumbs}{\string\thumbnewcolumn\space after \string\addthumb }{%
On page \thepage\space (approx.) \string\addthumb\space was used and *afterwards* %
\string\thumbnewcolumn .\MessageBreak%
When you want to use \string\thumbnewcolumn , do not use an \string\addthumb\space %
on the same\MessageBreak%
page before \string\thumbnewcolumn . Thus, either remove the \string\addthumb , %
or use a\MessageBreak%
\string\pagebreak , \string\newpage\space etc. before \string\thumbnewcolumn .\MessageBreak%
(And remember to use an \string\addthumb\space*after* \string\thumbnewcolumn .)\MessageBreak%
Your command \string\thumbnewcolumn\space will be ignored now.%
}%
\else%
\PackageWarning{thumbs}{%
Starting of another column requested by command\MessageBreak%
\string\thumbnewcolumn.\space Only use this command directly\MessageBreak%
before an \string\addthumb\space - did you?!\MessageBreak%
}%
\gdef\th@mbcolumnnew{1}%
\th@mb@dvance%
\gdef\th@mbprinting{0}%
\gdef\th@mbcolumnnew{2}%
\fi%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addtitlethumb}
% When a thumb mark shall not or cannot be placed on a page, e.\,g.~at the title page or
% when using |\includepdf| from \xpackage{pdfpages} package, but the reference in the thumb
% marks overview nevertheless shall name that page number and hyperlink to that page,
% |\addtitlethumb| can be used at the following page. It has five arguments. The arguments
% one to four are identical to the ones of |\addthumb| (see immediately below),
% and the fifth argument consists of the label of the page, where the hyperlink
% at the thumb marks overview page shall link to. For the first page the label
% \texttt{pagesLTS.0} can be use, which is already placed there by the used
% \xpackage{pageslts} package.
%
% \begin{macrocode}
\newcommand{\addtitlethumb}[5]{%
\xdef\th@mb@titlelabel{#5}%
\addthumb{#1}{#2}{#3}{#4}%
\xdef\th@mb@titlelabel{}%
}
% \end{macrocode}
% \end{macro}
%
% \pagebreak
%
% \begin{macro}{\thumbsnophantom}
% To locally disable the setting of a |\phantomsection| before a thumb mark,
% the command |\thumbsnophantom| is provided. (But at first it is not disabled.)
%
% \begin{macrocode}
\gdef\th@mbsphantom{1}
\newcommand{\thumbsnophantom}{\gdef\th@mbsphantom{0}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addthumb}
% Now the |\addthumb| command is defined, which is used to add a new
% thumb mark to the document.
%
% \begin{macrocode}
\newcommand{\addthumb}[4]{%
\gdef\th@mbprinting{1}%
\advance\th@mbposy\th@mbheighty%
\advance\th@mbposy\th@mbsdistance%
\ifdim\th@mbposy>\th@mbposybottom%
\PackageInfo{thumbs}{%
Thumbs column full, starting another column.\MessageBreak%
}%
\setlength{\th@mbposy}{\th@mbposytop}%
\advance\th@mbposy\th@mbsdistance%
\ifx\th@mbcolumn\pagesLTS@zero%
\xdef\th@umbsperpagecount{\th@mbs}%
\gdef\th@mbcolumn{1}%
\fi%
\fi%
\@tempcnta=\th@mbs\relax%
\advance\@tempcnta by 1%
\xdef\th@mbs{\the\@tempcnta}%
% \end{macrocode}
%
% The |\addthumb| command has four parameters:
% \begin{enumerate}
% \item a title for the thumb mark (for the thumb marks overview page,
% e.\,g. the chapter title),
%
% \item the text to be displayed in the thumb mark (for example a chapter number),
%
% \item the colour of the text in the thumb mark,
%
% \item and the background colour of the thumb mark
% \end{enumerate}
% (parameters in this order).
%
% \begin{macrocode}
\gdef\th@mbtitle{#1}%
\gdef\th@mbtext{#2}%
\gdef\th@mbtextcolour{#3}%
\gdef\th@mbbackgroundcolour{#4}%
% \end{macrocode}
%
% The width of the thumb mark text is determined and compared to the width of the
% thumb mark (rule). When the text is wider than the rule, this has to be changed
% (either automatically with option |width={autoauto}| in the next compilation run
% or manually by changing |width={|\ldots|}| by the user). It could be acceptable
% to have a thumb mark text consisting of more than one line, of course, in which
% case nothing needs to be changed. Possible horizontal movement (|\th@mbHitO|,
% |\th@mbHitE|) has to be taken into account.
%
% \begin{macrocode}
\settowidth{\@tempdima}{\th@mbtext}%
\ifdim\th@mbHitO>\th@mbHitE\relax%
\advance\@tempdima+\th@mbHitO%
\else%
\advance\@tempdima+\th@mbHitE%
\fi%
\ifdim\@tempdima>\th@mbmaxwidth%
\xdef\th@mbmaxwidth{\the\@tempdima}%
\fi%
\ifdim\@tempdima>\th@mbwidthx%
\ifthumbs@draft% \relax
\else%
\edef\thumbsinfoa{\the\th@mbwidthx}
\edef\thumbsinfob{\the\@tempdima}
\PackageWarning{thumbs}{%
Thumb mark too small (width: \thumbsinfoa )\MessageBreak%
or its text too wide (width: \thumbsinfob )\MessageBreak%
}%
\fi%
\fi%
% \end{macrocode}
%
% Into the |\jobname.tmb| file a |\thumbcontents| entry is written.
% If \xpackage{hyperref} is found, a |\phantomsection| is placed (except when
% globally disabled by option |nophantomsection| or locally by |\thumbsnophantom|),
% a~label for the thumb mark created, and the |\thumbcontents| entry will be
% hyperlinked to that label (except when |\addtitlethumb| was used, then the label
% reported from the user is used -- the \xpackage{thumbs} package does \emph{not}
% create that label!).
%
% \begin{macrocode}
\ltx@ifpackageloaded{hyperref}{% hyperref loaded
\ifthumbs@nophantomsection% \relax
\else%
\ifx\th@mbsphantom\pagesLTS@one%
\phantomsection%
\else%
\gdef\th@mbsphantom{1}%
\fi%
\fi%
}{% hyperref not loaded
}%
\label{thumbs.\th@mbs}%
\if@filesw%
\ifx\th@mb@titlelabel\empty%
\addtocontents{tmb}{\string\thumbcontents{#1}{#2}{#3}{#4}{\thepage}{thumbs.\th@mbs}{\th@mbcolumnnew}}%
\else%
\addtocounter{page}{-1}%
\edef\th@mb@page{\thepage}%
\addtocontents{tmb}{\string\thumbcontents{#1}{#2}{#3}{#4}{\th@mb@page}{\th@mb@titlelabel}{\th@mbcolumnnew}}%
\addtocounter{page}{+1}%
\fi%
%\else there is a problem, but the according warning message was already given earlier.
\fi%
% \end{macrocode}
%
% Maybe there is a rare case, where more than one thumb mark will be placed
% at one page. Probably a |\pagebreak|, |\newpage| or something similar
% would be advisable, but nevertheless we should prepare for this case.
% We save the properties of the thumb mark(s).
%
% \begin{macrocode}
\ifx\th@mbcolumnnew\pagesLTS@one%
\else%
\@tempcnta=\th@mbonpage\relax%
\advance\@tempcnta by 1%
\xdef\th@mbonpage{\the\@tempcnta}%
\fi%
\ifx\th@mbtoprint\pagesLTS@zero%
\else%
\ifx\th@mbcolumnnew\pagesLTS@zero%
\PackageWarning{thumbs}{More than one thumb at one page:\MessageBreak%
You placed more than one thumb mark (at least \th@mbonpage)\MessageBreak%
on page \thepage \space (page is approximately).\MessageBreak%
Maybe insert a page break?\MessageBreak%
}%
\fi%
\fi%
\ifnum\th@mbonpage=1%
\ifnum\th@mbonpagemax>0% \relax
\else \gdef\th@mbonpagemax{1}%
\fi%
\gdef\th@mbtextA{#2}%
\gdef\th@mbtextcolourA{#3}%
\gdef\th@mbbackgroundcolourA{#4}%
\setlength{\th@mbposyA}{\th@mbposy}%
\else%
\ifx\th@mbcolumnnew\pagesLTS@zero%
\@tempcnta=1\relax%
\edef\th@mbonpagetest{\the\@tempcnta}%
\@whilenum\th@mbonpagetest<\th@mbonpage\do{%
\advance\@tempcnta by 1%
\xdef\th@mbonpagetest{\the\@tempcnta}%
\ifnum\th@mbonpage=\th@mbonpagetest%
\ifnum\th@mbonpagemax<\th@mbonpage%
\xdef\th@mbonpagemax{\th@mbonpage}%
\fi%
\edef\th@mbtmpdef{\csname th@mbtext\AlphAlph{\the\@tempcnta}\endcsname}%
\expandafter\gdef\th@mbtmpdef{#2}%
\edef\th@mbtmpdef{\csname th@mbtextcolour\AlphAlph{\the\@tempcnta}\endcsname}%
\expandafter\gdef\th@mbtmpdef{#3}%
\edef\th@mbtmpdef{\csname th@mbbackgroundcolour\AlphAlph{\the\@tempcnta}\endcsname}%
\expandafter\gdef\th@mbtmpdef{#4}%
\fi%
}%
\else%
\ifnum\th@mbonpagemax<\th@mbonpage%
\xdef\th@mbonpagemax{\th@mbonpage}%
\fi%
\fi%
\fi%
\ifx\th@mbcolumnnew\pagesLTS@two%
\gdef\th@mbcolumnnew{0}%
\fi%
\gdef\th@mbtoprint{1}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\stopthumb}
% When a page (or pages) shall have no thumb marks, |\stopthumb| stops
% the issuing of thumb marks (until another thumb mark is placed or
% |\continuethumb| is used).
%
% \begin{macrocode}
\newcommand{\stopthumb}{\gdef\th@mbprinting{0}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\continuethumb}
% |\continuethumb| continues the issuing of thumb marks (equal to the one
% before this was stopped by |\stopthumb|).
%
% \begin{macrocode}
\newcommand{\continuethumb}{\gdef\th@mbprinting{1}}
% \end{macrocode}
% \end{macro}
%
% \pagebreak
%
% \begin{macro}{\thumbcontents}
% The \textbf{internal} command |\thumbcontents| (which will be read in from the
% |\jobname.tmb| file) creates a thumb mark entry on the overview page(s).
% Its seven parameters are
% \begin{enumerate}
% \item the title for the thumb mark,
%
% \item the text to be displayed in the thumb mark,
%
% \item the colour of the text in the thumb mark,
%
% \item the background colour of the thumb mark,
%
% \item the first page of this thumb mark,
%
% \item the label where it should hyperlink to
%
% \item and an indicator, whether |\thumbnewcolumn| is just issuing blank thumbs
% to fill a column
% \end{enumerate}
% (parameters in this order). Without \xpackage{hyperref} the $6^ \textrm{th} $ parameter
% is just ignored.
%
% \begin{macrocode}
\newcommand{\thumbcontents}[7]{%
\advance\th@mbposy\th@mbheighty%
\advance\th@mbposy\th@mbsdistance%
\ifdim\th@mbposy>\th@mbposybottom%
\setlength{\th@mbposy}{\th@mbposytop}%
\advance\th@mbposy\th@mbsdistance%
\fi%
\def\th@mb@tmp@title{#1}%
\def\th@mb@tmp@text{#2}%
\def\th@mb@tmp@textcolour{#3}%
\def\th@mb@tmp@backgroundcolour{#4}%
\def\th@mb@tmp@page{#5}%
\def\th@mb@tmp@label{#6}%
\def\th@mb@tmp@column{#7}%
\ifx\th@mb@tmp@column\pagesLTS@two%
\def\th@mb@tmp@column{0}%
\fi%
\setlength{\th@mbwidthxtoc}{\paperwidth}%
\advance\th@mbwidthxtoc-1in%
% \end{macrocode}
%
% Depending on which side the thumb marks should be placed
% the according dimensions have to be adapted.
%
% \begin{macrocode}
\def\th@mbstest{r}%
\ifx\th@mbstest\th@mbsprintpage% r
\advance\th@mbwidthxtoc-\th@mbHimO%
\advance\th@mbwidthxtoc-\oddsidemargin%
\setlength{\@tempdimc}{1in}%
\advance\@tempdimc+\oddsidemargin%
\else% l
\advance\th@mbwidthxtoc-\th@mbHimE%
\advance\th@mbwidthxtoc-\evensidemargin%
\setlength{\@tempdimc}{\th@bmshoffset}%
\advance\@tempdimc-\hoffset
\fi%
\setlength{\th@mbposyB}{-\th@mbposy}%
\if@twoside%
\ifodd\c@CurrentPage%
\ifx\th@mbtikz\pagesLTS@zero%
\else%
\setlength{\@tempdimb}{-\th@mbposy}%
\advance\@tempdimb-\thumbs@evenprintvoffset%
\setlength{\th@mbposyB}{\@tempdimb}%
\fi%
\else%
\ifx\th@mbtikz\pagesLTS@zero%
\setlength{\@tempdimb}{-\th@mbposy}%
\advance\@tempdimb-\thumbs@evenprintvoffset%
\setlength{\th@mbposyB}{\@tempdimb}%
\fi%
\fi%
\fi%
\def\th@mbstest{l}%
\ifx\th@mbstest\th@mbsprintpage% l
\advance\@tempdimc+\th@mbHimE%
\fi%
\put(\@tempdimc,\th@mbposyB){%
\ifx\th@mbstest\th@mbsprintpage% l
% \end{macrocode}
%
% Increase |\th@mbwidthxtoc| by the absolute value of |\evensidemargin|.\\
% With the \xpackage{bigintcalc} package it would also be possible to use:\\
% |\setlength{\@tempdimb}{\evensidemargin}%|\\
% |\@settopoint\@tempdimb%|\\
% |\advance\th@mbwidthxtoc+\bigintcalcSgn{\expandafter\strip@pt \@tempdimb}\evensidemargin%|
%
% \begin{macrocode}
\ifdim\evensidemargin <0sp\relax%
\advance\th@mbwidthxtoc-\evensidemargin%
\else% >=0sp
\advance\th@mbwidthxtoc+\evensidemargin%
\fi%
\fi%
\begin{picture}(0,0)%
% \end{macrocode}
%
% When the option |thumblink=rule| was chosen, the whole rule is made into a hyperlink.
% Otherwise the rule is created without hyperlink (here).
%
% \begin{macrocode}
\def\th@mbstest{rule}%
\ifx\thumbs@thumblink\th@mbstest%
\ifx\th@mb@tmp@column\pagesLTS@zero%
{\color{\th@mb@tmp@backgroundcolour}%
\hyperref[\th@mb@tmp@label]{\rule{\th@mbwidthxtoc}{\th@mbheighty}}%
}%
\else%
% \end{macrocode}
%
% When |\th@mb@tmp@column| is not zero, then this is a blank thumb mark from |thumbnewcolumn|.
%
% \begin{macrocode}
{\color{\th@mb@tmp@backgroundcolour}\rule{\th@mbwidthxtoc}{\th@mbheighty}}%
\fi%
\else%
{\color{\th@mb@tmp@backgroundcolour}\rule{\th@mbwidthxtoc}{\th@mbheighty}}%
\fi%
\end{picture}%
% \end{macrocode}
%
% When |\th@mbsprintpage| is |l|, before the picture |\th@mbwidthxtoc| was changed,
% which must be reverted now.
%
% \begin{macrocode}
\ifx\th@mbstest\th@mbsprintpage% l
\advance\th@mbwidthxtoc-\evensidemargin%
\fi%
% \end{macrocode}
%
% When |\th@mb@tmp@column| is zero, then this is \textbf{not} a blank thumb mark from |thumbnewcolumn|,
% and we need to fill it with some content. If it is not zero, it is a blank thumb mark,
% and nothing needs to be done here.
%
% \begin{macrocode}
\ifx\th@mb@tmp@column\pagesLTS@zero%
\setlength{\th@mbwidthxtoc}{\paperwidth}%
\advance\th@mbwidthxtoc-1in%
\advance\th@mbwidthxtoc-\hoffset%
\ifx\th@mbstest\th@mbsprintpage% l
\advance\th@mbwidthxtoc-\evensidemargin%
\else%
\advance\th@mbwidthxtoc-\oddsidemargin%
\fi%
\advance\th@mbwidthxtoc-\th@mbwidthx%
\advance\th@mbwidthxtoc-20pt%
\ifdim\th@mbwidthxtoc>\textwidth%
\setlength{\th@mbwidthxtoc}{\textwidth}%
\fi%
% \end{macrocode}
%
% \pagebreak
%
% Depending on which side the thumb marks should be placed the
% according dimensions have to be adapted here, too.
%
% \begin{macrocode}
\ifx\th@mbstest\th@mbsprintpage% l
\begin{picture}(-\th@mbHimE,0)(-6pt,-0.5\th@mbheighty+384930sp)%
\bgroup%
\setlength{\parindent}{0pt}%
\setlength{\@tempdimc}{\th@mbwidthx}%
\advance\@tempdimc-\th@mbHitO%
\setlength{\@tempdimb}{\th@mbwidthx}%
\advance\@tempdimb-\th@mbHitE%
\ifodd\c@CurrentPage%
\if@twoside%
\ifx\th@mbtikz\pagesLTS@zero%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\else%
\hspace*{+\th@mbHitE}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
\fi%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\fi%
\else%
\if@twoside%
\ifx\th@mbtikz\pagesLTS@zero%
\hspace*{+\th@mbHitE}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\fi%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\fi%
\fi%
\egroup%
\end{picture}%
\setlength{\@tempdimc}{-1in}%
\advance\@tempdimc-\evensidemargin%
\else% r
\setlength{\@tempdimc}{0pt}%
\fi%
\begin{picture}(0,0)(\@tempdimc,-0.5\th@mbheighty+384930sp)%
\bgroup%
\setlength{\parindent}{0pt}%
\vbox%
{\hsize=\th@mbwidthxtoc {%
% \end{macrocode}
%
% Depending on the value of option |thumblink|, parts of the text are made into hyperlinks:
% \begin{description}
% \item[- |none|] creates \emph{none} hyperlink
%
% \begin{macrocode}
\def\th@mbstest{none}%
\ifx\thumbs@thumblink\th@mbstest%
{\color{\th@mb@tmp@textcolour}\noindent \th@mb@tmp@title%
\leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
}%
\else%
% \end{macrocode}
%
% \item[- |title|] hyperlinks the \emph{titles} of the thumb marks
%
% \begin{macrocode}
\def\th@mbstest{title}%
\ifx\thumbs@thumblink\th@mbstest%
{\color{\th@mb@tmp@textcolour}\noindent%
\hyperref[\th@mb@tmp@label]{\th@mb@tmp@title}%
\leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
}%
\else%
% \end{macrocode}
%
% \item[- |page|] hyperlinks the \emph{page} numbers of the thumb marks
%
% \begin{macrocode}
\def\th@mbstest{page}%
\ifx\thumbs@thumblink\th@mbstest%
{\color{\th@mb@tmp@textcolour}\noindent%
\th@mb@tmp@title%
\leaders\box \ThumbsBox {\th@mbs@linefill \pageref{\th@mb@tmp@label}}%
}%
\else%
% \end{macrocode}
%
% \item[- |titleandpage|] hyperlinks the \emph{title and page} numbers of the thumb marks
%
% \begin{macrocode}
\def\th@mbstest{titleandpage}%
\ifx\thumbs@thumblink\th@mbstest%
{\color{\th@mb@tmp@textcolour}\noindent%
\hyperref[\th@mb@tmp@label]{\th@mb@tmp@title}%
\leaders\box \ThumbsBox {\th@mbs@linefill \pageref{\th@mb@tmp@label}}%
}%
\else%
% \end{macrocode}
%
% \item[- |line|] hyperlinks the whole \emph{line}, i.\,e. title, dots (or line or whatsoever)%
% and page numbers of the thumb marks
%
% \begin{macrocode}
\def\th@mbstest{line}%
\ifx\thumbs@thumblink\th@mbstest%
{\color{\th@mb@tmp@textcolour}\noindent%
\hyperref[\th@mb@tmp@label]{\th@mb@tmp@title%
\leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}}%
}%
\else%
% \end{macrocode}
%
% \item[- |rule|] hyperlinks the whole \emph{rule}, but that was already done above,%
% so here no linking is done
%
% \begin{macrocode}
\def\th@mbstest{rule}%
\ifx\thumbs@thumblink\th@mbstest%
{\color{\th@mb@tmp@textcolour}\noindent%
\th@mb@tmp@title%
\leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
}%
\else%
% \end{macrocode}
%
% \end{description}
% Another value for |\thumbs@thumblink| should never be encountered here.
%
% \begin{macrocode}
\PackageError{thumbs}{\string\thumbs@thumblink\space invalid}{%
\string\thumbs@thumblink\space has an invalid value,\MessageBreak%
although it did not have an invalid value before,\MessageBreak%
and the thumbs package did not change it.\MessageBreak%
Therefore some other package (or the user)\MessageBreak%
manipulated it.\MessageBreak%
Now setting it to "none" as last resort.\MessageBreak%
}%
\gdef\thumbs@thumblink{none}%
{\color{\th@mb@tmp@textcolour}\noindent%
\th@mb@tmp@title%
\leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
}%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
}%
}%
\egroup%
\end{picture}%
% \end{macrocode}
%
% The thumb mark (with text) as set in the document outside of the thumb marks overview page(s)
% is also presented here, except when we are printing at the left side.
%
% \begin{macrocode}
\ifx\th@mbstest\th@mbsprintpage% l; relax
\else%
\begin{picture}(0,0)(1in+\oddsidemargin-\th@mbxpos+20pt,-0.5\th@mbheighty+384930sp)%
\bgroup%
\setlength{\parindent}{0pt}%
\setlength{\@tempdimc}{\th@mbwidthx}%
\advance\@tempdimc-\th@mbHitO%
\setlength{\@tempdimb}{\th@mbwidthx}%
\advance\@tempdimb-\th@mbHitE%
\ifodd\c@CurrentPage%
\if@twoside%
\ifx\th@mbtikz\pagesLTS@zero%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\else%
\hspace*{+\th@mbHitE}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
\fi%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\fi%
\else%
\if@twoside%
\ifx\th@mbtikz\pagesLTS@zero%
\hspace*{+\th@mbHitE}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\fi%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
\fi%
\fi%
\egroup%
\end{picture}%
\fi%
\fi%
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\th@mb@yA}
% |\th@mb@yA| sets the y-position to be used in |\th@mbprint|.
%
% \begin{macrocode}
\newcommand{\th@mb@yA}{%
\advance\th@mbposyA\th@mbheighty%
\advance\th@mbposyA\th@mbsdistance%
\ifdim\th@mbposyA>\th@mbposybottom%
\PackageWarning{thumbs}{You are not only using more than one thumb mark at one\MessageBreak%
single page, but also thumb marks from different thumb\MessageBreak%
columns. May I suggest the use of a \string\pagebreak\space or\MessageBreak%
\string\newpage ?%
}%
\setlength{\th@mbposyA}{\th@mbposytop}%
\fi%
}
% \end{macrocode}
% \end{macro}
%
% \DescribeMacro{tikz, hyperref}
% To determine whether to place the thumb marks at the left or right side of a
% two-sided paper, \xpackage{thumbs} must determine whether the page number is
% odd or even. Because |\thepage| can be set to some value, the |CurrentPage|
% counter of the \xpackage{pageslts} package is used instead. When the current
% page number is determined |\AtBeginShipout|, it is usually the number of the
% next page to be put out. But when the \xpackage{tikz} package has been loaded
% before \xpackage{thumbs}, it is not the next page number but the real one.
% But when the \xpackage{hyperref} package has been loaded before the
% \xpackage{tikz} package, it is the next page number. (When first \xpackage{tikz}
% and then \xpackage{hyperref} and then \xpackage{thumbs} was loaded, it is
% the real page, not the next one.) Thus it must be checked which package was
% loaded and in what order.
%
% \begin{macrocode}
\ltx@ifpackageloaded{tikz}{% tikz loaded before thumbs
\ltx@ifpackageloaded{hyperref}{% hyperref loaded before thumbs,
%% but tikz and hyperref in which order? To be determined now:
%% Code similar to the one from David Carlisle:
%% http://tex.stackexchange.com/a/45654/6865
% \end{macrocode}
% \url{http://tex.stackexchange.com/a/45654/6865}
% \begin{macrocode}
\xdef\th@mbtikz{-1}% assume tikz loaded after hyperref,
%% check for opposite case:
\def\th@mbstest{tikz.sty}
\let\th@mbstestb\@empty
\@for\@th@mbsfl:=\@filelist\do{%
\ifx\@th@mbsfl\th@mbstest
\def\th@mbstestb{hyperref.sty}
\fi
\ifx\@th@mbsfl\th@mbstestb
\xdef\th@mbtikz{0}% tikz loaded before hyperref
\fi
}
%% End of code similar to the one from David Carlisle
}{% tikz loaded before thumbs and hyperref loaded afterwards or not at all
\xdef\th@mbtikz{0}%
}
}{% tikz not loaded before thumbs
\xdef\th@mbtikz{-1}
}
% \end{macrocode}
%
% \newpage
%
% \begin{macro}{\th@mbprint}
% |\th@mbprint| places a |picture| containing the thumb mark on the page.
%
% \begin{macrocode}
\newcommand{\th@mbprint}[3]{%
\setlength{\th@mbposyB}{-\th@mbposyA}%
\if@twoside%
\ifodd\c@CurrentPage%
\ifx\th@mbtikz\pagesLTS@zero%
\else%
\setlength{\@tempdimc}{-\th@mbposyA}%
\advance\@tempdimc-\thumbs@evenprintvoffset%
\setlength{\th@mbposyB}{\@tempdimc}%
\fi%
\else%
\ifx\th@mbtikz\pagesLTS@zero%
\setlength{\@tempdimc}{-\th@mbposyA}%
\advance\@tempdimc-\thumbs@evenprintvoffset%
\setlength{\th@mbposyB}{\@tempdimc}%
\fi%
\fi%
\fi%
\put(\th@mbxpos,\th@mbposyB){%
\begin{picture}(0,0)%
{\color{#3}\rule{\th@mbwidthx}{\th@mbheighty}}%
\end{picture}%
\begin{picture}(0,0)(0,-0.5\th@mbheighty+384930sp)%
\bgroup%
\setlength{\parindent}{0pt}%
\setlength{\@tempdimc}{\th@mbwidthx}%
\advance\@tempdimc-\th@mbHitO%
\setlength{\@tempdimb}{\th@mbwidthx}%
\advance\@tempdimb-\th@mbHitE%
\ifodd\c@CurrentPage%
\if@twoside%
\ifx\th@mbtikz\pagesLTS@zero%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
\else%
\hspace*{+\th@mbHitE}%
\th@mb@txtBox{#2}{#1}{l}{\@tempdimb}%
\fi%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
\fi%
\else%
\if@twoside%
\ifx\th@mbtikz\pagesLTS@zero%
\hspace*{+\th@mbHitE}%
\th@mb@txtBox{#2}{#1}{l}{\@tempdimb}%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
\fi%
\else%
\hspace*{-\th@mbHitO}%
\th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
\fi%
\fi%
\egroup%
\end{picture}%
}%
}
% \end{macrocode}
% \end{macro}
%
% \DescribeMacro{\AtBeginShipout}
% |\AtBeginShipoutUpperLeft| calls the |\th@mbprint| macro for each thumb mark
% which shall be placed on that page.
% When |\stopthumb| was used, the thumb mark is omitted.
%
% \begin{macrocode}
\AtBeginShipout{%
\ifx\th@mbcolumnnew\pagesLTS@zero% ok
\else%
\PackageError{thumbs}{Missing \string\addthumb\space after \string\thumbnewcolumn }{%
Command \string\thumbnewcolumn\space was used, but no new thumb placed with \string\addthumb\MessageBreak%
(at least not at the same page). After \string\thumbnewcolumn\space please always use an\MessageBreak%
\string\addthumb . Until the next \string\addthumb , there will be no thumb marks on the\MessageBreak%
pages. Starting a new column of thumb marks and not putting a thumb mark into\MessageBreak%
that column does not make sense. If you just want to get rid of column marks,\MessageBreak%
do not abuse \string\thumbnewcolumn\space but use \string\stopthumb .\MessageBreak%
(This error message will be repeated at all following pages,\MessageBreak%
\space until \string\addthumb\space is used.)\MessageBreak%
}%
\fi%
\@tempcnta=\value{CurrentPage}\relax%
\advance\@tempcnta by \th@mbtikz%
% \end{macrocode}
%
% because |CurrentPage| is already the number of the next page,
% except if \xpackage{tikz} was loaded before thumbs,
% then it is still the |CurrentPage|.\\
% Changing the paper size mid-document will probably cause some problems.
% But if it works, we try to cope with it. (When the change is performed
% without changing |\paperwidth|, we cannot detect it. Sorry.)
%
% \begin{macrocode}
\edef\th@mbstmpwidth{\the\paperwidth}%
\ifdim\th@mbpaperwidth=\th@mbstmpwidth% OK
\else%
\PackageWarningNoLine{thumbs}{%
Paperwidth has changed. Thumb mark positions become now adapted%
}%
\setlength{\th@mbposx}{\paperwidth}%
\advance\th@mbposx-\th@mbwidthx%
\ifthumbs@ignorehoffset%
\advance\th@mbposx-\hoffset%
\fi%
\advance\th@mbposx+1pt%
\xdef\th@mbpaperwidth{\the\paperwidth}%
\fi%
% \end{macrocode}
%
% Determining the correct |\th@mbxpos|:
%
% \begin{macrocode}
\edef\th@mbxpos{\the\th@mbposx}%
\ifodd\@tempcnta% \relax
\else%
\if@twoside%
\ifthumbs@ignorehoffset%
\setlength{\@tempdimc}{-\hoffset}%
\advance\@tempdimc-1pt%
\edef\th@mbxpos{\the\@tempdimc}%
\else%
\def\th@mbxpos{-1pt}%
\fi%
% \end{macrocode}
%
% | \else \relax%|
%
% \begin{macrocode}
\fi%
\fi%
\setlength{\@tempdimc}{\th@mbxpos}%
\if@twoside%
\ifodd\@tempcnta \advance\@tempdimc-\th@mbHimO%
\else \advance\@tempdimc+\th@mbHimE%
\fi%
\else \advance\@tempdimc-\th@mbHimO%
\fi%
\edef\th@mbxpos{\the\@tempdimc}%
\AtBeginShipoutUpperLeft{%
\ifx\th@mbprinting\pagesLTS@one%
\th@mbprint{\th@mbtextA}{\th@mbtextcolourA}{\th@mbbackgroundcolourA}%
\@tempcnta=1\relax%
\edef\th@mbonpagetest{\the\@tempcnta}%
\@whilenum\th@mbonpagetest<\th@mbonpage\do{%
\advance\@tempcnta by 1%
\edef\th@mbonpagetest{\the\@tempcnta}%
\th@mb@yA%
\def\th@mbtmpdeftext{\csname th@mbtext\AlphAlph{\the\@tempcnta}\endcsname}%
\def\th@mbtmpdefcolour{\csname th@mbtextcolour\AlphAlph{\the\@tempcnta}\endcsname}%
\def\th@mbtmpdefbackgroundcolour{\csname th@mbbackgroundcolour\AlphAlph{\the\@tempcnta}\endcsname}%
\th@mbprint{\th@mbtmpdeftext}{\th@mbtmpdefcolour}{\th@mbtmpdefbackgroundcolour}%
}%
\fi%
% \end{macrocode}
%
% When more than one thumb mark was placed at that page, on the following pages
% only the last issued thumb mark shall appear.
%
% \begin{macrocode}
\@tempcnta=\th@mbonpage\relax%
\ifnum\@tempcnta<2% \relax
\else%
\gdef\th@mbtextA{\th@mbtext}%
\gdef\th@mbtextcolourA{\th@mbtextcolour}%
\gdef\th@mbbackgroundcolourA{\th@mbbackgroundcolour}%
\gdef\th@mbposyA{\th@mbposy}%
\fi%
\gdef\th@mbonpage{0}%
\gdef\th@mbtoprint{0}%
}%
}
% \end{macrocode}
%
% \DescribeMacro{\AfterLastShipout}
% |\AfterLastShipout| is executed after the last page has been shipped out.
% It is still possible to e.\,g. write to the \xfile{aux} file at this time.
%
% \begin{macrocode}
\AfterLastShipout{%
\ifx\th@mbcolumnnew\pagesLTS@zero% ok
\else
\PackageWarningNoLine{thumbs}{%
Still missing \string\addthumb\space after \string\thumbnewcolumn\space after\MessageBreak%
last ship-out: Command \string\thumbnewcolumn\space was used,\MessageBreak%
but no new thumb placed with \string\addthumb\space anywhere in the\MessageBreak%
rest of the document. Starting a new column of thumb\MessageBreak%
marks and not putting a thumb mark into that column\MessageBreak%
does not make sense. If you just want to get rid of\MessageBreak%
thumb marks, do not abuse \string\thumbnewcolumn\space but use\MessageBreak%
\string\stopthumb %
}
\fi
% \end{macrocode}
%
% |\AfterLastShipout| the number of thumb marks per overview page,
% the total number of thumb marks, and the maximal thumb mark text width
% are determined and saved for the next \LaTeX\ run via the \xfile{.aux} file.
%
% \begin{macrocode}
\ifx\th@mbcolumn\pagesLTS@zero% if there is only one column of thumbs
\xdef\th@umbsperpagecount{\th@mbs}
\gdef\th@mbcolumn{1}
\fi
\ifx\th@umbsperpagecount\pagesLTS@zero
\gdef\th@umbsperpagecount{\th@mbs}% \th@mbs was increased with each \addthumb
\fi
\ifdim\th@mbmaxwidth>\th@mbwidthx
\ifthumbs@draft% \relax
\else
% \end{macrocode}
%
% \pagebreak
%
% \begin{macrocode}
\def\th@mbstest{autoauto}
\ifx\thumbs@width\th@mbstest%
\AtEndAfterFileList{%
\PackageWarningNoLine{thumbs}{%
Rerun to get the thumb marks width right%
}
}
\else
\AtEndAfterFileList{%
\edef\thumbsinfoa{\th@mbmaxwidth}
\edef\thumbsinfob{\the\th@mbwidthx}
\PackageWarningNoLine{thumbs}{%
Thumb mark too small or its text too wide:\MessageBreak%
The widest thumb mark text is \thumbsinfoa\space wide,\MessageBreak%
but the thumb marks are only \space\thumbsinfob\space wide.\MessageBreak%
Either shorten or scale down the text,\MessageBreak%
or increase the thumb mark width,\MessageBreak%
or use option width=autoauto%
}
}
\fi
\fi
\fi
\if@filesw
\immediate\write\@auxout{\string\gdef\string\th@mbmaxwidtha{\th@mbmaxwidth}}
\immediate\write\@auxout{\string\gdef\string\th@umbsperpage{\th@umbsperpagecount}}
\immediate\write\@auxout{\string\gdef\string\th@mbsmax{\th@mbs}}
\expandafter\newwrite\csname tf@tmb\endcsname
% \end{macrocode}
%
% And a rerun check is performed: Did the |\jobname.tmb| file change?
%
% \begin{macrocode}
\RerunFileCheck{\jobname.tmb}{%
\immediate\closeout \csname tf@tmb\endcsname
}{Warning: Rerun to get list of thumbs right!%
}
\immediate\openout \csname tf@tmb\endcsname = \jobname.tmb\relax
%\else there is a problem, but the according warning message was already given earlier.
\fi
}
% \end{macrocode}
%
% \begin{macro}{\addthumbsoverviewtocontents}
% |\addthumbsoverviewtocontents| with two arguments is a replacement for
% |\addcontentsline{toc}{<level>}{<text>}|, where the first argument of
% |\addthumbsoverviewtocontents| is for |<level>| and the second for |<text>|.
% If an entry of the thumbs mark overview shall be placed in the table of contents,
% |\addthumbsoverviewtocontents| with its arguments should be used immediately before
% |\thumbsoverview|.
%
% \begin{macrocode}
\newcommand{\addthumbsoverviewtocontents}[2]{%
\gdef\th@mbs@toc@level{#1}%
\gdef\th@mbs@toc@text{#2}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\clearotherdoublepage}
% We need a command to clear a double page, thus that the following text
% is \emph{left} instead of \emph{right} as accomplished with the usual
% |\cleardoublepage|. For this we take the original |\cleardoublepage| code
% and revert the |\ifodd\c@page\else| (i.\,e. if even |\c@page|) condition.
%
% \begin{macrocode}
\newcommand{\clearotherdoublepage}{%
\clearpage\if@twoside \ifodd\c@page% removed "\else" from \cleardoublepage
\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\th@mbstablabeling}
% When the \xpackage{hyperref} package is used, one might like to refer to the
% thumb overview page(s), therefore |\th@mbstablabeling| command is defined
% (and used later). First a~|\phantomsection| is added.
% With or without \xpackage{hyperref} a label |TableOfThumbs1| (or |TableOfThumbs2|
% or\ldots) is placed here. For compatibility with older versions of this
% package also the label |TableOfThumbs| is created. Equal to older versions
% it aims at the last used Table of Thumbs, but since version~1.0g \textbf{without}\\
% |Error: Label TableOfThumbs multiply defined| - thanks to |\overridelabel| from
% the \xpackage{undolabl} package (which is automatically loaded by the
% \xpackage{pageslts} package).\\
% When |\addthumbsoverviewtocontents| was used, the entry is placed into the
% table of contents.
%
% \begin{macrocode}
\newcommand{\th@mbstablabeling}{%
\ltx@ifpackageloaded{hyperref}{\phantomsection}{}%
\let\label\thumbsoriglabel%
\ifx\th@mbstable\pagesLTS@one%
\label{TableOfThumbs}%
\label{TableOfThumbs1}%
\else%
\overridelabel{TableOfThumbs}%
\label{TableOfThumbs\th@mbstable}%
\fi%
\let\label\@gobble%
\ifx\th@mbs@toc@level\empty%\relax
\else \addcontentsline{toc}{\th@mbs@toc@level}{\th@mbs@toc@text}%
\fi%
}
% \end{macrocode}
% \end{macro}
%
% \DescribeMacro{\thumbsoverview}
% \DescribeMacro{\thumbsoverviewback}
% \DescribeMacro{\thumbsoverviewverso}
% \DescribeMacro{\thumbsoverviewdouble}
% For compatibility with documents created using older versions of this package
% |\thumbsoverview| did not get a second argument, but it is renamed to
% |\thumbsoverviewprint| and additional to |\thumbsoverview| new commands are
% introduced. It is of course also possible to use |\thumbsoverviewprint| with
% its two arguments directly, therefore its name does not include any |@|
% (saving the users the use of |\makeatother| and |\makeatletter|).\\
% \begin{description}
% \item[-] |\thumbsoverview| prints the thumb marks at the right side
% and (in |twoside| mode) skips left sides (useful e.\,g. at the beginning
% of a document)
%
% \item[-] |\thumbsoverviewback| prints the thumb marks at the left side
% and (in |twoside| mode) skips right sides (useful e.\,g. at the end
% of a document)
%
% \item[-] |\thumbsoverviewverso| prints the thumb marks at the right side
% and (in |twoside| mode) repeats them at the next left side and so on
% (useful anywhere in the document and when one wants to prevent empty
% pages)
%
% \item[-] |\thumbsoverviewdouble| prints the thumb marks at the left side
% and (in |twoside| mode) repeats them at the next right side and so on
% (useful anywhere in the document and when one wants to prevent empty
% pages)
% \end{description}
%
% The |\thumbsoverview...| commands are used to place the overview page(s)
% for the thumb marks. Their parameter is used to mark this page/these pages
% (e.\,g. in the page header). If these marks are not wished,
% |\thumbsoverview...{}| will generate empty marks in the page header(s).
% |\thumbsoverview...| can be used more than once (for example at the
% beginning and at the end of the document). The overviews have labels
% |TableOfThumbs1|, |TableOfThumbs2| and so on, which can be referred to with
% e.\,g. |\pageref{TableOfThumbs1}|.
% The reference |TableOfThumbs| (without number) aims at the last used Table of Thumbs
% (for compatibility with older versions of this package).
%
% \begin{macro}{\thumbsoverview}
% \begin{macrocode}
\newcommand{\thumbsoverview}[1]{\thumbsoverviewprint{#1}{r}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\thumbsoverviewback}
% \begin{macrocode}
\newcommand{\thumbsoverviewback}[1]{\thumbsoverviewprint{#1}{l}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\thumbsoverviewverso}
% \begin{macrocode}
\newcommand{\thumbsoverviewverso}[1]{\thumbsoverviewprint{#1}{v}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\thumbsoverviewdouble}
% \begin{macrocode}
\newcommand{\thumbsoverviewdouble}[1]{\thumbsoverviewprint{#1}{d}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thumbsoverviewprint}
% |\thumbsoverviewprint| works by calling the internal command |\th@mbs@verview|
% (see below), repeating this until all thumb marks have been processed.
%
% \begin{macrocode}
\newcommand{\thumbsoverviewprint}[2]{%
% \end{macrocode}
%
% It would be possible to just |\edef\th@mbsprintpage{#2}|, but
% |\thumbsoverviewprint| might be called manually and without valid second argument.
%
% \begin{macrocode}
\edef\th@mbstest{#2}%
\def\th@mbstestb{r}%
\ifx\th@mbstest\th@mbstestb% r
\gdef\th@mbsprintpage{r}%
\else%
\def\th@mbstestb{l}%
\ifx\th@mbstest\th@mbstestb% l
\gdef\th@mbsprintpage{l}%
\else%
\def\th@mbstestb{v}%
\ifx\th@mbstest\th@mbstestb% v
\gdef\th@mbsprintpage{v}%
\else%
\def\th@mbstestb{d}%
\ifx\th@mbstest\th@mbstestb% d
\gdef\th@mbsprintpage{d}%
\else%
\PackageError{thumbs}{%
Invalid second parameter of \string\thumbsoverviewprint %
}{The second argument of command \string\thumbsoverviewprint\space must be\MessageBreak%
either "r" or "l" or "v" or "d" but it is neither.\MessageBreak%
Now "r" is chosen instead.\MessageBreak%
}%
\gdef\th@mbsprintpage{r}%
\fi%
\fi%
\fi%
\fi%
% \end{macrocode}
%
% Option |\thumbs@thumblink| is checked for a valid and reasonable value here.
%
% \begin{macrocode}
\def\th@mbstest{none}%
\ifx\thumbs@thumblink\th@mbstest% OK
\else%
\ltx@ifpackageloaded{hyperref}{% hyperref loaded
\def\th@mbstest{title}%
\ifx\thumbs@thumblink\th@mbstest% OK
\else%
\def\th@mbstest{page}%
\ifx\thumbs@thumblink\th@mbstest% OK
\else%
\def\th@mbstest{titleandpage}%
\ifx\thumbs@thumblink\th@mbstest% OK
\else%
\def\th@mbstest{line}%
\ifx\thumbs@thumblink\th@mbstest% OK
\else%
\def\th@mbstest{rule}%
\ifx\thumbs@thumblink\th@mbstest% OK
\else%
\PackageError{thumbs}{Option thumblink with invalid value}{%
Option thumblink has invalid value "\thumbs@thumblink ".\MessageBreak%
Valid values are "none", "title", "page",\MessageBreak%
"titleandpage", "line", or "rule".\MessageBreak%
"rule" will be used now.\MessageBreak%
}%
\gdef\thumbs@thumblink{rule}%
\fi%
\fi%
\fi%
\fi%
\fi%
}{% hyperref not loaded
\PackageError{thumbs}{Option thumblink not "none", but hyperref not loaded}{%
The option thumblink of the thumbs package was not set to "none",\MessageBreak%
but to some kind of hyperlinks, without using package hyperref.\MessageBreak%
Either choose option "thumblink=none", or load package hyperref.\MessageBreak%
When pressing Return, "thumblink=none" will be set now.\MessageBreak%
}%
\gdef\thumbs@thumblink{none}%
}%
\fi%
% \end{macrocode}
%
% When the thumb overview is printed and there is already a thumb mark set,
% for example for the front-matter (e.\,g. title page, bibliographic information,
% acknowledgements, dedication, preface, abstract, tables of content, tables,
% and figures, lists of symbols and abbreviations, and the thumbs overview itself,
% of course) or when the overview is placed near the end of the document,
% the current y-position of the thumb mark must be remembered (and later restored)
% and the printing of that thumb mark must be stopped (and later continued).
%
% \begin{macrocode}
\edef\th@mbprintingovertoc{\th@mbprinting}%
\ifnum \th@mbsmax > \pagesLTS@zero%
\if@twoside%
\def\th@mbstest{r}%
\ifx\th@mbstest\th@mbsprintpage%
\cleardoublepage%
\else%
\def\th@mbstest{v}%
\ifx\th@mbstest\th@mbsprintpage%
\cleardoublepage%
\else% l or d
\clearotherdoublepage%
\fi%
\fi%
\else \clearpage%
\fi%
\stopthumb%
\markboth{\MakeUppercase #1 }{\MakeUppercase #1 }%
\fi%
\setlength{\th@mbsposytocy}{\th@mbposy}%
\setlength{\th@mbposy}{\th@mbsposytocyy}%
\ifx\th@mbstable\pagesLTS@zero%
\newcounter{th@mblinea}%
\newcounter{th@mblineb}%
\newcounter{FileLine}%
\newcounter{thumbsstop}%
\fi%
% \end{macrocode}
% \pagebreak
% \begin{macrocode}
\setcounter{th@mblinea}{\th@mbstable}%
\addtocounter{th@mblinea}{+1}%
\xdef\th@mbstable{\arabic{th@mblinea}}%
\setcounter{th@mblinea}{1}%
\setcounter{th@mblineb}{\th@umbsperpage}%
\setcounter{FileLine}{1}%
\setcounter{thumbsstop}{1}%
\addtocounter{thumbsstop}{\th@mbsmax}%
% \end{macrocode}
%
% We do not want any labels or index or glossary entries confusing the
% table of thumb marks entries, but the commands must work outside of it:
%
% \begin{macro}{\thumbsoriglabel}
% \begin{macrocode}
\let\thumbsoriglabel\label%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\thumbsorigindex}
% \begin{macrocode}
\let\thumbsorigindex\index%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\thumbsorigglossary}
% \begin{macrocode}
\let\thumbsorigglossary\glossary%
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
\let\label\@gobble%
\let\index\@gobble%
\let\glossary\@gobble%
% \end{macrocode}
%
% Some preparation in case of double printing the overview page(s):
%
% \begin{macrocode}
\def\th@mbstest{v}% r l r ...
\ifx\th@mbstest\th@mbsprintpage%
\def\th@mbsprintpage{l}% because it will be changed to r
\def\th@mbdoublepage{1}%
\else%
\def\th@mbstest{d}% l r l ...
\ifx\th@mbstest\th@mbsprintpage%
\def\th@mbsprintpage{r}% because it will be changed to l
\def\th@mbdoublepage{1}%
\else%
\def\th@mbdoublepage{0}%
\fi%
\fi%
\def\th@mb@resetdoublepage{0}%
\@whilenum\value{FileLine}<\value{thumbsstop}\do%
% \end{macrocode}
%
% \pagebreak
%
% For double printing the overview page(s) we just change between printing
% left and right, and we need to reset the line number of the |\jobname.tmb| file
% which is read, because we need to read things twice.
%
% \begin{macrocode}
{\ifx\th@mbdoublepage\pagesLTS@one%
\def\th@mbstest{r}%
\ifx\th@mbsprintpage\th@mbstest%
\def\th@mbsprintpage{l}%
\else% \th@mbsprintpage is l
\def\th@mbsprintpage{r}%
\fi%
\clearpage%
\ifx\th@mb@resetdoublepage\pagesLTS@one%
\setcounter{th@mblinea}{\theth@mblinea}%
\setcounter{th@mblineb}{\theth@mblineb}%
\def\th@mb@resetdoublepage{0}%
\else%
\edef\theth@mblinea{\arabic{th@mblinea}}%
\edef\theth@mblineb{\arabic{th@mblineb}}%
\def\th@mb@resetdoublepage{1}%
\fi%
\else%
\if@twoside%
\def\th@mbstest{r}%
\ifx\th@mbstest\th@mbsprintpage%
\cleardoublepage%
\else% l
\clearotherdoublepage%
\fi%
\else%
\clearpage%
\fi%
\fi%
% \end{macrocode}
%
% When the very first page of a thumb marks overview is generated,
% the label is set (with the |\th@mbstablabeling| command).
%
% \begin{macrocode}
\ifnum\value{FileLine}=1%
\ifx\th@mbdoublepage\pagesLTS@one%
\ifx\th@mb@resetdoublepage\pagesLTS@one%
\th@mbstablabeling%
\fi%
\else
\th@mbstablabeling%
\fi%
\fi%
\null%
\th@mbs@verview%
\pagebreak%
% \end{macrocode}
% \pagebreak
% \begin{macrocode}
\ifthumbs@verbose%
\message{THUMBS: Fileline: \arabic{FileLine}, a: \arabic{th@mblinea}, %
b: \arabic{th@mblineb}, per page: \th@umbsperpage, max: \th@mbsmax.^^J}%
\fi%
% \end{macrocode}
%
% When double page mode is active and |\th@mb@resetdoublepage| is one,
% the last page of the thumbs mark overview must be repeated, but\\
% | \@whilenum\value{FileLine}<\value{thumbsstop}\do|\\
% would prevent this, because |FileLine| is already too large
% and would only be reset \emph{inside} the loop, but the loop would
% not be executed again.
%
% \begin{macrocode}
\ifx\th@mb@resetdoublepage\pagesLTS@one%
\setcounter{FileLine}{\theth@mblinea}%
\fi%
}%
% \end{macrocode}
%
% After the overview, the current thumb mark (if there is any) is restored,
%
% \begin{macrocode}
\setlength{\th@mbposy}{\th@mbsposytocy}%
\ifx\th@mbprintingovertoc\pagesLTS@one%
\continuethumb%
\fi%
% \end{macrocode}
%
% as well as the |\label|, |\index|, and |\glossary| commands:
%
% \begin{macrocode}
\let\label\thumbsoriglabel%
\let\index\thumbsorigindex%
\let\glossary\thumbsorigglossary%
% \end{macrocode}
%
% and |\th@mbs@toc@level| and |\th@mbs@toc@text| need to be emptied,
% otherwise for each following Table of Thumb Marks the same entry
% in the table of contents would be added, if no new
% |\addthumbsoverviewtocontents| would be given.
% ( But when no |\addthumbsoverviewtocontents| is given, it can be assumed
% that no |thumbsoverview|-entry shall be added to contents.)
%
% \begin{macrocode}
\addthumbsoverviewtocontents{}{}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\th@mbs@verview}
% The internal command |\th@mbs@verview| reads a line from file |\jobname.tmb| and
% executes the content of that line~-- if that line has not been processed yet,
% in which case it is just ignored (see |\@unused|).
%
% \begin{macrocode}
\newcommand{\th@mbs@verview}{%
\ifthumbs@verbose%
\message{^^JPackage thumbs Info: Processing line \arabic{th@mblinea} to \arabic{th@mblineb} of \jobname.tmb.}%
\fi%
\setcounter{FileLine}{1}%
\AtBeginShipoutNext{%
\AtBeginShipoutUpperLeftForeground{%
\IfFileExists{\jobname.tmb}{% then
\openin\@instreamthumb=\jobname.tmb %
\@whilenum\value{FileLine}<\value{th@mblineb}\do%
{\ifthumbs@verbose%
\message{THUMBS: Processing \jobname.tmb line \arabic{FileLine}.}%
\fi%
\ifnum \value{FileLine}<\value{th@mblinea}%
\read\@instreamthumb to \@unused%
\ifthumbs@verbose%
\message{Can be skipped.^^J}%
\fi%
% NIRVANA: ignore the line by not executing it,
% i.e. not executing \@unused.
% % \@unused
\else%
\ifnum \value{FileLine}=\value{th@mblinea}%
\read\@instreamthumb to \@thumbsout% execute the code of this line
\ifthumbs@verbose%
\message{Executing \jobname.tmb line \arabic{FileLine}.^^J}%
\fi%
\@thumbsout%
\else%
\ifnum \value{FileLine}>\value{th@mblinea}%
\read\@instreamthumb to \@thumbsout% execute the code of this line
\ifthumbs@verbose%
\message{Executing \jobname.tmb line \arabic{FileLine}.^^J}%
\fi%
\@thumbsout%
\else% THIS SHOULD NEVER HAPPEN!
\PackageError{thumbs}{Unexpected error! (Really!)}{%
! You are in trouble here.\MessageBreak%
! Type\space \space X \string<Return\string>\space to quit.\MessageBreak%
! Delete temporary auxiliary files\MessageBreak%
! (like \jobname.aux, \jobname.tmb, \jobname.out)\MessageBreak%
! and retry the compilation.\MessageBreak%
! If the error persists, cross your fingers\MessageBreak%
! and try typing\space \space \string<Return\string>\space to proceed.\MessageBreak%
! If that does not work,\MessageBreak%
! please contact the maintainer of the thumbs package.\MessageBreak%
}%
\fi%
\fi%
\fi%
\stepcounter{FileLine}%
}%
\ifnum \value{FileLine}=\value{th@mblineb}
\ifthumbs@verbose%
\message{THUMBS: Processing \jobname.tmb line \arabic{FileLine}.}%
\fi%
\read\@instreamthumb to \@thumbsout% Execute the code of that line.
\ifthumbs@verbose%
\message{Executing \jobname.tmb line \arabic{FileLine}.^^J}%
\fi%
\@thumbsout% Well, really execute it here.
\stepcounter{FileLine}%
\fi%
\closein\@instreamthumb%
% \end{macrocode}
%
% And on to the next overview page of thumb marks (if there are so many thumb marks):
%
% \begin{macrocode}
\addtocounter{th@mblinea}{\th@umbsperpage}%
\addtocounter{th@mblineb}{\th@umbsperpage}%
\@tempcnta=\th@mbsmax\relax%
\ifnum \value{th@mblineb}>\@tempcnta\relax%
\setcounter{th@mblineb}{\@tempcnta}%
\fi%
}{% else
% \end{macrocode}
%
% When |\jobname.tmb| was not found, we cannot read from that file, therefore
% the |FileLine| is set to |thumbsstop|, stopping the calling of |\th@mbs@verview|
% in |\thumbsoverview|. (And we issue a warning, of course.)
%
% \begin{macrocode}
\setcounter{FileLine}{\arabic{thumbsstop}}%
\AtEndAfterFileList{%
\PackageWarningNoLine{thumbs}{%
File \jobname.tmb not found.\MessageBreak%
Rerun to get thumbs overview page(s) right.\MessageBreak%
}%
}%
}%
}%
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thumborigaddthumb}
% When we are in |draft| mode, the thumb marks are
% \textquotedblleft de-coloured\textquotedblright{},
% their width is reduced, and a warning is given.
%
% \begin{macrocode}
\let\thumborigaddthumb\addthumb%
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\ifthumbs@draft
\setlength{\th@mbwidthx}{2pt}
\renewcommand{\addthumb}[4]{\thumborigaddthumb{#1}{#2}{black}{gray}}
\PackageWarningNoLine{thumbs}{thumbs package in draft mode:\MessageBreak%
Thumb mark width is set to 2pt,\MessageBreak%
thumb mark text colour to black, and\MessageBreak%
thumb mark background colour to gray.\MessageBreak%
Use package option final to get the original values.\MessageBreak%
}
\fi
% \end{macrocode}
%
% \pagebreak
%
% When we are in |hidethumbs| mode, there are no thumb marks
% and therefore neither any thumb mark overview page. A~warning is given.
%
% \begin{macrocode}
\ifthumbs@hidethumbs
\renewcommand{\addthumb}[4]{\relax}
\PackageWarningNoLine{thumbs}{thumbs package in hide mode:\MessageBreak%
Thumb marks are hidden.\MessageBreak%
Set package option "hidethumbs=false" to get thumb marks%
}
\renewcommand{\thumbnewcolumn}{\relax}
\fi
% \end{macrocode}
%
% \begin{macrocode}
%</package>
% \end{macrocode}
%
% \pagebreak
%
% \section{Installation}
%
% \subsection{Downloads\label{ss:Downloads}}
%
% Everything is available on \url{http://www.ctan.org/}
% but may need additional packages themselves.\\
%
% \DescribeMacro{thumbs.dtx}
% For unpacking the |thumbs.dtx| file and constructing the documentation
% it is required:
% \begin{description}
% \item[-] \TeX Format \LaTeXe{}, \url{http://www.CTAN.org/}
%
% \item[-] document class \xclass{ltxdoc}, 2007/11/11, v2.0u,
% \url{http://ctan.org/pkg/ltxdoc}
%
% \item[-] package \xpackage{morefloats}, 2012/01/28, v1.0f,
% \url{http://ctan.org/pkg/morefloats}
%
% \item[-] package \xpackage{geometry}, 2010/09/12, v5.6,
% \url{http://ctan.org/pkg/geometry}
%
% \item[-] package \xpackage{holtxdoc}, 2012/03/21, v0.24,
% \url{http://ctan.org/pkg/holtxdoc}
%
% \item[-] package \xpackage{hypdoc}, 2011/08/19, v1.11,
% \url{http://ctan.org/pkg/hypdoc}
% \end{description}
%
% \DescribeMacro{thumbs.sty}
% The |thumbs.sty| for \LaTeXe{} (i.\,e. each document using
% the \xpackage{thumbs} package) requires:
% \begin{description}
% \item[-] \TeX{} Format \LaTeXe{}, \url{http://www.CTAN.org/}
%
% \item[-] package \xpackage{xcolor}, 2007/01/21, v2.11,
% \url{http://ctan.org/pkg/xcolor}
%
% \item[-] package \xpackage{pageslts}, 2014/01/19, v1.2c,
% \url{http://ctan.org/pkg/pageslts}
%
% \item[-] package \xpackage{pagecolor}, 2012/02/23, v1.0e,
% \url{http://ctan.org/pkg/pagecolor}
%
% \item[-] package \xpackage{alphalph}, 2011/05/13, v2.4,
% \url{http://ctan.org/pkg/alphalph}
%
% \item[-] package \xpackage{atbegshi}, 2011/10/05, v1.16,
% \url{http://ctan.org/pkg/atbegshi}
%
% \item[-] package \xpackage{atveryend}, 2011/06/30, v1.8,
% \url{http://ctan.org/pkg/atveryend}
%
% \item[-] package \xpackage{infwarerr}, 2010/04/08, v1.3,
% \url{http://ctan.org/pkg/infwarerr}
%
% \item[-] package \xpackage{kvoptions}, 2011/06/30, v3.11,
% \url{http://ctan.org/pkg/kvoptions}
%
% \item[-] package \xpackage{ltxcmds}, 2011/11/09, v1.22,
% \url{http://ctan.org/pkg/ltxcmds}
%
% \item[-] package \xpackage{picture}, 2009/10/11, v1.3,
% \url{http://ctan.org/pkg/picture}
%
% \item[-] package \xpackage{rerunfilecheck}, 2011/04/15, v1.7,
% \url{http://ctan.org/pkg/rerunfilecheck}
% \end{description}
%
% \pagebreak
%
% \DescribeMacro{thumb-example.tex}
% The |thumb-example.tex| requires the same files as all
% documents using the \xpackage{thumbs} package and additionally:
% \begin{description}
% \item[-] package \xpackage{eurosym}, 1998/08/06, v1.1,
% \url{http://ctan.org/pkg/eurosym}
%
% \item[-] package \xpackage{lipsum}, 2011/04/14, v1.2,
% \url{http://ctan.org/pkg/lipsum}
%
% \item[-] package \xpackage{hyperref}, 2012/11/06, v6.83m,
% \url{http://ctan.org/pkg/hyperref}
%
% \item[-] package \xpackage{thumbs}, 2014/03/09, v1.0q,
% \url{http://ctan.org/pkg/thumbs}\\
% (Well, it is the example file for this package, and because you are reading the
% documentation for the \xpackage{thumbs} package, it~can be assumed that you already
% have some version of it -- is it the current one?)
% \end{description}
%
% \DescribeMacro{Alternatives}
% As possible alternatives in section \ref{sec:Alternatives} there are listed
% (newer versions might be available)
% \begin{description}
% \item[-] \xpackage{chapterthumb}, 2005/03/10, v0.1,
% \CTAN{info/examples/KOMA-Script-3/Anhang-B/source/chapterthumb.sty}
%
% \item[-] \xpackage{eso-pic}, 2010/10/06, v2.0c,
% \url{http://ctan.org/pkg/eso-pic}
%
% \item[-] \xpackage{fancytabs}, 2011/04/16 v1.1,
% \url{http://ctan.org/pkg/fancytabs}
%
% \item[-] \xpackage{thumb}, 2001, without file version,
% \url{ftp://ftp.dante.de/pub/tex/info/examples/ltt/thumb.sty}
%
% \item[-] \xpackage{thumb} (a completely different one), 1997/12/24, v1.0,
% \url{http://ctan.org/pkg/thumb}
%
% \item[-] \xpackage{thumbindex}, 2009/12/13, without file version,
% \url{http://hisashim.org/2009/12/13/thumbindex.html}.
%
% \item[-] \xpackage{thumb-index}, from the \xpackage{fancyhdr} package, 2005/03/22 v3.2,
% \url{http://ctan.org/pkg/fancyhdr}
%
% \item[-] \xpackage{thumbpdf}, 2010/07/07, v3.11,
% \url{http://ctan.org/pkg/thumbpdf}
%
% \item[-] \xpackage{thumby}, 2010/01/14, v0.1,
% \url{http://ctan.org/pkg/thumby}
% \end{description}
%
% \DescribeMacro{Oberdiek}
% \DescribeMacro{holtxdoc}
% \DescribeMacro{alphalph}
% \DescribeMacro{atbegshi}
% \DescribeMacro{atveryend}
% \DescribeMacro{infwarerr}
% \DescribeMacro{kvoptions}
% \DescribeMacro{ltxcmds}
% \DescribeMacro{picture}
% \DescribeMacro{rerunfilecheck}
% All packages of \textsc{Heiko Oberdiek}'s bundle `oberdiek'
% (especially \xpackage{holtxdoc}, \xpackage{alphalph}, \xpackage{atbegshi}, \xpackage{infwarerr},
% \xpackage{kvoptions}, \xpackage{ltxcmds}, \xpackage{picture}, and \xpackage{rerunfilecheck})
% are also available in a TDS compliant ZIP archive:\\
% \url{http://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\\
% It is probably best to download and use this, because the packages in there
% are quite probably both recent and compatible among themselves.\\
%
% \vspace{6em}
%
% \DescribeMacro{hyperref}
% \noindent \xpackage{hyperref} is not included in that bundle and needs to be
% downloaded separately,\\
% \url{http://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\
%
% \DescribeMacro{M\"{u}nch}
% A hyperlinked list of my (other) packages can be found at
% \url{http://www.ctan.org/author/muench-hm}.\\
%
% \subsection{Package, unpacking TDS}
% \paragraph{Package.} This package is available on \url{CTAN.org}
% \begin{description}
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.dtx}]\hspace*{0.1cm} \\
% The source file.
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.pdf}]\hspace*{0.1cm} \\
% The documentation.
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs-example.pdf}]\hspace*{0.1cm} \\
% The compiled example file, as it should look like.
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/README}]\hspace*{0.1cm} \\
% The README file.
% \end{description}
% There is also a thumbs.tds.zip available:
% \begin{description}
% \item[\url{http://mirror.ctan.org/install/macros/latex/contrib/thumbs.tds.zip}]\hspace*{0.1cm} \\
% Everything in \xfile{TDS} compliant, compiled format.
% \end{description}
% which additionally contains\\
% \begin{tabular}{ll}
% thumbs.ins & The installation file.\\
% thumbs.drv & The driver to generate the documentation.\\
% thumbs.sty & The \xext{sty}le file.\\
% thumbs-example.tex & The example file.
% \end{tabular}
%
% \bigskip
%
% \noindent For required other packages, please see the preceding subsection.
%
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
% \docstrip{} archive. The files are extracted by running the
% \xext{dtx} through \plainTeX{}:
% \begin{quote}
% \verb|tex thumbs.dtx|
% \end{quote}
%
% About generating the documentation see paragraph~\ref{GenDoc} below.\\
%
% \paragraph{TDS.} Now the different files must be moved into
% the different directories in your installation TDS tree
% (also known as \xfile{texmf} tree):
% \begin{quote}
% \def\t{^^A
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
% thumbs.sty & tex/latex/thumbs/thumbs.sty\\
% thumbs.pdf & doc/latex/thumbs/thumbs.pdf\\
% thumbs-example.tex & doc/latex/thumbs/thumbs-example.tex\\
% thumbs-example.pdf & doc/latex/thumbs/thumbs-example.pdf\\
% thumbs.dtx & source/latex/thumbs/thumbs.dtx\\
% \end{tabular}^^A
% }^^A
% \sbox0{\t}^^A
% \ifdim\wd0>\linewidth
% \begingroup
% \advance\linewidth by\leftmargin
% \advance\linewidth by\rightmargin
% \edef\x{\endgroup
% \def\noexpand\lw{\the\linewidth}^^A
% }\x
% \def\lwbox{^^A
% \leavevmode
% \hbox to \linewidth{^^A
% \kern-\leftmargin\relax
% \hss
% \usebox0
% \hss
% \kern-\rightmargin\relax
% }^^A
% }^^A
% \ifdim\wd0>\lw
% \sbox0{\small\t}^^A
% \ifdim\wd0>\linewidth
% \ifdim\wd0>\lw
% \sbox0{\footnotesize\t}^^A
% \ifdim\wd0>\linewidth
% \ifdim\wd0>\lw
% \sbox0{\scriptsize\t}^^A
% \ifdim\wd0>\linewidth
% \ifdim\wd0>\lw
% \sbox0{\tiny\t}^^A
% \ifdim\wd0>\linewidth
% \lwbox
% \else
% \usebox0
% \fi
% \else
% \lwbox
% \fi
% \else
% \usebox0
% \fi
% \else
% \lwbox
% \fi
% \else
% \usebox0
% \fi
% \else
% \lwbox
% \fi
% \else
% \usebox0
% \fi
% \else
% \lwbox
% \fi
% \else
% \usebox0
% \fi
% \end{quote}
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip{}'s
% \xfile{TDS} installing feature, then some files can already be in the right
% place, see the documentation of \docstrip{}.
%
% \subsection{Refresh file name databases}
%
% If your \TeX{}~distribution (\teTeX{}, \mikTeX{},\dots{}) relies on file name
% databases, you must refresh these. For example, \teTeX{} users run
% \verb|texhash| or \verb|mktexlsr|.
%
% \subsection{Some details for the interested}
%
% \paragraph{Unpacking with \LaTeX{}.}
% The \xfile{.dtx} chooses its action depending on the format:
% \begin{description}
% \item[\plainTeX:] Run \docstrip{} and extract the files.
% \item[\LaTeX:] Generate the documentation.
% \end{description}
% If you insist on using \LaTeX{} for \docstrip{} (really,
% \docstrip{} does not need \LaTeX{}), then inform the autodetect routine
% about your intention:
% \begin{quote}
% \verb|latex \let\install=y\input{thumbs.dtx}|
% \end{quote}
% Do not forget to quote the argument according to the demands
% of your shell.
%
% \paragraph{Generating the documentation.\label{GenDoc}}
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
% the documentation. The process can be configured by a
% configuration file \xfile{ltxdoc.cfg}. For instance, put the following
% line into this file, if you want to have A4 as paper format:
% \begin{quote}
% \verb|\PassOptionsToClass{a4paper}{article}|
% \end{quote}
%
% \noindent An example follows how to generate the
% documentation with \pdfLaTeX{}:
%
% \begin{quote}
%\begin{verbatim}
%pdflatex thumbs.dtx
%makeindex -s gind.ist thumbs.idx
%pdflatex thumbs.dtx
%makeindex -s gind.ist thumbs.idx
%pdflatex thumbs.dtx
%\end{verbatim}
% \end{quote}
%
% \subsection{Compiling the example}
%
% The example file, \textsf{thumbs-example.tex}, can be compiled via\\
% \indent |latex thumbs-example.tex|\\
% or (recommended)\\
% \indent |pdflatex thumbs-example.tex|\\
% and will need probably at least four~(!) compiler runs to get everything right.
%
% \bigskip
%
% \section{Acknowledgements}
%
% I would like to thank \textsc{Heiko Oberdiek} for providing
% the \xpackage{hyperref} as well as a~lot~(!) of other useful packages
% (from which I also got everything I know about creating a file in
% \xext{dtx} format, ok, say it: copying),
% and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex}
% newsgroups and everybody at \url{http://tex.stackexchange.com/}
% for their help in all things \TeX{} (especially \textsc{David Carlisle}
% for \url{http://tex.stackexchange.com/a/45654/6865}).
% Thanks for bug reports go to \textsc{Veronica Brandt} and
% \textsc{Martin Baute} (even two bug reports).
%
% \bigskip
%
% \phantomsection
% \begin{History}\label{History}
% \begin{Version}{2010/04/01 v0.01 -- 2011/05/13 v0.46}
% \item Diverse $\beta $-versions during the creation of this package.\\
% \end{Version}
% \begin{Version}{2011/05/14 v1.0a}
% \item Upload to \url{http://www.ctan.org/pkg/thumbs}.
% \end{Version}
% \begin{Version}{2011/05/18 v1.0b}
% \item When more than one thumb mark is places at one single page,
% the variables containing the values (text, colour, backgroundcolour)
% of those thumb marks are now created dynamically. Theoretically,
% one can now have $2\,147\,483\,647$ thumb marks at one page instead of
% six thumb marks (as with \xpackage{thumbs} version~1.0a),
% but I am quite sure that some other limit will be reached before the
% $2\,147\,483\,647^ \textrm{th} $ thumb mark.
% \item Bug fix: When a document using the \xpackage{thumbs} package was compiled,
% and the \xfile{.aux} and \xfile{.tmb} files were created, and the
% \xfile{.tmb} file was deleted (or renamed or moved),
% while the \xfile{.aux} file was not deleted (or renamed or moved),
% and the document was compiled again, and the \xfile{.aux} file was
% reused, then reading from the then empty \xfile{.tmb} file resulted
% in an endless loop. Fixed.
% \item Minor details.
% \end{Version}
% \begin{Version}{2011/05/20 v1.0c}
% \item The thumb mark width is written to the \xfile{log} file (in |verbose| mode
% only). The knowledge of the value could be helpful for the user,
% when option |width={auto}| was used, and one wants the thumb marks to be
% half as big, or with double width, or a little wider, or a little
% smaller\ldots\ Also thumb marks' height, top thumb margin and bottom thumb
% margin are given. Look for\\
% |************** THUMB dimensions **************|\\
% in the \xfile{log} file.
% \item Bug fix: There was a\\
% | \advance\th@mbheighty-\th@mbsdistance|,\\
% where\\
% | \advance\th@mbheighty-\th@mbsdistance|\\
% | \advance\th@mbheighty-\th@mbsdistance|\\
% should have been, causing wrong thumb marks' height, thereby wrong number
% of thumb marks per column, and thereby another endless loop. Fixed.
% \item The \xpackage{ifthen} package is no longer required for the \xpackage{thumbs}
% package, removed from its |\RequirePackage| entries.
% \item The \xpackage{infwarerr} package is used for its |\@PackageInfoNoLine| command.
% \item The \xpackage{warning} package is no longer used by the \xpackage{thumbs}
% package, removed from its |\RequirePackage| entries. Instead,
% the \xpackage{atveryend} package is used, because it is loaded anyway
% when the \xpackage{hyperref} package is used.
% \item Minor details.
% \end{Version}
% \begin{Version}{2011/05/26 v1.0d}
% \item Bug fix: labels or index or glossary entries were gobbled for the thumb marks
% overview page, but gobbling leaked to the rest of the document; fixed.
% \item New option |silent|, complementary to old option |verbose|.
% \item New option |draft| (and complementary option |final|), which
% \textquotedblleft de-coloures\textquotedblright\ the thumb marks
% and reduces their width to~$2\unit{pt}$.
% \end{Version}
% \begin{Version}{2011/06/02 v1.0e}
% \item Gobbling of labels or index or glossary entries improved.
% \item Dimension |\thumbsinfodimen| no longer needed.
% \item Internal command |\thumbs@info| no longer needed, removed.
% \item New value |autoauto| (not default!) for option |width|, setting the thumb marks
% width to fit the widest thumb mark text.
% \item When |width={autoauto}| is not used, a warning is issued, when the thumb marks
% width is smaller than the thumb mark text.
% \item Bug fix: Since version v1.0b as of 2011/05/18 the number of thumb marks at one
% single page was no longer limited to six, but the example still stated this.
% Fixed.
% \item Minor details.
% \end{Version}
% \begin{Version}{2011/06/08 v1.0f}
% \item Bug fix: |\th@mb@titlelabel| should be defined |\empty| at the beginning
% of the package: fixed. (Bug reported by \textsc{Veronica Brandt}. Thanks!)
% \item Bug fix: |\thumbs@distance| versus |\th@mbsdistance|: There should be only
% two times |\thumbs@distance|, the value of option |distance|,
% otherwise it should be the length |\th@mbsdistance|: fixed.
% (Also this bug reported by \textsc{Veronica Brandt}. Thanks!)
% \item |\hoffset| and |\voffset| are now ignored by default,
% but can be regarded using the options |ignorehoffset=false|
% and |ignorevoffset=false|.
% (Pointed out again by \textsc{Veronica Brandt}. Thanks!)
% \item Added to documentation: The package takes the dimensions |\AtBeginDocument|,
% thus later the page dimensions should not be changed.
% Now explicitly stated this in the documentation. |\paperwidth| changes
% are probably possible.
% \item Documentation and example now give a lot more details.
% \item Changed diverse details.
% \end{Version}
% \begin{Version}{2011/06/24 v1.0g}
% \item Bug fix: When \xpackage{hyperref} was \textit{not} used,
% then some labels were not set at all~- fixed.
% \item Bug fix: When more than one Table of Tumbs was created with the
% |\thumbsoverview| command, there were some
% |counter ... already defined|-errors~- fixed.
% \item Bug fix: When more than one Table of Tumbs was created with the
% |\thumbsoverview| command, there was a
% |Label TableofTumbs multiply defined|-error and it was not possible
% to refer to any but the last Table of Tumbs. Fixed with labels
% |TableofTumbs1|, |TableofTumbs2|,\ldots\ (|TableofTumbs| still aims
% at the last used Table of Thumbs for compatibility.)
% \item Bug fix: Sometimes the thumb marks were stopped one page too early
% before the Table of Thumbs~- fixed.
% \item Some details changed.
% \end{Version}
% \begin{Version}{2011/08/08 v1.0h}
% \item Replaced |\global\edef| by |\xdef|.
% \item Now using the \xpackage{pagecolor} package. Empty thumb marks now
% inherit their colour from the pages's background. Option |pagecolor|
% is therefore obsolete.
% \item The \xpackage{pagesLTS} package has been replaced by the
% \xpackage{pageslts} package.
% \item New kinds of thumb mark overview pages introduced additionally to
% |\thumbsoverview|: |\thumbsoverviewback|, |\thumbsoverviewverso|,
% and |\thumbsoverviewdouble|.
% \item New option |hidethumbs=true| to hide thumb marks (and their
% overview page(s)).
% \item Option |ignorehoffset| did not work for the thumb marks overview page(s)~-
% neither |true| nor |false|; fixed.
% \item Changed a huge number of details.
% \end{Version}
% \begin{Version}{2011/08/22 v1.0i}
% \item Hot fix: \TeX{} 2011/06/27 has changed |\enddocument| and
% thus broken the |\AtVeryVeryEnd| command/hooking
% of \xpackage{atveryend} package as of 2011/04/23, v1.7.
% Version 2011/06/30, v1.8, fixed it, but this version was not available
% at \url{CTAN.org} yet. Until then |\AtEndAfterFileList| was used.
% \end{Version}
% \begin{Version}{2011/10/19 v1.0j}
% \item Changed some Warnings into Infos (as suggested by \textsc{Martin Baute}).
% \item The SW(P)-warning is now only given |\IfFileExists{tcilatex.tex}|,
% otherwise just a message is given. (Warning questioned by
% \textsc{Martin Baute}, thanks.)
% \item New option |nophantomsection| to \emph{globally} disable the automatical
% placement of a |\phantomsection| before \emph{all} thumb marks.
% \item New command |\thumbsnophantom| to \emph{locally} disable the automatical
% placement of a |\phantomsection| before the \emph{next} thumb mark.
% \item README fixed.
% \item Minor details changed.
% \end{Version}
% \begin{Version}{2012/01/01 v1.0k}
% \item Bugfix: Wrong installation path given in the documentation, fixed.
% \item No longer uses the |th@mbs@tmpA| counter but uses |\@tempcnta| instead.
% \item No longer abuses the |\th@mbposyA| dimension but |\@tempdima|.
% \item Update of documentation, README, and \xfile{dtx} internals.
% \end{Version}
% \begin{Version}{2012/01/07 v1.0l}
% \item Bugfix: Used a |\@tempcnta| where a |\@tempdima| should have been.
% \end{Version}
% \begin{Version}{2012/02/23 v1.0m}
% \item Bugfix: Replaced |\newcommand{\QTO}[2]{#2}| (for SWP) by
% |\providecommand{\QTO}[2]{#2}|.
% \item Bugfix: When the \xpackage{tikz} package was loaded before \xpackage{thumbs},
% in |twoside|-mode the thumb marks were printed at the wrong side
% of the page. (Bug reported by \textsc{Martin Baute}, thanks!) With
% \xpackage{hyperref} it really depends on the loading order of the
% three packages.
% \item Now using |\ltx@ifpackageloaded| from the \xpackage{ltxcmds} package
% to check (after |\begin{document}|) whether the \xpackage{hyperref}
% package was loaded.
% \item For the thumb marks |\parbox|es instead of |\makebox|es are used
% (just in case somebody wants to place two lines into a thumb mark, e.\,g.\\
% |Sch |\\
% |St|\\
% in a phone book, where the other |S|es are placed in another chapter).
% \item Minor details changed.
% \end{Version}
% \begin{Version}{2012/02/25 v1.0n}
% \item Check for loading order of \xpackage{tikz} and \xpackage{hyperref} replaced
% by robust method. (Thanks to \textsc{David Carlisle},
% \url{http://tex.stackexchange.com/a/45654/6865}!)
% \item Fixed \texttt{url}-handling in the example in case the \xpackage{hyperref}
% package was not loaded.
% \item In the index the line-numbers of definitions were not underlined; fixed.
% \item In the \xfile{thumbs-example} there are now a few words about
% \textquotedblleft paragraph-thumbs\textquotedblright{}
% (i.\,e.~text which is too long for the width of a thumb mark).
% \end{Version}
% \begin{Version}{2013/08/22 v1.0o, not released to the general public}
% \item \textsc{Stephanie Hein} requested the feature to be able to increase
% the horizontal space between page edge and the text inside of the
% thumb mark. Therefore options |evenindent| and |oddexdent| were
% implemented (later renamed to |eventxtindent| and |oddtxtexdent|).
% \item \textsc{Bjorn Victor} reported the same problem and also the one,
% that two marks are not printed at the exact same vertical position
% on recto and verso pages. Because this can be seen with a lot of
% duplex printers, the new option |evenprintvoffset| allows to
% vertically shift the marks on even pages by any length.
% \end{Version}
% \begin{Version}{2013/09/17 v1.0p, not released to the general public}
% \item The thumb mark text is now set in |\parbox|es everywhere.
% \item \textsc{Heini Geiring} requested the feature to be able to
% horizontally move the marks away from the page edge,
% because this is useful when using brochure printing
% where after the printing the physical page edge is changed
% by cutting the paper. Therefore the options |evenmarkindent| and
% |oddmarkexdent| were introduced and the options |evenindent| and
% |oddexdent| were renamed to |eventxtindent| and |oddtxtexdent|.
% \item Changed a lot of internal details.
% \end{Version}
% \begin{Version}{2014/03/09 v1.0q}
% \item New version of the \xpackage{atveryend} package is now available at
% \url{CTAN.org} (see entry in this history for
% \xpackage{thumbs} version |[2011/08/22 v1.0i]|).
% \item Support for SW(P) drastically reduced. No more testing is performed.
% Get a current \TeX{} distribution instead!
% \item New option |txtcentered|: If it is set to |true|,
% the thumb's text is placed using |\centering|,
% otherwise either |\raggedright| or |\raggedleft|
% (depending on left or right page for double sided documents).
% \item |\normalsize| added to prevent
% \textquotedblleft font size leakage\textquotedblright{}
% from the respective page.
% \item Handling of obsolete options (mainly from version 2013/08/22 v1.0o)
% added.
% \item Changed (hopefully improved) a lot of details.
% \end{Version}
% \end{History}
%
% \bigskip
%
% When you find a mistake or have a suggestion for an improvement of this package,
% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.)\\
%
% \bigskip
%
% Note: \textsf{X} and \textsf{Y} are not missing in the following index,
% but no command \emph{beginning} with any of these letters has been used in this
% \xpackage{thumbs} package.
%
% \pagebreak
%
% \PrintIndex
%
% \Finale
\endinput
|