% Struct.tex copyright 1992 Victor Eijkhout % \Chapter The structure of Lollipop Lollipop provides tools for realizing the style or layout of a document. Some of these tools are macros ready to be used by the end user; they concern for instance selection of fonts. Others, the `generic constructs', are for the style designer so that she can use them to program the macros for the user. \Section[sec:doc-start-stop] Lollipop Files Any Lollipop document has to have a \cs{Start} and \cs{Stop} command. Before the \cs{Start} there can be style definition commands, but no text. For a number of reasons it is advisable to put as much of the style definition before the \cs{Start} command as possible. You can do that easily by loading the style as an input file, or by first dumping it as a format (see section~\ref[sec:style-dump]). \ImpNote Before the \cs{Start} command, \cs{everypar} contains an error message. The start command installs the default value for \cs{everypar}. \ImpNoteStop Both the start and the stop file load the \file{.aux} auxiliary file. None of this should concern you, really. Expert users who want to have certain actions performed at the start of the document may want to use \refcs{StartCommand} to specify what they wish done. See section~\ref[sec:adapt-distance] for an example. \Section Generic Constructs \label[generic:construct]\label[option:macro] There are five `generic constructs': headings, lists, text blocks, page grids, and external items. For each construct type there is a defining command, for instance \cs{DefineHeading} which is followed a list of `options', terminated by the word `Stop'. Options (possibly with values) have to be separated by a space or a line end; the keyword \opt{Stop} has to be followed by a space or a line end. Options may have zero, one or two values; if there are values, then the first one is separated from the option by a colon, the second is separated from the first by an equals sign. \Ver>\DefineFoo:Bar optiona optionb optionc:value optiond:valuea=valueb optione optionf Stop\DefineHeading:Foo> you can type \Ver>\Foo The title\DefineList:Foo> you can type \Ver>\Foo \item One item \item And another \FooStop \def\stop@command@suffix{Stop} \def\stop@command{\@command\stop@command@suffix}\DefineHeading:SubSection [...] SectionCounter . SubSectionCounter [...] Stop\OptionsMacro:baz=optiona optionb:value optionc Stop macro:baz\Distance:TheWidth\Distance:TheWidth=15pt\Distance:parskip=parundent\Distance:parskip=5pt \@GenericConstruct{Heading}\def\@GenericConstruct#1{\@GenericConstruct{Foo}>; \Ver> \append@to@list{@gencons}{\\#1;} \csarg\newtoks{#1@defaults} \csn #1@defaults\ecs{} \csarg\def{add@#1@default}##1% {\append@to@list{#1@defaults}{##1}} \Install@Noops{#1} \csarg\def{Define#1}:##1 {\DefineFoo:Bar>; \Ver> \def\@name{##1}\def\@class{#1} \Tmessage[def]{Defining a #1: ##1}DefineFoo:Bar> leads to \cs{@name} begin \n{Bar}, \cs{@class} being \n{Foo}; \Ver> \the\generic@defaults \csarg\the{#1@defaults} \Get@Items} \csarg\def{@#1Option}##1% {\csarg\def{#1@##1}####1####2} }\def\Get@Items#1 {\if\EmptyList{#1}\let\get@next@item\Get@Items \else\def\get@next@item{\@Get@Items#1 }\fi \get@next@item}\NewDummy{Stop}>, \ref[imp:new:dummy]), in which case you have reached the end of a generic definition, and can start performing the final rites. Otherwise, dissect this option item and go on with the rest of the options. \Ver> \def\@Get@Items#1 {\let\get@next@item=\Get@Items \csarg\ifx{#1}\Stop \the\generic@stop@defaults \let\get@next@item=\relax \else \Item@or@Macro#1::. \fi \get@next@item}\@FooOption{Bar}{ [...] }\@GenericOption{Bar}{ [...] } optiona:par1 optionb:par1=par2 \csarg\def{@#1Option}##1% {\csarg\def{#1@##1}####1####2}\@FooOption{Bar}{ ... }\def\Foo@Bar#1#2{ ... }\def\@GenericOption#1{ \append@to@list{@GenericOptions}{\\#1;} \csarg\def{Option@#1}##1##2}\@GenericOption{Bar}{ ... }\def\Option@Bar#1#2{ ... }