The blkcntrl package

Block Control

                Matt Swift <swift@bu.edu>

Version: v1.0 Documentation revision: 1996/03/26

Abstract

Inserts various hooks into block elements and footnotes.

Part I

Discussion

Part II

Implementation

1 Version control

\fileinfo \fileversion \filedate \docdate \PPOptArg These definitions must be the first ones in the file.
1 \def\fileinfo{Block Control}
2 \def\fileversion{v1.0}
3 \def\filedate{1996/03/26}
4 \def\docdate{1996/03/26}
5 \edef\PPOptArg {%
6 \filedate\space \fileversion\space \fileinfo
7 }

Stop right here if we’re just loading the file’s information, and don’t want to load this code for typesetting its documentation (only makes sense for certain packages). The JuStLaAdInFoRmAtIoN flag will be set by the documentation driver; the DoXNeeDME flag will be set in the dtx file, and will appear above if it’s set.

8 \makeatletter
9 \@ifundefined{JuStLoAdInFoRmAtIoN} {%
10 }{% ELSE
11 \@ifundefined{DoXNeeDME} {%
12  }{% ELSE
13  \UndefineCS\JuStLoAdInFoRmAtIoN
14  \usepackage{blkcntrl}%

15 }

16 \makeatother

17 \endinput

18 }

Now we check for L^{A}TEX2e and declare the package.

19 \NeedsTeXFormat{LaTeX2e}
20 \ProvidesPackage{blkcntrl}[\PPOptArg]

2 Requirements

21 \RequirePackage{moredefs,relsize}

3 General get-control hook hacks

\if@in@footnote@ \@in@footnote@true \@in@footnote@false \PreFootnote \PreChunk \PreQuote \PreQuotation \PreVerse \@makefntext I think macros are much more convenient as hooks than tokens. I use the prefixes

Pre or Post. We want to add a hook to the usual definition here, to gain some control over relative sizing in footnotes.

22 \defcommand\@makefntext [1] {%
23 \setlength\parindent{\@ne em}%
24 \noindent
25 \hbox to 1.8em{\hss\@makefnmark}%
26 {\PreFootnote #1}%

27 }

28 \newboolean{@in@footnote@}
29 \newcommand\PreFootnote {%
30 \@in@footnote@true

31 }

32 \ReserveCS\PreChunk
33 \newcommand\PreQuote {%
34 \PreChunk

35 }

36 \newcommand\PreQuotation {%
37 \PreChunk

38 }

39 \newcommand\PreVerse {%
40 \PreChunk

41 }

Additions to the above hooks should be made with \addto@macro. Deletions should be accomplished by scoping.

verse quotation quote These environments are the same for the standard document classes, and the only

change is to insert the above hooks.

The hook cannot be put into the second argument, which is called before the paragraph preceding the environment has been ended (unless the environment started a new one).

42 \renewenvironment{verse}
43  {\let\\\@centercr
44  \relax\begin{list}{}{\setlength{\itemsep}{\z@}%
45  \setlength{\itemindent}{-1.5em}%
46  \setlength{\listparindent}{\itemindent}%
47  \setlength{\rightmargin}{\leftmargin}%
48  \addtolength{\leftmargin}{1.5em}}%

49  \item[]\PreVerse\relax}
50  {\end{list}}
51 \renewenvironment{quotation}
52  {\begin{list}{}{\setlength{\listparindent}{1.5em}%
53  \setlength{\itemindent}{\listparindent}%
54  \setlength{\rightmargin}{\leftmargin}%
55  \setlength{\parsep}{\z@ \@plus\p@}}%
56  \item[]\PreQuotation\relax}
57  {\end{list}}
58 \renewenvironment{quote}
59  {\begin{list}{}{\setlength{\rightmargin}{\leftmargin}}%
60  \item[]\PreQuote\relax}
61  {\end{list}}

4 Some formatting that needs the extra control

\if@smallblocks@
\@smallblocks@true
\@smallblocks@false
\smallblocks

62 \newboolean{@smallblocks@}

63

64 \newcommand\smallblocks {%
65 \@smallblocks@true
66 \addto@macro\PreChunk {%
67  \if@in@footnote@\else
68  \relsize{-1}%
69  \fi
70 }%

71 }

Index

Numbers written in italic refer to the page where the corresponding entry is described, the ones underlined to the code line of the definition, the rest to the code lines where the entry is used.

macro=  \subitem macro+, 66
addtolength=  \subitem *+\addtolength+, 48
begin=  \subitem *+\begin+, 44, 52, 59
def=  \subitem *+\def+, 1--4
defcommand=  \subitem *+\defcommand+, 22
docdate=  \subitem *+\docdate+, \main{1}
edef=  \subitem *+\edef+, 5
else=  \subitem *+\else+, 67
end=  \subitem *+\end+, 50, 57, 61
endinput=  \subitem *+\endinput+, 17

environments:¿quotation,

\underline{2} environments:¿quote, \underline{2} environments:¿verse, \underline{2}

fi=  \subitem *+\fi+, 69
filedate=  \subitem *+\filedate+, \main{1}
fileinfo=  \subitem *+\fileinfo+, \main{1}
fileversion=  \subitem *+\fileversion+, \main{1}
hbox=  \subitem *+\hbox+, 25
hss=  \subitem *+\hss+, 25

item=  \subitem *+\item+, 49, 56, 60
itemindent=  \subitem *+\itemindent+, 45, 46, 53
itemsep=  \subitem *+\itemsep+, 44
JuStLoAdInFoRmAtIoN=  \subitem *+\JuStLoAdInFoRmAtIoN+, 13
leftmargin=  \subitem *+\leftmargin+, 47, 48, 54, 59
let=  \subitem *+\let+, 43
listparindent=  \subitem *+\listparindent+, 46, 52, 53
makeatletter=  \subitem *+\makeatletter+, 8
makeatother=  \subitem *+\makeatother+, 16
NeedsTeXFormat=  \subitem *+\NeedsTeXFormat+, 19
newboolean=  \subitem *+\newboolean+, 28, 62
newcommand=  \subitem *+\newcommand+, 29, 33, 36, 39, 64
noindent=  \subitem *+\noindent+, 24
=  \subitem +, 55
parindent=  \subitem *+\parindent+, 23
parsep=  \subitem *+\parsep+, 55
PPOptArg=  \subitem *+\PPOptArg+, \main{1}, 20
PreChunk=  \subitem *+\PreChunk+, \main{22}, 66
PreFootnote=  \subitem *+\PreFootnote+, \main{22}
PreQuotation=  \subitem *+\PreQuotation+, \main{22}, 56
PreQuote=  \subitem *+\PreQuote+, \main{22}, 60

                          PreVerse=  \subitem *+\PreVerse+, \main{22}, 49
                          ProvidesPackage=  \subitem *+\ProvidesPackage+, 20

quotation=quotation

(environment), \underline{42} quote=quote (en-

vironment), \underline{42}

                          relax=  \subitem *+\relax+, 44, 49, 56, 60
                          relsize=  \subitem *+\relsize+, 68
                          renewenvironment=  \subitem *+\renewenvironment+, 42, 51, 58
                          RequirePackage=  \subitem *+\RequirePackage+, 21
                          ReserveCS=  \subitem *+\ReserveCS+, 32
                          rightmargin=  \subitem *+\rightmargin+, 47, 54, 59
                          setlength=  \subitem *+\setlength+, 23, 44--47, 52--55, 59
                          smallblocks=  \subitem *+\smallblocks+, \main{62}
                          space=  \subitem *+\space+, 6
                          UndefineCS=  \subitem *+\UndefineCS+, 13
                          usepackage=  \subitem *+\usepackage+, 14

verse=verse (environment), \underline{42}

                          =  \subitem +, 44, 55