The blkcntrl LaTeX package

block control

Matt Swift <swift@alum.mit.edu>

Version: 1.2 Date: 2001/08/31

Documentation revision: 2001/08/31

Abstract

Inserts hooks into certain block elements and footnotes. Also provides a command to set block quotations one size smaller than the main text.

Contents

I Discussion 2

1 General 2 2 Programmers’ interface 2

II Implementation 3

3 Version control 3 4 Requirements 3 5 Options 3 6 General get-control hook hacks 4

Part I

Discussion

1 General

This package has two purposes. First, it inserts several hooks into constructs in the standard document classes so that other packages can use the hooks. The achicago, attrib, dialogue, and bits packages in the Frankenstein bundle require blkcntrl. Second, blkcntrl offers one option itself that uses the hooks. The smallblocks option has the same effect as using \smallblocks in the preamble, for which see below. The normalblocks option means no \smallblocks, and is there simply for completeness.

FIX; using smallblocks option gives option clash when other packages require blkcntrl. Do thorough review of option passing.

\smallblocks When \smallblocks is declared in the preamble, footnotes and the block ele-

ments quote, quotation, and verse are set one size smaller (i.e., \relsize{-1}).

\normalblocks

2 Programmers’ interface

\PreChunk
\PreQuote
\PreQuotation
\PreVerse
\PreFootnote

Part II

Implementation

3 Version control

\fileinfo \DoXUsepackagE \HaveECitationS \fileversion \filedate \docdate \PPOptArg These definitions must be the first ones in the file.
 1 \def\fileinfo{block control}
 2 \def\DoXPackageS {}
 3 \def\fileversion{v1.2}
 4 \def\filedate{2001/08/31}
 5 \def\docdate{2001/08/31}
 6 \edef\PPOptArg {%
 7 \filedate\space \fileversion\space \fileinfo
 8 }

If we’re loading this file from a \ProcessDTXFile command (see the compsci package), then \JusTLoaDInformatioN will be defined; othewise we assume it is not (that’s why the FunkY NamE).

If we’re loading from \ProcessDTXFile, we want to load the packages listed in \DoXPackageS (needed to typeset the documentation for this file) and then bail out. Otherwise, we’re using this file in a normal way as a package, so do nothing. \DoXPackageS, if there are any, are declared in the dtx file, and, if you’re reading the typeset documentation of this package, would appear just above. (It’s OK to call \usepackage with an empty argument or \relax, by the way.)

 9 \makeatletter% A special comment to help create bst files.  Don't change!
10 \@ifundefined{JusTLoaDInformatioN} {%
11 }{% ELSE (we know the compsci package is already loaded, too)
12 \UndefineCS\JusTLoaDInformatioN
13 \SaveDoXVarS
14 \eExpand\csname DoXPackageS\endcsname\In {%use \csname in case it's undefined
15  \usepackage{#1}%
16 }%
17 \RestoreDoXVarS
18 \makeatother
19 \endinput
20 }% A special comment to help create bst files.  Don't change!

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

21 \NeedsTeXFormat{LaTeX2e}
22 \ProvidesPackage{blkcntrl}[\PPOptArg]

4 Requirements

23 \RequirePackage{moredefs,relsize}

5 Options

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

24 \DeclareBooleanUserOptions{smallblocks}{normalblocks}
25 \@onlypreamble\smallblocks

26 \@onlypreamble\normalblocks
27 \ExecuteOptions{normalblocks}
28 \ProcessOptions

6 General get-control hook hacks

\if@in@footnote@ \@in@footnote@true \@in@footnote@false \PreFootnote \PreChunk \PreQuote \PreQuotation \PreVerse Additions to these hooks should be made with \\addto@macro. Deletions should

be accomplished by scoping.

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.

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

32 }

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

36 }

37 \newcommand\PreQuotation {%
38 \PreChunk

39 }

40 \newcommand\PreVerse {%
41 \PreChunk

42 }

\@makefntext All we’re doing is adding the \PreFootnote hook.

43 \defcommand\@makefntext [1] {%
44 \setlength\parindent{\@ne em}%
45 \noindent
46 \hb@xt@ 1.8em{\hss\@makefnmark}%
47 {\PreFootnote #1}%

48 }

verse quotation quote Again all we’re doing to these environments is adding the 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).

49 \renewenvironment{verse}
50  {\let\\\@centercr
51  \relax\list{}{\setlength{\itemsep}{\z@}%
52  \setlength{\itemindent}{-1.5em}%
53  \setlength{\listparindent}{\itemindent}%
54  \setlength{\rightmargin}{\leftmargin}%
55  \addtolength{\leftmargin}{1.5em}}%
56  \item\relax\PreVerse\relax}
57  {\endlist}
58 \renewenvironment{quotation}
59  {\list{}{\setlength{\listparindent}{1.5em}%
60  \setlength{\itemindent}{\listparindent}%
61  \setlength{\rightmargin}{\leftmargin}%
62  \setlength{\parsep}{\z@ \@plus\p@}}%

63  \item\relax\PreQuotation\relax}
64  {\endlist}
65 \renewenvironment{quote}
66  {\list{}{\setlength{\rightmargin}{\leftmargin}}%
67  \item\relax\PreQuote\relax}
68  {\endlist}
69 \AtBeginDocument {%
70 \if@smallblocks@
71  \addto@macro\PreChunk {%
72  \if@in@footnote@
73  \else
74  \relsize{-1}%
75  \fi
76  }%
77 \fi

78 }

Index

Numbers written in italic refer to the page where the corresponding entry is described; numbers underlined refer to the code line of the definition; numbers in roman refer to the code lines where the entry is used.

Symbols

\@centercr . . . . . . . 50
\@ifundefined . . . . . 10
\@in@footnote@false   \underline{29}
\@in@footnote@true . \underline{29}
\@makefnmark . . . . . . 46
\@makefntext . . . . . . \underline{43}

\@ne . . . . . . . . . . . . . 44

\@onlypreamble . . 25, 26

\@plus . . . . . . . . . . . 62

\@smallblocks@false   \underline{24}
\@smallblocks@true . \underline{24}

\\ . . . . . . . . . . . . . . 50

A

\addto@macro . . . . . . 71
\addtolength . . . . . . 55
\AtBeginDocument . . 69

C

\csname . . . . . . . . . . 14

D

\DeclareBooleanUserOptions

. . . . . . . . . . . . 24 \def . . . . . . . . . . . . . 1–5

\defcommand . . . . . . . 43

\docdate . . . . . . . . . . \underline{1}

\DoXPackageS . . . . . . . 2
\DoXUsepackagE . . . . . \underline{1}

E

\edef . . . . . . . . . . . . . 6 \eExpand . . . . . . . . . 14 \else . . . . . . . . . . . . 73

\endcsname . . . . . . . 14

\endinput . . . . . . . . 19 \endlist …. 57, 64, 68 environments:

   quotation . . . . . . \underline{49}

quote . . . . . . . . . \underline{49}
verse . . . . . . . . . \underline{49}

                          \ExecuteOptions . . . 27

F \fi . . . . . . . . . . . 75, 77 \filedate . . . . . . . . . \underline{1} \fileinfo . . . . . . . . . \underline{1}

                          \fileversion . . . . . . . \underline{1}

H

                          \HaveECitationS . . . . \underline{1}

\hb@xt@ . . . . . . . . . . 46 \hss . . . . . . . . . . . . . 46

I

                          \if@in@footnote@   \underline{29}, 72
                          \if@smallblocks@   \underline{24}, 70

\In . . . . . . . . . . . . . 14 \item . . . . . . . 56, 63, 67

                          \itemindent . . 52, 53, 60

\itemsep . . . . . . . . . 51

J

                          \JusTLoaDInformatioN 12

L

                          \leftmargin 54, 55, 61, 66

\let . . . . . . . . . . . . . 50 \list . . . . . . . 51, 59, 66

                          \listparindent 53, 59, 60

M

                          \makeatletter . . . . . . 9
                          \makeatother . . . . . . 18

N

                          \NeedsTeXFormat . . . 21
                          \newboolean . . . . . . . 29
                          \newcommand 30, 34, 37, 40

\noindent . . . . . . . . 45

                          \normalblocks . . . . 2, \underline{24}

P \p@ . . . . . . . . . . . . . 62

                                                   \parindent . . . . . . . 44

\parsep . . . . . . . . . . 62 \PPOptArg . . . . . . . \underline{1}, 22 \PreChunk …. 2, \underline{29}, 71

                                                   \PreFootnote . . 2, \underline{29}, 47
                                                   \PreQuotation . 2, \underline{29}, 63

\PreQuote …. 2, \underline{29}, 67 \PreVerse …. 2, \underline{29}, 56

                                                   \ProcessOptions . . . 28
                                                   \ProvidesPackage . . 22

Q

                                                   quotation (environ-

ment) . . . . . . . \underline{49} quote (environment) . \underline{49}

R \relax … 51, 56, 63, 67 \relsize . . . . . . . . . 74

                                                   \renewenvironment .

. . . . . . . 49, 58, 65

                                                   \RequirePackage . . . 23
                                                   \ReserveCS . . . . . . . 33
                                                   \RestoreDoXVarS . . . 17
                                                   \rightmargin . 54, 61, 66

S

                                                   \SaveDoXVarS . . . . . . 13
                                                   \setlength . . . . 44,

51–54, 59–62, 66

                                                   \smallblocks . . . . . 2, \underline{24}

\space . . . . . . . . . . . . 7

U

                                                   \UndefineCS . . . . . . . 12
                                                   \usepackage . . . . . . . 15

V verse (environment) . \underline{49}

Z \z@ . . . . . . . . . . . 51, 62