% comm.tex copyright 1992 Victor Eijkhout % copyright 2014--2016 Vafa Khalighi % % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program 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. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % \Chapter Commands \Section[sec:counters] Counters Counters can be declared explicitly by the user, but more often they are defined automatically in some generic construct: The \cs{Foo} defined by \Ver>\DefineBar:Foo ... counter:i ... Stop\NewCounter:Things for instance \Ver>\CounterRepresentation:Things=i\CounterRepresentation:Theorem=Lemma\StartCounter:things\StepCounter:things\BackStepCounter:things\SetCounter:things=5\AddToCounter:things=7\NewCounter:Favourite \AddToCounter:things=FavouriteValue\NewCounter:MyThings\GoverningCounter:SubSection=Section\label[bar]> will make \ver>\ref[bar]> refer to the value of the counter most recently changed. The way the counter is referenced can be altered by the \opt{label} option in generic constructs; see section~\ref[sec:opt:label]. For generic constructs with a counter no explicit \refcs{label} commands need to be given; such commands take an optional argument with the label key: \Ver>\Section[sec:examples] Examples\AdaptiveCounter:LastPage\SetCounter:LastPage=PageValue \Enumerate \SetCounter:item=-1 \item ... The most common change of font is a change in style. Therefore, issuing a command such as \Ver>\Style:bold\Typeface:GoudyOldStyle\PointSize:28 L\kern -.3em\raise .35ex\hbox {\script A}\kern -.1em\TeX\PointSizeScriptSizes:10=10,7,5 Here is the definition of the Computer Modern typeface: \Ver> \DefineTypeface{ComputerModern}{cm} {roman:r; slant:sl; italic:ti; mitalic:mi; bold:bx; typewriter:tt; default:r;} {<6:5; <7:6; <8:7; <9:8; <10:9; <11:10; <12:10 \scaled\magstephalf; <14:10 \scaled\magstep1; <16:10 \scaled\magstep2; <20:10 \scaled\magstep3; >19:10 \scaled\magstep4; default:10;}\makeatletter \DefineTypeface{Compu ... ... default:10;} [\ifStyle:italic \ifnum\Fsize<7 ti7\fi\fi \ifStyle:typewriter \ifnum\Fsize<8 tt8\fi\fi]\makeatletter \DefineTypeface{psHelvetica}{helv} {roman:; italic:i; mitalic:i; bold:b; default:;} {default: at \Fsize pt;} \makeatother\DefineFont:name=face,size,style\def\name{\TypeFace:face \PointSize:size \Style:style } \def\tt{\Typeface:ComputerModern \Style:typewriter }\BaselineSkipPointSizeRatio:1.3\SetPointSizeBaselineSkip:9=12\AlwaysIndent:no>. \SubSection[sec:basic-indent] Basic indent There is a quantity \refcs{basicindent} that is used on the first indentation level (see the next section for an explanation of these levels). At the start of a document it is set to the then current value of \cs{parindent}. You can override that by \refcs{BasicIndentIsSet}: give \Ver>\BasicIndentIsSet:no] \Distance:basicindent=25pt \TestList\item Level one \TestList\item Level two \TestList\item Level three\>] \ExampleStop The amount of indentation on a certain level can be set explicitly with \refcs{LevelIndent}. \Example \Distance:basicindent=15pt \LevelIndent:2=20pt \DefineList:TestList item:left itemCounter item:stop Stop \TestList\item Level one \TestList\item Level two \TestList\item Level three\>] \ExampleStop In fact, sometimes you may want to know the name of the indentation on a certain level. This is a control sequence such as \refcs{levelindentii} for the second level. You get the idea. \SubSection Manipulating the indentation level Every once in a while it can be useful to move to a next indentation level, or to return to a previous level. For this the two commands \refcs{PushIndentLevel} and \refcs{PopIndentLevel} are available. One application is for `interrupted lists': \Example \Itemize\item One {\par\PopIndentLevel Interrupted text!\par} \item Two\> \ExampleStop See chapter~\ref[chap:external-files] for examples of the use of \cs{PushIndentLevel} \Section Margins By default, \Lollipop\ tries to keep straight margins. You can change its mind about that by \refcs{FlushRight} and \refcs{FlushLeft} which are tests: \Ver>\FlushRight:no \FlushLeft:no\vwhite:15pt\hwhite:{15pt minus 3pt} line:start litteral:foo fillup litteral:bar line:stop\def\white:#1 {\@white{#1}}\Distance:oneline=15pt\DefineFoo:Bar whitebefore:oneline whiteafter:oneline\Distance:oneline={15pt plus 2pt minus 3pt}\Distance:whitebefore=oneline\DefineHeading:Section ... block:start [...] fillupto:widelabel title\AdaptiveDistance:WidestLabel=15pt \def\MeasureLabel{\ifdim\BlockWidth>\WidestLabel \global\WidestLabel\BlockWidth\fi} \DefineHeading:Section whitebefore:{20pt plus 2pt} whiteafter:14pt line:start PointSize:14 Style:italic block:start block:start ChapterCounter . SectionCounter Spaces:1 block:stop MeasureLabel fillupto:WidestLabel title line:stop external:contents title external:stop label:start ChapterCounter . SectionCounter label:stop Stop\StartCommand{\Distance:parindent=WidestLabel }\InputFile:parta \InputFile:partb\DefineTest:SomethingTheMatter\SomethingTheMatter:yes\SomethingTheMatter:no\ifSomethingTheMatter ... \else ... \fi\DefineFoo:Bar [...] ifSomethingTheMatter [...] fi [...] Stop\NewList:mylist\TheList:mylist\AppendToList:mylist={my data} \SubSection Programming Tools A few commands are useful for the Lollipop style designer who wants to write more sophisticated macros (see for instance the address book macros in the last chapter). \Description\item \refcs{UndefinedCS} is a test on control sequences. \Ver>\if\UndefinedCS{testcs} ... \else ... \fi\if\EqualString{one}{two} ... \else ... \fi\if\EqualStringX{one}{two} ... \else ... \fi\if\StringBefore{one}{two} ... \else ... \fi\if\NextChar[{\macro}{\macro[default]} ...\if\IsEmptyList{#1} ...\macro{}>. \item\refcs{loop} can be used for repeated execution of statements. (Users of plaing \TeX\ may recognize this macro; it is slightly extended here to include the \cs{else} case.) It is used as: \Ver>\loop ... \if ... \repeat\loop ... \if ... \else ... \repeat \SubSection[sec:everypar] \cs{everypar} The \TeX\ primitive \cs{everypar} should not be used any more. Instead use the command \refcs{EveryParagraph} as if you are setting a token list: \Ver>\EveryParagraph{ ... }\EveryMath{ ... }\EveryDisplay{ ... }