summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/logpap/logpap.dtx
blob: 44e201e047476c07fe607219c4f04e15b80d833a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
% \iffalse meta-comment
%
% Package logpap
% Copyright (c) 2004 Mike Kaufmann, all rights reserved
%
% This program is provided under the terms of the
% LaTeX Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt.
%
% Author: Mike Kaufmann
%         Mike.Kaufmann@ei.fh-giessen.de
% \fi
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
% \CheckSum{1968}
%
% \iffalse meta-comment
%
%<*package>
\def\fileversion{0.6}
\def\filedate{2004/02/01}
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{logpap}
\setlength{\unitlength}{1mm}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\begin{document}
   \DocInput{logpap.dtx}
\end{document}
%</driver>
%
%<*package>
% \fi
%
% \DoNotIndex{\,,\ }
% \DoNotIndex{\@@end,\@break@tfor,\@empty,\@ifnextchar}
% \DoNotIndex{\@ne,\@tempa,\@tempb,\@tempc,\@tempd,\@tempcnta,\@tempcntb}
% \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tfor}
% \DoNotIndex{\advance}
% \DoNotIndex{\begin,\begingroup}
% \DoNotIndex{\csname,\color,\CurrentOption}
% \DoNotIndex{\DeclareOption,\def,\divide,\do}
% \DoNotIndex{\edef,\else,\end,\endgroup,\endcsname,\ExecuteOption}
% \DoNotIndex{\expandafter,\ExecuteOptions}
% \DoNotIndex{\fi,\filedate,\fileversion}
% \DoNotIndex{\global}
% \DoNotIndex{\if,\ifcase,\ifcat,\ifdim,\ifnum,\ifx,\InputIfFileExists}
% \DoNotIndex{\LaTeX,\let,\line,\linethickness,\loop}
% \DoNotIndex{\m@ne,\makebox,\multiply,\MessageBreak}
% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newdimen,\newif}
% \DoNotIndex{\or}
% \DoNotIndex{\p@,\PackageError,\PackageWarning,\PackageInfo}
% \DoNotIndex{\PassOptionToPackage,\ProcessOptions,\ProvidesPackage,\put}
% \DoNotIndex{\quad}
% \DoNotIndex{\real,\relax,\renewcommand,\repeat,\RequirePackage}
% \DoNotIndex{\setlength,\settoheight,\scriptsize,\space,\strut}
% \DoNotIndex{\the,\textsf,\times,\typeout}
% \DoNotIndex{\unitlength}
% \DoNotIndex{\xdef,\z@}
%
% ^^A\changes{0.3}{2004/01/20}{initial release}
%
% ^^A \MakeShortVerb{\+}
% ^^A \DeleteShortVerb{\|}
%
% \makeatletter
% \let\PrintDescribeOpt\PrintDescribeEnv
% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
%     \Describe@Opt}
% \def\Describe@Opt#1{\endgroup
%     \marginpar{\raggedleft\PrintDescribeOpt{#1}}%
%     \SpecialOptIndex{#1}\@esphack\ignorespaces}
% \def\SpecialOptIndex#1{\@bsphack
%     \index{#1\actualchar{\protect\ttfamily#1}
%            (option)\encapchar usage}%
%     \index{options:\levelchar{\protect\ttfamily#1}\encapchar
%            usage}\@esphack}
% \makeatother
%
% \newcommand*{\bs}{\char '134 }
% \newcommand*{\lb}{\char '173 }
% \newcommand*{\rb}{\char '175 }
% \newcommand*{\param}[1]{\texttt{\textit{#1}}}
% \newcommand*{\lp}{\textsf{logpap}}
% \newcommand*{\newmac}{\vspace{2ex}\noindent}
%
% \title{The \lp\ Package\\Logarithmic Graph Paper with \LaTeX}
% \author{Mike Kaufmann\\|Mike.Kaufmann@ei.fh-giessen.de|}
% \date{\filedate (v\fileversion)}
% ^^A--------------------------------------------------------------------------
% \maketitle
% \begin{abstract}
% The \lp\ package provides four macros for drawing logarithmic-logarithmic,
% logarithmic-linear, linear-logarithmic and (because it was easy to implement)
% linear-linear graph paper with \LaTeX.
% \end{abstract}
%
% \tableofcontents
%
% ^^A--------------------------------------------------------------------------
% \section{Introduction}
% \subsection{Why this Package}
% Well, at least here in Germany logarithmic graph paper is expensive. And you
% might not get graph paper with the number of decades you just need. With the
% \lp\ package you can make your own graph paper now. And you can get your
% graph paper even when shops are closed.\footnote{The first parts of this
% package were made a weekend before I needed logarithmic graph paper for an
% experiment report, because the experiment took place on Monday morning.}
%
% ^^A---------------------------------------------
% \subsection{Packages used by the \lp\ Package}
% The \lp\ package uses the following two packages
% \begin{description}
% \item[calc] used for some divisions by a real number
% \item[color] used for drawing the graph paper in color
% \end{description}
%
% ^^A---------------------------------------------
% \subsection{Legal Stuff}
% This program is provided under the terms of the
% \LaTeX\ Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt.
%
% ^^A--------------------------------------------------------------------------
% \section{Overview}\label{sec:ov}
% Altough the \lp\ package only draws logarithmic graph paper, there are
% various things that can be changed. Figure \ref{fig:ov} will give an
% overwiev. Here the first graph paper part where made with the default
% settings and the command
% |\put(0,105){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}|.
% On the right side you can find the commands used to change the appearance.
%
% Not all commands possible are shown here. Every option can be used with
% |\LPSet{|\param{option1}|,|\param{option2}|,...}| within the document,
% every \param{option} has a counterpart |no|\param{option} and for every
% \param{option}|x| also an \param{option}|y| exists. Also commands to set
% the three line widths, colors and the appearance of the $\mu$ are not shown.
%
% \begin{figure}[ht]
% \centering
% \begin{picture}(140,120)
% \put( 0,105){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}
% \put(85,110){\makebox(0,0)[cl]{with default settings}}
%
% \LPSet{nodimensions,noticksupright,tenlower}
% \put( 0, 80){\loglinpap(80mm,10mm)(1,1){1}{0}[optional][optional]}
% \put(85, 89){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb nodimensions,}}}
% \put(85, 85){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ noticksupright,}}}
% \put(85, 81){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ tenlower\rb}}}
% \LPSet{dimensions,ticksupright,notenlower}
%
% \LPSet{notext,nofsnx}\DefineLPMinLineDist{1.9999mm}
% \put( 0, 55){\loglinpap(80mm,10mm)(1,1){1}{0}}
% \put(85, 64){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notext,}}}
% \put(85, 60){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ nofsnx\rb}}}
% \put(85, 56){\makebox(0,0)[cl]{\texttt{\bs DefineLPMinLineDist\lb 1.9999mm\rb}}}
% \LPSet{text,fsnx}\DefineLPMinLineDist{0.9999mm}
%
% \DefineLPText{new text\quad}\DefineLPLabelFont{\sffamily\tiny}\LPSet{notwoninex}
% \put( 0, 30){\loglinpap(80mm,10mm)(1,1){1}{0}}
% \put(85, 41){\makebox(0,0)[cl]{\texttt{\bs DefineLPText\lb new text\bs quad\rb}}}
% \put(85, 37){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelFont}}}
% \put(85, 33){\makebox(0,0)[cl]{\texttt{\ \ \ \ \lb\bs sffamily\bs tiny\rb}}}
% \put(85, 29){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notwoninex\rb}}}
% \DefineLPText{made with \LaTeX\ and \textsf{logpap}\quad}\DefineLPLabelFont{\scriptsize}\LPSet{twoninex}
%
% \DefineLPThickTickLen{1mm}\DefineLPMedTickLen{0.5mm}\DefineLPLabelDist{0.5mm}
% \put( 0,  5){\loglinpap(80mm,10mm)(1,1){1}{0}}
% \put(85, 14){\makebox(0,0)[cl]{\texttt{\bs DefineLPThickTickLen\lb 1mm\rb}}}
% \put(85, 10){\makebox(0,0)[cl]{\texttt{\bs DefineLPMedTickLen\lb 0.5mm\rb}}}
% \put(85,  6){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelDist\lb 0.5mm\rb}}}
% \DefineLPThickTickLen{2mm}\DefineLPMedTickLen{1mm}\DefineLPLabelDist{1mm}
% \end{picture}
% \caption{Overview}\label{fig:ov}
% \end{figure}
%
% ^^A--------------------------------------------------------------------------
% \newpage
% \section{Using the Package}
% \subsection{Drawing Logarithmic Graph Paper}\label{sec:dlgp}
% \DescribeMacro\loglogpap
% \DescribeMacro\loglinpap
% \DescribeMacro\linlogpap
% \DescribeMacro\linlinpap
% There are four commands for drwaing graph paper. They can be used as a
% single paragraph, in a \LaTeX\ \texttt{picture} environment or in a
% \LaTeX\ \texttt{figure} environment. But due to the fact that the ticks,
% the labeling, the text and the X- and Y-axis names are drawn outside of the
% given area (see first parameter), it would be the best to use them within
% a \texttt{picture} environment.
% \begin{description}
% \item[\texttt{\bs loglogpap}] draws double logarithmic graph paper
% \item[\texttt{\bs loglinpap}] draws logarithmic-linear graph paper
%       (logarithmic X-axis)
% \item[\texttt{\bs linlogpap}] draws linear-logarithmic graph paper
%       (logarithmic Y-axis)
% \item[\texttt{\bs linlinpap}] draws double linear graph paper
% \end{description}
% These macros all have six parameters:
% \begin{description}
% \item[\texttt{(\emph{x-length},\emph{y-length})}]
%       are the dimensions of the graph paper in x- and y-direction. You can
%       use everything accepted as a length by \TeX, such as a number followed
%       by a unit accepted by \TeX\ (200mm, 500pt, \ldots) or a length register
%       like |\textheight| or |\textwidth|.
% \item[\texttt{(\emph{x-decades/divisions},\emph{y-decades/divisions})}]
%       specifys the number decades for a logarithmic axis or the number of
%       divisions for a linear axis. You can use real numbers, but only the
%       first digit after the decimal point is used. For logarithmic axis a
%       value like 2.3 means that you will get two full decades (from 1 to 10)
%       and a partial decade from 1 to 3.
%
%       For logarithmic axis the minimum is 0.2 and values like $x.1$ are
%       not alowed. For linear axis the minimum is 0.1. You'll get an
%       appropriate error message if you type wrong values.
% \item[\texttt{\lb\emph{x-start},\emph{factor/increment}\rb}]
%       specifys the start value and a factor or increment for the x-axis
%       labeling.
%
%       The general format for \param{x-start} is: an optional ``$+$'' or
%       ``$-$'', followed by 1 to 3 digits, optionally followed by one of the
%       letters y, z, a, f, p, n, u, m, k, M, G, T, P, E, Z or Y. The letters
%       are for the exponents $10^{-24}$, $10^{-21}$, \ldots, $10^{21}$ and
%       $10^{24}$.
%
%       The \param{factor/increment} part is optional, it must be an integer
%       number. The default value is 1. For a logarithmic axis it is used as
%       factor, for a linear one as increment.
%
%       For logarithmic axis you can use 1, $-1$, 10, $-10$, 100 or $-100$
%       optionally followed by one of the exponent letters as start value
%       (\param{x-start}) and values from 2 to 9 as factor
%       (\param{factor/increment}). The exponent letter is included in
%       calculating the next value for a full decade. If the value is
%       1000 $\cdot$ \param{factor} it will be set to 1 $\cdot$ \param{factor}
%       and the next letter in order is appended (see first Example). Examples:
%       \begin{description}
%       \item[\texttt{\lb 10m,2\rb}] leads to ``20m'', ``200m'', ``2'',
%             ``20'', ``200'', ``2k'' and so on for the full decade and
%             ``4'', ``6'', \ldots\ ``18'' between them.
%       \item[\texttt{\lb -100\rb}] leads to ``$-100$'', ``$-1$k''
%             \ldots\ and ``$-2$'', ``$-3$'', \ldots\ ``$-9$'' between them.
%       \end{description}
%
%       For linear axis you can use a positive or negative integer number
%       optionally followed by one of the exponent letters as start value
%       (\param{x-start}) and a positive or negative one as increment
%       (\param{factor/increment}). The start value range is from $-999$ to
%       999\footnote{This restriction is caused by the parsing algorithem
%       used, which can only handle three digits in this version.}, for the
%       increment only 0 is not allowed. The exponent letter is not used when
%       calculating the next value, it is only appended to all values (see
%       first Example) and never changed (see third Example). Examples:
%       \begin{description}
%       \item[\texttt{\lb 10m,2\rb}] leads to ``10m'', ``12m'', ``14m'',
%             ``16m'', ``18m'' and so on.
%       \item[\texttt{\lb -100\rb}] leads to ``$-100$'', ``$-99$'' \ldots.
%       \item[\texttt{\lb 100,100\rb}] leads to ``100'', ``200'' \ldots
%             ``900'', ``1000''.
%       \end{description}
%
%       If the format or the values are not correct, you'll get anappropriate
%       error message.
% \item[\texttt{\lb\emph{y-start},\emph{factor/increment}\rb}]
%       specifys the start value and a factor or increment for the y-axis
%       labeling on the same way as for the x-axis.
% \item[\texttt{[\emph{x-axis name}]}]
%       specifys a name for the x-axis, it can be an mathematical expression.
%       The name is set behind the right end and under the x-axis.
%       The parameter is optional.
% \item[\texttt{[\emph{y-axis name}]}]
%       specifys a name for the y-axis, it can be an mathematical expression.
%       The name is set over the upper end and left from the y-axis.
%       The parameter is optional. If you want to have an y-axis name but no
%       x-axis name you must specify an empty x-axis name with \texttt{[]}.
% \end{description}
%
% ^^A---------------------------------------------
% \subsection{Package Options and Settings}\label{sec:opt}
% The package has eight option pairs. This means that every option
% \texttt{\emph{option}} has an counterpart \texttt{no\emph{option}}. The first
% switches on something the second switches off the same thing.
% The options are:
% \begin{description}
% \item[\texttt{[no]ticksupright}]
% \DescribeOpt{ticksupright}
% \DescribeOpt{noticksupright}
%       the drawing of ticks on the upper and the right side of the
%       graph paper will be switched on or off. Default is on.
% \item[\texttt{[no]twoninex}]
% \DescribeOpt{twoninex}
% \DescribeOpt{notwoninex}
%       applies only to logarithmic x-axis. The axis labeling for the values
%       for 2 to 9 within a decade will be switched on or off.
%       Default is on.
% \item[\texttt{[no]twoniney}]
% \DescribeOpt{twoniney}
% \DescribeOpt{notwoniney}
%       applies only to logarithmic y-axis. The axis labeling for the values
%       for 2 to 9 within a decade will be switched on or off.
%       Default is on.
% \item[\texttt{[no]fsnx}]
% \DescribeOpt{fsnx}
% \DescribeOpt{nofsnx}
%       applies only to logarithmic x-axis. The axis labeling for the values
%       for 5, 7 and 9 within a decade will be switched on or off. Note that
%       if \texttt{notwoninex} is set, the values for 5, 7 and 9 will never
%       appear. Default is on.
% \item[\texttt{[no]fsny}]
% \DescribeOpt{fsny}
% \DescribeOpt{nofsny}
%       applies only to logarithmic y-axis. The axis labeling for the values
%       for 5, 7 and 9 within a decade will be switched on or off. Note that
%       if \texttt{notwoniney} is set, the values for 5, 7 and 9 will never
%       appear. Default is on.
% \item[\texttt{[no]tenlower}]
% \DescribeOpt{tenlower}
% \DescribeOpt{notenlower}
%       applies only to logarithmic x-axis.The axis labeling for the values for
%       10 (at a decades border) will be set lower if on. Default is off.
% \item[\texttt{[no]text}]
% \DescribeOpt{text}
% \DescribeOpt{notext}
%       the text ``made with \LaTeX\ and \lp'' will be set left over the
%       graph paper if on. Default is on. The text can be changed.
% \item[\texttt{[no]dimensions}]
% \DescribeOpt{dimensions}
% \DescribeOpt{nodimensions}
%       the dimensions of the graph paper in decades and/or divisions will be
%       shown (after the text ``made with \LaTeX\ and \lp'') if on. Default
%       is on.
% \end{description}
% Options unknown by the \lp\ package will be passed to the color package. So
% you can use all options of the color package too. But note: global option
% (options passed to the document class) are not passed to the package.
%
% \newmac
% \DescribeMacro\LPSet
% Everything set with package options can allso be set with the |\LPSet|
% command. So you can have more then one graph paper with different settings
% in one document. It takes a comma seperated list of option as parameter.
% Example:
% \begin{verbatim}
% \LPSet{noticksupright,notext,nodimensions}\end{verbatim}
% ^^A\end{verbatim}
% Unknown options passed to |\LPSet| are silently ignored.
%
% The new settings are then valid from the point you called the command until
% the end of the current environment or, if not inside of an environment, until
% the end of the document.
%
% ^^A---------------------------------------------
% \subsection{Setup Commands}
% The command for changing settings done by package options were allready
% described in subsection \ref{sec:opt}. Here the rest of the setup commands
% are following. These settings are also valid from the point you called a
% command until the end of the current environment or, if not inside of an
% environment, until the end of the document.
%
% \newmac
% \DescribeMacro\DefineLPThickLineThickness
% \DescribeMacro\DefineLPMedLineThickness
% \DescribeMacro\DefineLPThinLineThickness
% As seen in section \ref{sec:ov} there are three different line widths used.
% They can be set with the commands
%
% \vspace{1ex}\noindent{\small
% \texttt{\bs DefineLPThickLineThickness\lb\emph{thickness}\rb}\\
% \texttt{\bs DefineLPMedLineThickness\lb\emph{thickness}\rb}\\
% \texttt{\bs DefineLPThinLineThickness\lb\emph{thickness}\rb}}
%
% \vspace{1ex}\noindent
% where \texttt{\emph{thickness}} can be everything accepted as a length by
% \TeX. The default values are 0.8\,pt for thick lines, 0.5\,pt for medium
% lines and 0.2\,pt for thin lines.
%
% Setting these values is a little bit critical, because they depend on the
% printer resolution.
%
% If you set the thin line thickness to the minimum line thickness your printer
% can draw, it is possible that your printer draws some thin lines with double
% thickness. With a medium line thickness of twice the thin line thickness then
% you might not be able to distinguish between thin and medium lines.
%
% With a thin line thickness value of 1.6 times the minimum line thickness of
% your printer this (hopefully) will not happen, but it might be only once
% this minimum. The medium line thickness then should be at least twice the
% thin line thickness and the thick line thickness more than three times the
% thin line thickness and more than 1.5 times the medium line thickness. Here
% the fact that a printer pixel is larger than guessed due to the resolution
% and some printers are capable of subpixel printing (printing some smaller
% pixels) where not taken into account. The default values should fit for a
% 600\,dpi printer, but anyway it would be a good idea to test them with your
% printer.
%
% This problem was the reason for supporting a configuration file (see
% subsection \ref{sec:conf}). There you can put these values for your printer
% and so there is no need to put them in every document. And if you give your
% source to anyone else he will automaticly use his own configuration file if
% he has one.
%
% \newmac
% \DescribeMacro\DefineLPMinLineDist
% With \texttt{\bs DefineLPMinLineDist\lb\emph{minimum-line-distance}\rb} you
% can set the minimum distance between the lines drawn. Note that due to
% rounding error it might be necessary to give a value a little bit lesser
% then the value you want. So the default value is not 1\,mm but 0.9999\,mm.
%
% Another thing to keep in mind is that the thick lines will allways be drawn.
% If they are to close together you will get a warning message, and an ugly
% result of course.
%
% \newmac
% \DescribeMacro\DefineLPThickTickLen
% With \texttt{\bs DefineLPThickTickLen\lb\emph{thick-tick-length}\rb} you can
% set the length of the ticks for thick lines, the default value is 2\,mm.
%
% \newmac
% \DescribeMacro\DefineLPMedTickLen
% And with \texttt{\bs DefineLPMedTickLen\lb\emph{medium-tick-length}\rb} you
% can set the length of the ticks for medium lines, the default value is 1\,mm.
%
% Note: there is no |\DefineLPThinTickLen| command, because thin lines will
% never have ticks.
%
% \newmac
% \DescribeMacro\DefineLPLabelDist
% The command \texttt{\bs DefineLPLabelDist\lb\emph{label-distance}\rb}
% sets the distance between the axis labeling and the ticks, the default
% value is 1\,mm. The label distance for a full decades label with option
% \texttt{tenlower} is calculated so that the label is set one
% \texttt{\emph{label-distance}} under the normal labels. The value of
% \texttt{\emph{label-distance}} is also used as distance between the text
% above the graph paper and the ticks and the axis names and the ticks.
%
% \newmac
% \DescribeMacro\DefineLPLabelFont
% And the command \texttt{\bs DefineLPLabelFont\lb\emph{label-font}\rb}
% sets the font used for axis labeling and the text above the graph paper.
% Here you can use all font size commands and commands like |\sffamily|,
% |\bfseries| and |\itshape| for the font you want. Note: the |\text..|
% commands are not possible here. The default is |\scriptsize|.
%
% \newmac
% \DescribeMacro\DefineLPLineColor
% \DescribeMacro\DefineLPLabelColor
% The two commands \texttt{\bs DefineLPLineColor\lb...\rb} and
% \texttt{\bs DefineLPLabelColor\lb...\rb} sets the colors for
% lines and labeling. Here you have to use a complete |\color|
% command\footnote{Please refer to \texttt{grfguide} for the description
% of the \texttt{\bs color} command.} (with the advantage to have all
% capabilities of it). The defaults are |\color[cmyk]{1,0,0,0}| (cyan) for
% line color and |\color[cmyk]{0,0,0,1}| (black) for labeling color.
%
% There are three reasons for the line color default:
% \begin{enumerate}
% \item The printer colors are (normaly) cyan, magenta, yellow and black, so
%       the |cmyk| color model where chosen.
% \item Only one of these printer colors where chosen, so there is no
%       need of rastering (which might be worse for thin lines).
% \item The color cyan where chosen, because with black you wouldn't see your
%       (handdrawn) graph, with yellow the lines are to bright and magenta
%       lines are (in my opinion) to heavy.
% \end{enumerate}
%
% \newmac
% \DescribeMacro\DefineLPmu
% On the axis labeling there might be a letter appended for ``micro''
% ($10^{-6}$). Due to the fact that not all fonts provide a upright
% text-$\mu$, the default is just the letter ``u''. But with
% \texttt{\bs DefineLPmu\lb\emph{mu}\rb} you can redefine it to the
% letter you want (e.g.\ |$\mu$| or |\textmu| if provided).
%
% \newmac
% \DescribeMacro\DefineLPText
% With \texttt{\bs DefineLPText\lb\emph{new-text}\rb} you can change the text
% displayed above the graph paper. It only changes the first part, not the
% second where the dimensions are shown. The distance between the two text
% parts has to be a part of the new text. The default text is
% ``made with \LaTeX\ and \lp'' followed by a |\quad|.
%
% ^^A---------------------------------------------
% \subsection{Length of Decades/Divisions}
% \DescribeMacro\lpgridx
% \DescribeMacro\lpgridy
% After drawing the graph paper the length of a single decade or division on
% the x-axis can be found in |\lpgridx|. And the length of a decade or division
% on the y-axis can be found in |\lpgridy|. This might be usefull to put
% something into or around the graph paper, but unfortunately it won't be easy
% to do such a thing.
%
% ^^A---------------------------------------------
% \subsection{Configuration File}\label{sec:conf}
% At the end of the \lp\ package a config file with the name
% \texttt{logpap.cfg} is loaded. It has to be somewhere where \TeX\ can find
% it. An appropriate place should be the folder
% \texttt{.../texmf/tex/latex/config/}.
%
% Allthough you can make any kind of settings in this file, it is strictly
% recommended to use it only for setting the line widths. There should also
% be a |\ProvidesFile| command as first line. Here an example
% configuration file:
%
% \begin{verbatim}
% \ProvidesFile{logpap.cfg}[2004/02/01 v0.6 configuration for a 600dpi printer]
% \DefineLPThickLineThickness{0.8pt}
% \DefineLPMedLineThickness{0.5pt}
% \DefineLPThinLineThickness{0.2pt}\end{verbatim}
% ^^A\end{verbatim}
%
% ^^A---------------------------------------------
% \subsection{Warnings and Errors}
% There are two warning messages and six error messages, which can occur.
% Both warning messages can occur several times for one graph paper. And if
% you ignore an error message (by not correcting the error), you might get
% more error messages. For all error messages there is an appropriate help
% text, just type |h| at the |?|-prompt to see it.
%
% \newmac
% The first warning message is
% \begin{verbatim}
% Package logpap Warning: lines are to close together
% (logpap)                 on input line ...\end{verbatim}
% ^^A\end{verbatim}
% Because thick lines are always drawn, it can happen that they are closer
% than the minimum line distance.
%
% \newmac
% The second warning message is
% \begin{verbatim}
% Package logpap Warning: log. axis value went to large
% (logpap)                (no more letters for exponent, used X)
% (logpap)                 on input line ...\end{verbatim}
% ^^A\end{verbatim}
% If the value for a full decade of a logarithmic axis is $10^{27}$ or larger,
% there are no more letters for the exponent. The package then uses an X.
%
% \newmac
% The first error message is
% \begin{verbatim}
% ! Package logpap Error: number of decades for logaritmic axis to small.\end{verbatim}
% ^^A\end{verbatim}
% It occurs, when the number of decades is less then 0.2.
%
% \newmac
% The second error message is
% \begin{verbatim}
% ! Package logpap Error: wrong number of decades for logaritmic axis.\end{verbatim}
% ^^A\end{verbatim}
% It occurs, when the number of decades is something like $x.1$, which doesn't
% make sense.
%
% \newmac
% The third error message is
% \begin{verbatim}
% ! Package logpap Error: number of divisions for linear axis to small.\end{verbatim}
% ^^A\end{verbatim}
% It occurs, when the number of divisins is less then 0.1.
%
% \newmac
% The fourth error message is
% \begin{verbatim}
% ! Package logpap Error: wrong format of start value.\end{verbatim}
% ^^A\end{verbatim}
% It occurs, when the format of start value for logarithmic or linear axis is
% not correct. The format is: an optional $+$ or $-$, followed by 1-3 digits,
% optionaly followed by one of the letters ``yzafpnumkMGTPEZY''.
%
% \newmac
% The fifth error message is
% \begin{verbatim}
% ! Package logpap Error: wrong increment for linear axis.\end{verbatim}
% ^^A\end{verbatim}
% It occurs only, when the increment for a linear axis is 0, which doesn't make
% any sense.
%
% \newmac
% The sixth error message is
% \begin{verbatim}
% ! Package logpap Error: wrong logarithmic start value.\end{verbatim}
% ^^A\end{verbatim}
% It occurs, when the start value for a logarithmic axis is not $-100$,
% $-10$, $-1$, 1, 10 or 100.
%
% \newmac
% The seventh error message is
% \begin{verbatim}
% ! Package logpap Error: wrong factor for logarithmic axis.\end{verbatim}
% ^^A\end{verbatim}
% It occurs, when the factor for a logarithmic axis is not in the range from
% 1 to 9.
%
% ^^A--------------------------------------------------------------------------
% \StopEventually{\newpage\PrintIndex \PrintChanges}
%
% ^^A--------------------------------------------------------------------------
% \newpage
% \section{The Code}
% \subsection{The Usual}
% First the usual things.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2001/06/01]
\ProvidesPackage{logpap}[\filedate\space
    v\fileversion\space drawing logarithmic graph paper]
%    \end{macrocode}
%
% ^^A---------------------------------------------
% \subsection{The Options and Settings}
% Bevor declaring the options and settings, the booleans used by them are
% defined.
%
% \begin{macro}{\iflp@ticksupright}
% \begin{macro}{\lp@ticksuprighttrue}
% \begin{macro}{\lp@ticksuprightfalse}
% If the boolean |\iflp@ticksupright| is true ticks at the upper and the right
% side of the graph paper will be drawn.
%    \begin{macrocode}
\newif\iflp@ticksupright
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@text}
% \begin{macro}{\lp@texttrue}
% \begin{macro}{\lp@textfalse}
% If the boolean |\iflp@text| is true the text (not the dimensions) above the
% graph paper is shown.
%    \begin{macrocode}
\newif\iflp@text
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@dimensions}
% \begin{macro}{\lp@dimensionstrue}
% \begin{macro}{\lp@dimensionsfalse}
% If the boolean |\iflp@dimensions| is true the dimensions (not the text) above
% the graph paper is shown.
%    \begin{macrocode}
\newif\iflp@dimensions
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@twoninex}
% \begin{macro}{\lp@twoninextrue}
% \begin{macro}{\lp@twoninexfalse}
% If the boolean |\iflp@twoninex| is false the labels for 2 to 9 within a
% decade of the x-axis will not appear.
%    \begin{macrocode}
\newif\iflp@twoninex
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@fsnx}
% \begin{macro}{\lp@fsnxtrue}
% \begin{macro}{\lp@fsnxfalse}
% If the boolean |\iflp@fsnx| is false the labels for 5, 7 and 9 within a
% decade of the x-axis will not appear.
%    \begin{macrocode}
\newif\iflp@fsnx
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@twoniney}
% \begin{macro}{\lp@twonineytrue}
% \begin{macro}{\lp@twonineyfalse}
% If the boolean |\iflp@twoniney| is false the labels for 2 to 9 within a
% decade of the y-axis will not appear.
%    \begin{macrocode}
\newif\iflp@twoniney
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@fsny}
% \begin{macro}{\lp@fsnytrue}
% \begin{macro}{\lp@fsnyfalse}
% If the boolean |\iflp@fsny| is false the labels for 5, 7 and 9 within a
% decade of the y-axis will not appear.
%    \begin{macrocode}
\newif\iflp@fsny
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@tenlower}
% \begin{macro}{\lp@tenlowertrue}
% \begin{macro}{\lp@tenlowerfalse}
% If the boolean |\iflp@tenlower| is true the labels for a full decade of
% the x-axis will be set lower (under the other labels). The label for the
% origin is not affected by |\iflp@tenlower|.
%    \begin{macrocode}
\newif\iflp@tenlower
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@DeclareOS}
% With |\lp@DeclareOS| an option and an internal setting command in the form
% |\lp@@set|\param{option} is defined simultaneously.
%    \begin{macrocode}
\newcommand*\lp@DeclareOS[2]{\DeclareOption{#1}{#2}
    \expandafter\def\csname lp@@set#1\endcsname{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LPSet}
% The command |\LPSet| just passes the comma seperated list of option (|#1|)
% to |\lp@set|.
%    \begin{macrocode}
\newcommand*\LPSet[1]{\lp@set#1,\@@end}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@set}
% In |\lp@set| the first option is executed, then it is called recursively
% until the list is empty. Unknown options passed to |\LPSet| are silently
% ignored.
%    \begin{macrocode}
\def\lp@set#1,#2\@@end{\csname lp@@set#1\endcsname
    \def\@tempa{#2}\ifx\@tempa\@empty\else\lp@set#2\@@end\fi}
%    \end{macrocode}
% \end{macro}
% Now all options and internal setting commands are declared.
%    \begin{macrocode}
\lp@DeclareOS{ticksupright}{\lp@ticksuprighttrue}
\lp@DeclareOS{noticksupright}{\lp@ticksuprightfalse}
\lp@DeclareOS{twoninex}{\lp@twoninextrue}
\lp@DeclareOS{notwoninex}{\lp@twoninexfalse}
\lp@DeclareOS{twoniney}{\lp@twonineytrue}
\lp@DeclareOS{notwoniney}{\lp@twonineyfalse}
\lp@DeclareOS{fsnx}{\lp@fsnxtrue}
\lp@DeclareOS{nofsnx}{\lp@fsnxfalse}
\lp@DeclareOS{fsny}{\lp@fsnytrue}
\lp@DeclareOS{nofsny}{\lp@fsnyfalse}
\lp@DeclareOS{tenlower}{\lp@tenlowertrue}
\lp@DeclareOS{notenlower}{\lp@tenlowerfalse}
\lp@DeclareOS{text}{\lp@texttrue}
\lp@DeclareOS{notext}{\lp@textfalse}
\lp@DeclareOS{dimensions}{\lp@dimensionstrue}
\lp@DeclareOS{nodimensions}{\lp@dimensionsfalse}
%    \end{macrocode}
% Options unknown to the \lp\ package are passed to the color package.
%    \begin{macrocode}
\DeclareOption*{\PassOptionToPackage{\CurrentOption}{color}}
%    \end{macrocode}
% The booleans defaults are set and the options are processed.
%    \begin{macrocode}
\ExecuteOptions{ticksupright,twoninex,twoniney,fsnx,fsny,notenlower,text,dimensions}
\ProcessOptions\relax
%    \end{macrocode}
% The calc package is needed to calculate the length of a divison or decade.
% The color package is used to get colored lines for the graph paper.
% These packages are loaded here.
%    \begin{macrocode}
\RequirePackage{calc}
\RequirePackage{color}
%    \end{macrocode}
%
% ^^A---------------------------------------------
% \subsection{The logarithmic Values}
% Because it wouldn't be easy to calculate a logarithem with \TeX\footnote{And
% because I'm no mathematician, which means I don't know how to calculate a
% logarithem numerical.} the logarithmic value for $x.y$ is stored in a macro
% |\lp@log|\param{x.y}
%
% \begin{macro}{\deflp@logline}
% Such a value is defined with
% |\deflp@logline{|\param{value}|}{|\param{logarithem-of-value}|}|.
%    \begin{macrocode}
\newcommand*{\deflp@logline}[2]{\expandafter\def\csname lp@log#1\endcsname{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\getlp@logline}
% With |\getlp@logline{|\param{value}|}| the logarithem of the value can be
% requested (if defined before).
%    \begin{macrocode}
\newcommand*{\getlp@logline}[1]{\csname lp@log#1\endcsname}
%    \end{macrocode}
% \end{macro}
% Now the logarithems of 1.0 to 10.0 in steps of 0.1 are defined.
%    \begin{macrocode}
\deflp@logline{1.0}{0}
\deflp@logline{1.1}{.041393}
\deflp@logline{1.2}{.078181}
\deflp@logline{1.3}{.113943}
\deflp@logline{1.4}{.146128}
\deflp@logline{1.5}{.176091}
\deflp@logline{1.6}{.20412}
\deflp@logline{1.7}{.230449}
\deflp@logline{1.8}{.255273}
\deflp@logline{1.9}{.278754}
\deflp@logline{2.0}{.30103}
\deflp@logline{2.1}{.322219}
\deflp@logline{2.2}{.342423}
\deflp@logline{2.3}{.361728}
\deflp@logline{2.4}{.380211}
\deflp@logline{2.5}{.39794}
\deflp@logline{2.6}{.414973}
\deflp@logline{2.7}{.431364}
\deflp@logline{2.8}{.447158}
\deflp@logline{2.9}{.462398}
\deflp@logline{3.0}{.477121}
\deflp@logline{3.1}{.491362}
\deflp@logline{3.2}{.50515}
\deflp@logline{3.3}{.518514}
\deflp@logline{3.4}{.531479}
\deflp@logline{3.5}{.544068}
\deflp@logline{3.6}{.556303}
\deflp@logline{3.7}{.568202}
\deflp@logline{3.8}{.579784}
\deflp@logline{3.9}{.591065}
\deflp@logline{4.0}{.60206}
\deflp@logline{4.1}{.612784}
\deflp@logline{4.2}{.623249}
\deflp@logline{4.3}{.633468}
\deflp@logline{4.4}{.643453}
\deflp@logline{4.5}{.653213}
\deflp@logline{4.6}{.662758}
\deflp@logline{4.7}{.672098}
\deflp@logline{4.8}{.681241}
\deflp@logline{4.9}{.690196}
\deflp@logline{5.0}{.69897}
\deflp@logline{5.1}{.70757}
\deflp@logline{5.2}{.716003}
\deflp@logline{5.3}{.724276}
\deflp@logline{5.4}{.732394}
\deflp@logline{5.5}{.740363}
\deflp@logline{5.6}{.748188}
\deflp@logline{5.7}{.755875}
\deflp@logline{5.8}{.763428}
\deflp@logline{5.9}{.770852}
\deflp@logline{6.0}{.778151}
\deflp@logline{6.1}{.78533}
\deflp@logline{6.2}{.792392}
\deflp@logline{6.3}{.799341}
\deflp@logline{6.4}{.80618}
\deflp@logline{6.5}{.812913}
\deflp@logline{6.6}{.819544}
\deflp@logline{6.7}{.826075}
\deflp@logline{6.8}{.832509}
\deflp@logline{6.9}{.838849}
\deflp@logline{7.0}{.845098}
\deflp@logline{7.1}{.851258}
\deflp@logline{7.2}{.857332}
\deflp@logline{7.3}{.863323}
\deflp@logline{7.4}{.869232}
\deflp@logline{7.5}{.875061}
\deflp@logline{7.6}{.880814}
\deflp@logline{7.7}{.886491}
\deflp@logline{7.8}{.892095}
\deflp@logline{7.9}{.897627}
\deflp@logline{8.0}{.90309}
\deflp@logline{8.1}{.908485}
\deflp@logline{8.2}{.913814}
\deflp@logline{8.3}{.919078}
\deflp@logline{8.4}{.924279}
\deflp@logline{8.5}{.929419}
\deflp@logline{8.6}{.934498}
\deflp@logline{8.7}{.939519}
\deflp@logline{8.8}{.944483}
\deflp@logline{8.9}{.94939}
\deflp@logline{9.0}{.954243}
\deflp@logline{9.1}{.959041}
\deflp@logline{9.2}{.963788}
\deflp@logline{9.3}{.968483}
\deflp@logline{9.4}{.973128}
\deflp@logline{9.5}{.977724}
\deflp@logline{9.6}{.982271}
\deflp@logline{9.7}{.986772}
\deflp@logline{9.8}{.991226}
\deflp@logline{9.9}{.995635}
\deflp@logline{10.0}{1}
%    \end{macrocode}
% I thought about making an extra package for the logarithmic values. Perhaps
% it might be usefull for other packages. But, because I'm not able to write
% a macro that calculates the logarithem, I decided not doing this.
%
% ^^A---------------------------------------------
% \subsection{Registers and other Booleans needed}
% \begin{macro}{\lp@dcntx}
% In the counter |\lp@dcntx| the number of full decades or divisions of the
% x-axis is stored and counted down when drawing lines.
%    \begin{macrocode}
\newcount\lp@dcntx
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@dcnty}
% In the counter |\lp@dcnty| the number of full decades or divisions of the
% y-axis is stored and counted down when drawing lines.
%    \begin{macrocode}
\newcount\lp@dcnty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lpgridx}
% The dimen |\lpgridx| holds the length of a full decade or division for the
% x-axis.
%    \begin{macrocode}
\newdimen\lpgridx
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lpgridy}
% The dimen |\lpgridy| holds the length of a full decade or division for the
% y-axis.
%    \begin{macrocode}
\newdimen\lpgridy
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@thicklinelenx}
% In the dimen |\lp@thicklinelenx| the length of a horizontal thick line is
% calculated and stored.
%    \begin{macrocode}
\newdimen\lp@thicklinelenx
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@thicklineleny}
% In the dimen |\lp@thicklineleny| the length of a vertical thick line is
% calculated and stored.
%    \begin{macrocode}
\newdimen\lp@thicklineleny
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@medlinelenx}
% In the dimen |\lp@medlinelenx| the length of a horizontal medium line is
% calculated and stored.
%    \begin{macrocode}
\newdimen\lp@medlinelenx
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@medlineleny}
% In the dimen |\lp@medlineleny| the length of a vertical medium line is
% calculated and stored.
%    \begin{macrocode}
\newdimen\lp@medlineleny
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@osg}
% The dimen |\lp@osg| is used while drawing lines. Here the offset from the
% origin of the graph paper to the begin of the actual decade or division is
% calculated and stored.
%    \begin{macrocode}
\newdimen\lp@osg
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@osl}
% The dimen |\lp@osl| is used while drawing lines. Here first the offset from
% the beginning of the actual decade or division to the actual line is
% calculated. And then |\lp@osg| is added to it to get the offset from the
% origin of the graph paper to the actual line.
%    \begin{macrocode}
\newdimen\lp@osl
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\iflp@partdecx}
% \begin{macro}{\lp@partdecxtrue}
% \begin{macro}{\lp@partdecxfalse}
% The boolean |\iflp@partdecx| will be set if the last decade or division on
% the x-axis is only a partial one ($x.y$ and not $x$ or $x.0$ as the number
% of decades or divisions).
%    \begin{macrocode}
\newif\iflp@partdecx
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@partdecy}
% \begin{macro}{\lp@partdecytrue}
% \begin{macro}{\lp@partdecyfalse}
% The boolean |\iflp@partdecy| will be set if the last decade or division on
% the y-axis is only a partial one ($x.y$ and not $x$ or $x.0$ as the number
% of decades or divisions).
%    \begin{macrocode}
\newif\iflp@partdecy
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@fulldecx}
% \begin{macro}{\lp@fulldecxtrue}
% \begin{macro}{\lp@fulldecxfalse}
% The boolean |\iflp@fulldecx| will be set if there is at least one full
% decade or division for the x-axis ($x.y$ or $x$ and not $0.y$ as the number
% of decades or divisions).
%    \begin{macrocode}
\newif\iflp@fulldecx
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@fulldecy}
% \begin{macro}{\lp@fulldecytrue}
% \begin{macro}{\lp@fulldecyfalse}
% The boolean |\iflp@fulldecy| will be set if there is at least one full
% decade or division for the y-axis ($x.y$ or $x$ and not $0.y$ as the number
% of decades or divisions).
%    \begin{macrocode}
\newif\iflp@fulldecy
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@twonine}
% \begin{macro}{\lp@twoninetrue}
% \begin{macro}{\lp@twoninefalse}
% Because the same macro is used to get the next label for a logarithmic
% x- and y-axis, the boolean |\iflp@twonine| is needed. It is set to the
% meaning of |\iflp@twoninex| or |\iflp@twoniney| before labeling is done.
%    \begin{macrocode}
\newif\iflp@twonine
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@fsn}
% \begin{macro}{\lp@fsntrue}
% \begin{macro}{\lp@fsnfalse}
% Because the same macro is used to get the next label for a logarithmic
% x- and y-axis, the boolean |\iflp@fsn| is needed. It is set to the
% meaning of |\iflp@fsnx| or |\iflp@fsny| before labeling is done.
%    \begin{macrocode}
\newif\iflp@fsn
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@ten}
% \begin{macro}{\lp@tentrue}
% \begin{macro}{\lp@tenfalse}
% The boolean |\iflp@ten| is needed to distinguish between the labels within
% decade and the labels of a full decade, to be able to set only the last
% lower.
%    \begin{macrocode}
\newif\iflp@ten
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@logx}
% \begin{macro}{\lp@logxtrue}
% \begin{macro}{\lp@logxfalse}
% The boolean |\iflp@logx| is true if the x-axis is logarithmic. It is needed
% to setup things on different ways for logarithmic and linear axis.
%    \begin{macrocode}
\newif\iflp@logx
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@logy}
% \begin{macro}{\lp@logytrue}
% \begin{macro}{\lp@logyfalse}
% The boolean |\iflp@logy| is true if the y-axis is logarithmic. It is needed
% to setup things on different ways for logarithmic and linear axis.
%    \begin{macrocode}
\newif\iflp@logy
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\iflp@preached}
% \begin{macro}{\lp@preachedtrue}
% \begin{macro}{\lp@preachedfalse}
% The boolean |\iflp@preached| is used while parsing the start value for axis
% labeling. It will be true if the parsed character is one of the letters for
% the exponent. It is also used to get the next exponent letter when labeling
% is done. There it will be true if the start exponent letter (not the next
% one) is reached.
%    \begin{macrocode}
\newif\iflp@preached
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Setup Commands}
% Everything set with the |\DefineLP...| commands is stored in a macro. For
% the first seven this where done to save dimen registers. For the last five
% it seems to be the natural way.
%
% \begin{macro}{\DefineLPThickLineThickness}
% \begin{macro}{\lp@tkltkness}
% With |\DefineLPThickLineThickness| the thick line width is stored in
% |\lp@tkltkness|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPThickLineThickness[1]{\renewcommand*\lp@tkltkness{#1}}
\newcommand*\lp@tkltkness{0.8\p@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPMedLineThickness}
% \begin{macro}{\lp@mdltkness}
% With |\DefineLPMedLineThickness| the medium line width is stored in
% |\lp@mdltkness|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPMedLineThickness[1]{\renewcommand*\lp@mdltkness{#1}}
\newcommand*\lp@mdltkness{0.5\p@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPThinLineThickness}
% \begin{macro}{\lp@tnltkness}
% With |\DefineLPThinLineThickness| the thin line width is stored in
% |\lp@tnltkness|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPThinLineThickness[1]{\renewcommand*\lp@tnltkness{#1}}
\newcommand*\lp@tnltkness{0.2\p@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPMinLineDist}
% \begin{macro}{\lp@mindist}
% With |\DefineLPMinLineDist| the minimum distance between two lines drawn
% is stored in |\lp@mindist|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPMinLineDist[1]{\renewcommand*\lp@mindist{#1}}
\newcommand*\lp@mindist{0.9999mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPThickTickLen}
% \begin{macro}{\lp@tol}
% With |\DefineLPThickTickLen| the tick length of thick lines
% is stored in |\lp@tol|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPThickTickLen[1]{\renewcommand*\lp@tol{#1}}
\newcommand*\lp@tol{2mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPMedTickLen}
% \begin{macro}{\lp@mol}
% With |\DefineLPMedTickLen| the tick length of medium lines
% is stored in |\lp@mol|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPMedTickLen[1]{\renewcommand*\lp@mol{#1}}
\newcommand*\lp@mol{1mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPLabelDist}
% \begin{macro}{\lp@lpos}
% With |\DefineLPLabelDist| the distance betweens ticks and labeling
% is stored in |\lp@lpos|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPLabelDist[1]{\renewcommand*\lp@lpos{#1}}
\newcommand*\lp@lpos{1mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPLabelFont}
% \begin{macro}{\lp@font}
% With |\DefineLPLabelFont| the commands needed to choose the font for the
% labeling and the text above the graph paper are stored in |\lp@font|, which
% is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPLabelFont[1]{\renewcommand*\lp@font{#1}}
\newcommand*\lp@font{\scriptsize}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPLineColor}
% \begin{macro}{\lp@linecolor}
% With |\DefineLPLineColor| the command for setting the line color
% is stored in |\lp@linecolor|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPLineColor[1]{\renewcommand*\lp@linecolor{#1}}
\newcommand*\lp@linecolor{\color[cmyk]{1,0,0,0}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPLabelColor}
% \begin{macro}{\lp@labelcolor}
% With |\DefineLPLabelColor| the command for setting the labels color
% is stored in |\lp@labelcolor|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPLabelColor[1]{\renewcommand*\lp@labelcolor{#1}}
\newcommand*\lp@labelcolor{\color[cmyk]{0,0,0,1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPmu}
% \begin{macro}{\lp@mu}
% With |\DefineLPmu| the exponent letter for ``micro'' ($10^{-6}$) is stored in
% |\lp@mu|, which is initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPmu[1]{\renewcommand*\lp@mu{#1}}
\newcommand*\lp@mu{u}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DefineLPText}
% \begin{macro}{\lp@textone}
% With |\DefineLPText| the first part of the text above the graph paper and
% the distance to the second part is stored in |\lp@textone|, which is
% initialized in the next line.
%    \begin{macrocode}
\newcommand*\DefineLPText[1]{\renewcommand*\lp@textone{#1}}
\newcommand*\lp@textone{made with \LaTeX\ and \textsf{logpap}\quad}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Making Lists}
% Before describing the next commands, the mechanism how lines are drawn has
% to be explained:
%
% First the length of a division or decade for an axis is calculated.
% Then a comma separated list is built for every line width. Such a list
% contains normalized\footnote{The Values are all in the range from 0 to 1.
% To get the absolute value it has to be multiplied with the length of a
% division or decade.} offsets from beginning of a decade or division to the
% line to draw. The list for thick lines will always contain offsets for all
% possible lines. The lists for medium and thin lines may contain all offsets
% for a part from $x$ to $(x+1)$, the offsets for $x.2$, $x.4$, $x.6$ and $x.8$
% (no medium line), only the offsets for the medium lines ($x.5$) or no offsets
% at all.\footnote{Here $x$ is 0 for linear axis and 1 to 9 for logarithmic
% axis.} Therefor the distances between $x.9$ to $(x+1).0$, $x.8$ to $(x+1).0$
% and $x.5$ to $(x+1).0$ are calculated and compared to the given minimum line
% distance. The distance between $x$ to $(x+1)$ is only calculated and
% compared to get a warning message if necessary. At last every list is passed
% to a macro, which works it up recursively. This is done once for every decade
% or division (the lists contain the offsets for one decade or division only).
%
% For a partial division only the offsets for $0.1$ to $0.y$ are appended to
% the list, where $y$ is the first digit after the decimal point of the
% \texttt{\emph{decades/divisions}} argument to the linear axis.
% For a partial decade only the offsets for $1.1$ to $x.0$ are appended to the
% list, where $x$ is the first digit after the decimal point of the
% \texttt{\emph{decades/divisions}} argument to the logarithmic axis.
%
% \begin{macro}{\lp@thicklines}
% \begin{macro}{\lp@medlines}
% \begin{macro}{\lp@thinlines}
% In |\lp@thicklines|, |\lp@medlines| and |\lp@thinlines| the comma separated
% lists of normalized offsets form a decades or divisions beginning to the line
% to draw for thick, medium and thin lines are stored.
%
% \begin{macro}{\lp@lllist}
% In |\lp@lllist| the values form 2 to (maximal) 10 for logarithmic axis
% labeling are stored, but in the same order as the offsets for the thick
% lines in |\lp@thicklines|, because latter is used for labeling too.
%
% \begin{macro}{\lp@clearlists}
% With |\lp@clearlists| all theses lists are cleared.
%    \begin{macrocode}
\def\lp@clearlists{%
    \def\lp@thicklines{,}\def\lp@medlines{,}\def\lp@thinlines{,}%
    \def\lp@lllist{,}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Making Lists for logarithmic Axis}
% \begin{macro}{\lp@mkthickloglist}
% \begin{macro}{\lp@thicklines}
% \begin{macro}{\lp@lllist}
% With |\lp@mkthickloglist| the lists in |\lp@thicklines| and |\lp@lllist|
% are built. The parameter is 10 to build lists for a full decade and the
% first digit after the decimal point of the \texttt{\emph{decades/divisions}}
% argument to the logarithmic axis for a partial decade.
%    \begin{macrocode}
\def\lp@mkthickloglist#1{%
    \@tempcnta\@ne\loop
        \advance\@tempcnta\@ne
        \edef\lp@thicklines{\getlp@logline{\the\@tempcnta.0},\lp@thicklines}%
        \edef\lp@lllist{\the\@tempcnta,\lp@lllist}%
    \ifnum\@tempcnta<#1\repeat}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@mkmedloglist}
% \begin{macro}{\lp@medlines}
% In |\lp@mkmedloglist| one offset value is appended to the list in
% |\lp@medlines|. Parameter |#1| can be a decimal value from 1.0 to 10.0, but
% of course |\lp@mkmedloglist| will be called only with values like $x.5$.
%    \begin{macrocode}
\def\lp@mkmedloglist#1{%
    \edef\lp@medlines{\getlp@logline{#1},\lp@medlines}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@mkthinloglist}
% \begin{macro}{\lp@thinlines}
% In |\lp@mkthinloglist| one offset value is appended to the list in
% |\lp@thinlines|. Parameter |#1| can be a decimal value from 1.0 to 10.0, but
% of course |\lp@mkthinloglist| will be called only with values from $x.1$ to
% $x.4$ and from $x.6$ to $x.9$.
%    \begin{macrocode}
\def\lp@mkthinloglist#1{%
    \edef\lp@thinlines{\getlp@logline{#1},\lp@thinlines}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@mkthinloglisttwo}
% The command |\lp@mkthinloglisttwo| appends the offset values for
% $x.2$, $x.4$, $x.6$ and $x.8$ to |\lp@thinlines|. Here $x$ is from 1 to 9
% and passed as parameter |#1|.
%    \begin{macrocode}
\def\lp@mkthinloglisttwo#1{%
    \lp@mkthinloglist{#1.2}\lp@mkthinloglist{#1.4}%
    \lp@mkthinloglist{#1.6}\lp@mkthinloglist{#1.8}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@mkthinloglistone}
% The command |\lp@mkthinloglistone| appends the offset values for
% $x.1$ to $x.4$ and $x.6$ to $x.9$ to |\lp@thinlines|. Here $x$ is from
% 1 to 9 and passed as parameter |#1|.
%    \begin{macrocode}
\def\lp@mkthinloglistone#1{\lp@mkthinloglisttwo{#1}%
    \lp@mkthinloglist{#1.1}\lp@mkthinloglist{#1.3}%
    \lp@mkthinloglist{#1.7}\lp@mkthinloglist{#1.9}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@getdist}
% In |\lp@getdist| the absolute distance between two lines is calculated.
% With parameter |#1| the length of a decade is passed, it has to be one
% of the dimens |\lpgridx| or |\lpgridy|. The parameters |#2| and |#3| are the
% decimal values for the two lines (in the range from 1.0 to 10.0). Note that
% |#2| must be greater then |#3|. After calling |\lp@getdist| the dimen
% |\@tempdima| will contain the absolute distance.
%    \begin{macrocode}
\def\lp@getdist#1#2#3{%
    \expandafter\@tempdima\getlp@logline{#2}#1%
    \expandafter\@tempdimb\getlp@logline{#3}#1%
    \advance\@tempdima-\@tempdimb}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@mkloglistpart}
% The macro |\lp@mkloglistpart| extends the lists for medium and thin lines
% with the line offsets for the part between $x$ and $(x+1)$, where $x$ is
% from 1 to 9. The decision which offsets are appended (as described earlier)
% is made here. Parameter |#1| is the length of a decade, passed with one
% of the dimens |\lpgridx| or |\lpgridy|. Parameters |#2| is $(x+1)$ and
% parameter |#3| is $x$.
%    \begin{macrocode}
\def\lp@mkloglistpart#1#2#3{%
    \lp@getdist{#1}{#2.0}{#3.9}\ifdim\@tempdima<\lp@mindist
        \lp@getdist{#1}{#2.0}{#3.8}\ifdim\@tempdima<\lp@mindist
            \lp@getdist{#1}{#2.0}{#3.5}\ifdim\@tempdima<\lp@mindist
                \lp@getdist{#1}{#2.0}{#3.0}\ifdim\@tempdima<\lp@mindist
                    \PackageWarning{logpap}{%
                        lines are to close together\MessageBreak}%
                \fi
            \else
                \lp@mkmedloglist{#3.5}%
            \fi
        \else
            \lp@mkthinloglisttwo{#3}%
        \fi
    \else
        \lp@mkmedloglist{#3.5}\lp@mkthinloglistone{#3}%
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@mkloglist}
% With |\lp@mkloglist| all lists for full or partial decade are built.
% Again parameter |#1| is the length of a decade (|\lpgridx| or |\lpgridy|).
% Parameter |#2| is 10 for a full decade and the first digit after the
% decimal point of the \texttt{\emph{decades/divisions}} argument to the
% logarithmic axis for a partial decade.
%    \begin{macrocode}
\def\lp@mkloglist#1#2{\lp@clearlists\lp@mkthickloglist{#2}%
    \@tempcnta#2\@tempcntb\@tempcnta\advance\@tempcntb\m@ne
    \loop
        \lp@mkloglistpart{#1}{\the\@tempcnta}{\the\@tempcntb}%
        \advance\@tempcnta\m@ne\advance\@tempcntb\m@ne
    \ifnum\@tempcnta>\@ne\repeat}
%    \end{macrocode}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Making Lists for linear Axis}
% \begin{macro}{\lp@mkthicklinlist}
% \begin{macro}{\lp@thicklines}
% With |\lp@mkthicklinlist| the list for thick lines is built. Because it
% will contain only one line at maximum, here no |\edef| is needed. Parameter
% |#1| is 1 for a full division and $.y$ for a partial division, where $y$
% is the first digit after the decimal point of the
% \texttt{\emph{decades/divisions}} argument to the linear axis.
% The decision if the offset has to be appended is made here.
%    \begin{macrocode}
\def\lp@mkthicklinlist#1{%
    \@tempdima#1\p@\relax\ifdim\@tempdima>.99\p@\def\lp@thicklines{1,}\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@mkmedlinlist}
% \begin{macro}{\lp@medlines}
% With |\lp@mkmedlinlist| the list for medium lines is built. It also
% will contain only one line at maximum, so no |\edef| is needed here too.
% Parameter |#1| is 1 for a full division and $.y$ for a partial division,
% where $y$ is the first digit after the decimal point of the
% \texttt{\emph{decades/divisions}} argument to the linear axis.
% One part of the decision if the offset has to be appended is made here.
%    \begin{macrocode}
\def\lp@mkmedlinlist#1{%
    \@tempdima#1\p@\relax\ifdim\@tempdima>.49\p@\def\lp@medlines{.5,}\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@mkthinlinlist}
% \begin{macro}{\lp@thinlines}
% With |\lp@mkthinlinlist| one line offset is appended to the list for thin
% lines. Parameter |#1| is this offset, only the values .1 to .4 and .6 to .9
% are used.
%    \begin{macrocode}
\def\lp@mkthinlinlist#1{%
    \edef\lp@thinlines{#1,\lp@thinlines}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@mkthinlinlisttwo}
% In |\lp@mkthinlinlisttwo| the offsets (for) .2, .4, .6 and .8 are appended
% if necessary. The decision is made by parameter |#1|, which is 1 for a full
% division and $.y$ for a partial division, where $y$ is the first digit after
% the decimal point of the \texttt{\emph{decades/divisions}} argument to the
% linear axis. One part of the decision, which offsets has to be appended is
% made here.
%    \begin{macrocode}
\def\lp@mkthinlinlisttwo#1{%
    \@tempdima#1\p@\relax
    \ifdim\@tempdima>.19\p@\lp@mkthinlinlist{.2}%
    \ifdim\@tempdima>.39\p@\lp@mkthinlinlist{.4}%
    \ifdim\@tempdima>.59\p@\lp@mkthinlinlist{.6}%
    \ifdim\@tempdima>.79\p@\lp@mkthinlinlist{.8}%
    \fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@mkthinlinlistone}
% In |\lp@mkthinlinlisttwo| the offsets (for) .1 to .4 and .6 to .9 are
% appended if necessary. The decision is made by parameter |#1|, which is 1 for
% a full division and $.y$ for a partial division, where $y$ is the first digit
% after the decimal point of the \texttt{\emph{decades/divisions}} argument to
% the linear axis. One part of the decision, which offsets has to be appended
% is made here.
%    \begin{macrocode}
\def\lp@mkthinlinlistone#1{\lp@mkthinlinlisttwo{#1}%
    \@tempdima#1\p@\relax
    \ifdim\@tempdima>.09\p@\lp@mkthinlinlist{.1}%
    \ifdim\@tempdima>.29\p@\lp@mkthinlinlist{.3}%
    \ifdim\@tempdima>.69\p@\lp@mkthinlinlist{.7}%
    \ifdim\@tempdima>.89\p@\lp@mkthinlinlist{.9}%
    \fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@getlindist}
% In |\lp@getlindist| the absolute distance between two lines is calculated.
% Parameter |#1| is the length of a division (|\lpgridx| or |\lpgridy|). The
% parameters |#2| and |#3| are the two line offsets, here |#2| has to be
% greater then |#3|. After calling |\lp@getlindist| the dimen |\@tempdima|
% will contain the absolute distance.
%    \begin{macrocode}
\def\lp@getlindist#1#2#3{%
    \@tempdima#2#1\@tempdimb#3#1%
    \advance\@tempdima-\@tempdimb}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@mklinlist}
% With |\lp@mklinlist| all lists for full or partial division are built.
% Again parameter |#1| is the length of a division (|\lpgridx| or |\lpgridy|).
% Parameter |#2| is 1 for a full division and $.y$ for a partial division,
% where $y$ is the first digit after the decimal point of the
% \texttt{\emph{decades/divisions}} argument to the linear axis.
% The first part of the decision, which offsets has to be appended is
% made here.
%    \begin{macrocode}
\def\lp@mklinlist#1#2{\lp@clearlists\lp@mkthicklinlist{#2}%
    \lp@getlindist{#1}{1.0}{0.9}\ifdim\@tempdima<\lp@mindist
        \lp@getlindist{#1}{1.0}{0.8}\ifdim\@tempdima<\lp@mindist
            \lp@getlindist{#1}{1.0}{0.5}\ifdim\@tempdima<\lp@mindist
                \lp@getlindist{#1}{1.0}{0.0}\ifdim\@tempdima<\lp@mindist
                    \PackageWarning{logpap}{%
                        lines are to close together\MessageBreak}%
                \fi
            \else
                \lp@mkmedlinlist{#2}%
            \fi
        \else
            \lp@mkthinlinlisttwo{#2}%
        \fi
    \else
        \lp@mkmedlinlist{#2}\lp@mkthinlinlistone{#2}%
    \fi}
%    \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Drawing Lines}
% \begin{macro}{\lp@dolinesx}
% The command |\lp@dolinesx| draws all lines from one list of line offsets
% (which contains the offsets for one decade or division). The offset from
% the origin of the graph paper to the start of the decade or division to
% draw is calculated and stored in |\lp@osg|. Parameter |#1| is the macro,
% where the list is stored. Parameter |#2| is the thickness of the lines,
% |#3| is the start positions of the lines in y-direction and |#4| is the
% line length. The real work is done by |\lp@dolinex|, which is called with
% the expanded list.
%    \begin{macrocode}
\def\lp@dolinesx#1#2#3#4{\linethickness#2%
    \lp@osg\lp@dcntx\lpgridx
    \expandafter\lp@dolinex#1,\@@end{#3}{#4}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@dolinex}
% If the list is not empty, |\lp@dolinex| first calculates the offset form
% the origin of the graph paper to the line to draw in |\lp@osl|. Then the
% line is drawn. Note: the command |\put| works with a dimen, because
% |\unitlength| was disabled (with |\let\unitlength\relax|) before starting
% the \texttt{picture} environment. At last |\lp@dolinex| calls itself
% recursively, until the list is empty. Parameter |#1| is the first element of
% the list and parameter |#2| its rest. Parameter |#3| is the start positions
% of the lines in y-direction and |#4| is the line length.
%    \begin{macrocode}
\def\lp@dolinex#1,#2,\@@end#3#4{%
    \def\@tempc{#1}\ifx\@tempc\@empty\else
    \lp@osl#1\lpgridx \advance\lp@osl\lp@osg
    \put(\lp@osl,#3){\line(0,1){#4}}%
    \def\@tempc{#2}\ifx\@tempc\@empty\else
    \lp@dolinex#2,\@@end{#3}{#4}\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@dolinesy}
% The command |\lp@dolinesy| works the same way as |\lp@dolinesx|. It has the
% same parameters, except that |#3| is the start position in x-direction.
%    \begin{macrocode}
\def\lp@dolinesy#1#2#3#4{\linethickness#2%
    \lp@osg\lp@dcnty\lpgridy
    \expandafter\lp@doliney#1,\@@end{#3}{#4}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@doliney}
% And |\lp@doliney| works the same way as |\lp@dolinex|. It has also the same
% parameters, except that here |#3| is the start position in x-direction too.
%    \begin{macrocode}
\def\lp@doliney#1,#2,\@@end#3#4{%
    \def\@tempc{#1}\ifx\@tempc\@empty\else
    \lp@osl#1\lpgridy \advance\lp@osl\lp@osg
    \put(#3,\lp@osl){\line(1,0){#4}}%
    \def\@tempc{#2}\ifx\@tempc\@empty\else
    \lp@doliney#2,\@@end{#3}{#4}\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Labeling}
% \subsubsection{Setup for Labels}
% During setup the \texttt{\emph{x/y-start},\emph{factor/increment}} argument
% is tested and split into four macros. These macros and their contents
% after setup (if everything is correct) are shown in table \ref{tab:sfi}.
% \begin{table}[ht]
% \begin{tabular}{lp{10cm}}\hline\\
% \texttt{\bs lp@sign} & If \texttt{\emph{x/y-start}} is negativ, it contains
%                        a ``$-$'', else it is empty.\\[.8ex]
% \texttt{\bs lp@sll}  & It contains the absolute \texttt{\emph{x/y-start}}
%                        value (1 to 3 digits), the value itself is not tested
%                        here (but it will be done later).\\[.8ex]
% \texttt{\bs lp@sllp} & It contains the exponent letter if appended, else it
%                        is empty.\\[.8ex]
% \texttt{\bs lp@lfi}  & It contains the \texttt{\emph{factor/increment}}
%                        value, which is not tested here (but a range test
%                        will be done later). If no
%                        \texttt{\emph{factor/increment}} is given,
%                        it is 1.\\[2.5ex]\hline
% \end{tabular}
% \caption{Macros for \texttt{\emph{x/y-start},\emph{factor/increment}}
%          after Setup}\label{tab:sfi}
% \end{table}
%
% \begin{macro}{\lp@setuplabel}
% \begin{macro}{\lp@lfi}
% For setup the command |\lp@setuplabel| has to be called with the
% \texttt{\emph{x/y-start}, \emph{factor/increment}} argument and a trailing
% comma appended to it, to make it work without a
% \texttt{\emph{factor/increment}} part. The \texttt{\emph{x/y-start}} part
% is processed with |\lp@getsign@ndparse|. If no
% \texttt{\emph{factor/increment}} part is given, |\lp@lfi| is set to 1
% (the default), else this part is processed with |\lp@setup@lfi|.
%    \begin{macrocode}
\def\lp@setuplabel#1,#2\@@end{%
    \lp@getsign@ndparse#1\@@end
    \def\@tempa{#2}\ifx\@tempa\@empty\def\lp@lfi{1}\else
        \def\@tempb{,}\ifx\@tempa\@tempb\def\lp@lfi{1}\else
            \lp@setup@lfi#2\@@end\fi\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@setup@lfi}
% \begin{macro}{\lp@lfi}
% The command |\lp@setup@lfi| discards the trailing comma from
% \texttt{\emph{factor/increment},} and stores the factor or increment to
% |\lp@lfi|.
%    \begin{macrocode}
\def\lp@setup@lfi#1,\@@end{\def\lp@lfi{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@getsign@ndparse}
% \begin{macro}{\lp@sign}
% In |\lp@getsign@ndparse| a leading ``$+$'' or ``$-$'' is discarded from
% \texttt{\emph{x/y-start}}. If it was a ``$-$'', it is stored in |\lp@sign|,
% otherwise |\lp@sign| will be empty. The rest (digits and exponent letter)
% is passed to |\lp@parsesll| together with four ``x'', so that there are
% at least five characters.
%    \begin{macrocode}
\def\lp@getsign@ndparse#1#2\@@end{%
    \if#1-\relax
        \def\lp@sign{#1}\lp@parsesll#2xxxx\@@end
    \else\if#1+\relax
        \def\lp@sign{}\lp@parsesll#2xxxx\@@end
    \else
        \def\lp@sign{}\lp@parsesll#1#2xxxx\@@end
    \fi\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@parsesll}
% \begin{macro}{\lp@sll}
% \begin{macro}{\lp@sllp}
% In |\lp@parsesll| the first four parameters takes the first four characters
% passed from |\lp@getsign@ndparse| and parameter |#5| takes the rest (1 to 4
% times ``x''). The first character has to be a digit, if not an error message
% (|\lp@formaterr|) will occur. The next two characters can be a digit,
% one of the exponent letters or an ``x''. If not, the same error message
% will occur. And the fourth character can be an exponent letter or an ``x''.
% Again the error message will occur, if it is not. When an exponent letters or
% an ``x'' is detected, no further characters are tested. The digits are stored
% in |\lp@sll|. The exponent letter is stored in |\lp@sllp|, if there isn't
% one, |\lp@sllp| will be empty.
%    \begin{macrocode}
\def\lp@parsesll#1#2#3#4#5\@@end{%
    \if\lp@isdigit#1\relax
        \if\lp@isdigit#2\relax
            \if\lp@isdigit#3\relax
                \lp@testletter#4\iflp@preached
                    \def\lp@sll{#1#2#3}\def\lp@sllp{#4}%
                \else\if#4x\relax
                    \def\lp@sll{#1#2#3}\def\lp@sllp{}%
                \else
                    \lp@formaterr
                \fi\fi
            \else\lp@testletter#3\iflp@preached
                \def\lp@sll{#1#2}\def\lp@sllp{#3}%
            \else\if#3x\relax
                \def\lp@sll{#1#2}\def\lp@sllp{}%
            \else
                \lp@formaterr
            \fi\fi\fi
        \else\lp@testletter#2\iflp@preached
            \def\lp@sll{#1}\def\lp@sllp{#2}%
        \else\if#2x\relax
            \def\lp@sll{#1}\def\lp@sllp{}%
        \else
            \lp@formaterr
        \fi\fi\fi
    \else
        \lp@formaterr
    \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@formaterr}
% The command |\lp@formaterr| gives an error message for a wrong
% \texttt{\emph{x/y-start}} argument. It is used only in |\lp@parsesll|.
%    \begin{macrocode}
\def\lp@formaterr{%
    \PackageError{logpap}{wrong format of start value}%
        {The format of the start value is:\MessageBreak
         optional + or -, followed by 1-3 digits, optionaly\MessageBreak
         followed by one of the letters [yzafpnumkMGTPEZY].\MessageBreak
         Please correct it before going on,\MessageBreak
         otherwise you might get more error messages.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@isdigit}
% With |\lp@isdigit| parameter |#1| is tested, whether it is a digit or
% not.\footnote{This macro was kept from the UK-\TeX FAQ,
% chapter ``Macro programming'', section ``Is the argument a number?''.}
% It has to be invoked as follows: |\if\lp@isdigit|\meta{character}
% \meta{stuff for character is a digit} |\else|
% \meta{stuff for character is not a digit} |\fi|. The |\if| is needed to make
% it work in nested if-strctures, therefor |\lp@isdigit| begins with |TT\fi|
% to end this |\if|. The |\else| and |\fi| then belongs to the (uncomplete)
% |\ifcat|. The comparison is done by the |\ifnum|. If |#1| is a digit the
% second value will be 10 or greater, so the |\ifnum| expands to ``|_|'' and
% the |\ifcat| will be true. In the other case|\ifnum| expands to ``|A|'' and
% the |\ifcat| will be false. The macro would also work for positive numbers.
%    \begin{macrocode}
\def\lp@isdigit#1{TT\fi\ifcat_\ifnum9<1#1 _\else A\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@testletter}
% In |\lp@testletter| parameter |#1|, which has to be one character,
% is compared to all possible exponent letter. The boolean |\iflp@preached|
% is set to true if |#1| is one of the letters, else it is set to false.
%    \begin{macrocode}
\def\lp@testletter#1{%
    \def\@tempb{#1}\lp@preachedfalse
    \@tfor\@tempc:=yzafpnumkMGTPEZY\do{%
        \if\@tempc\@tempb\relax\relax\lp@preachedtrue\@break@tfor\fi}}
%    \end{macrocode}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Range Test for Label Values}
% The next two macros (|\lp@testrangelin| and |\lp@testrangelog|) are not
% invoked directly. Their meaning is assigned to |\lp@testrangex| and
% |\lp@testrangey| by |\lp@@@logpap| instead, so the right test for an axis
% takes place.
%
% \begin{macro}{\lp@testrangelin}
% In |\lp@testrangelin| the start value for a linear axis is not tested,
% because due to the tests in |\lp@parsesll| it is in the range from
% $-999$ to 999 and there is no other limitation. The increment is only
% tested against 0, because this doesn't make any sense.
%    \begin{macrocode}
\def\lp@testrangelin{\@tempcnta\lp@lfi\relax
    \ifnum\@tempcnta=0\relax
        \PackageError{logpap}{wrong increment for linear axis}%
            {The increment value is 0, which doesn't make any sense.\MessageBreak
             Please correct it before going on.}%
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@testrangelog}
% In |\lp@testrangelog| first the start value is tested whether it is 1, 10
% or 100. If not, an error message will occur. A test against the possible
% negative values is not necessary, because |\lp@sll| only contains the
% absolute value (the sign is in |\lp@sign|). The test against 0 is not realy
% necessary, but I could resist ;-) At last the factor is tested whether
% it is in the range from 1 to 9.
%    \begin{macrocode}
\def\lp@testrangelog{\@tempcnta\lp@sll\relax
    \ifnum\@tempcnta=1\else\ifnum\@tempcnta=10\else\ifnum\@tempcnta=100\else
        \ifnum\@tempcnta=0\relax
            \PackageError{logpap}{wrong logarithmic start value}%
                {0 as start value for a logarithmic axis?\MessageBreak
                 This is a typo, isn't it?\MessageBreak
                 If not, you should learn more mathematics\MessageBreak
                 before using this package ;-)\MessageBreak
                 Only -100, -10, -1, 1, 10 and 100 are allowed.\MessageBreak
                 Please correct it before going on.}%
        \else
            \PackageError{logpap}{wrong logarithmic start value}%
                {Only -100, -10, -1, 1, 10 and 100 are allowed.\MessageBreak
                 Please correct it before going on.}%
        \fi
    \fi\fi\fi
    \@tempcnta\lp@lfi\relax
    \ifnum\@tempcnta<1\lp@logfacerr\else\ifnum\@tempcnta>9\lp@logfacerr\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@logfacerr}
% The command |\lp@logfacerr| just gives out an error message for a wrong
% factor for logarithmic axis labeling.
%    \begin{macrocode}
\def\lp@logfacerr{\PackageError{logpap}{wrong factor for logarithmic axis}%
    {The factor has to be in the range from 1 to 9.\MessageBreak
     Please correct it before going on.}}
%    \end{macrocode}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Getting next Label}
% The two macros |\lp@nextlinlabel| and |\lp@nextloglabel| are not invoked
% directly, but assigned to |\lp@nextxlabel| and |\lp@nextylabel| by
% |\lp@@@logpap|.
%
% \begin{macro}{\lp@nextlinlabel}
% \begin{macro}{\lp@label}
% In |\lp@nextlinlabel| first the labels value is calculated. Therefore the
% increment (|#3|) is multiplied with the number of the division (|#4|) and
% to the result the increment is added, because the label is at the end of
% the actual division. To get the final value the signed (|#6|) start value
% (|#1|) has to be added. After that if the exponent letter (|#2|) is ``u''
% it is replaced with |\lp@mu|. The complete label is stored in |\lp@label|,
% but with the exponent letter discarded if the value is 0. Note: parameter
% |#5| is not used here, but it is necessary to be parameter compatible with
% |\lp@nextloglabel|.
%    \begin{macrocode}
\def\lp@nextlinlabel#1#2#3#4#5#6{\@tempcnta#3\multiply\@tempcnta#4\relax
    \advance\@tempcnta#3\advance\@tempcnta#6#1\relax
    \def\@tempa{#2}\def\@tempb{u}\ifx\@tempa\@tempb\def\@tempa{\lp@mu}\fi
    \edef\lp@label{\the\@tempcnta\ifnum\@tempcnta=0\else\@tempa\fi}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@nextloglabel}
% The parameters for |\lp@nextloglabel| are the absolut start value (|#1|),
% the start exponent letter (|#2|), the factor (|#3|), the decades count
% (beginning with 0, |#4|), a number from 2 to 10 (|#5|) and the sign (|#6|).
%
% First the number is used to distinguish between a label within a decade
% (values from 2 to 9) and a label for a full decade (10). The latter label
% consists of the sign, the factor multiplied with one of the values 1, 10 or
% 100 and the trailing exponent letter.
%    \begin{macrocode}
\def\lp@nextloglabel#1#2#3#4#5#6{%
    \@tempcnta#5\relax\ifnum\@tempcnta=10
        \lp@tentrue
%    \end{macrocode}
% The values 1, 10 and 100 can also be expressed as $10^a$, where the exponent
% $a$ (in |\@tempcnta|) is 0, 1 or 2. To get this exponent the decades count
% (|#4|) has to be advanced by one if the start value (|#1|) is 1, by two if
% the start value is 10 or by three if the start value is 100.
%    \begin{macrocode}
        \@tempcnta#4\relax\@tempcntb#1\relax
        \advance\@tempcnta\@ne
        \ifnum\@tempcntb>1\advance\@tempcnta\@ne
            \ifnum\@tempcntb>10\advance\@tempcnta\@ne\fi\fi
%    \end{macrocode}
% After a modulo 3 (next four lines) $a$ is in the right range and |\lp@label|
% can be defined as the value needed within a case structure.
%    \begin{macrocode}
        \@tempcntb\@tempcnta
        \divide\@tempcntb 3\relax
        \multiply\@tempcntb 3\relax
        \advance\@tempcnta-\@tempcntb
        \ifcase\@tempcnta
            \def\lp@label{1}\or
            \def\lp@label{10}\or
            \def\lp@label{100}\fi
%    \end{macrocode}
% From the modulo operation the vaule $a-(a\;\mbox{mod}\;3)$ remains in
% |\@tempcntb|. After dividing it by 3 it contains the number of exponent
% letters to step further. This is done in |\lp@getpot| after that |\@tempa|
% will contain the needed letter, or an ``X'' if there are no more letters.
% In the latter case a warning is given.
%    \begin{macrocode}
        \divide\@tempcntb 3\relax
        \lp@getpot{#2}\@tempcntb
        \def\@tempb{X}\ifx\@tempa\@tempb
           \PackageWarning{logpap}{%
               log. axis value went to large\MessageBreak
               (no more letters for exponent, used X)\MessageBreak}%
        \fi
%    \end{macrocode}
% \begin{macro}{\lp@label}
% If the exponent letter is ``u'', it is replaced by |\lp@mu|. Then the value
% (1, 10 or 100) is multiplied with the factor (|#3|) and the signed (|#6|)
% label is built in |\lp@label|.
%    \begin{macrocode}
        \def\@tempb{u}\ifx\@tempa\@tempb\def\@tempa{\lp@mu}\fi
        \@tempcnta\lp@label\multiply\@tempcnta#3\relax
        \edef\lp@label{#6\the\@tempcnta\@tempa}%
    \else
%    \end{macrocode}
% This method building the complte label is independent of the order drawing
% the decades.
%
% \begin{macro}{\lp@label}
% If a label for within a decade is needed, the number (|#5|) is multiplied
% with the factor (|#3|) and then the signed (|#6|) label is built in
% |\lp@label|. But if the option |notwonine| where given, |\lp@label| will be
% empty and if the option |nofsn| where given, the already built |\lp@label|
% for 5, 7 and 9 will be cleared.
%    \begin{macrocode}
        \lp@tenfalse
        \iflp@twonine
            \multiply\@tempcnta#3\relax
            \edef\lp@label{#6\the\@tempcnta}%
            \iflp@fsn\else
                \divide\@tempcnta#3\relax
                \ifnum\@tempcnta=9\def\lp@label{}\fi
                \ifnum\@tempcnta=7\def\lp@label{}\fi
                \ifnum\@tempcnta=5\def\lp@label{}\fi
            \fi
        \else
            \def\lp@label{}%
        \fi
    \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@getpot}
% In |\lp@getpot| the exponent letter needed for a full decades label is
% ascertained. It takes the letter to start with (|#1|) and the number of
% of letters to step further (|#2|) as parameters. The macro |\@tempa| will
% contain the ascertained letter after operation. It is predefined as ``X'',
% which will be the result, if there are not enough letters.
%
% Within the |\@tfor| loop the boolean |\iflp@preached| is set to true in the
% pass the start letter is reached. From the same pass on the number of letters
% to step further is counted down once a pass until it is $-1$. Then |\@tempa|
% is set to the actual letter. Note: the |{}| in the token list (between |:=|
% and |\do|) stands for the nonexisting letter for $10^0$.  The |\@tfor| loop
% will always run completely, because (for whatever reasons) |\@break@tfor|
% doesn't work within the |\ifnum|.
%    \begin{macrocode}
\def\lp@getpot#1#2{%
    \def\@tempb{#1}\def\@tempa{X}\@tempcnta#2\relax\lp@preachedfalse
    \@tfor\@tempc:=yzafpnum{}kMGTPEZY\do{%
        \if\@tempc\@tempb\relax\relax\lp@preachedtrue\fi
        \iflp@preached\advance\@tempcnta\m@ne
            \ifnum\@tempcnta=\m@ne\edef\@tempa{\@tempc}\fi
        \fi}}
%    \end{macrocode}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Drawing Labels}
% \begin{macro}{\lp@xlabel}
% With |\lp@xlabel| one label for the x-axis is drawn. Parameter |#1| is the
% offset from the origin of the graph paper to the thick line, where the label
% has to appear at. Parameter |#2| is the label. Note: the value in |\lp@lpos|
% is already advanced by |\lp@tol|, when calling |\lp@xlabel|. Note (2): the
% command |\put| works with a dimen, because |\unitlength| was disabled before
% starting the \texttt{picture} environment.
%    \begin{macrocode}
\def\lp@xlabel#1#2{\let\@tempb\lp@lpos
    \iflp@tenlower\iflp@ten\let\@tempb\lp@llpos\fi\fi
    \put(#1,-\@tempb){\makebox(\z@,\z@)[tc]{\lp@font #2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@ylabel}
% With |\lp@ylabel| one label for the y-axis is drawn. Parameter |#1| is the
% offset from the origin of the graph paper to the thick line, where the label
% has to appear at. Parameter |#2| is the label. Note: the value in |\lp@lpos|
% is already advanced by |\lp@tol|, when calling |\lp@ylabel|. Note (2): here
% also |\put| works with a dimen, because of the disabled |\unitlength|.
%    \begin{macrocode}
\def\lp@ylabel#1#2{\put(-\lp@lpos,#1){\makebox(\z@,\z@)[cr]{\lp@font #2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@nextlllist}
% \begin{macro}{\lp@llno}
% \begin{macro}{\lp@lllist}
% In |\lp@nextlllist| the first element of the list in |\lp@lllist| is
% discarded from it and stored in |\lp@llno|. The macro has to be called
% with the expanded |\lp@lllist|.
%    \begin{macrocode}
\def\lp@nextlllist#1,#2\@@end{%
    \def\lp@llno{#1}\def\lp@lllist{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@dolabelsx}
% \begin{macro}{\lp@lllist}
% With |\lp@dolabelsx| the labels for one decade or division are drawn. Here
% first the offset from the origin of the graph paper to the beginning of the
% actual decade or division is calculated and stored in |\lp@osg|. Then the
% list containing the values for logarithmic axis labels (|#5|) is assigned to
% |\lp@lllist|.\footnote{The name \texttt{\bs lp@lllist} can be used here,
% because after building the list in \texttt{\bs lp@lllist} it is assigned to
% one of the names \texttt{\bs lp@lllistx}, \texttt{\bs lp@lllisty},
% \texttt{\bs lp@partlllistx} or \texttt{\bs lp@partlllisty}.} At last
% |\lp@dolabelx| is called with the expanded list of offsets from the beginning
% of a decade or division to the thick lines, where the labels has to appear
% at, and the other papameters. These parameters are the start value (|#2|),
% the start exponent letter (|#3|), the factor or increment (|#4|) and the
% start values sign (|#6|).
%    \begin{macrocode}
\def\lp@dolabelsx#1#2#3#4#5#6{\lp@osg\lp@dcntx\lpgridx
    \let\lp@lllist#5\relax
    \expandafter\lp@dolabelx#1,\@@end{#2}{#3}{#4}{#6}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@dolabelx}
% If the list is not empty, |\lp@dolabelx| first calculates the offset form
% the origin of the graph paper to the line, where the label has to appear at,
% in |\lp@osl|. Then the next element of |\lp@lllist| is stored in |\lp@llno|,
% the next label is built and it is drawn. At last |\lp@dolabelx| calls itself
% recursively, until the list is empty. Parameter |#1| is the first element of
% the list of offsets and parameter |#2| its rest. Parameter |#3| is the start
% value, |#4| the start exponent letter, |#5| the factor or increment and |#6|
% the start values sign.
%    \begin{macrocode}
\def\lp@dolabelx#1,#2,\@@end#3#4#5#6{%
    \def\@tempc{#1}\ifx\@tempc\@empty\else
    \lp@osl#1\lpgridx \advance\lp@osl\lp@osg
    \expandafter\lp@nextlllist\lp@lllist\@@end
    \lp@nextxlabel{#3}{#4}{#5}\lp@dcntx\lp@llno{#6}%
    \lp@xlabel\lp@osl\lp@label
    \def\@tempc{#2}\ifx\@tempc\@empty\else
    \lp@dolabelx#2,\@@end{#3}{#4}{#5}{#6}\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@dolabelsy}
% \begin{macro}{\lp@lllist}
% The command |\lp@dolabelsy| works the same way and has the same parameters
% as |\lp@dolabelsx|, but of course for the y-axis.
%    \begin{macrocode}
\def\lp@dolabelsy#1#2#3#4#5#6{\lp@osg\lp@dcnty\lpgridy
    \let\lp@lllist#5\relax
    \expandafter\lp@dolabely#1,\@@end{#2}{#3}{#4}{#6}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@dolabely}
% The command |\lp@dolabely| works the same way and has the same parameters
% as |\lp@dolabelx|, but of course for the y-axis.
%    \begin{macrocode}
\def\lp@dolabely#1,#2,\@@end#3#4#5#6{%
    \def\@tempc{#1}\ifx\@tempc\@empty\else
    \lp@osl#1\lpgridy \advance\lp@osl\lp@osg
    \expandafter\lp@nextlllist\lp@lllist\@@end
    \lp@nextylabel{#3}{#4}{#5}\lp@dcnty\lp@llno{#6}%
    \lp@ylabel\lp@osl\lp@label
    \def\@tempc{#2}\ifx\@tempc\@empty\else
    \lp@dolabely#2,\@@end{#3}{#4}{#5}{#6}\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Some Macros for Initialization}
% \subsubsection{Setting Lists}
% \begin{macro}{\lp@setlinesx}
% \begin{macro}{\lp@thicklinesx}
% \begin{macro}{\lp@medlinesx}
% \begin{macro}{\lp@thinlinesx}
% \begin{macro}{\lp@lllistx}
% In |\lp@setlinesx| only the already built lists for a full decade or
% divisions are assigned the macros special to the x-axis.
%    \begin{macrocode}
\def\lp@setlinesx{\let\lp@thicklinesx\lp@thicklines
    \let\lp@medlinesx\lp@medlines \let\lp@thinlinesx\lp@thinlines
    \let\lp@lllistx\lp@lllist}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@setlinesy}
% \begin{macro}{\lp@thicklinesy}
% \begin{macro}{\lp@medlinesy}
% \begin{macro}{\lp@thinlinesy}
% \begin{macro}{\lp@lllisty}
% In |\lp@setlinesy| only the already built lists for a full decade or
% divisions are assigned the macros special to the y-axis.
%    \begin{macrocode}
\def\lp@setlinesy{\let\lp@thicklinesy\lp@thicklines
    \let\lp@medlinesy\lp@medlines \let\lp@thinlinesy\lp@thinlines
    \let\lp@lllisty\lp@lllist}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@setpartlinesx}
% \begin{macro}{\lp@partthicklinesx}
% \begin{macro}{\lp@partmedlinesx}
% \begin{macro}{\lp@partthinlinesx}
% \begin{macro}{\lp@partlllistx}
% In |\lp@setpartlinesx| only the already built lists for a partial decade or
% divisions are assigned the macros special to the x-axis.
%    \begin{macrocode}
\def\lp@setpartlinesx{\let\lp@partthicklinesx\lp@thicklines
    \let\lp@partmedlinesx\lp@medlines \let\lp@partthinlinesx\lp@thinlines
    \let\lp@partlllistx\lp@lllist}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lp@setpartlinesy}
% \begin{macro}{\lp@partthicklinesy}
% \begin{macro}{\lp@partmedlinesy}
% \begin{macro}{\lp@partthinlinesy}
% \begin{macro}{\lp@partlllisty}
% In |\lp@setpartlinesy| only the already built lists for a partial decade or
% divisions are assigned the macros special to the y-axis.
%    \begin{macrocode}
\def\lp@setpartlinesy{\let\lp@partthicklinesy\lp@thicklines
    \let\lp@partmedlinesy\lp@medlines \let\lp@partthinlinesy\lp@thinlines
    \let\lp@partlllisty\lp@lllist}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Parsing Number of Decades/Divisions}
% \begin{macro}{\lp@ipart}
% The macro |\lp@ipart| expands to the integer part of a real number, which
% is passed to it.
%    \begin{macrocode}
\def\lp@ipart#1.#2\@@end{#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@rpart}
% The macro |\lp@rpart| expands to the part after the decimal point of
% a real number, which is passed to it.
%    \begin{macrocode}
\def\lp@rpart#1.#2\@@end{#2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@firstdigit}
% The macro |\lp@firstdigit| expands to the first digit of a (integer) number,
% which is passed to it.
%    \begin{macrocode}
\def\lp@firstdigit#1#2\@@end{#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@getreal}
% In |\lp@getreal| the number of decades or division as passed to the
% \texttt{\emph{decades/divisions}} argument of an axis (parameter |#1|)
% is split. The integer part is stored in |\@tempa|, if there is no integer
% part |\@tempa| will be 0. The first digit after the decimal point is stored
% in |\@tempb| if it is not equal 0, else |\@tempb| will be empty. This works
% for $x$, $x.$, $x.0$, $x.y$, $x.0z$, $x.yz$, $0.y$, $0.yz$, $.y$ and $.yz$
% (here $x$ and $y$ are single digits and $z$ is the rest).
%    \begin{macrocode}
\def\lp@getreal#1{%
    \edef\@tempa{\lp@ipart#1.\@@end}%
    \ifx\@tempa\@empty\def\@tempa{0}\fi
    \edef\@tempc{\lp@rpart#1.\@@end}%
    \ifx\@tempc\@empty\let\@tempb\@empty\else
        \if\@tempc.\let\@tempb\@empty\else
            \edef\@tempd{\expandafter\lp@firstdigit\@tempc\@@end}%
            \if\@tempd0\let\@tempb\@empty\else
                \let\@tempb\@tempd\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% ^^A------------------------------
% \subsubsection{Checking Number of Decades/Devisions}
% \begin{macro}{\lp@decerr}
% With |\lp@decerr| an error message for a to small number of decades is given.
%    \begin{macrocode}
\def\lp@decerr{%
    \PackageError{logpap}{number of decades for logaritmic axis to small}%
        {The number of decades for a logaritmic axis\MessageBreak
         has to be at least 0.2.\MessageBreak
         Please correct it before going on,\MessageBreak
         otherwise you might get more error messages.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@decerri}
% With |\lp@decerri| an error message for a wrong number of decades is given.
%    \begin{macrocode}
\def\lp@decerri{%
    \PackageError{logpap}{wrong number of decades for logaritmic axis}%
        {For the number of decades for a logaritmic axis\MessageBreak
         values like x.1 are not alowed.\MessageBreak
         You can only use x.0 (or only x) and x.2 to x.9.\MessageBreak
         Please correct it before going on,\MessageBreak
         otherwise you might get more error messages.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@checkdec}
% In |\lp@checkdec| the number of decades is checked against a minimum value of
% 0.2 and values in the form x.1 and an appropriate error messages is given if
% necessary. The integer part has to be in |\@tempa| and the first digit after
% the decimal point in |\@tempb| when calling |\lp@checkdec|.
%    \begin{macrocode}
\def\lp@checkdec{\@tempcnta\@tempa
    \ifx\@tempb\@empty\@tempcntb0\relax\else\@tempcntb\@tempb\relax\fi
    \ifnum\@tempcnta<0\relax\lp@decerr\else
        \ifnum\@tempcntb=0\relax\ifnum\@tempcnta=0\relax\lp@decerr\fi\else
            \ifnum\@tempcntb<0\relax\lp@decerri\else
                \ifnum\@tempcntb=1\relax
                    \ifnum\@tempcnta=0\relax\lp@decerr\else
                        \lp@decerri\fi\fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@diverr}
% With |\lp@diverr| an error message for a to small number of divisions is
% given.
%    \begin{macrocode}
\def\lp@diverr{%
    \PackageError{logpap}{number of divisions for linear axis to small}%
        {The number of divisions for a linear axis\MessageBreak
         has to be at least 0.1.\MessageBreak
         Please correct it before going on,\MessageBreak
         otherwise you might get more error messages.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@checkdiv}
% In |\lp@checkdiv| the number of divisions is checked against a minimum value
% of 0.1 and an appropriate error message is given if necessary. The integer
% part has to be in |\@tempa| and the first digit after the decimal point in
% |\@tempb| when calling |\lp@checkdiv|.
%    \begin{macrocode}
\def\lp@checkdiv{\@tempcnta\@tempa
    \ifx\@tempb\@empty\@tempcntb0\relax\else\@tempcntb\@tempb\relax\fi
    \ifnum\@tempcnta<0\relax\lp@diverr\else
        \ifnum\@tempcnta=0\relax
            \ifnum\@tempcntb<1\relax\lp@diverr\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Drawing the whole Graph Paper}
% \begin{macro}{\lp@logpap}
% The command |\lp@logpap| is invoked by the four main macros. It only checks
% if there is a first optional argument.
%    \begin{macrocode}
\def\lp@logpap(#1,#2)(#3,#4)#5#6{%
    \@ifnextchar[{\lp@@logpap{#1}{#2}{#3}{#4}{#5}{#6}}%
                 {\lp@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@@logpap}
% The command |\lp@@logpap| checks if there is a second optional argument.
%    \begin{macrocode}
\def\lp@@logpap#1#2#3#4#5#6[#7]{%
    \@ifnextchar[{\lp@@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[#7]}%
                 {\lp@@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[#7][]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lp@@@logpap}
% In |\lp@@@logpap| most of the work is done. The parameters are the dimension
% of the graph paper in x- (|#1|) and y-direction (|#2|), the number of decades
% or divisions in x- (|#3|) and y-direction (|#4|), the start value and factor
% or increment for x- (|#5|) and y-axis labeling (|#6|) and the x- (|#7|) and
% y-axis name (|#8|).
%
% First a lot of settings for the x-axis are made. Here the number of decades
% or divisions is split (integer part in |\@tempa| and first digit after
% decimal point in |\@tempb|, empty if 0 or none) and checked, the boolean
% |\iflp@fulldecx| is set and the text showing the dimensions (|\lp@texttwo|)
% is extended. Latter is done several times until the text is complete.
%    \begin{macrocode}
\def\lp@@@logpap#1#2#3#4#5#6[#7][#8]{%
    \lp@getreal{#3}\iflp@logx\lp@checkdec\else\lp@checkdiv\fi
    \ifnum\@tempa=0\relax\lp@fulldecxfalse\else\lp@fulldecxtrue\fi
    \edef\lp@texttwo{\lp@texttwo\ \@tempa}%
%    \end{macrocode}
% Now the boolean |\lp@partdecxfalse| is set and |\lp@real| and |\lp@part|
% are defined, but latter only if there is a partial decade or division.
%    \begin{macrocode}
    \ifx\@tempb\@empty
        \lp@partdecxfalse
        \let\lp@real\@tempa
        \edef\lp@texttwo{\lp@texttwo\iflp@logx\,dec\fi\ $\times$}%
    \else
        \lp@partdecxtrue
        \iflp@logx
            \edef\lp@real{\@tempa\getlp@logline{\@tempb.0}}%
            \edef\lp@part{\@tempb}%
            \edef\lp@texttwo{\lp@texttwo.\@tempb\,dec\ $\times$}%
        \else
            \edef\lp@real{\@tempa.\@tempb}%
            \edef\lp@part{.\@tempb}%
            \edef\lp@texttwo{\lp@texttwo.\@tempb\ $\times$}%
        \fi
    \fi
%    \end{macrocode}
% Then |\lp@dcntx| is set and |\lpgridx| is calculated with help of the
% extensions to |\setlength| by the \textsf{calc} package (and made global,
% so it can be used after the graph paper was drawn). All lists for the
% x-axis are made and the necessary commands for testing the range of the
% argument for labeling and getting the next label are assigned to
% |\lp@testrangex| and |\lp@nextxlabel|.
%    \begin{macrocode}
    \lp@dcntx\@tempa
    \setlength\lpgridx{#1/\real{\lp@real}}\global\lpgridx\lpgridx
    \iflp@logx
        \lp@mkloglist\lpgridx{10}\lp@setlinesx
        \iflp@partdecx \lp@mkloglist\lpgridx\lp@part \lp@setpartlinesx\fi
        \let\lp@testrangex\lp@testrangelog
        \let\lp@nextxlabel\lp@nextloglabel
    \else
        \lp@mklinlist\lpgridx{1}\lp@setlinesx
        \iflp@partdecx \lp@mklinlist\lpgridx\lp@part \lp@setpartlinesx\fi
        \let\lp@testrangex\lp@testrangelin
        \let\lp@nextxlabel\lp@nextlinlabel
    \fi
%    \end{macrocode}
% After this the same things are set up for y-axis on the same way.
%    \begin{macrocode}
    \lp@getreal{#4}\iflp@logx\lp@checkdec\else\lp@checkdiv\fi
    \ifnum\@tempa=0\relax\lp@fulldecyfalse\else\lp@fulldecytrue\fi
    \edef\lp@texttwo{\lp@texttwo\ \@tempa}%
    \ifx\@tempb\@empty
        \lp@partdecyfalse
        \let\lp@real\@tempa
        \edef\lp@texttwo{\lp@texttwo\iflp@logy\,dec\fi}%
    \else
        \lp@partdecytrue
        \iflp@logy
            \edef\lp@real{\@tempa\getlp@logline{\@tempb.0}}%
            \edef\lp@part{\@tempb}%
            \edef\lp@texttwo{\lp@texttwo.\@tempb\,dec}%
        \else
            \edef\lp@real{\@tempa.\@tempb}%
            \edef\lp@part{.\@tempb}%
            \edef\lp@texttwo{\lp@texttwo.\@tempb}%
        \fi
    \fi
    \lp@dcnty\@tempa
    \setlength\lpgridy{#2/\real{\lp@real}}\global\lpgridy\lpgridy
    \iflp@logy
        \lp@mkloglist\lpgridy{10}\lp@setlinesy
        \iflp@partdecy \lp@mkloglist\lpgridy\lp@part \lp@setpartlinesy\fi
        \let\lp@testrangey\lp@testrangelog
        \let\lp@nextylabel\lp@nextloglabel
    \else
        \lp@mklinlist\lpgridy{1}\lp@setlinesy
        \iflp@partdecy \lp@mklinlist\lpgridy\lp@part \lp@setpartlinesy\fi
        \let\lp@testrangey\lp@testrangelin
        \let\lp@nextylabel\lp@nextlinlabel
    \fi
%    \end{macrocode}
% Now the lengths for thick and medium lines are calculated by adding the tick
% length once, or twice if ticks on the upper and the right side of the graph
% paper should appear.
%    \begin{macrocode}
    \lp@thicklinelenx#1\advance\lp@thicklinelenx\lp@tol
    \lp@thicklineleny#2\advance\lp@thicklineleny\lp@tol
    \lp@medlinelenx#1\advance\lp@medlinelenx\lp@mol
    \lp@medlineleny#2\advance\lp@medlineleny\lp@mol
    \iflp@ticksupright
        \advance\lp@thicklinelenx\lp@tol
        \advance\lp@thicklineleny\lp@tol
        \advance\lp@medlinelenx\lp@mol
        \advance\lp@medlineleny\lp@mol
    \fi
%    \end{macrocode}
% Then everything for x-axis labeling is set up, the values are tested and
% assigned to |\lp@sllx|, |\lp@sllpx|, |\lp@lfix| and |\lp@signx|.
%    \begin{macrocode}
    \lp@setuplabel#5,\@@end
    \lp@testrangex
    \let\lp@sllx\lp@sll\let\lp@sllpx\lp@sllp\let\lp@lfix\lp@lfi
    \let\lp@signx\lp@sign
%    \end{macrocode}
% The same is done for y-axis labeling.
%    \begin{macrocode}
    \lp@setuplabel#6,\@@end
    \lp@testrangey
    \let\lp@slly\lp@sll\let\lp@sllpy\lp@sllp\let\lp@lfiy\lp@lfi
    \let\lp@signy\lp@sign
%    \end{macrocode}
% After that |\unitlength| is disabled within a group (ending at the end of
% |\lp@@@logpap|), so all commands of the \texttt{picture} environment and the
% environment itself will work with dimens (and only with dimens). Then
% |\lp@llpos| is calculated so that labels, which have to appear lower (see
% option \texttt{tenlower}), are put one |\lp@lpos| under normal labels and
% |\lp@lpos| is advanced by |\lp@tol|, so that normal labels appears one
% (unadvanced) |\lp@lpos| under the ticks.
%    \begin{macrocode}
    \begingroup
    \let\unitlength\relax
    {\lp@font\settoheight\@tempdima{M}\advance\@tempdima\lp@tol
     \advance\@tempdima\lp@lpos\advance\@tempdima\lp@lpos
     \xdef\lp@llpos{\the\@tempdima}}%
    \@tempdima\lp@lpos\advance\@tempdima\lp@tol\edef\lp@lpos{\the\@tempdima}%
    \begin{picture}(#1,#2)(\z@,\z@)
%    \end{macrocode}
% Within the \texttt{picture} environment first the label for the x-axis origin
% is set. For a logarithmic axis the start value has to be multiplied by the
% factor. If the exponent letter is ``u'' it is replaced with |\lp@mu|. And
% if the start value is 0 (linear axis only) the sign and the exponent letter
% are cleard.
%    \begin{macrocode}
    \lp@labelcolor
    \lp@tenfalse
    \@tempcnta\lp@sllx\iflp@logx\multiply\@tempcnta\lp@lfix\fi
    \def\@tempa{u}\ifx\lp@sllpx\@tempa\def\@tempa{\lp@mu}\else
        \def\@tempa{\lp@sllpx}\fi
    \begingroup
    \ifnum\@tempcnta=0\let\lp@signx\@empty\let\@tempa\@empty\fi
    \lp@xlabel{\z@}{\lp@signx\the\@tempcnta\@tempa}
    \endgroup
%    \end{macrocode}
% The label for the y-axis origin is set on the same way.
%    \begin{macrocode}
    \@tempcnta\lp@slly\iflp@logy\multiply\@tempcnta\lp@lfiy\fi
    \def\@tempa{u}\ifx\lp@sllpy\@tempa\def\@tempa{\lp@mu}\else
        \def\@tempa{\lp@sllpy}\fi
    \begingroup
    \ifnum\@tempcnta=0\let\lp@signy\@empty\let\@tempa\@empty\fi
    \lp@ylabel{\z@}{\lp@signy\the\@tempcnta\@tempa}
    \endgroup
%    \end{macrocode}
% Now the two text parts are set above the graph paper.
%    \begin{macrocode}
    \@tempdima#2\advance\@tempdima\lp@lpos
    \iflp@ticksupright\else\advance\@tempdima-\lp@tol\fi
    \put(\z@,\@tempdima){\makebox(\z@,\z@)[bl]{\lp@font
        \iflp@text\lp@textone\fi\iflp@dimensions\lp@texttwo\fi}}
%    \end{macrocode}
% And the axis names are set at the end of the y- and x-axis. The y-position
% for the y-axis name (|\@tempdima|) is the same as for the two text parts.
%    \begin{macrocode}
    \put(-\lp@lpos,\@tempdima){\makebox(\z@,\z@)[br]{#8}}
    \@tempdima#1\advance\@tempdima\lp@lpos
    \iflp@ticksupright\else\advance\@tempdima-\lp@tol\fi
    \put(\@tempdima,-\lp@lpos){\makebox(\z@,\z@)[tl]{#7}}
%    \end{macrocode}
% Then the lines for the origin are drawn.
%    \begin{macrocode}
    \lp@linecolor
    \linethickness\lp@tkltkness
    \put(-\lp@tol,\z@){\line(1,0){\lp@thicklinelenx}}
    \put(\z@,-\lp@tol){\line(0,1){\lp@thicklineleny}}
%    \end{macrocode}
% After that lines and labels for the x-axis will be done. Here first the
% booleans |\iflp@twonine| and |\iflp@fsn| are set depending on
% |\iflp@twoninex| and |\iflp@fsnx|.
%    \begin{macrocode}
    \iflp@twoninex\lp@twoninetrue\else\lp@twoninefalse\fi
    \iflp@fsnx\lp@fsntrue\else\lp@fsnfalse\fi
%    \end{macrocode}
% Then lines and labels for a partial decade or division are done if there is
% one.
%    \begin{macrocode}
    \iflp@partdecx
        \lp@dolinesx\lp@partthicklinesx\lp@tkltkness{-\lp@tol}\lp@thicklineleny
        \lp@dolinesx\lp@partmedlinesx\lp@mdltkness{-\lp@mol}\lp@medlineleny
        \lp@dolinesx\lp@partthinlinesx\lp@tnltkness\z@{#2}%
        \lp@labelcolor
        \lp@dolabelsx\lp@partthicklinesx\lp@sllx\lp@sllpx\lp@lfix\lp@partlllistx\lp@signx
        \lp@linecolor
    \fi
%    \end{macrocode}
% If there is at least one full decade or division, they are done one by one.
%    \begin{macrocode}
    \iflp@fulldecx\advance\lp@dcntx\m@ne
        \loop
            \lp@dolinesx\lp@thicklinesx\lp@tkltkness{-\lp@tol}\lp@thicklineleny
            \lp@dolinesx\lp@medlinesx\lp@mdltkness{-\lp@mol}\lp@medlineleny
            \lp@dolinesx\lp@thinlinesx\lp@tnltkness\z@{#2}%
            \lp@labelcolor
            \lp@dolabelsx\lp@thicklinesx\lp@sllx\lp@sllpx\lp@lfix\lp@lllistx\lp@signx
            \lp@linecolor
            \advance\lp@dcntx\m@ne
        \ifnum\lp@dcntx>\m@ne\repeat
    \fi
%    \end{macrocode}
% The lines and labels for y-axis are done on the same way as for the x-axis.
%    \begin{macrocode}
    \iflp@twoniney\lp@twoninetrue\else\lp@twoninefalse\fi
    \iflp@fsny\lp@fsntrue\else\lp@fsnfalse\fi
    \iflp@partdecy
        \lp@dolinesy\lp@partthicklinesy\lp@tkltkness{-\lp@tol}\lp@thicklinelenx
        \lp@dolinesy\lp@partmedlinesy\lp@mdltkness{-\lp@mol}\lp@medlinelenx
        \lp@dolinesy\lp@partthinlinesy\lp@tnltkness\z@{#1}%
        \lp@labelcolor
        \lp@dolabelsy\lp@partthicklinesy\lp@slly\lp@sllpy\lp@lfiy\lp@partlllisty\lp@signy
        \lp@linecolor
    \fi
    \iflp@fulldecy\advance\lp@dcnty\m@ne
        \loop
            \lp@dolinesy\lp@thicklinesy\lp@tkltkness{-\lp@tol}\lp@thicklinelenx
            \lp@dolinesy\lp@medlinesy\lp@mdltkness{-\lp@mol}\lp@medlinelenx
            \lp@dolinesy\lp@thinlinesy\lp@tnltkness\z@{#1}%
            \lp@labelcolor
            \lp@dolabelsy\lp@thicklinesy\lp@slly\lp@sllpy\lp@lfiy\lp@lllisty\lp@signy
            \lp@linecolor
            \advance\lp@dcnty\m@ne
        \ifnum\lp@dcnty>\m@ne\repeat
    \fi
    \end{picture}\endgroup}
%    \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{The main Macros}
% The four main macros are very simple. Here only two booleans are set and
% the first part of the text showing the dimensions is defined. They even
% take no parameters. This is done by |\lp@logpap|, called at the end of
% the main macros.
%
% \begin{macro}{\loglinpap}
% The command |\loglinpap| draws graph paper with logarithmic x-axis and
% linear y-axis.
%    \begin{macrocode}
\def\loglinpap{\lp@logxtrue\lp@logyfalse\def\lp@texttwo{log--lin:}\lp@logpap}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\loglogpap}
% The command |\loglogpap| draws graph paper with logarithmic x- and y-axis.
%    \begin{macrocode}
\def\loglogpap{\lp@logxtrue\lp@logytrue\def\lp@texttwo{log--log:}\lp@logpap}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\linlogpap}
% The command |\linlogpap| draws graph paper with linear x-axis and
% logarithmic y-axis.
%    \begin{macrocode}
\def\linlogpap{\lp@logxfalse\lp@logytrue\def\lp@texttwo{lin--log:}\lp@logpap}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\linlinpap}
% The command |\linlinpap| draws graph paper with linear x- and y-axis.
%    \begin{macrocode}
\def\linlinpap{\lp@logxfalse\lp@logyfalse\def\lp@texttwo{lin--lin:}\lp@logpap}
%    \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{Config File}
% The last thing to do is loading the config file if it exists. In this case
% a message will be typed out.
%    \begin{macrocode}
\InputIfFileExists{logpap.cfg}%
    {\typeout{Package logpap Info: Local config file logpap.cfg used}}{}
%    \end{macrocode}
%
% \newpage
% \Finale\endinput
%</package>
% ^^A Now the source of the example
%<*example>
\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{logpap}

\voffset-2cm
\hoffset-0.5cm
\textheight25cm
\textwidth14cm

\parindent0pt
\parskip1ex plus.3ex minus.2ex
\pagestyle{empty}
\unitlength1mm

\newcommand*{\lp}{\textsf{logpap}}
\newcommand*{\bs}{\char '134 }
\newcommand*{\lb}{\char '173 }
\newcommand*{\rb}{\char '175 }
\newcommand*{\param}[1]{\texttt{\textit{#1}}}

\begin{document}
\centerline{\textbf{\LARGE Some Examples for the \lp\ package.\footnote{The
source of this example file is part of \texttt{logpap.dtx}.}}}

\vspace{4mm}
The \lp\ package provides four macros for drawing logarithmic-logarithmic,
logarithmic-linear, linear-logarithmic and (because it was easy to implement)
linear-linear graph paper with \LaTeX.

\vspace{2mm}
\begin{picture}(140,50)
\LPSet{nofsnx,notwoniney}
\put( 0, 5){\linlogpap(60mm,12.5mm)(6,1){0,10}{1}[X][Y]}
\put(75, 5){\linlinpap(60mm,12.5mm)(6,1){0,10}{0,10}[X][Y]}
\put( 0,32.5){\loglogpap(60mm,12.5mm)(2,1){100m}{1}[X][Y]}
\put(75,32.5){\loglinpap(60mm,12.5mm)(2,1){100m}{0,10}[X][Y]}
\end{picture}

\vspace{2mm}
Altough the \lp\ package only draws logarithmic graph paper, there are
various things that can be changed. Figure \ref{fig:ov} will give an
overwiev. Here the first graph paper part where made with the default
settings and the command
\verb|\put(0,91){\loglinpap(80mm,10mm)(1,1){1}| \verb|{0}[X-name][Y-name]}|.
On the right side you can find the commands used to change the appearance.

Not all commands possible are shown here. Every option can be used with
\verb|\LPSet{|\param{option1}\verb|,| \param{option2}\verb|,...}| within the
document, every \param{option} has a counterpart \verb|no|\param{option} and
for every \param{option}\verb|x| also an \param{option}\verb|y| exists. Also
commands to set the three line widths, colors and the appearance of the $\mu$
are not shown.

\begin{figure}[ht]
\centering
\begin{picture}(140,106)
\put( 0,91){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}
\put(85,96){\makebox(0,0)[cl]{with default settings}}

\LPSet{nodimensions,noticksupright,tenlower}
\put( 0,69){\loglinpap(80mm,10mm)(1,1){1}{0}[optional][optional]}
\put(85,78){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb nodimensions,}}}
\put(85,74){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ noticksupright,}}}
\put(85,70){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ tenlower\rb}}}
\LPSet{dimensions,ticksupright,notenlower}

\LPSet{notext,nofsnx}\DefineLPMinLineDist{1.9999mm}
\put( 0,47){\loglinpap(80mm,10mm)(1,1){1}{0}}
\put(85,56){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notext,}}}
\put(85,52){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ nofsnx\rb}}}
\put(85,48){\makebox(0,0)[cl]{\texttt{\bs DefineLPMinLineDist\lb 1.9999mm\rb}}}
\LPSet{text,fsnx}\DefineLPMinLineDist{0.9999mm}

\DefineLPText{new text\quad}\DefineLPLabelFont{\sffamily\tiny}\LPSet{notwoninex}
\put( 0,25){\loglinpap(80mm,10mm)(1,1){1}{0}}
\put(85,36){\makebox(0,0)[cl]{\texttt{\bs DefineLPText\lb new text\bs quad\rb}}}
\put(85,32){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelFont}}}
\put(85,28){\makebox(0,0)[cl]{\texttt{\ \ \ \ \lb\bs sffamily\bs tiny\rb}}}
\put(85,24){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notwoninex\rb}}}
\DefineLPText{made with \LaTeX\ and \textsf{logpap}\quad}\DefineLPLabelFont{\scriptsize}\LPSet{twoninex}

\DefineLPThickTickLen{1mm}\DefineLPMedTickLen{0.5mm}\DefineLPLabelDist{0.5mm}
\put( 0, 3){\loglinpap(80mm,10mm)(1,1){1}{0}}
\put(85,12){\makebox(0,0)[cl]{\texttt{\bs DefineLPThickTickLen\lb 1mm\rb}}}
\put(85, 8){\makebox(0,0)[cl]{\texttt{\bs DefineLPMedTickLen\lb 0.5mm\rb}}}
\put(85, 4){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelDist\lb 0.5mm\rb}}}
\DefineLPThickTickLen{2mm}\DefineLPMedTickLen{1mm}\DefineLPLabelDist{1mm}
\end{picture}
\caption{Overview}\label{fig:ov}
\end{figure}
\end{document}
%</example>