summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/thumbs/thumbs.dtx
blob: d30c931ca4d549dcb66b19d09143ed800c20c8a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
% \iffalse meta-comment
%
% File: thumbs.dtx
% Version: 2011/05/14 v1.0a
%
% Copyright (C) 2010, 2011 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. 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
% and the derived files
%    thumbs.sty, thumbs.ins, thumbs.drv,
%    thumbs-example.tex, thumbs.pdf.
%
% Distribution:
%    CTAN:macros/latex/contrib/thumbs/thumbs.dtx
%    CTAN:macros/latex/contrib/thumbs/thumbs.pdf
%    CTAN:install/macros/latex/contrib/thumbs.tds.zip
%
% 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: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 2011/05/14 v1.0a Thumb marks and overwiew page(s) (HMM)}
\Msg{*************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

Project: thumbs
Version: 2011/05/14 v1.0a

Copyright (C) 2010, 2011 by
    H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>

The usual disclaimer applys:
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
and the derived files
   thumbs.sty, thumbs.pdf, thumbs.ins, thumbs.drv,
   thumbs-example.tex.

\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}[2009/09/24]
\ProvidesFile{thumbs.drv}%
  [2011/05/14 v1.0a Thumb marks and overwiew page(s) (HMM)]%
\documentclass[landscape]{ltxdoc}[2007/11/11]% v2.0u
\usepackage{geometry}[2010/09/12]% v5.6
\usepackage{holtxdoc}[2011/02/04]% v0.21
%% 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 overwiew page(s) (HMM)},%
 pdfkeywords={LaTeX, thumb, thumbs, thumb index, thumbs index, index, Hans-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{1663}
%
% \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{\NeedsTeXFormat,\DoNotIndex,\verb}
% \DoNotIndex{\def,\edef,\gdef,\global}
% \DoNotIndex{\ifx,\kvoptions,\listfiles,\mathord,\mathrm,\ProcessKeyvalOptions}
% \DoNotIndex{\SetupKeyvalOptions}
% \DoNotIndex{\bigskip,\space,\thinspace,\Huge,\Large,\large,\linebreak,\MessageBreak}
% \DoNotIndex{\ldots,\indent,\noindent,\newline,\pagebreak,\pagenumbering}
% \DoNotIndex{\textbf,\textit,\textsf,\texttt,\textquotedblleft,\textquotedblright}
% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
% \DoNotIndex{\chapter,\section}
% \DoNotIndex{\arabic,\c@th@mbs@tmpA,\endcsname,\ifnum,\newpage,\setcounter,\advance}
% \DoNotIndex{\setlength,\the,\value,\textbackslash,\,}
%
% \title{The \xpackage{thumbs} package}
% \date{2011/05/14 v1.0a}
% \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 methode for large documents.
% \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 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.\\
% 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.
%
% \subsection{Options}
% \DescribeMacro{options}
% \indent The \xpackage{thumbs} package takes the following options:
%
% \subsubsection{pagecolor\label{sss:pagecolor}}
% \DescribeMacro{pagecolor}
% \indent Option |pagecolor| wants to know the background colour of the pages
% for use with the \texttt{xcolor} package. The default value is |white|.
%
% \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!)
%
% \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 |\voffset| plus |\topmargin|. Dimensions (e.\,g. $1\unit{cm}$)
%  are also accepted.
%
% \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+\voffset+\topmargin-\thumbs@distance+\th@mbheighty+\headheight+|%
%  |\headsep+\textheight+\footskip|\newline%
%  |-\thumbs@distance-\th@mbheighty|.\\
%  Dimensions (e.\,g. $1\unit{cm}$) are also accepted.
%
% \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}
%
% \pagebreak
%
% \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.
%
% \subsection{Commands to be used in the document}
% \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).\\
%
% \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.\\
%
% \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.\\
%
% \DescribeMacro{\thumbsoverview}
% The command |\thumbsoverview| is used to place the overview page(s) for the thumb marks.
% Its single parameter is used to mark this page/these pages (e.\,g. in the page header).
% If these marks are not whished, |\thumbsoverview{}| will generate empty marks in the
% page header(s). |\thumbsoverview| could be used more than once (for example at the
% beginning and at the end of the document), but the label |TableOfThumbs| would than
% be multilpy defined (no great harm done, but hyperlinks will only link to one of the
% labels).\\
%
% \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|.\\
%
% \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|.
%
% \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 (You programmed or found another alternative,
%  which is available at \CTAN{}?\\
%  OK, send an e-mail to me with the name, location at \CTAN{},
%  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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% When compiling with SWP 5.50. Build 2960, %
%% these additional packages are needed:     %
%% \usepackage[T1]{fontenc}                  %
%% \usepackage{amsfonts}                     %
%% \usepackage[math]{cellspace}              %
%% \usepackage{xcolor}                       %
%% \pagecolor{white}                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{lipsum}[2011/04/14]% v1.2
\usepackage{eurosym}[1998/08/06]% v1.1
\usepackage[extension=pdf,%
 pdfpagelayout=TwoPageRight,pdfpagemode={UseNone},%
 plainpages=false,%
 pdfpagelabels=true,%
 hyperindex=false,%
 pdflang={en},%
 pdftitle={thumbs package example},%
 pdfauthor={Hans-Martin Muench},%
 pdfsubject={Example for the thumbs package},%
 pdfkeywords={LaTeX, thumbs, thumb marks, Hans-Martin Muench},%
 pdfview=Fit,pdfstartview=Fit,%
 linktoc=all]{hyperref}[2011/04/17]% v6.82g
\usepackage[pagecolor=white,thumblink=rule,linefill=dots,height={auto},minheight={47pt},%
            width={auto},distance={2mm},topthumbmargin={auto},bottomthumbmargin={auto},%
            verbose=true]{thumbs}[2011/05/14]% 1.0a
\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}%
\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.0a as of 2011/05/14 (HMM).
The used options were \texttt{pagecolor=white},
\texttt{thumblink=rule}, \texttt{linefill=dots},
\texttt{height=auto}, \texttt{minheight=\{47pt\}},
width={auto}, \texttt{distance=\{2mm\}}, \texttt{topthumbmargin=\{auto\}},
\texttt{bottomthumbmargin=\{auto\}}, and \texttt{verbose=true}.
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{green} 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.}

\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 \textbackslash addthumbsoverviewtocontents adds the thumb
marks overview page to the table of contents.

\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 the thumb marks
for some page(s):

\newpage

\stopthumb

The command
\begin{verbatim}
\stopthumb
\end{verbatim}
was used here. Until another 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}{\Huge{Huge Text}}{yellow}{green}

\addthumb{bold text }{\textbf{Bf Text}}{pink}{blue}

\addthumb{Huge Bold Text}{\Huge{\textbf{HBT}}}{black}{yellow}

When there is more than one thumb mark at one page, this is no problem.
When more than six (6) thumb marks are at one (1) page,
only the first six will be shown,
while all will appear in the thumbs overview page.
On the following pages the correct, last thumb mark will appear.
More than one thumb mark at one page probably does not make much sense.
This package was not created to create decorations at the page margin,
but if you really need more than six thumb marks at one page,
feel free to send an e-mail to the maintainer.
If you have got an idea how to dynamically create thumb
\textquotedblleft registers\textquotedblright\ (thereby overcomming
this limitation), please send an e-mail to the maintainer, too.

\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.

\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 colum is started
(which will happen here).

\newpage

\addthumb{B mark}{\Huge{\textbf{B}}}{brown}{pink}

There! A new thumb colum 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 curiouse 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

\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 colum was started manually!

\newpage

Some text.

\newpage

\addthumb{G mark}{\Huge{\textbf{G}}}{orange}{violet}

I just added another thumb mark.

\newpage

Well, I think that are enough thumb marks.

Good bye!

\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}[1994/06/01]% or later
\ProvidesPackage{thumbs}[2011/05/14 v1.0a
            Thumb marks and overwiew 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 methode for large documents,
%% as well as an overview page.

%    \end{macrocode}
%
% For SW(P) users, we issue a warning. Unfortunately, we cannot check for the used
% software (can we?), 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. (Thus: RTFM of thumbs!)
% The options for those packages might be changed by the user -- I did not
% test all available options, thus first test, whether the document can be compiled
% with these options, and then try to change them according to your whishes.
%
%    \begin{macrocode}
\message{^^J *** Compiling with SW(P)? ^^J%
 Please see the sw(p)*.log or \jobname.log-file! *** ^^J}
\PackageWarningNoLine{thumbs}{%
  When compiling with SWP 5.50 Build 2960,\MessageBreak%
  these additional packages are needed:\MessageBreak%
  \string\usepackage[T1]{fontenc}\MessageBreak%
  \string\usepackage{amsfonts}\MessageBreak%
  \string\usepackage[math]{cellspace}\MessageBreak%
  \string\usepackage{xcolor}\MessageBreak%
  \string\pagecolor{white}\MessageBreak%
  especially before hyperref and thumbs,\MessageBreak%
  but best right after the \string\documentclass!\MessageBreak%
 }

%    \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}[2010/12/23]% v3.10
%    \end{macrocode}
%
% as well as some other packages:
%
%    \begin{macrocode}
\RequirePackage{atbegshi}[2011/01/30]% v1.15
\RequirePackage{xcolor}[2007/01/21]% v2.11
\RequirePackage{picture}[2009/10/11]% v1.3
\RequirePackage{alphalph}[2010/04/18]% v2.3
%    \end{macrocode}
%
% For the total number of the current page we need the \xpackage{pagesLTS}
% package of myself (see subsection~\ref{ss:Downloads}):
%
%    \begin{macrocode}
\RequirePackage{pagesLTS}[2011/03/17]% v1.1o
\RequirePackage{rerunfilecheck}[2011/04/15]% v1.7
\RequirePackage{ifthen}[2001/05/26]% v1.1c; for \whiledo
\RequirePackage{warning}[2001/08/17]% v0.01
%    \end{macrocode}
%
% A last information for the user:
%
%    \begin{macrocode}
%% thumbs may work with earlier versions of those packages,
%% but this was not tested. Please consider updating your 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.\\
%
% The options are introduced:
%
%    \begin{macrocode}
\SetupKeyvalOptions{family=thumbs,prefix=thumbs@}
\DeclareStringOption[white]{pagecolor}[white]% \thumbs@pagecolor
\DeclareStringOption{linefill}[dots]
\DeclareStringOption[rule]{thumblink}[rule]
\DeclareStringOption[47pt]{minheight}[47pt]
\DeclareStringOption{height}[auto]
\DeclareStringOption{width}[auto]
\DeclareStringOption{distance}[2mm]
\DeclareStringOption{topthumbmargin}[auto]
\DeclareStringOption{bottomthumbmargin}[auto]
\DeclareBoolOption[true]{verbose}

\ProcessKeyvalOptions*

\ifthumbs@verbose
\else
  \PackageWarningNoLine{thumbs}{Option verbose=false found:\MessageBreak%
    You will lose some information.}
\fi

%    \end{macrocode}
%
% \DescribeMacro{pagecolor}
% We set the (background) page colour to |\thumbs@pagecolor|, because the
% \texttt{xcolour} package needs a defined colour here (it~can be changed later).
%
%    \begin{macrocode}
\pagecolor{\thumbs@pagecolor}

%    \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}
%
% 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@mbposytop
\newdimen\th@mbposybottom
\newdimen\th@mbwidthxtoc
\newdimen\th@mbsposytocy
\newdimen\th@mbsposytocyy

\newdimen\th@mbsdistance% vertical distance between thumb marks
\ifx\thumbs@distance\empty%
  \setlength{\th@mbsdistance}{1mm}
\else
  \setlength{\th@mbsdistance}{\thumbs@distance}
\fi

%    \end{macrocode}
%
% We create a new |Box| for the thumbs, a~temporary counter and make some
% global definitions.
%
%    \begin{macrocode}
\newbox\ThumbsBox

%    \end{macrocode}
%
% Generally it is not necessary to initialise a counter, because this is done
% automatically. But some packages change the handling of counters
% (e.\,g.~the \xpackage{localloc} package as of 1995/09/24, v1.1b), and then
% a~new counter might have a value different from zero (or the register might
% even contain something which is not a number value at all but some other
% string).
%
%    \begin{macrocode}
\newcounter{th@mbs@tmpA}
\setcounter{th@mbs@tmpA}{0}

\gdef\th@mbs{0}
\gdef\th@mbsmax{0}
\gdef\th@umbsperpage{0}

\gdef\th@mbtitle{}
\gdef\th@mbtext{}
\gdef\th@mbtextcolour{\thumbs@pagecolor}
\gdef\th@mbbackgroundcolour{\thumbs@pagecolor}
\gdef\th@mbcolumn{0}

\gdef\th@mbtextA{}
\gdef\th@mbtextcolourA{\thumbs@pagecolor}
\gdef\th@mbbackgroundcolourA{\thumbs@pagecolor}

\gdef\th@mbprinting{1}
\gdef\th@mbtoprint{0}
\gdef\th@mbonpage{0}
\gdef\th@mbonpagemax{0}

\gdef\th@mbcolumnnew{0}

\gdef\thumb@two{2}% There is no \pagesLTS@two (yet).

\gdef\th@mbs@toc@level{}
\gdef\th@mbs@toc@text{}

%    \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}
%
% \pagebreak
%
% In |\setth@mbheight| the height of a thumb mark (for automatically thumb heights)
% is computed as
%\begin{verbatim}
% "round down{((Thumbs extension) / (Number of Thumbs)) - (distance between Thumbs)}"
%\end{verbatim}
% .
%
%    \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
  \setcounter{th@mbs@tmpA}{\th@mbsmax}
  \ifnum\value{th@mbs@tmpA}>1
    \divide\th@mbheighty\th@mbsmax
  \fi
  \advance\th@mbheighty-\th@mbsdistance
  % Remove numbers behind the decimal seperator, e.g. 13.67777 pt -> 13 pt:
  \@settopoint\th@mbheighty%
  }

%    \end{macrocode}
%
% At the beginning of the document |\AtBeginDocument| is executed.
%
%    \begin{macrocode}
\AtBeginDocument{%
  \setlength{\th@mbposyA}{1pt}
  \ifdim \thumbs@minheight < \th@mbposyA% too small
    \setlength{\thumbs@minheight}{1pt}
  \else
    \ifdim \thumbs@minheight = \th@mbposyA% small, but ok
    \else
      \ifdim \thumbs@minheight > \th@mbposyA% ok
      \else
        \PackageError{thumbs}{Option minheight has invalid value}{%
          Please use a number and a length unit (e.g. mm, cm, pt)\MessageBreak%
          and no space between as value for option minheight\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{\th@mbposyA}{\thumbs@minheight}
%    \end{macrocode}
%
% This should be a temporary dimension, but we do not want to waste
% a~|newdimension|, and |\th@mbposyA| is not used here yet and
% will be set later.\\
% Thumb height |\th@mbheighty| is treated. If the value is empty,
% it is set to |\th@mbposyA|, which was just defined to be $47\unit{pt}$
% (by default, or to the value choosen by the user with package option
% |minheight={...}|):
%
%    \begin{macrocode}
  \ifx\thumbs@height\empty%
    \setlength{\th@mbheighty}{\th@mbposyA}
  \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 enought:\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+\th@mbposyA% = \thumbs@minheight
     \fi
    \else
%    \end{macrocode}
%
% When a value has been given for the thumb marks' height, this fixed value is used.
%
%    \begin{macrocode}
      \PackageInfo{thumbs}{Now setting thumbs' height to \thumbs@height.\MessageBreak}
      \setlength{\th@mbheighty}{\thumbs@height}
    \fi
  \fi
%    \end{macrocode}
%
% Read in the |\jobname.tmb|-file:
%
%    \begin{macrocode}
  \newread\@instreamthumb%
%    \end{macrocode}
%
% Setting the thumb mark width (|\th@mbwidthx|):
%
%    \begin{macrocode}
  \setlength{\th@mbwidthx}{\paperwidth}
  \advance\th@mbwidthx-\textwidth
  \divide\th@mbwidthx4
  \setlength{\th@mbposyA}{0sp}
  \ifx\thumbs@width\empty%
  \else
    \def\th@mbstest{auto}
    \ifx\thumbs@width\th@mbstest%
    \else
      \ifdim \thumbs@width > \th@mbposyA% OK
        \setlength{\th@mbwidthx}{\thumbs@width}
      \else
        \PackageError{thumbs}{Thumbs not wide enought}{%
          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
%    \end{macrocode}
%
% Setting the position of the first/top thumb mark. Vertical (y) position
% is a little bit complicated, because option |\thumbs@topthumbmargin| must be handeled:
%
%    \begin{macrocode}
  % Thumb position x \th@mbposx
  \setlength{\th@mbposx}{\paperwidth}
  \advance\th@mbposx-\th@mbwidthx
  \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+\voffset
    \advance\th@mbposy+\topmargin
    \advance\th@mbposy-\thumbs@distance
    \advance\th@mbposy+\th@mbheighty
  \else
    \setlength{\th@mbposyA}{-1pt}
    \ifdim \thumbs@topthumbmargin > \th@mbposyA% 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-\thumbs@distance
    \advance\th@mbposy+\th@mbheighty
  \fi
  \setlength{\th@mbposytop}{\th@mbposy}
%    \end{macrocode}
%
% 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}
    \advance\th@mbposybottom+\voffset
    \advance\th@mbposybottom+\topmargin
    \advance\th@mbposybottom-\thumbs@distance
    \advance\th@mbposybottom+\th@mbheighty
    \advance\th@mbposybottom+\headheight
    \advance\th@mbposybottom+\headsep
    \advance\th@mbposybottom+\textheight
    \advance\th@mbposybottom+\footskip
    \advance\th@mbposybottom-\thumbs@distance
    \advance\th@mbposybottom-\th@mbheighty
  \else
    \setlength{\th@mbposyA}{\paperheight}
    \advance\th@mbposyA-\thumbs@bottomthumbmargin
    \advance\th@mbposyA-\th@mbposytop
    \advance\th@mbposyA-\thumbs@distance
    \advance\th@mbposyA-\th@mbheighty
    \advance\th@mbposyA-\thumbs@distance
    \ifdim \th@mbposyA > 0sp%ok
    \else
      \setlength{\th@mbposyA}{\paperheight}
      \advance\th@mbposyA-\th@mbposytop
      \advance\th@mbposyA-\thumbs@distance
      \advance\th@mbposyA-\th@mbheighty
      \advance\th@mbposyA-\thumbs@distance
      \advance\th@mbposyA-1pt
      \PackageWarning{thumbs}{Thumbs column ending too high.\MessageBreak%
        Option bottomthumbmargin has value '\thumbs@bottomthumbmargin'.\MessageBreak%
        bottomthumbmargin will be set to '\the\th@mbposyA'.\MessageBreak%
       }
      \global\edef\thumbs@bottomthumbmargin{\the\th@mbposyA}
    \fi
    \setlength{\th@mbposyA}{\thumbs@bottomthumbmargin}
    \setlength{\@tempdimc}{-1pt}
    \ifdim \th@mbposyA < \@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
%    \end{macrocode}
%
% \pagebreak
%
% |\th@mbposyA| is no longer used as temporary dimension here, but 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}
%
% \DescribeMacro{\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%
    \addthumb{}{}{\thumbs@pagecolor}{\thumbs@pagecolor}%
    \th@mb@dvance%
  \fi%
  }

%    \end{macrocode}
%
% \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|.
%
%    \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}
%
% \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 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]{%
  \global\edef\th@mb@titlelabel{#5}%
  \addthumb{#1}{#2}{#3}{#4}%
  \global\edef\th@mb@titlelabel{}%
  }

%    \end{macrocode}
%
% \DescribeMacro{\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%
    \PackageWarning{thumbs}{%
      Thumbs column full, starting another column.\MessageBreak%
      }%
    \setlength{\th@mbposy}{\th@mbposytop}%
    \advance\th@mbposy\thumbs@distance%
    \ifx\th@mbcolumn\pagesLTS@zero%
      \global\edef\th@umbsperpage{\th@mbs}%
      \gdef\th@mbcolumn{1}%
    \fi%
  \fi%
  \setcounter{th@mbs@tmpA}{\th@mbs}%
  \addtocounter{th@mbs@tmpA}{+1}%
  \global\edef\th@mbs{\arabic{th@mbs@tmpA}}%
%    \end{macrocode}
%
% We do not want any labels or index or glossary entries confusing the
% table of thumbs entries:
%
%    \begin{macrocode}
  {\let\label\@gobble%
   \let\index\@gobble%
   \let\glossary\@gobble%
%    \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}
%
% |\@ifpackageloaded| cannot be used after |\AtBeginDocument|, so here
% it is not checked for the \xpackage{hyperref} package, but for its
% |\Hy@Warning| command. If some other package or user is defining |\Hy@Warning|,
% \xpackage{thumbs} will falsely assume, that \xpackage{hyperref} has been loaded,
% but by my humble opinion, defining |\Hy@Warning| does not make sense and
% is bad style (except definition by the \xpackage{hyperref} package itself,
% of course). Into the |\jobname.tmb| file a |\thumbcontents| entry is written.
% If \xpackage{hyperref} is found, a |\phantomsection| is placed, 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}
  \@ifundefined{Hy@Warning}{% hyperref not loaded
    }{% hyperref loaded
      \phantomsection%
      \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). Instead of using |\...A|,
% |\...B| and so on, I really would like to generate this dynamically.
% If anybody could tell me how to do this, please send me an e-mail, thanks!
%
% \pagebreak
%
%    \begin{macrocode}
  \ifx\th@mbcolumnnew\pagesLTS@one%
  \else%
    \setcounter{th@mbs@tmpA}{\th@mbonpage}%
    \addtocounter{th@mbs@tmpA}{+1}%
    \global\edef\th@mbonpage{\arabic{th@mbs@tmpA}}%
  \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 pagebreak?\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%
      \ifnum\th@mbonpage=2%
        \ifnum\th@mbonpagemax>1%
        \else \gdef\th@mbonpagemax{2}%
        \fi%
        \gdef\th@mbtextB{#2}%
        \gdef\th@mbtextcolourB{#3}%
        \gdef\th@mbbackgroundcolourB{#4}%
      \else%
        \ifnum\th@mbonpage=3%
          \ifnum\th@mbonpagemax>2%
          \else \gdef\th@mbonpagemax{3}%
          \fi%
          \gdef\th@mbtextC{#2}%
          \gdef\th@mbtextcolourC{#3}%
          \gdef\th@mbbackgroundcolourC{#4}%
        \else%
          \ifnum\th@mbonpage=4%
            \ifnum\th@mbonpagemax>3%
            \else \gdef\th@mbonpagemax{4}%
            \fi%
            \gdef\th@mbtextD{#2}%
            \gdef\th@mbtextcolourD{#3}%
            \gdef\th@mbbackgroundcolourD{#4}%
          \else%
            \ifnum\th@mbonpage=5%
              \ifnum\th@mbonpagemax>4%
              \else \gdef\th@mbonpagemax{5}%
              \fi%
              \gdef\th@mbtextE{#2}%
              \gdef\th@mbtextcolourE{#3}%
              \gdef\th@mbbackgroundcolourE{#4}%
            \else%
              \ifnum\th@mbonpage=6%
                \ifnum\th@mbonpagemax>5%
                \else \gdef\th@mbonpagemax{6}%
                \fi%
                \gdef\th@mbtextF{#2}%
                \gdef\th@mbtextcolourF{#3}%
                \gdef\th@mbbackgroundcolourF{#4}%
              \else%
%    \end{macrocode}
%
% Dynamical creation also would overcome the limitation of six thumb marks on
% a single page. It would be possible to continue with |\...G| and so on, but
% this increases the code further -- and where to stop?
%
%    \begin{macrocode}
                \PackageError{thumbs}{Too many thumbs on one page!}{%
                  You tried to placed more than six (!) thumb marks on a single page,\MessageBreak%
                  (approximate page number: \thepage ).\MessageBreak%
                  Maybe insert a \string\pagebreak or \string\newpage?\MessageBreak%
                  No following thumb marks will show on this page, sorry.\MessageBreak%
                  If you absolutly need more marks on one page,\MessageBreak%
                  please write an e-mail to the package maintainer.\MessageBreak%
                 }%
              \fi%
            \fi%
          \fi%
        \fi%
      \fi%
    \else%
      \ifnum\th@mbonpagemax<\th@mbonpage%
        \global\edef\th@mbonpagemax{\th@mbonpage}%
      \fi%
    \fi%
  \fi%
  \ifx\th@mbcolumnnew\thumb@two% There is no \pagesLTS@two (yet).
    \gdef\th@mbcolumnnew{0}%
  \fi%
  \gdef\th@mbtoprint{1}%
  }

%    \end{macrocode}
%
% \DescribeMacro{\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}
%
% \DescribeMacro{\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}
%
% \DescribeMacro{\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 issueing 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\thumb@two%
    \def\th@mb@tmp@column{0}%
  \fi%
  \setlength{\th@mbwidthxtoc}{\paperwidth}%
  \advance\th@mbwidthxtoc-1in%
  \advance\th@mbwidthxtoc-\hoffset%
  \advance\th@mbwidthxtoc-\oddsidemargin%
%    \end{macrocode}
%
% \pagebreak
%
%    \begin{macrocode}
  \put(1in+\hoffset+\oddsidemargin,-\th@mbposy){%
    \begin{picture}(0,0)%
%    \end{macrocode}
%
% When the option |thumblink=rule| was choosen, 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@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%
      \begin{picture}(0,0)(0,-0.5\th@mbheighty+384930sp)%
        \bgroup%
          \setlength{\parindent}{0pt}%
          \vbox% to \textwidth
           {\hsize=\textwidth {%
%    \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.
%
%    \begin{macrocode}
      \begin{picture}(0,0)(1in+\hoffset+\oddsidemargin-\th@mbxpos,-0.5\th@mbheighty+384930sp)%
        \bgroup%
          \setlength{\parindent}{0pt}%
          \makebox[\th@mbwidthx][r]{{\color{\th@mb@tmp@textcolour}\th@mb@tmp@text \space}}%
        \egroup%
      \end{picture}%
    \fi%
    }%
  }

%    \end{macrocode}
%
% \DescribeMacro{\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}
%
% \pagebreak
%
% \DescribeMacro{\th@mbprint}
% |\th@mbprint| places a |picture| containing the thumb mark on the page.
%
%    \begin{macrocode}
\newcommand{\th@mbprint}[3]{%
  \put(\th@mbxpos,-\th@mbposyA){%
    \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}%
       \ifodd\c@CurrentPage%
         \if@twoside%
           \makebox[\th@mbwidthx][l]{{\color{#2}\hspace*{1pt}\space #1}}%
         \else%
           \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}%
         \fi%
       \else%
         \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}%
       \fi%
     \egroup%
   \end{picture}%
  }%
 }

%    \end{macrocode}
%
% \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%
  \setcounter{th@mbs@tmpA}{\value{CurrentPage}}%
  \addtocounter{th@mbs@tmpA}{-1}% because CurrentPage is already the one of the next page
  \def\th@mbxpos{\th@mbposx}%
  \ifodd\c@th@mbs@tmpA% \relax
  \else%
    \if@twoside \def\th@mbxpos{-1pt}% \else \relax
    \fi%
  \fi%
  \AtBeginShipoutUpperLeft{%
    \setcounter{th@mbs@tmpA}{\th@mbonpage}%
    \ifx\th@mbprinting\pagesLTS@one%
      \th@mbprint{\th@mbtextA}{\th@mbtextcolourA}{\th@mbbackgroundcolourA}%
      \ifnum\value{th@mbs@tmpA}>1%
        \th@mb@yA%
        \th@mbprint{\th@mbtextB}{\th@mbtextcolourB}{\th@mbbackgroundcolourB}%
        \ifnum\value{th@mbs@tmpA}>2%
          \th@mb@yA%
          \th@mbprint{\th@mbtextC}{\th@mbtextcolourC}{\th@mbbackgroundcolourC}%
          \ifnum\value{th@mbs@tmpA}>3%
            \th@mb@yA%
            \th@mbprint{\th@mbtextD}{\th@mbtextcolourD}{\th@mbbackgroundcolourD}%
            \ifnum\value{th@mbs@tmpA}>4%
              \th@mb@yA%
              \th@mbprint{\th@mbtextE}{\th@mbtextcolourE}{\th@mbbackgroundcolourE}%
              \ifnum\value{th@mbs@tmpA}>5%
                \th@mb@yA%
                \th@mbprint{\th@mbtextF}{\th@mbtextcolourF}{\th@mbbackgroundcolourF}%
                \ifnum\value{th@mbs@tmpA}>6%
                  \PackageWarning{thumbs}{Too many thumbs on one page,\MessageBreak%
                    please see error message already given above.\MessageBreak%
                   }%
                \fi%
              \fi%
            \fi%
          \fi%
        \fi%
      \fi%
    \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}
    \ifnum\value{th@mbs@tmpA}<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}
%
% \pagebreak
%
% \DescribeMacro{\AfterLastShipout}
%
%    \begin{macrocode}
\AfterLastShipout{%
  \ifx\th@mbcolumnnew\pagesLTS@zero% ok
  \else
    \PackageWarningNoLine{thumbs}{%
      Still missing \string\addthumb\space after \string\thumbnewcolumn\space after\MessageBreak%
      last shipout: 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
% and the total number of thumb marks 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
    \global\edef\th@umbsperpage{\th@mbs}
    \gdef\th@mbcolumn{1}
  \fi
  \ifx\th@umbsperpage\pagesLTS@zero
    \gdef\th@umbsperpage{\th@mbs}% \th@mbs was increased with each \addthumb
  \fi
  \if@filesw
    \immediate\write\@auxout{\string
      \gdef\string\th@umbsperpage{\th@umbsperpage}}
    \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}
%
% \pagebreak
%
% \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|.
%
%    \begin{macrocode}
\newcommand{\addthumbsoverviewtocontents}[2]{%
  \gdef\th@mbs@toc@level{#1}
  \gdef\th@mbs@toc@text{#2}
  }

%    \end{macrocode}
%
% \DescribeMacro{\thumbsoverview}
% |\thumbsoverview| is used to place the overview page(s) for the thumb marks.
% Its parameter is used to mark this page/these pages (e.\,g. in the page header).
% If these marks are not whished, |\thumbsoverview{}| will generate empty marks in the
% page header(s). |\thumbsoverview| could be used more than once (for example at the
% beginning and at the end of the document), but the label |TableOfThumbs| would than
% be multilpy defined (no great harm done, but hyperlinks will only link to one of the
% labels). |\thumbsoverview| works by calling the internal command |\th@mbs@verview|
% (see below), repeating this until all thumb marks have been processed.
%
%    \begin{macrocode}
\newcommand{\thumbsoverview}[1]{%
%    \end{macrocode}
%
% Option |\thumbs@thumblink| is checked for a valid and resonable value here.
%
%    \begin{macrocode}
  \def\th@mbstest{none}%
  \ifx\thumbs@thumblink\th@mbstest% OK
  \else%
    \@ifundefined{Hy@Warning}{% hyperref not loaded
      \PackageError{thumbs}{Option thumblink != 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}%
      }{% 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 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%
    }%
  \fi%
%    \end{macrocode}
%
% When the thumb overview is printed and there is already a thumb mark set,
% for example for the frontmatter (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}%
  \stopthumb%
  \markboth{\MakeUppercase #1 }{\MakeUppercase #1 }
  \setlength{\th@mbsposytocy}{\th@mbposy}
  \setlength{\th@mbposy}{\th@mbsposytocyy}
  \newcounter{th@mblinea}
  \setcounter{th@mblinea}{1}
  \newcounter{th@mblineb}
  \setcounter{th@mblineb}{\th@umbsperpage}
  \newcounter{FileLine}
  \setcounter{FileLine}{1}
  \newcounter{thumbsstop}
  \setcounter{thumbsstop}{1}
  \addtocounter{thumbsstop}{\th@mbsmax}
  \whiledo{\value{FileLine}<\value{thumbsstop}}
    {\if@twoside \cleardoublepage%
     \else \clearpage%
     \fi%
%    \end{macrocode}
%
% When the \xpackage{hyperref} package is used, one might like to refer to the
% thumb overview page(s), therefore a phantomsection is added and a label
% |TableOfThumbs| is placed here. When |\addthumbsoverviewtocontents| was used,
% the entry is placed into the table of contents.
%
%    \begin{macrocode}
     \ifnum\value{FileLine}=1%
       \@ifundefined{Hy@Warning}{}{\phantomsection \label{TableOfThumbs}}%
       \ifx\th@mbs@toc@level\empty%
       \else \addcontentsline{toc}{\th@mbs@toc@level}{\th@mbs@toc@text}%
       \fi%
     \fi%
     \null%
     \th@mbs@verview%
     \pagebreak%
     \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}
%
% 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}
%
% \DescribeMacro{\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 %
          \whiledo{\value{FileLine}<\value{th@mblineb}}
           {\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  X \string<return\string>  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  \string<return\string>  to proceed.\MessageBreak%
                    ! If that does not work,\MessageBreak%
                    ! you might 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}%
        \setcounter{th@mbs@tmpA}{\th@mbsmax}%
        \ifnum \value{th@mblineb}>\value{th@mbs@tmpA}
          \setcounter{th@mblineb}{\value{th@mbs@tmpA}}%
        \fi%
      }{% else
        \addglobalwarning{%
          \PackageWarningNoLine{thumbs}{%
            File \jobname.tmb not found.\MessageBreak%
            Rerun to get thumbs overview page(s) right.\MessageBreak%
           }%
         }%
       }%
      }%
    }%
  }

%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \pagebreak
%
% \section{Installation}
%
% \subsection{Downloads\label{ss:Downloads}}
%
% Everything should be available on \CTAN{}, \url{http://www.ctan.org/tex-archive/},
% 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[-] package \xpackage{geometry}, 2010/09/12, v5.6, \CTAN{macros/latex/contrib/geometry/geometry.dtx}
%
% \item[-] document class \textsf{ltxdoc}, 2007/11/11, v2.0u, \CTAN{macros/latex/base/ltxdoc.dtx}
%
% \item[-] package \xpackage{holtxdoc}, 2011/02/04, v0.21, \CTAN{macros/latex/contrib/oberdiek/holtxdoc.dtx}
%
% \item[-] package \xpackage{hypdoc}, 2010/03/26, v1.9, \CTAN{macros/latex/contrib/oberdiek/hypdoc.dtx}
% \end{description}
%
% \DescribeMacro{thumbs.sty}
% The \texttt{thumbs.sty} for \LaTeXe\ (i.\,e. all documents using
% the \xpackage{thumbs} package) requires:
% \begin{description}
% \item[-] \TeX Format \LaTeXe, \url{http://www.CTAN.org/}
%
% \item[-] package \xpackage{kvoptions}, 2010/12/23, v3.10, \CTAN{macros/latex/contrib/oberdiek/kvoptions.dtx}
%
% \item[-] package \xpackage{atbegshi}, 2011/01/30, v1.15, \CTAN{macros/latex/contrib/oberdiek/atbegshi.dtx}
%
% \item[-] package \xpackage{xcolor}, 2007/01/21, v2.11, \CTAN{macros/latex/contrib/xcolor/xcolor.dtx}
%
% \item[-] package \xpackage{picture}, 2009/10/11, v1.3, \CTAN{macros/latex/contrib/oberdiek/picture.dtx}
%
% \item[-] package \xpackage{alphalph}, 2010/04/18, v2.3, \CTAN{macros/latex/contrib/oberdiek/alphalph.dtx}
%
% \item[-] package \xpackage{pagesLTS}, 2011/03/17, v1.1o, \CTAN{macros/latex/contrib/pageslts/pagesLTS.dtx}
%
% \item[-] package \xpackage{rerunfilecheck}, 2011/04/15, v1.7, \CTAN{macros/latex/contrib/oberdiek/rerunfilecheck.dtx}
%
% \item[-] package \xpackage{ifthen}, 2001/05/26, v1.1c, \CTAN{macros/latex/base/ifthen.dtx}
%
% \item[-] package \xpackage{warning}, 2001/08/17, v0.01, \CTAN{macros/latex/contrib/warning/warning.sty}
%
% \end{description}
%
% \DescribeMacro{SW/SWP}
% When compiling with SWP 5.50 Build 2960, these additional packages are needed:
%
% \begin{quote}
%\begin{verbatim}
%\usepackage[T1]{fontenc}
%\usepackage{amsfonts}
%\usepackage[math]{cellspace}
%\usepackage{xcolor}
%\pagecolor{white}
%\end{verbatim}
% \end{quote}
%
% \noindent especially before \xpackage{hyperref} and \xpackage{thumbs}, but best right after the |\documentclass|!
% (The options for those packages might be changed by the user -- I did not test all available options,
%  thus first test, whether the document can be compiled with these options, and then try to change them
%  according to your whishes.)
%
% \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, \CTAN{fonts/eurosym.zip}

% \item[-] package \xpackage{lipsum}, 2011/04/14, v1.2, \CTAN{macros/latex/contrib/lipsum/lipsum.dtx}
%
% \item[-] package \xpackage{hyperref}, 2011/04/17, v6.82g, \CTAN{macros/latex/contrib/hyperref/hyperref.dtx}
%
% \item[-] package \xpackage{thumbs}, 2011/05/14, v1.0a, \CTAN{macros/latex/contrib/thumbs/thumbs.dtx}\\
%   (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
% \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, \CTAN{macros/latex/contrib/eso-pic/eso-pic.dtx}
%
% \item[-] \xpackage{fancytabs}, 2011/04/16 v1.1, \CTAN{macros/latex/contrib/fancytabs/fancytabs.dtx}
%
% \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, \CTAN{macros/latex/contrib/thumb/thumb.dtx}
%
% \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,
%  \CTAN{macros/latex/contrib/fancyhdr/fancyhdr.pdf}
%
% \item[-] \xpackage{thumbpdf}, 2010/07/07, v3.11, \CTAN{support/thumbpdf/thumbpdf.sty}
%
% \item[-] \xpackage{thumby}, 2010/01/14, v0.1, \CTAN{macros/latex/contrib/thumby/thumby.sty}
% \end{description}
%
% \DescribeMacro{Oberdiek}
% \DescribeMacro{holtxdoc}
% \DescribeMacro{alphalph}
% \DescribeMacro{atbegshi}
% \DescribeMacro{kvoptions}
% \DescribeMacro{picture}
% \DescribeMacro{rerunfilecheck}
% All packages of Heiko Oberdiek's bundle `oberdiek'
% (especially \xpackage{holtxdoc}, \xpackage{alphalph}, \xpackage{atbegshi}, \xpackage{kvoptions},
% \xpackage{picture}, and \xpackage{rerunfilecheck})
% are also available in a TDS compliant ZIP archive:\\
% \CTAN{install/macros/latex/contrib/oberdiek.tds.zip}.\\
% It is probably best to download and use this, because the packages in there
% should be both recent and compatible.\\
%
% \vspace{1.5cm}
%
% \DescribeMacro{M\"{u}nch}
% A hyperlinked list of my (other) packages can be found at \url{http://www.Uni-Bonn.de/~uzs5pv/LaTeX.html}.
%
% \pagebreak
%
% \subsection{Package, unpacking TDS}
%
% \paragraph{Package.} This package should be available on \CTAN{}:
% \begin{description}
% \item[\CTAN{macros/latex/contrib/thumbs/thumbs.dtx}]\hspace*{0.1cm} \\
%       The source file.
% \item[\CTAN{macros/latex/contrib/thumbs/thumbs.pdf}]\hspace*{0.1cm} \\
%       The documentation.
% \item[\CTAN{macros/latex/contrib/thumbs/thumbs-example.pdf}]\hspace*{0.1cm} \\
%       The compiled example file, as it should look like.
% \item[\CTAN{macros/latex/contrib/thumbs/README}]\hspace*{0.1cm} \\
%       The README file.
% \item[\CTAN{install/macros/latex/contrib/thumbs.tds.zip}]\hspace*{0.1cm} \\
%       Everything in 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, see the preceding subsection.
%
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
% \docstrip\ archive. The files are extracted by running the
% \xfile{.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.sty\\
%   thumbs.pdf & doc/latex/thumbs.pdf\\
%   thumbs-example.tex & doc/latex/thumbs-example.tex\\
%   thumbs-example.pdf & doc/latex/thumbs-example.pdf\\
%   thumbs.dtx & source/latex/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
% 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 this
% 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.drv
%makeindex -s gind.ist thumbs.idx
%pdflatex thumbs.drv
%makeindex -s gind.ist thumbs.idx
%pdflatex thumbs.drv
%\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.
%
% \section{Acknowledgements}
%
% I would like to thank \textsc{Heiko Oberdiek}
% (heiko dot oberdiek at googlemail dot com) 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 for their help in all things \TeX.
%
% \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 \CTAN{}.
%   \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.)\\
%
% Note: \textsf{Q}, \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