summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/labbook/labbook.dtx
blob: 61ff728ecf873cd9e27b1694ee2ea689d913e301 (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
% \CheckSum{910}
% \iffalse meta-comment
% ======================================================================
% labbook.dtx 
% Copyright (C) 2003 Frank Küster
%
% This file can be redistributed and/or modified under the terms
% of the LaTeX Project Public Licence Version 1.0. See:
% http://www.ctan.org/tex-archive/macros/latex/base/lppl.txt
% ----------------------------------------------------------------------
% labbook.dtx
% Copyright (C) 2003 
%
%
% Diese Datei kann nach den Regeln der LaTeX Project Public
% Licence Version 1.0 weiterverbreitet und/oder modifiziert 
% werden.
%
% ======================================================================
%
% \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         \~}
% \fi
% \iffalse
%<*dtx>
            \ProvidesFile{labbook.dtx}
%</dtx>
%\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<driver>\ProvidesFile{labbook.drv}
%<examplen>\ProvidesFile{examplen.tex}%
%<examplde>\ProvidesFile{examplde.tex}%
%<boilerplates>\ProvidesFile{boilerplates.tex}%
%<labboode>\ProvidesFile{labboode.tex}%
%<labbook>\ProvidesClass{labbook}
            [2003/05/20 v1.1 LaTeX2e labbook document class]
%<*driver>
\documentclass{article}
\usepackage{doc}
\usepackage{marvosym}
\EnableCrossrefs
%
\DoNotIndex{\@addtoreset,\@arabic,\@gobble}
\DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined}
\DoNotIndex{\@minus,\@namedef,\@nameuse,\@nil}
\DoNotIndex{\@onelevel@sanitize,\@plus,\@sptoken}
\DoNotIndex{\@startsection}
\DoNotIndex{\\,\ ,\|,\@tmpA,\@tmpB,\@tmpC}
\DoNotIndex{\AfterPackage,\arabic,\AtEndDocument,\AtBeginDocument,\author,\addchap}
\DoNotIndex{\begin,\caption,\ClassError,\ClassWarning,\csname,\CurrentOption}
\DoNotIndex{\c@experiment,\cfigure,\c@fk@argnumber,\c@paragraph,\c@subexperiment,\c@subparagraph,\c@subsection}
\DoNotIndex{\centering,\chapter}
\DoNotIndex{\DeclareOption,\def,\documentclass,\dots,\date}
\DoNotIndex{\edef,\emph,\endinput}
\DoNotIndex{\if,\else,\fi,\empty,\end,\endcsname,\expandafter}
\DoNotIndex{\fbox,\FK@@sp@b,\FK@@sp@c,\FK@@sp@d,\FK@tempa,\FK@toks@,\FK@@sp@def,\frontmatter,\futurelet}
\DoNotIndex{\fk@old@addcontentsline,\fk@old@appendix,\fk@old@backmatter}
\DoNotIndex{\if@mainmatter,\fi,\ifnum,\fi}
\DoNotIndex{\ifx,\fi,\input}
\DoNotIndex{\l@chapter,\l@section,\l@subsection,\l@experiment,\l@labday,\l@subexperiment,\label,\let,\LoadClass}
\DoNotIndex{\maketitle,\MessageBreak,\message}
\DoNotIndex{\newcommand,\newcounter,\newif,\newtoks,\nobreak,\normalfont}
\DoNotIndex{\othertext}
\DoNotIndex{\par,\PassOptionsToClass,\printindex,\ProcessOptions}
\DoNotIndex{\protect,\protected@edef,\protected@xdef,\providecommand}
\DoNotIndex{\raggedsection,\refstepcounter,\relax,\renewcommand,\RequirePackage,\rule}
\DoNotIndex{\sdsband,\sdsbandh,\sdsbandl,\sdsgel,\sometext}
\DoNotIndex{\sectfont,\setcounter,\size@section,\space,\stepcounter}
\DoNotIndex{\tableofcontents,\textit,\textdegree}
\DoNotIndex{\the,\theexperiment,\thefigure,\theparagraph,\thesubparagraph,\thesubsubsection}
\DoNotIndex{\title}
\DoNotIndex{\usepackage,\Xothertext,\Xsometext,\z@}
\CodelineIndex
%
\begin{document}
 \DocInput{labbook.dtx}
\end{document}
%</driver>
% \fi
% 
% \GetFileInfo{labbook.dtx}
% \RecordChanges
%
% \MacroIndent=2em
% \setcounter{IndexColumns}{2}
% 
% \MakeShortVerb{\|}
% \MakeShortVerb{\§}
%
% \title{labbook.cls, a \LaTeX\ class to typeset laboratory journals}
% \author{Frank K\"uster}
% \date{\filedate}
% \maketitle
% 
% \thispagestyle{empty}
%\begin{abstract}
% This class is designed to typeset laboratory journals with \LaTeX\ 
% that contain chronologically ordered records about experiments. Each
% day, the new pages are simply added at the end, and from the
% sectioning commands, an experiment index is generated to make it
% easier to find a particular experiment. Because |\frontmatter| has
% roman page numbering, it is easy to separately extend index, toc and
% list of abbreviations.  The class is based on the KOMA-Script class
% |scrbook.cls|. Therefore all features of this class can be used --
% reading of |scrguide| (german) or |scrguien| (english), the
% documentation of KOMA-Script, is highly recommended.
%\end{abstract}
%
% \addtocontents{toc}{\protect\enlargethispage{-5\baselineskip}}
% \tableofcontents
%
% \clearpage
% \part{User documentation}
%
% \section{General information}
%
%
% \subsection{Legal considerations}
%
%   Writing of laboratory journals is sometimes regulated by law,
%   often funding institutions have additional requirements. Thus it is
%   usually \emph{not} allowed to keep a lab journal in electronic form
%   only; sometimes even hardcover books have to be used. On the other
%   hand it seems to be common practice to keep notes on loose leafes,
%   computer files or a jotter book and compile them in the hardcover
%   lab journal in a more or less regular manner.
% 
%   Therefore it seems tenable to work with an electronic version of the
%   journal and a printout in parallel. If required, the printout can be
%   clipped or bound, and a version on a CD-ROM should have equal
%   value as evidence as a book. On the other hand, one gains a lot,
%   especially with a PDF version: full text search, easy inclusion of
%   graphs and pictures, possibility of hyperlinking to data files etc.
%
% \subsection{Features}
% \label{sec:features}
%
%   \begin{description}
% \item[basis class] |labbook.cls| is based on the KOMA-Script-class
%   |scrbook.cls|. Therefore it offers all the features of this class:
%   changing the page layout, head- and footlines, paragraph markup, and
%   changing appearance of floats and margin notes. It is highly
%   recommended to read the documentation, scrguien.
%   \item[Sectioning] The lab journal is structured in a chronological
%     way. Instead of |\chapter|, |\labday| is used. Within a day the
%     text is sectioned according to experiments -- this can be a
%     complete measurement from design to evaluation, but also one test
%     in a series that takes several days. |\experiment| is on the level
%     of section, and there is |\subexperiment| which corresponds to
%     |\subsection|. Below that, the usual sectioning commands can be
%     used (although their usage doesn't seem very sensible to me,
%     mind KOMA-script's |\minisec| command).
%   \item[Index and table of contents] Because of the chronological
%     structure, a traditional table of contents is not sufficient,
%     especially if investigations in a series of experiments are
%     conducted on different days. Therefore, an index is created. It is
%     built from the toc entries of the sectioning commands. One can
%     also define abbreviations to use in the argument of |\experiment|
%     and |\subexperiment|. Thus, the consistent creation of the index
%     is much easier. Furthermore, you can create multiple index
%     entries for one experiment.
%   \item[hyperref integration] The class works together well with
%     |hyperref.sty| to produce PDF files with navigation features.
%   \end{description}
%
% \section{Usage}
% \label{sec:usage}
%
%
% \subsection{Initialization}
% \label{sec:options}
%
% If you want to use hyperref.sty, you \emph{must} specify the class
% option |hyperref| like this
% \begin{verbatim}\documentclass[hyperref]{labbook}\end{verbatim}
% after that you can load hyperref and other packages
% in the order appropriate for your document. If you load hyperref.sty
% without giving the option, hyperref will overwrite some changes this
% class makes to \LaTeX\ internals. If you use hyperref, you should
% also consider the KOMA option |idxtotoc|: The index will not only be
% listed in the table of contents, but also in the PDF bookmarks.
%
% Besides that, all options you specifiy are just handed on to
% |scrbook.cls|. You might want to use |openany| to allow new labdays
% to begin on any page.
%
% \section{Sectioning commands}
% \label{sec:gliederungsbefehle}
%
%\subsection{\textbackslash\texttt{labday}}
%\label{sec:labday}
%
% \DescribeMacro{\labday}
% |labday| can be used to create an unnumbered heading formatted like a
% chapter. Its text is put into the table of contents and used as
% running title -- usually one would just use the date, perhaps with the
% weekday. It should be used only within mainmatter and will take care
% of index entries for the lower sectioning levels (see below). It calls
% |\addchap| internally, there is no starred form or optional argument
% to |\labday|.
%
% \subsection{\textbackslash\texttt{experiment} and
% \textbackslash\texttt{subexperiment}: The simple usage}
% \label{sec:exper-und-subexp}
%
% \DescribeMacro{\experiment} 
% Within a |\labday|, numbered headlines for
% single experiments can be created with 
% \begin{verbatim}\experiment[<short form>]{long form}\end{verbatim}
% Its text (or that of the optional argument) is not only typeset in the
% table of contents and page head, but also in the index. This eases the
% orientation, particularly if experiments are done several times or
% take longer than one day. The index entries specify the page range of
% the whole experiment, not only the starting page; and if the same
% experiment is repeated on different days that fall on subsequent
% pages, one common index range is generated.
%
% Note that you cannot use commas\footnote{In fact, the string
%   \texttt{\MVAt--\MVAt} is not allowed, too -- see the implementation
%   notes below.} in the optional argument (see below). If you
% have to, enclose the optional argument in additional curly braces:
% \begin{verbatim}
% \experiment[{one, two, three}]{The one, the two and the three}
% \end{verbatim}
%
% \DescribeMacro{\subexperiment} Below |\experiment| you can use
% |\subexperiment| which works in the same way and produces
% sub-indexentries. It is intended for sections like ``design,
% realization, evaluation'' or ``preparation, purification,
% measurement''.
%
%
% \subsection{Advanced Usage: Experiment Abbreviations}
% \label{sec:abkurzungen}
%
% \DescribeMacro{\newexperiment} 
% If one uses slightly different wording (or spelling) in two occurences
% of the same experiment, they will get different index entries. To
% avoid this, one can define abbreviations for frequently used
% experiment headlines, toc and index entries. This is done with the macro
%
% |\newexperiment{<abbrev>}[<short form>]{<long form>}|
%
% Here, |<abbrev>| is the abbreviation that can be given later to make
% \LaTeX\ use the |<long form>| and |<short form>|. The short form is
% for index, table of contents and running title, and giving it is
% optional. When using the abbreviation, specify it \emph{without}
% prepending a backslash, i.e. |\experiment{abbrev}|. Abbreviations may
% contain any char except the backslash, the tilde (\textasciitilde),
% commas and spaces.
%
% \DescribeMacro{\newsubexperiment} 
% For |\subexperiment|, there is an analogous macro,
% |\newsubexperiment|. 
%
% If you try to define an abbreviation that has already been used, you
% will get an error message. You can use the same abbreviation for one
% experiment and one subexperiment entry (although doing this may cause
% confusion, not to TeX, but to you). If you leave out the optional
% argument, the long form is also used for index and table of contents.
%
% Usually you just type |\experiment{abbrev}|, but you can also combine
% a varied text in the long form with an abbreviation in the optional
% argument: |\experiment[abbrev]{varied text}|, to make sure the index
% stays simple. You cannot use a free text optional argument with an
% abbreviation in the mandatory argument (because the abbreviation yet
% has an associated index entry). But it is, in principle, possible to
% use two different abbreviations in optional and mandatory argument -
% but only as long as both yield the same index entry.
%
%
% \subsection{Fancy stuff: Multiple index entries for experiments}
% \label{sec:mult-index-entr}
%
% Sometimes one performs corresponding working steps of different
% experiments in parallel -- this complicates index entries.  Consider
% that by some screening method you have identified the substances A152
% and B96 from a combinatorial library as promising drugs
% against some disease. The next things to do is to verify their exact
% structure, composition or sequence and establish a medium-scale
% preparation protocol for further characterization. Probably you can
% save time by doing some of these steps in parallel, but you will end
% up with index entries like ``A152 and B96, sequencing'' -- and two
% months later you will have to remember wether you sequenced B96
% together with A152 or rather, the following week, with A43 and
% C12. Therefore it would be nice to get two index entries for the
% experiment ``Sequencing of A152 and B96'', namely ``A152, sequencing''
% and ``B96, sequencing''. And you can have exactly that.
%
% \DescribeMacro{\experiment}\DescribeMacro{\subexperiment}
% In fact the syntax for both |\experiment| and |\subexperiment| allows
% for a comma separated list in the optional argument. The first element
% will be used for table of contents and page head, and the following
% elements will produce index entries. Suppose you have defined the
% abbreviations A152-seq and \mbox{B96-seq}, you can thus say:
% \begin{verbatim}
% \experiment[Sequencing of A152 and B96, A152-seq, B96-seq]{Sequencing
%   of inhibitor candidates A152 and B96}
% \end{verbatim}%
% and get what you want. Spaces before and after the commas will be
% ignored. You're free to use abbreviations or free text anywhere, but
% for the index entries only abbreviations really make sense. 
%
%
%
% \section{Example}
%
% For further explanation, please refer to the example file
% examplen.tex that is generated by 
% \begin{verbatim}
% latex labbook.ins
% \end{verbatim}
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \part{Implementation}
% \changes{v1.0}{2003/04/28}{first public release}
% \changes{v1.1}{2003/05/20}{added lists in optional argument, which
%    required reemplementing some of the old stuff}
%
%
%    \begin{macrocode}
%<*labbook>
%    \end{macrocode}
%
% \section{Initialization}
%
% \subsection{Options}
%
% Some packages the user might use have to be loaded before hyperref, so
% this class cannot load it internally. However, we have to take care of
% it because of two reasons: One is that we need to provide it with some
% macros for our new sectioning levels, the more important is that we cannot
% redefine |\addcontentsline| before hyperref has done it. But we can't
% simply delay this until after hyperref has been loaded, since this
% might never occur. 
%
% \changes{v1.1}{2003/05/20}{removed hardwired KOMA option openany}
%
% Therefore the user has to specifiy wether she intends to use it, using
% the option |hyperref|.
%
%    \begin{macrocode}
\newif\ifwe@use@hyperref\we@use@hyperreffalse
\DeclareOption{hyperref}{\we@use@hyperreftrue}
%    \end{macrocode}
%
% The rest is just passed to |scrbook.cls|:
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrbook}}
\ProcessOptions\relax
\LoadClass{scrbook}
%    \end{macrocode}
%
% \subsection{Load the makeidx package}
% \label{sec:pckload}
%
% \changes{v1.0a}{2003/04/29}{don't load hyperref automatically, only
%   execute compatibility definitions if it \emph{is} loaded}
%    \begin{macrocode}
\RequirePackage{makeidx} \makeindex
%    \end{macrocode}
%
% \section{Experiment abbreviations}
% \label{sec:experiment-abbr}
%
% To facilitate the creation of the index (specifically to avoid that
% little differences or typos mess it up), the user may define
% abbreviations for his experiment (and subexperiment) headings. This
% can be done using the macro |\newexperiment|. It's first argument is
% the abbreviation, then comes an optional short form for index
% entries, table of contents and running titles. Last comes the
% mandatory title argument. 
%
% Then we check wether |\newexperiment| has been called with an optional
% argument, and call the respective commands. |\@ifnextchar| looks for
% the first character after the first argument, and keeps it. Thus, the
% following macros get the same arguments that |\newexperiment| had.
%
%    \begin{macrocode}
\def\newexperiment#1{%
  \@ifnextchar [{\opt@arg@newexperiment{#1}}%
    {\nopt@arg@newexperiment{#1}}%]
}
%    \end{macrocode}
%
% The long and short forms for \textit{\texttt{abbrev}} are assigned to
% |\long@|\textit{\texttt{<abbrev>}} and
% |\short@|\texttt{\textit{<abbrev>}}, respectively. After checking wether
% \textit{\texttt{abbrev}} has not yet been used, the second argument is assigned
% to the long and short form for the case when there was no optional
% argument. In case of an optional argument, this is used for the
% short form.
%
%    \begin{macrocode}
\def\nopt@arg@newexperiment#1#2{%
  \@ifundefined{long@exp@#1}{%
    \@namedef{long@exp@#1}{#2}%
    \@namedef{short@exp@#1}{#2}%
    }{%
    \ClassError
      {labbook}
      {experiment abbreviation yet defined}
      {The abbreviation for an experiment that you wanted to define
      with this command has already been defined.}%
    }
}
\def\opt@arg@newexperiment#1[#2]#3{%
  \@ifundefined{long@exp@#1}{%
    \@namedef{long@exp@#1}{#3}%
    \@namedef{short@exp@#1}{#2}%
  }{%
    \ClassError
      {labbook}
      {experiment abbreviation yet defined}
      {The abbreviation for an experiment that you wanted to define
      with this command has already been defined.}%
  }
}
%    \end{macrocode}
%
% The same is done for |\subexperiment|. Any subexperiment abbreviation
% may be used within any experiment.
%
%    \begin{macrocode}
\def\newsubexperiment#1{%
  \@ifnextchar [{\opt@arg@newsubexperiment{#1}}%]
    {\nopt@arg@newsubexperiment{#1}}%
}%
\def\nopt@arg@newsubexperiment#1#2{%
  \@ifundefined{long@subexp@#1}{%
    \@namedef{long@subexp@#1}{#2}%
    \@namedef{short@subexp@#1}{#2}%
    }{%
    \ClassError
      {labbook}
      {experiment abbreviation yet defined}
      {The abbreviation for an experiment that you wanted to define
      with this command has already been defined.}%
    }%
}%
\def\opt@arg@newsubexperiment#1[#2]#3{%
  \@ifundefined{long@subexp@#1}{%
    \@namedef{long@subexp@#1}{#3}%
    \@namedef{short@subexp@#1}{#2}%
  }{%
    \ClassError
      {labbook}
      {experiment abbreviation yet defined}
      {The abbreviation for an experiment that you wanted to define
      with this command has already been defined.}%
  }%
}%
%    \end{macrocode}
%
% Note that the usage is |\experiment{|\textit{\texttt{abbrev}}|}|,
% \emph{not}  |\experiment{\|\textit{\texttt{abbrev}}|}|
%
% \section{Defining internal macros}
% \label{sec:defin-intern-macr}
%
% We first define some internal helper macros that we will use for
% different purposes.
%
% \subsection{Macros for argument parsing}
% \label{sec:macr-argum-pars}
%
% \subsubsection{Parsing a comma separated list}
% \label{sec:pars-comma-separ}
%
% The new sectioning commands can be used with a comma separated list of
% items in the optional argument (see below, \ref{sec:optarg-exp}), and
% we will be constructing a similar list if there is one more index entry
% for one sectioning command. To parse this list, we use code that is
% essentially taken from |keyval.sty| (page 4 in its manual).
%
% First we need some helper macros.  |\FK@@sp@def| defines the control
% sequence in its first argument to expand to its second argument, but
% with any leading or trailing whitespace removed.
%
%    \begin{macrocode}
\def\@tmpA#1{%
\def\FK@@sp@def##1##2{%
  \futurelet\FK@tempa\FK@@sp@d##2\@nil\@nil#1\@nil\relax##1}%
\def\FK@@sp@d{%
  \ifx\FK@tempa\@sptoken
    \expandafter\FK@@sp@b
  \else
    \expandafter\FK@@sp@b\expandafter#1%
  \fi}%
\def\FK@@sp@b#1##1 \@nil{\FK@@sp@c##1}%
  }%
\def\FK@@sp@c#1\@nil#2\relax#3{\FK@toks@{#1}\edef#3{\the\FK@toks@}}%
\newtoks\FK@toks@%
\@tmpA{ }%
%    \end{macrocode}
%
% Now we define a way to parse the optional argument and break it at
% every comma. |\fk@getcommasep@list| is a wrapper macro. It executes
% its first argument once before the list is read, assigns its further
% arguments to actions that will be done while going through the list,
% and then calls |\fk@@getcommasep@list| which takes as its argument the
% first element of the list after it, i.e. everything up to the first
% comma. It then works through the previously defined actions with this
% element and then calls itself recursively, taking the next element as
% its argument. |\fk@getcommasep@list| has to be called with
% |<list>,\relax,|. Therefore, when all elements of the list have been
% used, |\relax| is the next, and the recursion ends. 
%
%    \begin{macrocode}
\newcounter{fk@commasep@argnumber}%
\def\fk@getcommasep@list#1#2#3#4#5#6{%
  \setcounter{fk@commasep@argnumber}{0}%
  #1
  \def\fk@commasep@beforebranch{#2}%
  \def\fk@commasep@firstelement{#3}%
  \def\fk@commasep@furtherelements{#4}%
  \def\fk@commasep@afterlastelement{#5\empty}%
  \def\fk@commasep@aftereachelement{#6}%
  \fk@@getcommasep@list
}
\def\fk@@getcommasep@list#1,{%
  \stepcounter{fk@commasep@argnumber}%
  \fk@commasep@beforebranch%
  \ifx\relax#1%
    \fk@commasep@afterlastelement%
%    \end{macrocode}
%
%   The counter has been incremented, and if we are already after the
%   last element (so the argument was |\relax|), then
%   |\fk@commasep@afterlastelement| (the fifth argument to the wrapper
%   macro) is executed.
%
% The |\else|-branch means we have a real list element. We assign it (with
% whitespace removed) to |\fk@commasep@arg|. Then we check the counter
% wether we are working with the first element of the list, or with
% subsequent elements, and execute the respective commands (arguments
% number 3 and 4 to the wrapper macro). 
%
%    \begin{macrocode}
  \else%
    \FK@@sp@def\fk@commasep@arg{#1}%
    \ifnum\c@fk@commasep@argnumber=1%
      \fk@commasep@firstelement%
    \else%
      \fk@commasep@furtherelements%
    \fi%
%    \end{macrocode}
%
% After that, the sixth argument is executed which has been assigned to
% |\fk@commasep@aftereachelement|, and the macro calls
% itself again to take the next element.
%
%    \begin{macrocode}
    \fk@commasep@aftereachelement%
    \expandafter\fk@@getcommasep@list%
  \fi%
}
%    \end{macrocode}
%
% Index entries for a sectioning level may contain commas, therefore
% using a comma separated list for them is not a good idea. We just copy
% the above definitions, but use |@--@| as the delimiter. Should you
% ever have to use this in an index entry, you need to define a command
% that typesets it and put this command in your optional argument, or
% the abbreviation definition.
%
%    \begin{macrocode}
\newcounter{fk@atdashsep@argnumber}%
\def\fk@getatdashsep@list#1#2#3#4#5#6{%
  \setcounter{fk@atdashsep@argnumber}{0}%
  #1
  \def\fk@atdashsep@beforebranch{#2}%
  \def\fk@atdashsep@firstelement{#3}%
  \def\fk@atdashsep@furtherelements{#4}%
  \def\fk@atdashsep@afterlastelement{#5\empty}%
  \def\fk@atdashsep@aftereachelement{#6}%
  \fk@@getatdashsep@list
}
\def\fk@@getatdashsep@list#1§{%
  \stepcounter{fk@atdashsep@argnumber}%
  \fk@atdashsep@beforebranch%
  \ifx\relax#1%
    \fk@atdashsep@afterlastelement%
  \else%
    \FK@@sp@def\fk@atdashsep@arg{#1}%
    \ifnum\c@fk@atdashsep@argnumber=1%
      \fk@atdashsep@firstelement%
    \else%
      \fk@atdashsep@furtherelements%
    \fi%
    \fk@atdashsep@aftereachelement%
    \expandafter\fk@@getatdashsep@list%
  \fi%
}
%    \end{macrocode}
%
% \subsubsection{Parsing lists in the optional argument}
% \label{sec:pars-lists-opti}
%
% Now we define a macro that uses |\fk@getcommasep@list| to parse the
% comma separated list in the optional argument of |\experiment| and
% |\subexperiment| (see \ref{sec:optarg-exp}). Its only declared argument
% is the sectioning level specifier (|exp| or |subexp|), but it should
% be called with the comma separated list (ending with |\relax,|) 
% following the specifier. This specifier is stored in the macro
% |\fk@explevel| to make its usage more clear.
%
% First |\ifmore@thanone@item| is defined. It will be used to
% conditionally trigger actions after the last element. Before
% starting to iterate over the list, i.e. in the first argument to
% |\fk@getcommasep@list|, we set this to false.
%
%    \begin{macrocode}
\newif\ifmore@thanone@item%
\def\fk@parse@optarg{%
  \fk@getcommasep@list{%
    \more@thanone@itemfalse%
  }{% 
  }{% 
%    \end{macrocode}
%
% There's nothing to be done on every iteration before branching, so the
% second argument to |\fk@getcommasep@list| is empty. The third is
% executed for the first element in the list. We simply define the macro
% |\fk@current@tocentry| as this first element for later use.
% |\@onelevel@sanitize| changes |\fk@commasep@arg| to consist only of
% strings, not command sequences. This is necessary because hyperref
% will give an error with certain command sequences in bookmarks etc,
% e.g. with |\textit| which expands to |\protect\textit|. Wether this
% item will only be used for the toc and running title, or wether it
% additionally is put into the index (namely if there is only this first
% argument) cannot be decided now.
%
%    \begin{macrocode}
    \@onelevel@sanitize{\fk@commasep@arg}%
    \protected@edef\fk@current@tocentry{\fk@commasep@arg}%
  }{% 
%    \end{macrocode}
%   
%   If there is at least a second element\footnote{note that it
%     doesn't make sense to use a list with two elements - there will
%     be only one index entry, so you can just as well use only one.
%     The only difference will be that you get the possibility to have
%     different wording in the index entry \emph{and} the toc entry
%     and the section heading, which I would try to avoid.}, we set
%   |\ifmore@thanone@item| to |true|, then assign the currently
%   processed list element to |\fk@currentarg|, appending a space only
%   after we have made sure there will be no problems with fragile
%   commands. Then we check wether it is an abbreviation for the
%   current sectioning level.  According to the result, we create the
%   text to put in the index (|\fk@current@arg| itself or the text the
%   abbreviation stands for). Then we call |\fk@buildindexlist| (see
%   below) with it to add it to the index list for the current sectioning
%   commands.
%
%    \begin{macrocode}
    \more@thanone@itemtrue%
    \protected@edef\fk@currentarg{\fk@commasep@arg}%
    \@onelevel@sanitize{\fk@currentarg}%
    \protected@edef\fk@currentarg@withspace{\fk@currentarg\space}%
    \expandafter\fk@checkifabbrev@arg%
      \fk@currentarg@withspace&{long@\fk@explevel}%
    \ifabbrev@defined%
      \expandafter\protected@edef%
          \csname fk@current@\fk@explevel name\expandafter%
          \endcsname{%
            \csname short@\fk@explevel @\fk@currentarg\endcsname}%
      \fk@buildindexlist{%
        \csname short@\fk@explevel @\fk@currentarg\endcsname}%
    \else%
      \expandafter\protected@edef%
          \csname fk@current@\fk@explevel name\endcsname{%
            \fk@currentarg}%
      \expandafter\fk@buildindexlist{\fk@currentarg}
    \fi%
  }{%
%    \end{macrocode}
%
%   After the last element, the procedure of sanitizing, space
%   appending and abbreviation checking is repeated.  Because this is
%   done after the last element, the result of the check will not be
%   overwritten by other index elements. If there was only one element
%   in the optional argument, we have to add the content of
%   |\fk@current@tocentry| to the (still empty) indexlist. 
%
%   In this case, there is nothing to be done after each processed
%   list element, so the last argument to |\fk@getcommaseplist| is
%   empty. 
%
%    \begin{macrocode}
    \protected@edef\fk@currentarg{\fk@current@tocentry}%
    \@onelevel@sanitize{\fk@currentarg}%
    \protected@edef\fk@currentarg@withspace{\fk@currentarg\space}%
    \expandafter\fk@checkifabbrev@arg%
      \fk@currentarg@withspace&{long@\fk@explevel}%
    \ifmore@thanone@item\else%
      \ifabbrev@defined%
        \fk@buildindexlist{%
          \csname short@\fk@explevel @\fk@currentarg\endcsname}%
      \else%
        \expandafter\fk@buildindexlist{\fk@currentarg}%
      \fi%
    \fi%
  }{% 
  }%
}
%    \end{macrocode}
%
% 
% \subsubsection{Building and using the list of index entries}
% \label{sec:building-list-index}
%
% The text to be indexed for every sectioning command is kept in a comma
% separated list, even if there is only one element. This list is build
% by prepending the new element to the expansion of the list. First, the
% lists (for experiments and subexperiments) are defined (as empty
% lists). The macros that call |\fk@buildindexlist| have to properly set
% |\fk@explevel| to |exp| or |subexp|, so that the new element gets into
% the right list.
%
%    \begin{macrocode}
\def\fk@exp@indexlist{}%
\def\fk@subexp@indexlist{}%
\def\fk@buildindexlist#1{%
  \def\@tmpA{exp}
  \ifx\fk@explevel\@tmpA
    \protected@edef\fk@exp@indexlist{#1§\fk@exp@indexlist}
  \else
    \protected@edef\fk@subexp@indexlist{#1§\fk@subexp@indexlist}
  \fi
}
%    \end{macrocode}
%
% To write index entries for each list element, we use
% |\fk@getcommasep@list| again. Here there is no difference between
% first and further elements, so we just define commands in the sixth
% argument, which is processed once for every element. The list never
% contains abbreviations, but always the text itself, so we just call
% |\fk@@writeindex| with the element.
%
%    \begin{macrocode}
\def\fk@useindexlist{%
  \fk@getatdashsep@list{}{}{}{}{}{%
    \fk@@writeindex{\fk@atdashsep@arg}%
  }%
}%
%    \end{macrocode}
%
% |\fk@@writeindex| handles the differences in index writing for
% experiments and subexperiments. If a new experiment is started (or
% closed), then an index for every list element has to be written:
%
%    \begin{macrocode}
\def\fk@@writeindex#1{%
  \def\@tmpA{exp}%
  \ifx\fk@explevel\@tmpA%
    \fk@writeindex{#1}%
  \else%
%    \end{macrocode}
%
% If we are writing index entries for a subexperiment, things get more
% complicated, because the experiment \emph{and} the subexperiment
% might have more than one associated index entry. Therefore we have to
% iterate over both |\fk@exp@indexlist| and |\fk@subexp@indexlist|. To
% achieve this, for a subexperiment (where |\fk@explevel| is |subexp|),
% |\fk@useindexlist| will be called with
% |\fk@|\textit{exp}|@indexlist|, and |\fk@parselevel| is set
% to |exp|. When |\fk@openindex| is called with explevel
%  |subexp|, but parselevel |exp|, its argument is
% assigned to |\fk@current@expname|, the parselevel is changed to
% |subexp|, and |\fk@useindexlist| is called again with
% |\fk@|\textit{subexp}|@indexlist|. When doing this,
% |\fk@openindex| will be called again, but since now the parselevel
%  is |subexp|, we get into the other branch. After processing
% |\fk@subexp@indexlist| is finished, we have to continue processing
% the next elements in |\fk@exp@indexlist|. Therefore we reset the
% parselevel to |exp|.
%
%    \begin{macrocode}
    \ifx\fk@parselevel\@tmpA% we are iterating over the current list
                            % of experiments
      \protected@edef\fk@current@expname{#1}
      \def\fk@parselevel{subexp}
      \expandafter\fk@useindexlist\fk@subexp@indexlist\relax§%
      \def\fk@parselevel{exp}
    \else
%    \end{macrocode}
%
% When processing the subexperiment's index list, we get into this
% branch, and now for every subexperiment index element an entry is made
% for the current meaning of |\k@current@expname|. 
%
%    \begin{macrocode}
      \fk@writeindex{\fk@current@expname!#1}%
    \fi
  \fi%
}%
%    \end{macrocode}
%
% The previous procedure made use of |\fk@writeindex| which is never
% defined itself. It is |\let| to |\fk@openindex| or |\fk@closeindex|,
% depending on where it is called. The first writes index entries which
% open a range, i.e. §\index{text|(}§, the second closes the ranges
% again (§\index{text|)}§).
%
%    \begin{macrocode}
\def\fk@openindex#1{\index{#1|(}}%)
\def\fk@closeindex#1{\index{#1|)}}%)
%    \end{macrocode}
%
% \subsection{Checking for abbreviation usage}
% \label{sec:check-abbr-usage}
%
% The next few macros are used to check wether an abbreviation or a
% text was used as the argument of |\(sub)experiment|. First a little
% helper macro:
%
%    \begin{macrocode}
\def\muST@bE@emPTy{\message{Numquam videbor}}%
%    \end{macrocode}
%
% |\fk@checkifabbrev@arg| is defined so that its first argument ends
% with a space and the second only at the \&-sign; it is called with a
% space appended to the item to check. Thus, if the second argument
% isn't empty, there was a space in the item itself, and it cannot be an
% abbreviation. If the second argument is empty, we check wether we have
% an abbreviation using |\fk@checkfirst|:
%
%    \begin{macrocode}
\newif\ifabbrev@defined%
\def\fk@checkifabbrev@arg #1 #2&#3{%
  \ifx\muST@bE@emPTy#2\muST@bE@emPTy%
    \protected@edef\@tmpA{#1\space}%
    \expandafter\fk@checkfirst\@tmpA{#3}%
  \else%
    \abbrev@definedfalse%
  \fi%
}%
%    \end{macrocode}
%
% The first argument of |\fk@checkfirst| ends at the first space - note that
% |\fk@currentarg| was defined with a space appended. This is necessary because
% we have to be able to cut |\fk@currentarg| in words, not in single
% characters. The second argument to |\fk@checkfirst| specifies the
% level we are on (experiment or subexperiment).
%
% The macro now checks wether the requested abbreviation has been
% defined, and sets the conditional accordingly:
%
%    \begin{macrocode}
\def\fk@checkfirst #1 #2{%
  \@ifundefined{#2@#1}{\abbrev@definedfalse}{\abbrev@definedtrue}%
}%
%    \end{macrocode}
%
% \subsection{Closing the index entries}
% \label{sec:closing-entries}
%
% This macro, |\fk@close@labindex|, will be used in a couple of
% circumstances to close open index ranges. First we make
% |\fk@writeindex| produce entries that close the index ranges. If there
% has been no experiment on the current |\labday|, then |\fk@explevel|
% is undefined, and we don't do anything. Otherwise the experiment level
% is determined, and |\fk@@close@labindex| is called appropriately.
%
% \changes{v1.0a}{2003/04/29}{removed wrong index closing for
%  subexperiments}
%    \begin{macrocode}
\def\fk@close@labindex{%
  \let\fk@writeindex\fk@closeindex%
  \@ifundefined{fk@explevel}{}{%
%    \end{macrocode}
%
% If |\fk@explevel| is |exp|, then we need to close any open experiment
% \emph{and} subexperiment index ranges. We first handle the
% subexperiment. Before we call the macro that does it, we set
% |\fk@explevel| to |subexp| and |\fk@parselevel| to |exp|, as required
% by |\fk@@writeindex| (see \ref{sec:building-list-index}), and after
% that we reset it to |exp| to close the experiment ranges themselves.
% If |\fk@explevel| is |subexp|, however, we just call the closing
% macro:
%
%    \begin{macrocode}
    \def\@tmpA{exp}%
    \ifx\fk@explevel\@tmpA%
      \def\fk@parselevel{exp}%
      \def\fk@explevel{subexp}%
      \fk@@close@labindex%
      \def\fk@explevel{exp}%
      \fk@@close@labindex%
    \else%
      \fk@@close@labindex%
    \fi%
  }%
}%
%    \end{macrocode}
%
% |\fk@@close@labindex| calls |\fk@useindexlist| -- always with 
% the argument |\fk@exp@indexlist| -- and then flushes the list
% for the current explevel. 
%
%    \begin{macrocode}
\def\fk@@close@labindex{%
  \expandafter\fk@useindexlist\fk@exp@indexlist\relax§%
  \expandafter\def\csname fk@\fk@explevel @indexlist\endcsname{}%
}
%    \end{macrocode}
%
%
% \section[Defining the new sectioning commands]{Defining the new
% sectioning commands \textbackslash\texttt{labday} and
% \textbackslash\texttt{(sub)experiment}} 
% \label{sec:newsectcommands}
%
% First we define the counters. Footnote numbers are reset every day.
%
%\changes{v1.1a}{2003/06/13}{Let footnote numbering be reset every day}
%    \begin{macrocode}
\newcounter{labday}
\newcounter{experiment}[labday]
\newcounter{subexperiment}[experiment]
\@addtoreset{footnote}{labday}
%    \end{macrocode}
%
% If somebody uses |\subsubsection|, this has to be reset
% properly. The marks have to be let to |\@gobble| initially: 
%
%    \begin{macrocode}
\@addtoreset{subsubsection}{subexperiment}
\let\experimentmark\@gobble
\let\subexperimentmark\@gobble
%    \end{macrocode}
%
% The level of sections is designed to be used to classify an
% experiment. The level
% below that, usually subsection, is redefined as |\subexperiment|. It
% should be used for things like ``rationale'', ``preparations'', or
% ``evaluation'', or the like, and will also get into the toc and index:
%
%    \begin{macrocode}
\setcounter{tocdepth}{3}
%    \end{macrocode}
%
% Thus, chapters, sections and subsections go into the toc besides
% labdays, experiments and subexperiments, but this should only be
% used for things in |\frontmatter| or at the start of |\mainmatter|.
%
% Besides that, nothing is done in this class to format table of
% contents and index. This can be done individually with different
% packages on CTAN.
%
%\subsection{Defining experiment}
%\label{sec:defining-experiment}
%
%    \begin{macrocode}
\def\experiment{%
%    \end{macrocode}
%
% The first thing we do is close the index entry for the preceding
% |\experiment| and |\subexperiment|. Thus, this will be done before a
% potential page break. The macro |\fk@close@labindex| will be defined
% later, see \ref{sec:closing-entries}.  Then we set
% |\iflower@sectionlevel| to |false| -- this might have been set true by
% a previously used |\subsubsection|, were no indexing should be done.
%
%    \begin{macrocode}
  \def\fk@explevel{exp}
  \fk@close@labindex%
  \lower@sectionlevelfalse%
%    \end{macrocode}
%
% One can use the unstarred form with abbreviations, and with free text,
% too. However, if there is more than just text in the free text, e.g. a
% command like |\textit{...}|, then there will be an error message from
% \TeX\ which is hard to understand. Therefore it is strongly
% recommended to use free text only with the starred form. 
% 
% We descriminate between the starred and unstarred forms and first
% define the unstarred version: It checks wether there is an optional
% argument in square brackets and calls the respective macros:
%
%    \begin{macrocode}
  \@ifstar{\@sexperiment}{\@experiment}%
}
\def\@experiment{%
  \@ifnextchar [{\opt@arg@experiment}{\nopt@arg@experiment}%
}
%    \end{macrocode}
%
% \subsubsection{\textbackslash\texttt{experiment} without optional argument}
%
% First the case of no optional argument is defined. Either the one
% argument is an abbreviation as defined by the user command
% |\newexperiment|, or it is of free form. Checking which is not
% straightforward, because we cannot simply put a whole sentence,
% possibly with markup macros, into an |\@ifundefined|-command.
%
%    \begin{macrocode}
\def\nopt@arg@experiment#1{%
  \def\fk@currentarg{#1 }\@onelevel@sanitize{\fk@currentarg}%
  \expandafter\fk@checkifabbrev@arg\fk@currentarg&{long@exp}%
%    \end{macrocode}
%
% The first line in the definition has the effect that |\fk@currentarg|
% contains the argument text, but everything is read as text, not as a
% macro, even if it looks like it. Then |\fk@checkifabbrev@arg| is called
% with this string of characters and (possibly) spaces as an argument
% and an arbitrary delimiter, here \&. This macro, defined below,
% changes the conditional |\ifabbrev@defined|.
%
%    \begin{macrocode}
  \ifabbrev@defined%
%    \end{macrocode}
%
% The case with an abbreviation, so we have to manually assign short
% and long forms for |\@startsection|, and make sure that the short
% form gets into the index. Indexing is done by calling
% |\fk@buildindexlist| with the meaning of the abbreviation. It will
% automatically used by |\addcontentsline|. The actual arguments for
% |\@startsection| are just a copy of the |\section|-definition from
% scrbook.cls. 
%
%    \begin{macrocode}
    \fk@buildindexlist{\csname short@exp@#1\endcsname}%
    \@startsection{experiment}{1}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         [\@nameuse{short@exp@#1}]{\@nameuse{long@exp@#1}}%
  \else%
%    \end{macrocode}
%
% |\else| is the case where the user just uses
% the free form (or mistyped the abbreviation
% - but that will show up in the dvi/pdf
% file). |\@startsection| will |\@dblarg| the parameter itself.
%
%    \begin{macrocode}
    \expandafter\fk@buildindexlist{\fk@currentarg}
    \@startsection{experiment}{1}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         {#1}% 
  \fi%
}%
%    \end{macrocode}
%
% \subsubsection{\textbackslash\texttt{experiment} with an optional argument}
% \label{sec:optarg-exp}
%
% Now comes the case where |\experiment| was called with an optional
% argument. The optional argument may consist of
% \begin{itemize}
% \item One arbitrary sentence with formatting \emph{without} commas, or
% \item one previously defined abbreviation, or
% \item a comma separated list of items. The items should usually be
%   abbreviations, the first may be an arbitrary sentence (with formatting).
% \end{itemize}
% In the latter case, the first one is used for the table of contents
% and the running title, but \emph{not} for the index; the following are
% put in the index. All this is achieved by calling
% |\fk@parse@optarg|, after setting its parselevel to exp.
%
%    \begin{macrocode}
\def\opt@arg@experiment[#1]#2{%
  \fk@parse@optarg#1,\relax,%
%    \end{macrocode}
%
% The checks regarding abbreviations get more complicated
% here, we have to check the first item in the optional argument -- this is
% done by the macro |\fk@parse@optarg|~--, and the long argument.
%
%    \begin{macrocode}
  \ifabbrev@defined%
    \def\fk@currentarg{#2 }\@onelevel@sanitize{\fk@currentarg}%
    \expandafter\fk@checkifabbrev@arg\fk@currentarg&{long@exp}%
    \ifabbrev@defined%
%    \end{macrocode}
% This is the strange, but working case with two predefined
% forms. We have to check wether they are equal. In fact the
% user may use different abbreviations as long as the short
% forms expand to the same index/toc entry.
%
% The check works like this: The first |\expandafter| delays the |\ifx|
% conditional until the next token, |\csname|, has been
% expanded. Expansion of |\csname|, however, scans for an
% |\endcsname|, but before it gets there (to the first one), it
% encounters the second |\expandafter|. Therefore, first the last
% |\csname| is expanded, yielding the macro |\short@exp@<second-abbrev>|, then the
% first is expanded, and we get\\
% |\ifx\short@exp@<first-abbrev>\short@exp@<second-abbrev>|.
%
%    \begin{macrocode}
          \expandafter\ifx%
               \csname short@exp@\fk@current@tocentry\expandafter%
               \endcsname\csname short@exp@#2\endcsname%
            \@startsection{experiment}{1}{\z@}%
              {-3.5ex \@plus -1ex \@minus -.2ex}%
              {2.3ex \@plus.2ex}%
              {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
              [\@nameuse{short@exp@\fk@current@tocentry}]%
              {\@nameuse{long@exp@#2}}%
          \else%
            \ClassError
             {labbook}
             {index entry and experiment title don't match}
             {%
               You have used \protect\experiment\space with an
               optional argument, and used abbreviations
               \MessageBreak both in the optional argument
               (the first item in square brackets, for the index
               and toc\MessageBreak entries) and the mandatory
               argument (in curly braces, for the experiment title
               in the text). This is only possible if both would
               yield the same index/toc\MessageBreak
               entries. However, you requested the index
               entry\MessageBreak
               \@nameuse{short@exp@\fk@current@tocentry}
               \MessageBreak
               but the title corresponds to index entry\MessageBreak
               \@nameuse{short@exp@#2}}%
          \fi%
    \else%
%    \end{macrocode}
%
% This is the working case with a 
% predefined short form and a free
% long form. We warn the user - she might
% have accidentaly chosen the abbreviation:
%
%    \begin{macrocode}
      \ClassWarning{labbook}
        {Using a pre-defined short form for this
          \protect\experiment.\MessageBreak 
          Please check that the abbreviation\MessageBreak
          \csname short@exp@#1\endcsname\MessageBreak corresponds
          properly to the long form \MessageBreak #2\MessageBreak}
      \@startsection{experiment}{1}{\z@}%
        {-3.5ex \@plus -1ex \@minus -.2ex}%
        {2.3ex \@plus.2ex}%
        {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
        [\@nameuse{short@exp@\fk@current@tocentry}]{#2}%
    \fi%
  \else%
%    \end{macrocode}
%
% The |\fi| is the end of the conditional regarding the mandatory
% argument, when the (first element of the) optional argument was an
% abbreviation. The |\else| case now means that the optional argument is
% a text, and we have to check again the state of the mandatory
% argument:
%
%    \begin{macrocode}
    \def\fk@currentarg{#2 }\@onelevel@sanitize{\fk@currentarg}%
    \expandafter\fk@checkifabbrev@arg\fk@currentarg&{long@exp}%
    \ifabbrev@defined%
%    \end{macrocode}
%
% This is the error case with a free optional and
% a predefined mandatory argument:
%
%    \begin{macrocode}
    \ClassError {labbook} {Manual short form conflicts with
      abbreviated title} {You have used an optional argument to
      \protect\experiment\space (the first element in
      square\MessageBreak brackets) that TeX does not
      recognize as an abbreviation. However, in the
      \MessageBreak experiment title (in the curly braces),
      you have used an abbreviation defined\MessageBreak with
      \protect\newexperiment. This doesn't make sense, so 
      I don't accept it.}%
    \else%
%    \end{macrocode}
%
% This is the working case where
%  optional and mandatory argument both are free form:
%
%    \begin{macrocode}
      \@startsection{experiment}{1}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         [\fk@current@tocentry]{#2}%
    \fi%
  \fi%
}%
%    \end{macrocode}
%
% There is no starred form yet - we issue an error. We could as well
% |\let| it to the unstarred form, but then old documents would change
% their appearance once a starred form is introduced.
%
%    \begin{macrocode}
\def\@sexperiment#1{%
  \ClassError{labbook}{%
    Starred form of \protect\experiment\space not defined
  }{%
    There is no starred form of \protect\experiment\space defined
  in this version of labbook.cls. Please use the unstarred form, or
  check for a new version.
  }
}
%    \end{macrocode}
%
% \subsection{Defining \textbackslash\texttt{subexperiment}}
% \label{sec:defin-subexp}
%
% We define |\subexperiment| analogous to |\experiment|. In order to make
% |\fk@close@labindex| work properly, we assign explevel and parselevel.
%
%    \begin{macrocode}
\def\subexperiment{%
  \def\fk@explevel{subexp}%
  \def\fk@parselevel{exp}%
  \fk@close@labindex%
  \lower@sectionlevelfalse%
  \@ifstar{\@ssubexperiment}{\@subexperiment}%
}%
\def\@subexperiment{%
  \@ifnextchar [{\opt@arg@subexperiment}{\nopt@arg@subexperiment}%]
}%
\def\nopt@arg@subexperiment#1{%
  \def\fk@parselevel{exp}
  \def\fk@currentarg{#1 }\@onelevel@sanitize{\fk@currentarg}%
  \expandafter\fk@checkifabbrev@arg\fk@currentarg&{long@subexp}%
  \ifabbrev@defined%
    \fk@buildindexlist{\csname short@subexp@#1\endcsname}%
    \@startsection{subexperiment}{2}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         [\@nameuse{short@subexp@#1}]{\@nameuse{long@subexp@#1}}%
  \else
    \expandafter\fk@buildindexlist{#1}
    \@startsection{subexperiment}{2}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         {#1}%
  \fi%
}%
%    \end{macrocode}
%
% For parsing the optional argument, we need parselevel |subexp|. After
% that, |\addcontentsline| (which is implicitly called by
% |\@startsection|) needs parselevel |exp| to properly set the index
% entries.
%
%    \begin{macrocode}
\def\opt@arg@subexperiment[#1]#2{%
  \def\fk@parselevel{subexp}
  \fk@parse@optarg#1,\relax,%
  \def\fk@parselevel{exp}%
  \ifabbrev@defined%
    \def\fk@currentarg{#2 }\@onelevel@sanitize{\fk@currentarg}%
    \expandafter\fk@checkifabbrev@arg\fk@currentarg&{long@exp}%
    \ifabbrev@defined%
      \expandafter\ifx\csname short@subexp@\fk@current@tocentry%
          \expandafter\endcsname\csname short@subexp@#2\endcsname%
        \@startsection{subexperiment}{2}{\z@}%
           {-3.5ex \@plus -1ex \@minus -.2ex}%
           {2.3ex \@plus.2ex}%
           {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
           [\@nameuse{short@subexp@\fk@current@tocentry}]%
           {\@nameuse{long@subexp@#2}}%
      \else%
        \ClassError
          {labbook}
          {index entry and subexperiment title don't match}
          {%
            You have used \protect\subexperiment\space with an
            optional argument, and used abbreviations\MessageBreak
            both in the optional argument (in square brackets, for
            the index and toc\MessageBreak entries) and the
            mandatory argument (in curly braces, for the experiment
            title in the text). This is only possible if both would
            yield the same index/toc\MessageBreak entries. However,
            you requested the index entry\MessageBreak
            \@nameuse{short@subexp@#1}\MessageBreak 
            but the title corresponds to index entry\MessageBreak
            \@nameuse{short@subexp@#2}}%
      \fi%
    \else%
       \ClassWarning{labbook}
         {Using a pre-defined short form for this
          \protect\subexperiment.\MessageBreak 
          Please check that the abbreviation\MessageBreak \csname
          short@subexp@#1\endcsname\MessageBreak corresponds
          properly to the long form \MessageBreak #2\MessageBreak}%
       \@startsection{subexperiment}{2}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         [\@nameuse{short@subexp@\fk@current@tocentry}]{#2}%
    \fi%
  \else%
    \def\fk@currentarg{#2 }\@onelevel@sanitize{\fk@currentarg}%
    \expandafter\fk@checkifabbrev@arg\fk@currentarg&{long@subexp}%
    \ifabbrev@defined%
      \ClassError
         {labbook}
         {Manual short form conflicts with abbreviated title}
         {You have used an optional argument to
          \protect\subexperiment\space (the short form, in
          \MessageBreak square brackets) that TeX does not
          recognize as an abbreviation. However, \MessageBreak 
          in the subexperiment title (in the curly braces), 
          you have used an abbreviation\MessageBreak defined
          with \protect\newsubexperiment. This doesn't make
          sense, so I don't accept it.}%
    \else%
      \@startsection{subexperiment}{2}{\z@}%
         {-3.5ex \@plus -1ex \@minus -.2ex}%
         {2.3ex \@plus.2ex}%
         {\raggedsection\normalfont\sectfont\nobreak\size@section\nobreak}%
         [\fk@current@tocentry]{#2}%
    \fi%
  \fi%
}%
\def\@ssubexperiment#1{%
  \ClassError{labbook}{%
    Starred form of \protect\subexperiment\space not defined
  }{%
    There is no starred form of \protect\subexperiment\space defined
  in this version of labbook.cls. Please use the unstarred form, or
  check for a new version.
  }%
}%
%    \end{macrocode}
%
% \subsection{Defining labday}
% \label{sec:defining-labday}
%
% In mainmatter, |\labday| replaces chapter. (|\chapter| may still be
% used and will get a toc entry, e.g. after |\backmatter|). |\labday| is
% an extended |\addchap| (i.e. an un-numbered |\chapter| with toc entry
% and assignment of a running headline) which additionally sets the
% closing index entry for the preceding |\(sub)experiment|. After
% closing, |\k@explevel| is made undefined, so that addcontentsline
% won't try to open index ranges.
%
%    \begin{macrocode}
\newcommand*{\labday}{%
  \def\fk@explevel{exp}%
  \fk@close@labindex%
  \let\fk@explevel\@undefined%
  \refstepcounter{labday}%
  \addchap%
}%
%    \end{macrocode}
%
%
% \subsection{Adjusting the definition of part}
% \label{sec:adj-part}
%
% If part is used, it must also call |\fk@close@labindex|.
%
%    \begin{macrocode}
\let\fk@part\part
\renewcommand*{\part}{%
  \def\fk@explevel{exp}%
  \fk@close@labindex%
  \let\fk@explevel\@undefined%
  \fk@part%
}
%    \end{macrocode}
%
%
% \subsection{Adjusting subsubsection}
% \label{sec:adj-subsubsection}
%
% If somebody uses lower sectioning levels than |\subexperiment|, the
% index lists are not affected, and thus |\addcontentsline| would again
% open the index entries for the last |\subexperiment|. To avoid this,
% we extend |\subsubsection|; it now sets the conditional
% |\iflower@sectionlevel| to true. This will be checked by |\addcontentsline|.
%
%    \begin{macrocode}
\newif\iflower@sectionlevel
\let\fk@oldsubsubsection\subsubsection%
\renewcommand{\subsubsection}{%
  \lower@sectionleveltrue%
  \fk@oldsubsubsection%
}
%    \end{macrocode}
%
% \subsection{Section numbering, floats and the table of contents}
% \label{sec:adjust-section-number}
%
% Since the days will not be numbered, we want to also change the
% numbering scheme for the new sectioning commands:
%
%    \begin{macrocode}
\renewcommand*\theexperiment{\@arabic\c@experiment}%
\renewcommand*\thesubexperiment{%
  \theexperiment.\@arabic\c@subexperiment}%
%    \end{macrocode}
%
% And for consistency also for the lower levels -- nobody will ever need
% these numbered, will one?
%
%    \begin{macrocode}
\renewcommand*\thesubsubsection{%
  \thesubexperiment.\@arabic\c@subsection}%
\renewcommand*\theparagraph{%
  \thesubsubsection.\@arabic\c@paragraph}%
\renewcommand*\thesubparagraph{%
  \theparagraph.\@arabic\c@subparagraph}%
%    \end{macrocode}
%
% And the floats:
%
%    \begin{macrocode}
\@addtoreset{figure}{labday}%
\@addtoreset{table}{labday}%
\renewcommand*\thefigure{%
  \@arabic\c@figure}%
\renewcommand*\thetable{%
  \@arabic\c@table}%
%    \end{macrocode}
%
%
% To be able to print a table of contents, we have to define
% |\contentsline| for labday, experiment and subexperiment. We just copy the
% definitions from |\chapter| and |\(sub)section|:
%
%    \begin{macrocode}
\let\l@labday\l@chapter%
\let\l@experiment\l@section%
\let\l@subexperiment\l@subsection%
%    \end{macrocode}
%
% \section{Building the index}
% \label{sec:building-index}
%
% \subsection[Redefining addcontentsline]{Redefining \protect\verb|\@addcontentsline|}
% \label{sec:redefining-addcont}
%
% If |\experiment| or |\subexperiment| are called, then
% |\addcontentsline| is extended to open the index range entries
% (closing is done by |\fk@close@labindex|, see above).
%
% Redefining is only done \emph{here} if we do not use |hyperref.sty|.
% If the |hyperref| option has been specified, it is delayed until after
% this package has been loaded, see section \ref{sec:hyperref-compat}.
% What we do here in any case is define a macro that will do the real
% defining of |\addcontentsline|.
%
% \changes{v1.0a}{2003/04/29}{don't load hyperref automatically, only
%   execute compatibility definitions if it \emph{is} loaded}
%    \begin{macrocode}
%    \begin{macrocode}
\def\define@addcontentsline{%
  \let\fk@old@addcontentsline\addcontentsline%
  \def\addcontentsline##1##2##3{%
%    \end{macrocode}
%
% First, we call all the old commands. After that, we apply the changes,
% starting with a bunch of checks: First wether we are called from a
% sectioning command (writing to |toc|), not by a caption of a figure or
% table; then wether |\fk@explevel| is defined (i.e. wether we are not
% called by |\part|, |\labday| or a traditional sectioning command
% outside mainmatter). And last wether we are not called by
% subsubsection or lower.
%
%    \begin{macrocode}
    \fk@old@addcontentsline{##1}{##2}{##3}%
    \def\@tmpA{toc}%
    \def\@tmpB{##1}%
    \ifx\@tmpA\@tmpB%
      \@ifundefined{fk@explevel}{}{%
        \iflower@sectionlevel\else%
%    \end{macrocode}
%
% We define |\fk@writeindex| to open ranges and then call
% |\fk@useindexlist| with the experiment's indexlist -- as explained
% above (see \ref{sec:building-list-index}), this is also correct for
% subexperiments.
%
%    \begin{macrocode}
          \let\fk@writeindex\fk@openindex%
          \expandafter\fk@useindexlist\fk@exp@indexlist\relax§%
        \fi%
      }%
    \fi%
  }%
}%
%    \end{macrocode}
%
% Now let's see wether hyperref.sty is used, according to the class
% option. If no, we can redefine |\addcontentsline| right now:
%
%    \begin{macrocode}
%
\ifwe@use@hyperref\else%
  \define@addcontentsline%
\fi%
%    \end{macrocode}
%
%
%\subsection{Making sure the last index range is closed}
%
% Since closing of the index entries is usually done by the subsequent
% call of |\(sub)experiment|, the last would never be closed. The
% closing has to be done at the begin of the appendix if there is one,
% or at the end of mainmatter, if |\backmatter| is called, or at last at
% the end of the document. The user should still be able to call
% |\appendix| and |\backmatter| in arbitrary order, or not at all. To
% decide at which place we close, we define a new conditional which is
% initialized to be false. Then we define the command
% |\fk@close@labindex| to close the index entries, if one is open (i.e.
% if |\fk@current@(sub)expname| is not |\relax|). After closing, we
% |\let| the index names to |\relax|.
%
% The |\appendix| command is extended to call |\fk@close@labindex| if
% the conditional is still false, so is |\backmatter|. Additionally,
% after closing the index entries |\fk@explevel| is made undefined, so
% that subsequent calls of |\addcontentsline| don't even try to use
% the (albeit empty) index lists.
%
%\changes{v1.1a}{2003/06/13}{Set footnote to 0 at the beginning of the
%appendix and backmatter}
%    \begin{macrocode}
\newif\iflast@labindex@closed\last@labindex@closedfalse%
\let\fk@old@appendix\appendix%
\def\appendix{%
  \iflast@labindex@closed\else%
    \def\fk@explevel{exp}%
    \fk@close@labindex%
    \last@labindex@closedtrue%
    \let\fk@explevel\@undefined%
    \setcounter{footnote}{0}%
  \fi%
  \fk@old@appendix%
}%
\let\fk@old@backmatter\backmatter%
\def\backmatter{%
  \iflast@labindex@closed\else%
    \def\fk@explevel{exp}%
    \fk@close@labindex%
    \last@labindex@closedtrue%
    \let\fk@explevel\@undefined
    \setcounter{footnote}{0}%
  \fi%
  \fk@old@backmatter%
}
%    \end{macrocode}
%
% And as a last resort, |\AtEndDocument| will do it.
%
%    \begin{macrocode}
\AtEndDocument{%
  \iflast@labindex@closed\else%
    \def\fk@explevel{exp}%
    \fk@close@labindex%
  \fi%
}
%    \end{macrocode}
%
%
% \section{hyperref compatibility macros}
% \label{sec:hyperref-compat}
%
% \changes{v1.0a}{2003/04/29}{don't load hyperref automatically, only
%   execute compatibility definitions if it \emph{is} loaded}
% \changes{v1.0a}{2003/04/29}{fix subfigure bug}
%
% First we redefine |\addcontentsline| which was delayed, the
% definition is explained above (see \ref{sec:redefining-addcont})
%
%    \begin{macrocode}
\ifwe@use@hyperref
  \AfterPackage{hyperref}{%
    \define@addcontentsline%
    \providecommand*{\toclevel@labday}{0}%
    \providecommand*{\toclevel@experiment}{1}%
    \providecommand*{\toclevel@subexperiment}{2}%
    \newcommand*\theHlabday{%
      \arabic{labday}}%
    \newcommand*\theHexperiment{%
      \theHlabday.\arabic{experiment}}%
    \newcommand*\theHsubexperiment{%
      \theHexperiment.\arabic{subexperiment}}%
    \renewcommand*\theHsubsubsection{%
      \theHsubexperiment.\arabic{subsubsection}}%
    \renewcommand*\theHfigure{%
      \theHlabday.\arabic{figure}}%
    \renewcommand*\theHtable{%
      \theHlabday.\arabic{table}}%
    \newcommand*\theHsubfigure{%
      \theHfigure.\arabic{subfigure}}
  }%
  \AtBeginDocument{%
    \@ifpackageloaded{hyperref}{}{%
      \ClassError{labbook}{%
        hyperref option given, but package not loaded}{%
        You have specified the class option hyperref, but
        not loaded the package until \protect\begin{document}.
      }
    }
  }
\else
  \AtBeginDocument{%
    \@ifpackageloaded{hyperref}{%
      \ClassError{labbook}{%
        hyperref option not given, but package loaded}{%
        You have not specified the class option hyperref,
        but loaded the package. Don't do that again!
      }%
    }{}%
  }%
\fi%
%</labbook>
%    \end{macrocode}
% 
%\iffalse
%<*examplen>
% run this file through latex (pdflatex would be fine), and don't
% forget to generate the index by calling
%
% makeindex examplen
%
% and running latex again.

\documentclass[idxtotoc,hyperref]{labbook}
% The option idxtotoc causes the index to be included in the table of
% contents and, as a consequence, also in the pdf bookmarks list, which
% is very useful. It is specific for the KOMA-classes.

% The option hyperref is necessary if hyperref is to be used.

\usepackage[%
  backref=page,%
  pdfpagelabels=true,%
  plainpages=false,%
  colorlinks=true,%
  bookmarks=true,%
  pdfview=FitB]{hyperref}
% see the hyperref documentation 

\input{boilerplates}


% I'll do the next one every couple of days in this project, so I
% define an abbreviation. Abbreviation definitions have to be assigned
% in the preamble. 

\newexperiment{prep_S-peptide}{Preparation of RNase A S-peptide}
\newsubexperiment{subtilisin}[subtilisin digest]{Digestion with
  Subtilisin}
%the \subexperiment gets an optional argument for the toc and index
%(and running title)

\newexperiment{prep?some1th&^ing}{Preparation of purified something}
% you can use nearly any character in the abbreviation. However,
% spaces, commas, and the tilde (~) do not work.

\newexperiment{lyoph-A}{Lyophilization of A}
\newexperiment{lyoph-B}{Lyophilization of B}


\begin{document}

\frontmatter
\title{Laboratory Journal from 2003-04-22 to \dots}
\author{Jane Eager}
\maketitle

\printindex
\tableofcontents

\mainmatter


\labday{Tuesday, April 22, 2003}


\experiment{prep_S-peptide}
\subexperiment{subtilisin}

\Xsometext\par
\Xsometext\par
\Xsometext\par
\Xsometext\par
\begin{figure}[htbp]
  \centering
  \sdsgel
  \caption{Some very interesting SDS gel}
  \label{fig:digest-sds}
\end{figure}

\experiment{Expression of Hagridin in \textit{E. coli}}
% of course you don't have to use abbreviations.

\subexperiment[Transformation with HagIV plasmid]{Transformation of
  hogwarts-auxotrophic \textit{E. coli} with the HagIV
  plasmid}
% the optional argument works well even without abbreviations

\Xothertext\Xothertext

\labday{Wednesday, April 23, 2003}

\experiment{prep_S-peptide}

\subexperiment[subtilisin]{Digestion using the new batch of
  Subtilisin}
% you can use the abbreviation in the optional argument together with
%  a varied long form

\experiment{prep?some1th&^ing}
% remember: Everything but spaces, comma and ~ (the tilde)

\experiment{Preparation of A}

A was prepared according to the protocol in Muller \textit{et al.} and
was temporarily stored in the freezer.

\labday{Thursday, April 24, 2003}

\experiment{Preparation of B}

B was prepared according to the protocol by Smith and Fox.

% The next working step is carried out on the two substances at once,
% so there should be an index entry for both of them:

\experiment[Lyophilization of A and B,lyoph-A, lyoph-B ]{Lyophilization
  of A and B}
% The first item in the comma-separated list in the optional argument
% will be used for the table of contents and running title (and for
% the index, if there is only this single item). The other items
% generate an index entry. You can use abbreviations as well as free text.

\end{document}
%</examplen>
%<*examplde>
% Diese Datei mit latex bearbeiten (oder besser pdflatex), und nicht
% vergessen
%
% makeindex examplde
%
% aufzurufen, um dem Index zu erzeugen, und nochmals latex laufen zu lassen
\documentclass[idxtotoc,hyperref]{labbook}
% Die Option idxtotoc sorgt dafür, dass der Index im Inhaltsverzeichnis
% auftaucht - und damit auch in den pdf-Bookmarks, was sehr praktisch
% ist. Sie ist spezifisch für die KOMA-Klassen.

% Die Option hyperref ist nötig, wenn hyperref geladen werden soll.

\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english,german]{babel}

\usepackage[%
  backref=page,%
  pdfpagelabels=true,%
  plainpages=false,%
  colorlinks=true,%
  bookmarks=true,%
  pdfview=FitB]{hyperref}
% siehe die hyperref-Dokumentation

\input{boilerplates}

% Das folgende werde ich im Laufe dieses Projekts alle paar Tage
% machen, daher definiere ich eine Abkürzung. Die
% Abkürzungsdefinitionen müssen in der Präambel stehen.

\newexperiment{prep_S-peptide}{Präparation von RNase-A-S-Peptid}
\newsubexperiment{subtilisin}[Subtilisin-Verdau]{Behandlung mit
  Subtilisin}
% das \subexperiment erhält ein optionales Argument für
% Inhaltsverzeichnis und Index (und den Kolumnentitel).

\newexperiment{prep?irge1nd&^was}{Herstellung von gereinigtem
  Irgendwas}
% Man kann fast alle Zeichen in der Abkürzung verwenden. Nur
% Leerzeichen, Komma und die Tilde (~) sind nicht erlaubt.

\newexperiment{lyoph-A}{Lyophilisieren von A}
\newexperiment{lyoph-B}{Lyophilisieren von B}


\begin{document}

\frontmatter
\title{Laborjournal vom  2003-04-22 bis \dots}
\author{Erika Ehrgeizig}
\maketitle

\printindex
\tableofcontents

\mainmatter


\labday{Dienstag, 22. April 2003}


\experiment{prep_S-peptide}
\subexperiment{subtilisin}

\Xsometext\par
\Xsometext\par
\Xsometext\par
\Xsometext\par
\begin{figure}[htbp]
  \centering
  \sdsgel
  \caption{Ein sehr interessantes SDS-Gel}
  \label{fig:digest-sds}
\end{figure}

\experiment{Expression von Hagridin in \textit{E. coli}}
% natürlich braucht man keine Abkürzungen verwenden.

\subexperiment[Transformation mit HagIV-Plasmid]{Transformation von
  hogwarts-auxotrophen \textit{E. coli} mit dem Plasmid HagIV}
% das optionale Argument kann ebenfalls ohne Abkürzung verwendet werden.

\Xothertext\Xothertext

\labday{Mittwoch, 23. April 2003}

\experiment{prep_S-peptide}

\subexperiment[subtilisin]{Verdau mit der neuen Charge Subtilisin}
% man kann eine Abkürzung im optionalen Argument zusammen mit einer
% variierten Langform verwenden.

\experiment{prep?irge1nd&^was}
% dran denken: Alles außer Leerzeichen, Komma und ~ (die Tilde).

\experiment{Herstellung von A}

A wurde nach der Vorschrift in Müller \textit{et al.} hergestellt und
vorläufig im Eisschrank gelagert.

\labday{Donnerstag, 24. April 2003}

\experiment{Herstellung von B}

B wurde nach der Vorschrift von Meier und Schulze hergestellt.

% Der nächste Arbeitschritt wird gleichzeitig an beiden Substanzen
% durchgeführt. Daher sollte auch jede einen Indexeintrag erhalten:

\experiment[Lyophilisieren von A und B,lyoph-A, lyoph-B ]{Lyophilisieren
  von A und B}
% Das erste Element der kommaseparierten Liste im optionalen Argument
% wird für das Inhaltsverzeichnis und die Kolumnentitel verwendet (und
% für den Index, wenn es nur diesen einen Eintrag gibt). Die weiteren
% erzeugen einen Indexeintrag. Man kann sowohl Abkürzungen als auch
%  freien Text verwenden


\end{document}
%</examplde>
%<*boilerplates>
% just fom demonstration of how the index works with entries that
% span several pages, I define some boilerplates:
\newcommand*{\sometext}{A rather lengthy description which is just
  here to use some space, so that one can see the effect of the index
  ranges. }
\newcommand*{\Xsometext}{\sometext\sometext\sometext\sometext
  \sometext\sometext\sometext\sometext\sometext\sometext}
\newcommand*{\othertext}{Some shorter Text, the cells will only grow
  if you're not a muggle\dots }
\newcommand*{\Xothertext}{\othertext\othertext\othertext
  \othertext\othertext\othertext\othertext}

\newcommand{\sdsband}{\rule{1cm}{0.15cm}}
\newcommand{\sdsbandh}{\rule[0.2cm]{1cm}{0.15cm}}
\newcommand{\sdsbandl}{\rule[-0.15cm]{1cm}{0.15cm}}
\newcommand*{\sdsgel}{%
    \begin{tabular}{cccccccc}
\sdsband & \sdsbandl & \sdsband & \sdsbandh & 
  \sdsbandh & \sdsband & \sdsbandl & \sdsband \\[0.5cm]
\sdsbandl & \sdsband & \sdsbandh & \sdsbandl & 
  \sdsband & \sdsbandl & \sdsbandh & \sdsband \\[0.5cm]
\sdsbandh & \sdsbandl & \sdsbandh & \sdsband & 
  \sdsbandl & \sdsbandh & \sdsband & \sdsbandl \\[0.5cm]
\sdsband & \sdsbandh & \sdsbandl & \sdsbandl & 
  \sdsband & \sdsbandh & \sdsbandl & \sdsbandh \\[0.5cm]
\sdsbandl & \sdsbandl & \sdsbandh & \sdsband & 
  \sdsbandh & \sdsbandl & \sdsbandh & \sdsband \\[0.5cm]
    \end{tabular}
}
%</boilerplates>
%    \end{macrocode}
%    \begin{macrocode}
%<*labboode>
\documentclass[a4paper]{article}
\usepackage{doc}
\usepackage{ngerman}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\MacroIndent=2em

\MakeShortVerb{\|}

\begin{document}

\title{labbook.cls, eine \LaTeX-Klasse zum F"uhren von experimentellen
  Laborjournalen, Version 1.1}

\author{Frank K"uster}
\date{2003-05-20}
\maketitle

\begin{abstract}
  Diese Klasse soll es erm"oglichen, Laborb"ucher mit chronologischen
  Aufzeichnungen "uber Experimente mit \LaTeX\ zu f"uhren. Die neuen
  Seiten werden einfach jeden Tag hinten angeheftet, aus den
  Gliederungselementen wird ein Experiment-Index generiert, um das
  Auffinden von bestimmten Experimenten zu erleichtern. Durch
  unterschiedliche Seitennummerierung kann der Vorspann (Index,
  Inhalt, Abkürzungsverzeichnis) unabhängig vom Hauptteil verl"angert
  werden.  Die Klasse basiert auf der KOMA-Script-Klasse
  |scrbook.cls|. Es k"onnen daher alle Merkmale dieser Klasse
  verwendet werden -- die Lekt"ure des |scrguide|, der
  KOMA-Script-Dokumentation, wird daher sehr empfohlen.
\end{abstract}

\tableofcontents

\section{Generelles}

\subsection{Rechtliches}

Die F"uhrung von Laborb"uchern ist teilweise gesetzlich geregelt, oft
stellen Institutionen zur Forschungsf"orderung weitere Anforderungen.
In der Regel ist es daher \emph{nicht} erlaubt, ein Laborjournal
lediglich in elektronischer Form zu f"uhren; teilweise sind gebundene
B"ucher vorgeschrieben. Allerdings scheint es auch dort "ublich zu
sein, die Notizen, die man w"ahrend der Experimente auf losen
Bl"attern, in Computerdateien oder einem "`Schmierbuch"' gef"uhrt hat,
mehr oder weniger regelm"a"sig ins gebundene Laborjournal zu
"ubertragen.

Aus diesem Grund scheint es mir vertretbar, mit einer elektronischen
und einer parallelen ausgedruckten Fassung des Laborjournals zu
arbeiten. Bei Bedarf kann die ausgedruckte Fassung geheftet oder
gebunden werden, eine auf CD-ROM gebrannte Version sollte einem Buch
an Beweiskraft nicht nachstehen. Dem stehen die gro"sen Vorteile v.a. einer
PDF-Fassung gegen"uber: Volltextsuche, einfache Einbindung von
Graphen und Bildern, M"oglichkeit der Verlinkung von Datendateien etc.

\subsection{Merkmale}
\label{sec:features}

\begin{description}
\item[Basisklasse] |labbook.cls| basiert auf der KOMA-Script-Klasse
  |scrbook.cls| und bietet daher alle Möglichkeiten dieser Klasse, vom
  Seitenlayout über Kopfzeilengestaltung und Absatzauszeichnung bis
  hin zu Variationen des Layouts von \textit{floats} und
  Randbemerkungen. Die Lektüre des scrguide wird sehr empfohlen!
\item[Gliederung] Die Gliederung erfolgt zun"achst chronologisch,
  statt |\chapter| wird |\labday| verwendet. Innerhalb eines Tages
  wird nach Experimenten untergliedert -- das kann eine vollständige
  Messung von der Planung bis zur Auswertung sein, aber auch ein
  Arbeitsgang eines mehrere Tage dauernden Versuchs. |\experiment|
  steht auf der Ebene von |\section|, zusätzlich steht
  |\subexperiment| auf der |\subsection|-Ebene zur Verfügung. Darunter
  gibt es die "ublichen Gliederungsebenen, auch wenn eine sehr tiefe
  Schachtelung wenig sinnvoll erscheint -- man beachte das
  |\minisec|-Kommando von KOMA-Script.
\item[Index und Inhaltsverzeichnis] Wegen der chronologischen Gliederung ist ein
  traditionelles Inhaltsverzeichnis nicht ausreichend, besonders wenn
  Versuche in einem zusammenh"angenden Experiment an verschiedenen
  Tagen durchgef"uhrt werden. Daher wird zusätzlich ein Index
  ausgegeben. Der Index wird aus den Inhaltsverzeichnis-Einträgen der
  Abschnittsbefehle erstellt. Als Argument für |\experiment| und
  |\subexperiment| kann man auch vorher definierte Abkürzungen
  verwenden. Dadurch soll die konsistente Erstellung des Index
  erleichtert werden. Außerdem können einem Experiment mehrere
  Indexeinträge zugeordnet werden.
\item[hyperref-Integration] Die Klasse arbeitet gut mit dem Paket
  |hyperref.sty| zur Erstellung von pdf-Dateien mit
  Navigationsfunktionen zusammen.
\end{description}


\section{Benutzung}
\label{sec:usage}


\subsection{Initialisierung}
\label{sec:options}

Wenn man hyperref verwenden möchte \emph{muss} man die Klassenoption
|hyperref| angeben:
\begin{verbatim}
\documentclass[hyperref]{labbook}
\end{verbatim}
Danach kann man hyperref und andere Pakete in der jeweils passenden
Reihenfolge laden. Wird hyperref geladen, ohne die Option anzugeben,
dann überschreibt es einige Änderungen, die in dieser Klasse in
\LaTeX-Interna eingefügt werden. Umgekehrt werden diese Änderungen gar
nicht erst durchgeführt, wenn man die Option |hyperref| angibt, aber
das Laden des Paketes vergisst! Bei der Verwendung von hyperref
sollte man außerdem die KOMA-Option |idxtotoc| in Erwägung ziehen: Der
Index wird nämlich nicht nur in das Inhaltsverzeichnis aufgenommen,
sondern auch in die PDF-Bookmarks.

Ansonsten werden derzeit einfach alle Optionen an scrbook
durchgereicht. Die Verwendung von |openany| bietet sich an, damit
Labortage auf jeder Seite beginnen können.

\section{Gliederungsbefehle}
\label{sec:gliederungsbefehle}

subsection{\textbackslash\texttt{labday}}
label{sec:labday}

\DescribeMacro{\labday} Der Befehl |\labday| kann verwendet werden, um
eine nicht nummerierte "Uberschrift zu erzeugen. Ihr Text (bzw. der des
optionalen Arguments) wird ins Inhaltsverzeichnis aufgenommen und als
lebender Kolumnentitel gesetzt.  In der Regel wird man einfach das
Datum, vielleicht mit dem Wochentag, verwenden.  |\labday| kümmert
sich auch um die Indexeinträge der untergeordneten Gliederungspunkte;
man sollte es nur innerhalb von mainmatter verwenden. Intern wird
|\addchap| aufgerufen, es gibt keine Sternform und kein optionales
Argument. 

\subsection{\textbackslash\texttt{experiment} und
  \textbackslash\texttt{subexperiment}: Einfache Verwendung}
\label{sec:exper-und-subexp}

\DescribeMacro{\experiment} Innerhalb eines Tages k"onnen nummerierte
"Uberschriften für einzelne Experimente mit
\begin{verbatim}
\experiment[<Kurzform>]{<Langform>}
\end{verbatim}
erzeugt werden. Ihr Text (bzw. der des optionalen Arguments) wird
nicht nur ins Inhaltsverzeichnis und den Seitenkopf geschrieben,
sondern auch in den Index. Dieser erleichtert die Orientierung,
besonders wenn Experimente mehrfach oder "uber mehrere Tage hinweg
durchgef"uhrt werden. Die Indexeintr"age geben nicht nur die Seiten
des Beginns jedes Experiments an, sondern den ganzen Seitenbereich,
und fassen zusammenhängende Bereiche des gleichen Experiments an
unterschiedlichen Tagen zusammen.

Beachten Sie, dass man im optionalen Argument keine Kommas verwenden
darf, weil es auch eine durch Kommas abgetrennte Liste enthalten kann
(s.\,u.). Wenn Sie doch ein Komma benötigen, schließen Sie das
optionale Argument nochmals in geschweifte Klammern ein:
\begin{verbatim}
\experiment[{eins, zwei, drei}]{Die Eins, die zwei und die Drei}
\end{verbatim}

\DescribeMacro{\subexperiment} Das selbe gilt f"ur die darunter
liegenden |\subexperiment|-Eintr"age. Sie sind f"ur Untergliederungen
der Art "`Planung, Durchf"uhrung, Auswertung"' oder "`Herstellung,
Reinigung, Messung"' vorgesehen.


\subsection{Fortgeschrittene Verwendung: Abk"urzungen}
\label{sec:abkurzungen}

\DescribeMacro{\newexperiment} Wenn man für das gleiche Experiment an
unterschiedlichen Stellen leicht unterschiedliche Formulierungen (oder
Schreibungen) wählt, erhält man unterschiedliche Indexeinträge. Um
dies zu vermeiden, kann man sich Abk"urzungen für häufig auftretende
Experimente definieren. Dies geschieht mit dem Makro

|\newexperiment{<abk>}{<Langform>}{<Kurzform>}|

Dabei bezeichnet |<abk>| die Abk"urzung, mit der man auf die
definierte |<Langform>| und |<Kurzform>| zugreifen kann (letztere für
Index, Inhaltsverzeichnis und Kolumnentitel). Der Text der Abk"urzung
ist dabei \emph{ohne} vorangestellten Backslash einzugeben, also als
|\experiment{abk}|! Die Abk"urzungen d"urfen außer der Tilde
(\textasciitilde), dem Komma und Leerzeichen sämtliche Zeichen
enthalten.

\DescribeMacro{\newsubexperiment} Für |\subexperiment| steht ein
analoges Makro, |\newsubexperiment|, zur Verfügung.

Bei jeder Verwendung eines dieser Makros wird "uberpr"uft, ob die
gew"unschte Abk"urzung bereits verwendet wurde, und gegebenenfalls ein
Fehler erzeugt. Gleichlautende Abk"urzungen f"ur |\experiment| und
|\subexperiment| sind grunds"atzlich m"oglich, d"urften aber nur
Verwirrung stiften (beim Benutzer, nicht bei \TeX). Wird das dritte
Argument dieser Makros leer gelassen, so wird die Langform auch f"ur
Index und Inhaltsverzeichnis verwendet.

|\experiment| und |\subexperiment| k"onnen wie |\section| mit oder
ohne optionales Argument verwendet werden, und zwar sowohl mit v"ollig
frei gew"ahlten "Uberschriften (Kurz- und Langform) als auch mit einer
Abk"urzung. Die Kombination einer Abk"urzung im optionalen Argument
und einer variierten, freien Langform im Hauptargument ist m"oglich,
die Verwendung eines frei formulierten optionalen Arguments mit einer
Abk"urzung im Pflichargument f"uhrt jedoch zu einem Fehler, denn die
Abk"urzung legt ja bereits einen Index- und Verzeichniseintrag fest.
Die Verwendung zweier unterschiedlicher Abk"urzungen in optionalem und
Pflichtargument ist m"oglich, wenn sie beide zum selben Indexeintrag
f"uhren.


\subsection{Mehrfache Indexeinträge}

Manchmal führt man zusammenpassende Arbeitschritte für verschiedene
Experimente parallel aus, das verkompliziert die Indexeinträge.
Stellen Sie sich z.\,B. vor, Sie hätten mit einer Screening-Methode
die Substanzen A152 und B96 aus einer kombinatorischen Bibliothek als
vielversprechende Medikamente identifiziert. Als nächstes möchten Sie
deren exakte Struktur, Zusammensetzung oder Sequenz verifizieren und
eine Präparationsmethode für etwas größere Mengen entwickeln.
Wahrscheinlich können Sie Zeit sparen, indem Sie einige dieser
Schritte für beide Substanzen parallel ausführen, aber dann erhalten
Sie einen Index mit Einträgen wie "`A152 und B96, Sequenzierung"' --
und zwei Monate später sollen Sie sich erinnern, ob sie B96 zusammen
mit A152 sequenziert haben oder stattdessen in der folgenden Woche mit
A43 und C12. Daher wäre es praktisch, für das Experiment
"`Sequenzierung von A152 und B96"' zwei Indexeinträge zu erhalten,
nämlich "A152, Sequenzierung"' und "B96, Sequenzierung"'. Und genau
das können Sie einfach erzeugen.

\DescribeMacro{\subexperiment}\DescribeMacro{\experiment} 
Denn die Syntax von |\experiment| und |\subexperiment| erlaubt es,
eine durch Kommata abgetrennte Liste im optionalen Argument zu
verwenden. Das erste Element wird für das Inhaltsverzeichnis und die
Kolumnentitel verwendet, und die folgenden Elemente liefern
Indexeinträge. Angenommen, Sie haben die Abkürzungen A152-seq und
B96-seq definiert, dann brauchen Sie nur zu schreiben:
\begin{verbatim}
\experiment[Sequenzierung A152 und B96, A152-seq,
B96-seq]{Sequenzierung der Inhibitor-Kandidaten A152 und B96}
\end{verbatim}
und Sie erhalten was Sie wünschen. Leerzeichen vor und nach den
Kommata werden ignoriert. Sie können überall Abkürzungen oder freien
Text wählen, obwohl für die Indexeinträge wahrscheinlich nur
Abkürzungen wirklich sinnvoll sind.


\section{Implementierung}

Die Implementierung ist auf Englisch dokumentiert und kann durch
Übersetzung von |labbook.dtx| mit latex erhalten werden.

\PrintIndex

\end{document}
%</labboode>
%<*labbook>
\endinput
%</labbook>
%\fi
%
% \clearpage
% \Finale
%
%