From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/labbook/README | 30 + macros/latex/contrib/labbook/labboode.pdf | Bin 0 -> 76250 bytes macros/latex/contrib/labbook/labbook.dtx | 2171 +++++++++++++++++++++++++++++ macros/latex/contrib/labbook/labbook.el | 39 + macros/latex/contrib/labbook/labbook.ins | 90 ++ macros/latex/contrib/labbook/labbook.pdf | Bin 0 -> 172052 bytes 6 files changed, 2330 insertions(+) create mode 100644 macros/latex/contrib/labbook/README create mode 100644 macros/latex/contrib/labbook/labboode.pdf create mode 100644 macros/latex/contrib/labbook/labbook.dtx create mode 100644 macros/latex/contrib/labbook/labbook.el create mode 100644 macros/latex/contrib/labbook/labbook.ins create mode 100644 macros/latex/contrib/labbook/labbook.pdf (limited to 'macros/latex/contrib/labbook') diff --git a/macros/latex/contrib/labbook/README b/macros/latex/contrib/labbook/README new file mode 100644 index 0000000000..c58141f404 --- /dev/null +++ b/macros/latex/contrib/labbook/README @@ -0,0 +1,30 @@ +Abstract + + labbook.cls - a document class that produces an index of sectioning + commands + + This class is designed to typeset laboratory journals that contain + chronologically ordered records about experiments. From the + sectioning commands, an experiment index is generated. The class + is based on the KOMA-Script class scrbook.cls. + +To produce the class and example files + + latex labbook.ins + + +To produce the documentation + + (pdf)latex labbook.dtx + + To produce an index for the documentation: + + makeindex -s gind.ist labbook + + To produce a change history for the documentation: + + makeindex -s gglo.ist -o labbook.gls labbook.glo + +Users of Emacs and AUCTeX might want to copy the file labbook.el to +a place where AUCTeX finds its style files. + diff --git a/macros/latex/contrib/labbook/labboode.pdf b/macros/latex/contrib/labbook/labboode.pdf new file mode 100644 index 0000000000..2fba7af97f Binary files /dev/null and b/macros/latex/contrib/labbook/labboode.pdf differ diff --git a/macros/latex/contrib/labbook/labbook.dtx b/macros/latex/contrib/labbook/labbook.dtx new file mode 100644 index 0000000000..61ff728ecf --- /dev/null +++ b/macros/latex/contrib/labbook/labbook.dtx @@ -0,0 +1,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} +% +%\NeedsTeXFormat{LaTeX2e}[1995/12/01] +%\ProvidesFile{labbook.drv} +%\ProvidesFile{examplen.tex}% +%\ProvidesFile{examplde.tex}% +%\ProvidesFile{boilerplates.tex}% +%\ProvidesFile{labboode.tex}% +%\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} +% +% \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[]{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{}[]{}| +% +% Here, || is the abbreviation that can be given later to make +% \LaTeX\ use the || and ||. 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{}} and +% |\short@|\texttt{\textit{}}, 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 +% |,\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{% + \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@|, then the +% first is expanded, and we get\\ +% |\ifx\short@exp@\short@exp@|. +% +% \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% +% +% \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} +% +%<*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} +% +%<*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} +} +% +% \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[]{} +\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{}{}{}| + +Dabei bezeichnet || die Abk"urzung, mit der man auf die +definierte || und || 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} +% +%<*labbook> +\endinput +% +%\fi +% +% \clearpage +% \Finale +% +% diff --git a/macros/latex/contrib/labbook/labbook.el b/macros/latex/contrib/labbook/labbook.el new file mode 100644 index 0000000000..a71af8b92a --- /dev/null +++ b/macros/latex/contrib/labbook/labbook.el @@ -0,0 +1,39 @@ +(TeX-add-style-hook "labbook" + (lambda () + (TeX-add-symbols + '("newexperiment" "abbreviation" t) + '("newsubexperiment" "abbreviation" t) + ) + (setq LaTeX-largest-level (LaTeX-section-level "chapter")) + ;; load basic definitons + (TeX-run-style-hooks "scrbase") + (TeX-run-style-hooks "scrbook") + (make-local-variable 'LaTeX-section-list) + (setq LaTeX-section-list + '(("part" 0) + ("labday" 1) + ("chapter" 1) + ("experiment" 2) + ("section" 2) + ("subexperiment" 3) + ("subsection" 3) + ("subsubsection" 4) + ("paragraph" 5) + ("subparagraph" 6) + ("addpart" 0) + ("addsec" 2) + ("minisec" 7))) + (setq LaTeX-section-label + '(("chapter" . "day:") + ("labday" . "day:") + ("section" . "sec:") + ("experiment" . "sec:") + ("subexperiment" . "sec:") + ("subsection" . "sec:"))) + (if (fboundp 'reftex-add-section-levels) + (reftex-add-section-levels '(("labday" . 1) + ("experiment" . 2) + ("subexperiment" . 3)))) +)) + + diff --git a/macros/latex/contrib/labbook/labbook.ins b/macros/latex/contrib/labbook/labbook.ins new file mode 100644 index 0000000000..c7825ccf47 --- /dev/null +++ b/macros/latex/contrib/labbook/labbook.ins @@ -0,0 +1,90 @@ +\let\ifbeta\iffalse +%% +%% This file will generate fast loadable files from the dtx files in this +%% bundle when run through LaTeX or TeX. +%% +%% This file is part of the labbook bundle +%% --------------------------------------------------- +%% +%% This system is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +%% +%% IMPORTANT NOTICE: +%% +%% Copyright 2002 Frank Küster +%% All rights reserved. This package is licensed under the +%% LaTeX Project Public License. For further information, see +%% http://www.ctan.org/tex-archive/macros/latex/base/lppl.txt +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\batchfile{labbook.ins} +\input docstrip.tex + +\keepsilent +\askforoverwritetrue +%\askforoverwritefalse + +\preamble +\endpreamble + +\ifToplevel{\ifx\generate\undefined +\Msg{**********************************************} +\Msg{*} +\Msg{* This installation requires docstrip} +\Msg{* version 2.3c or later.} +\Msg{*} +\Msg{* An older version of docstrip has been input} +\Msg{*} +\Msg{**********************************************} +\errhelp{Move or rename old docstrip.tex.} +\errmessage{Old docstrip in input path} +\batchmode +\csname @@end\endcsname +\fi +} + +\declarepreamble\mainpreamble + +Copyright (C) 2002 Frank Küster. + +All rights reserved. +\endpreamble +\declarepostamble\nullpostamble +\endpostamble + +%% File generation: + +\generate{% + \usepreamble\mainpreamble + \file{labbook.cls}{\from{labbook.dtx}{labbook}} + \file{labboode.tex}{\from{labbook.dtx}{labboode}} + \file{examplen.tex}{\from{labbook.dtx}{examplen}} + \file{examplde.tex}{\from{labbook.dtx}{examplde}} + \file{boilerplates.tex}{\from{labbook.dtx}{boilerplates}} +} + +\ifToplevel{ +\Msg{***********************************************************} +\Msg{*} +\ifbeta +\Msg{* THIS IS A BETA VERSION. YOU SHOULD NOT INSTALL OR USE IT!} +\Msg{* THERE MAY BE A LOT OF BUGS AT THIS VERSION!} +\Msg{* PLEASE INSTALL THE RELEASE YOU CAN FIND AT CTAN!} +\Msg{*} +\else +\Msg{* To finish the installation you have to move} +\Msg{* labbook.cls into a directory searched by TeX.} +\Msg{*} +\Msg{* For the documentation see the README file.} +\Msg{*} +\Msg{* Happy TeXing} +\fi +\Msg{***********************************************************} +} + +\endinput +%% +%% end of file `labbook.ins' diff --git a/macros/latex/contrib/labbook/labbook.pdf b/macros/latex/contrib/labbook/labbook.pdf new file mode 100644 index 0000000000..bd956afe3e Binary files /dev/null and b/macros/latex/contrib/labbook/labbook.pdf differ -- cgit v1.2.3