Debian Codegraph @

texmf-dist/doc/latex/frankenstein/unsupported/bits.sty

raw
1 %^^A* legal notices
2 % \iffalse
3 %
4 % This program is part of the Frankenstein bundle for LaTeX.
5 %
6 % Copyright 1995-2001 Matt Swift <[email protected]>.
7 %
8 % This file contains both the code and documentation for the
9 % bits LaTeX package. It will work ONLY if it is placed in a
10 % proper directory. Files called README, INSTALL, bits.tex
11 % and bits.ins should have also been distributed to you
12 % with this file. See them for more information on how to typeset
13 % the documentation with LaTeX and how to generate a version of this
14 % file that will work faster than this one.
15 %
16 % This program is free software; you may redistribute it and/or
17 % modify it under the conditions of the LaTeX Project Public
18 % License, either version 1.2 or (at your option) any later version.
19 % The latest version of this license is in
20 % http://www.latex-project.org/lppl.txt, and version 1.2 or later is
21 % part of all distributions of LaTeX version 1999/12/01 or later.
22 %
23 % This program is distributed in the hope that it will be useful,
24 % but without any warranty; without even the implied warranty of
25 % merchantability or fitness for a particular purpose. See the
26 % LaTeX Project Public License for more details.
27 %
28 % \fi
29 %
30 %^^A* checks
31 %
32 %^^A NOTE: The character table, with two %'s, will get written to all files.
33 %% \CharacterTable
34 %% {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
35 %% 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
36 %% Digits \0\1\2\3\4\5\6\7\8\9
37 %% Exclamation \! Double quote \" Hash (number) \#
38 %% Dollar \$ Percent \% Ampersand \&
39 %% Acute accent \' Left paren \( Right paren \)
40 %% Asterisk \* Plus \+ Comma \,
41 %% Minus \- Point \. Solidus \/
42 %% Colon \: Semicolon \; Less than \<
43 %% Equals \= Greater than \> Question mark \?
44 %% Commercial at \@ Left bracket \[ Backslash \\
45 %% Right bracket \] Circumflex \^ Underscore \_
46 %% Grave accent \` Left brace \{ Vertical bar \|
47 %% Right brace \} Tilde \~}
48 %
49 % \CheckSum{602}
50 %
51 % \newcommand\scheme [2] {\ensuremath{\frac{#1}{#2}}}
52 %
53 %^^A** abstract
54 % \begin{abstract}
55 % Bits provides a programmer's interface for a new idea called a
56 % \term{bit}, which is like an environment but has a title, author, and
57 % other attributes usually only associated with the \env{document}
58 % environment.
59 %
60 % This package is useful but may have problems and is unsupported.
61 % \end{abstract}
62 % \tableofcontents
63 %
64 % \part{Discussion}
65 %
66 % This documentation is spotty, but should be accurate. Please feel free to
67 % write me if you can't figure something out.
68 %
69 % \section{Basic concepts and terminology}
70 % \subsection{Users' interface}
71 %
72 % A \term{bit} is the smallest part of a document treated as an independent
73 % unit. Each \term{bit} has an explicit type called a \term{bitstyle}.
74 % (Examples: generic, story, poem, recipe, letter.) A bit's bitstyle
75 % determines the markup that is legal within the bit. (Additional declarations
76 % can be made on a per-bit basis, also; see below.) A bit's formatting is
77 % determined by both its bitstyle and the copystyle (see below) of the
78 % document. New bitstyles can be added.
79 %
80 % A \term{copystyle} is one of an explicit list of ways to present a collection
81 % of bits together in a single document. It might well be called a
82 % ``documentstyle'' and be implemented as a \LaTeX{} documentclass, but if they
83 % are kept separate, copystyles and documentclasses can coexist with each
84 % other, and this leads to a greater flexibility when dealing with existing
85 % documents. The relationship between copystyles and documentclasses is
86 % discussed further below. New copystyles can be added.
87 %
88 % \subsection{Programmers' interface}
89 %
90 % The formatting of a bit is considered to involve a fixed number of
91 % \term{tasks}. Examples of tasks performed near the beginning of formatting a
92 % bit are inserting some space after the preceding bit, and formatting the
93 % title of the current bit. Each task must be assigned a \term{procedure} that
94 % accomplishes that task. (Notice that the null procedure might be a suitable
95 % procedure for some tasks in some situations.) We call a mapping of some
96 % tasks to suitable procedures a \term{profile}. We call a profile that maps
97 % the \emph{complete} set of tasks a \term{scheme}. You need a scheme to
98 % format a bit, and the scheme to use for a given bit is determined by its
99 % bitstyle and copystyle.
100 %
101 % Now we are in a position to try to visualize the variable space established
102 % by the \term{bits} package. It's not simple, and if you think of a better
103 % way, please let me know.
104 %
105 % As just explained, to format a bit, you need a scheme, which is a series of
106 % procedures suitable for a series of certain tasks. To be concrete, let's
107 % assume there are 4 tasks. Identify each task with a general color. In our
108 % example, let's use red, blue, green, and yellow. Think of a scheme as a
109 % stack of colored blocks, each representing a procedure. The top block,
110 % corresponding to the first task, is red, the second block is blue, the third
111 % green, and the bottom block, corresponding to the final task, is yellow.
112 %
113 % Suppose I create a new scheme, the same as the original except for a slight
114 % change in the first task. This would be represented by changing the color of
115 % the red, or top, block to a different shade of red. The precise color of a
116 % block represents the specific procedure. A general color is associated with
117 % a task because it is expected that no procedure suitable for one task is
118 % going to be suitable for another task. The redness of a block represents its
119 % suitability for the the first task.
120 %
121 % (If we wanted to be exact, we would observe that some procedures, such as the
122 % null procedure, might be suitable for more than one task. OK, let such
123 % procedures be a shade of grey, with the null task, let us say, being white.
124 % Then the colored block at each task's position will have either the
125 % associated color of the task or a shade of grey.)
126 %
127 % I have drawn in your mind the picture of two stacks of 4 colored blocks,
128 % differing only in the shade of the top (red) block. Let's give them the
129 % names Jack and Jill. Let Jack and Jill represent two bitstyles. You can
130 % imagine as many bitstyles as you like---Jack, Jill, Hank, Wendy, and
131 % Beauregard; all are stacks of four colored blocks arranged next to each other
132 % in a line, a red block on top, a blue block, a green block, and a yellow
133 % block. Some of the stacks might even have identical blocks. This would mean
134 % that two bitstyles have the same scheme. You refer to bitstyles by their
135 % name, so in the future, you could change one bitstyle and make it different
136 % from the other. In fact, when you create a new bitstyle, it is initially
137 % simply a copy of an existing bitstyle. Then you can modify the new one if
138 % you want to.
139 %
140 % bitclass? bittype? bitstyle best describes a scheme. bitscheme?
141 %
142 % You've almost got the whole picture now. We need to consider copystyles.
143 % Suppose Jack, Jill, Hank, Wendy, and little Beauregard are all siblings.
144 % They have the same last name, Grimm. Grimm is the name of a copystyle.
145 % Across town, or in a parallel universe, there is another set of siblings
146 % Jack, Jill, etc.\ with a different last name, Beedle. They, too, are
147 % represented by a line of stacks of colored blocks. Line up the Beedle
148 % siblings behind the Grimm siblings, and you now have a pile of colored blocks
149 % 4 high (4 tasks), 5 wide (the 5 bitstyles Jack, Jill, etc.), and 2 deep (the
150 % 2 copystyles Grimm and Beedle).
151 %
152 % That's it. Given a bitstyle (e.g., Hank) and a copystyle (e.g., Beedle), you
153 % have a particular scheme for formatting a bit.
154 %
155 % As you may notice, there is so far no justification for the metaphor of
156 % family. Nothing I've said yet about tasks and procedures corresponds to the
157 % metaphor's suggestion that Hank Beedle is probably more similar to Wendy
158 % Beedle than he is to Hank Grimm; or that when putting together the Beedles in
159 % a family photograph, there is a certain pleasing aesthetic unity that would
160 % be lacking if any of those odd-looking Grimms were to stray into the picture.
161 % In fact, technically, each scheme can be completely different from every
162 % other scheme, Hank Beedle being as different from Wendy Beedle as he is from
163 % Hank Grimm.
164 %
165 % These metaphors are justified when you consider the way in which new
166 % copystyles and bistyles are added, and the expected purposes for bitstyles
167 % and copystyles.
168 %
169 % OR: family of Poems, family of recipes. First name is the copystyle. Then a
170 % document would consist of Hank Poem, Hank Recipe, etc. = Standard Poem,
171 % Standard Recipe; Fancy Poem, Fancy Recipe.
172 %
173 % Or, each family has one Poem, one Recipe, etc. So a document puts together
174 % members of a family, Poem, Recipe, etc.
175 %
176 % \section{Usage}
177 %
178 % Bits look like \LaTeX{} environments that take two arguments. (Surprise
179 % surprise that's exactly what they are.) Here's an example of a bit with
180 % hypothetical bitstyle ``poem'':
181 %
182 % \begin{codeexample}
183 % \begin{poem}{Butterflies}{\subtitle{An Address to My Stomach}}
184 % O jittery one, quavering tub, \\
185 % Rumble not your complaints so violently! \\
186 % Remember your jollitude just last Sunday, \\
187 % The pound of bovine ambrosia \\
188 % I filled you to the gills with \\
189 % To silence you, on this, my wedding day.
190 % \end{poem}
191 % \end{codeexample}
192 %
193 % \section{Extension and customization}
194 % \subsection{Customizing an instance of a bit}
195 %
196 % Fat little Hank Beedle might come with a note tied around his neck on a piece
197 % of yarn, with special instructions on his care and feeding from his mother.
198 % ``Peanuts will give him hives,'' it might say. And ``A quart of sour cream
199 % is always welcome.''
200 %
201 % \subsection{Adding bitstyles, copystyles, and tasks}
202 %
203 % When you add a new bitstyle $B'$, you create a new scheme for each of the
204 % existing copystyles. You name an existing bitstyle $B$ and zero or more
205 % profiles. For each existing copystyle $C$, the profiles will be composed
206 % with the \scheme{B}{C} scheme to obtain the new scheme \scheme{B'}{C}.
207 % (Notice that if any of the profiles you name are schemes, the choice of $B$
208 % is irrelevant, and that if you name no profiles, $B' = B$.)
209 %
210 % The procedure is identical when you add a new copystyle. Just swap
211 % references to copystyles and bibstyles in the last paragraph.
212 %
213 % You can add to list of tasks. When you do this, you must assign a default
214 % procedure for it (part of the \cat{Z} scheme, the universal default). All
215 % existing bitstyles and copystyles will inherit the same procedure for this
216 % task. This makes sense because they've presumably all done the task the same
217 % way before, if they've done it at all. You can promulgate changes with
218 % \cs\Promulgate etc.
219 %
220 % \section{Notes}
221 %
222 % FIX; bit type determines its markup; bitstyle is a mapping of tasks to
223 % procedures.
224 %
225 % \StopEventually{}
226 %
227 % \part{Implementation}
228 %
229 % \section{Version control}
230 %
231 % \begin{macro}{\fileinfo}
232 % \begin{macro}{\DoXUsepackagE}
233 % \begin{macro}{\HaveECitationS}
234 % \begin{macro}{\fileversion}
235 % \begin{macro}{\filedate}
236 % \begin{macro}{\docdate}
237 % \begin{macro}{\PPOptArg}
238 % These definitions must be the first ones in the file.
239 % \begin{macrocode}
240 \def\fileinfo{basic bits (Frankenstein's guts)}
241 \def\DoXPackageS {}
242 \def\fileversion{v1.2}
243 \def\filedate{2001/08/31}
244 \def\docdate{2001/08/31}
245 \edef\PPOptArg {%
246 \filedate\space \fileversion\space \fileinfo
247 }
248 % \end{macrocode}
249 % \end{macro}
250 % \end{macro}
251 % \end{macro}
252 % \end{macro}
253 % \end{macro}
254 % \end{macro}
255 % \end{macro}
256 %
257 % If we're loading this file from a \cs\ProcessDTXFile command (see the
258 % \package{compsci} package), then \cs\JusTLoaDInformatioN will be defined;
259 % othewise we assume it is not (that's why the FunkY NamE).
260 %
261 % If we're loading from \cs\ProcessDTXFile, we want to load the packages listed
262 % in \cs\DoXPackageS (needed to typeset the documentation for this file) and
263 % then bail out. Otherwise, we're using this file in a normal way as a
264 % package, so do nothing. \cs\DoXPackageS, if there are any, are declared in
265 % the \ext{dtx} file, and, if you're reading the typeset documentation of this
266 % package, would appear just above. (It's OK to call \cs\usepackage with an
267 % empty argument or \cs\relax, by the way.)
268 % \begin{macrocode}
269 \makeatletter% A special comment to help create bst files. Don't change!
270 \@ifundefined{JusTLoaDInformatioN} {%
271 }{% ELSE (we know the compsci package is already loaded, too)
272 \UndefineCS\JusTLoaDInformatioN
273 \SaveDoXVarS
274 \eExpand\csname DoXPackageS\endcsname\In {%use \csname in case it's undefined
275 \usepackage{#1}%
276 }%
277 \RestoreDoXVarS
278 \makeatother
279 \endinput
280 }% A special comment to help create bst files. Don't change!
281 % \end{macrocode}
282 %
283 % Now we check for \LaTeX2e and declare the LaTeX package.
284 % \begin{macrocode}
285 \NeedsTeXFormat{LaTeX2e}
286 \ProvidesPackage{bits}[\PPOptArg]
287 % \end{macrocode}^^A special comment to help create bst files. Don't change!
288 %
289 % ^^A NOTE: We have to compensate for the above backslashes, which are not
290 % ^^A actually in the .dtx file the author works on, by adding to the
291 % ^^A CheckSum.
292 %%
293 % \AddToCheckSum{17}^^A `dtx-update-checksum' automatically handles this.
294 % \AddToCheckSum{7}^^A The half a macrocode env. at the top is missed, however...
295 % \AddToCheckSum{10}^^A ... and so are the 5 \defs from the .dtx file
296 % ^^A that precede it.
297 % \IfCitations {%
298 % \AddToCheckSum{2}^^A When \initelyHavECitationS is defined in
299 % } ^^A the .dtx file, we need 2 more in the CheckSum.
300 %
301 %
302 % \section{Preliminaries}
303 %
304 % \subsection{Requirements}
305 %
306 % \begin{macrocode}
307 \RequirePackage{blkcntrl,letterhead,moredefs,relsize}
308 % \end{macrocode}
309 %
310 % \subsection{Option processing}
311 %
312 % \begin{macrocode}
313 \DeclareOption{poetica} {%
314 \RequirePackage{poetica}
315 \newcommand\FullTitlePoetica {%
316 \begin{Poetica}
317 \fontshape{t}\selectfont
318 \BitTitle\\%
319 \ifx\BitSubtitle\ShortEmpty \else
320 \BitSubtitle\\%
321 \fi
322 \end{Poetica}
323 }
324 \AtBeginDocument {%
325 \let\FullTitle\FullTitlePoetica
326 }
327 }
328 % \end{macrocode}
329 % FIX: hmm, I think I always want user options so that I can have two different
330 % packages require a package, and they don't have to match up on their options.
331 % What about options that can only be used in preamble, that would be the right
332 % thing for many cases I think. Aak, \cname{ends} can't be defined without
333 % special handling? Hmm, seems like it can.
334 % \begin{macrocode}
335 \DeclareBooleanUserOptions{ends}{noends}
336 \DeclareBooleanUserOptions{signed}{anonymous}
337
338 \DeclareBooleanOptions{titlepage}{notitlepage}
339
340 \ExecuteOptions{ends,notitlepage,signed}
341 \ProcessOptions
342 % \end{macrocode}
343 %
344 % \section{Making new copy and bit styles}
345 %
346 % \subsection{General stuff}
347 %
348 % \begin{macro}{\bt@a}
349 % \begin{macro}{\bt@b}
350 % \begin{macro}{\bt@c}
351 % \begin{macro}{\bt@d}
352 % \begin{macro}{\bt@e}
353 % \mbox{}
354 % \begin{macrocode}
355 \ReserveCS\bt@a
356 \ReserveCS\bt@b
357 \ReserveCS\bt@c
358 \ReserveCS\bt@d
359 \ReserveCS\bt@e
360 % \end{macrocode}
361 % \end{macro}
362 % \end{macro}
363 % \end{macro}
364 % \end{macro}
365 % \end{macro}
366 %
367 % \begin{macro}{\bt@tasks}
368 % \begin{macro}{\bt@bitstyle@list}
369 % \begin{macro}{\bt@copystyle@list}
370 % Comma-separated lists of valid bitstyles, copystyles, and tasks. We start
371 % them off non-null to bootstrap the system of adding new ones, which adds
372 % them preceded by a comma.
373 % \begin{macrocode}
374 \newcommand\bt@tasks {%
375 environment,end@bit,begin@bit,interbits,firstbit%
376 ,settitle,setfirsttitle%
377 }
378 \newcommand\bt@bitstyle@list {%
379 generic%
380 }
381 \newcommand\bt@copystyle@list {%
382 standard%
383 }
384 % \end{macrocode}
385 % \end{macro}
386 % \end{macro}
387 % \end{macro}
388 %
389 % \begin{macro}{\if@bt@trymoreschemes@}
390 % \begin{macro}{\@bt@trymoreschemes@true}
391 % \begin{macro}{\@bt@trymoreschemes@false}
392 % \begin{macro}{\bt@list@car}
393 % \begin{macro}{\bt@list@cdr}
394 % \cname{bt@list@car} and \cname{bt@list@cdr} expand to the car and cdr of a
395 % comma-separated list, respectively.
396 % \begin{macrocode}
397 \provideboolean{@bt@trymoreschemes@}
398
399 \NewName{bt@list@car}{#1,#2\@nil} {%
400 #1%
401 }
402 \NewName{bt@list@cdr}{#1,#2\@nil} {%
403 #2%
404 }
405 % \end{macrocode}
406 % \end{macro}
407 % \end{macro}
408 % \end{macro}
409 % \end{macro}
410 % \end{macro}
411 %
412 % \begin{macro}{\NewCopystyle}
413 % \begin{macro}{\NewBitstyle}
414 % \begin{macro}{\bt@assign@task}
415 % To define a new style, you specify a base style and a list of profiles.
416 % Each of these can be empty. If no base style is specified, the root style
417 % is used (i.e., standard copystyle or generic bitstyle). See discussion
418 % above.
419 % \begin{macrocode}
420 \newcommand\NewCopystyle [2][Z] {% args: [profile-list] new-copystyle
421 \addto@macro\bt@copystyle@list{,#2}%
422 \@for\bt@a:=\bt@bitstyle@list \do {%
423 \@for\bt@b:=\bt@tasks \do {%
424 \eExpand\bt@b\In {%
425 \expandafter\bt@assign@task
426 \expandafter{\bt@a}{#2}{##1}{#1}%
427 }%
428 }%
429 }%
430 }
431 \newcommand\NewBitstyle [2][Z] {% args: [scheme-list] new-bitstyle
432 \addto@macro\bt@bitstyle@list{,#2}%
433 \@for\bt@a:=\bt@copystyle@list \do {%
434 \@for\bt@b:=\bt@tasks \do {%
435 \eExpand\bt@a\In {%
436 \eExpand\bt@b\In {%
437 % \eExpandNest\bt@b\In {% FIX?
438 \bt@assign@task{#2}{##1}{####1}{#1}%
439 }%
440 }%
441 }%
442 }%
443 }
444 \newcommand\bt@assign@task [4] {% args: bitstyle copystyle
445 % task scheme-list
446 \@bt@trymoreschemes@true
447 \edef\bt@d{#4}% scheme-list that diminishes; edef not necessary
448 \@whilesw\if@bt@trymoreschemes@\fi {%
449 % \end{macrocode}
450 % There's at least one element to start; and the last scheme (\cat{Z}) is always
451 % defined.
452 % \begin{macrocode}
453 \edef\bt@c{%
454 \bt@list@car\bt@d,\@nil
455 }
456 \@ifundefined{bt@make@#3@\bt@c} {%
457 \edef\bt@d{\bt@list@cdr\bt@d,\@nil}%
458 }{% ELSE
459 \@nameuse{bt@make@#3@\bt@c}{#1}{#2}%
460 \@bt@trymoreschemes@false
461 }%
462 }%
463 }
464 % \end{macrocode}
465 % \end{macro}
466 % \end{macro}
467 % \end{macro}
468 %
469 % \begin{macro}{\PromulgateTaskAcrossCopystyles}
470 % \begin{macro}{\PromulgateTaskAcrossBitstyles}
471 % \mbox{}
472 % \begin{macrocode}
473 \newcommand\PromulgateTaskAcrossCopystyles [3] {% args: task scheme bitstyle
474 \@for\bt@a:=\bt@copystyle@list \do {%
475 \@nameuse{bt@make@#1@#2}{#3}{\bt@a}%
476 }%
477 }
478 \newcommand\PromulgateTaskAcrossBitstyles [3] {% args: task scheme copystyle
479 \@for\bt@a:=\bt@bitstyle@list \do {%
480 \@nameuse{bt@make@#1@#2}{\bt@a}{#3}%
481 }%
482 }
483 % \end{macrocode}
484 % \end{macro}
485 % \end{macro}
486 %
487 % \begin{macro}{\bt@begin@bit@common}
488 % \begin{macro}{\BitStyle}
489 % \begin{macro}{\PreBitAll}
490 % \cname{bt@begin@bit@common} should be called early in the sequence of
491 % beginning a bit.
492 % \begin{macrocode}
493 \providesavebox\sc@box@a
494 \newcommand\bt@begin@bit@common [2] {%
495 \title{#1}%
496 % \end{macrocode}
497 % We want to clear all optional attributes here, such as subtitle. FIX: should
498 % be a list of attributes and perhaps even abstract clearing functions on them, etc.
499 % \begin{macrocode}
500 \subtitle{}%
501 % \end{macrocode}
502 % Execute stuff: FIXME: nice hooks can be set here to execute things later
503 % We introduce the \par so that extra spaces in the argument are not going to
504 % mean anything. It would be complicated but possible by means perhaps of
505 % \cs\nullfont to avoid starting a paragraph here. Arg, the kernel is so
506 % opaque on how it handles ignoring spaces and what it's doing with everypar.
507 % \begin{macrocode}
508 \par #2%
509 \refstepcounter{bit}%
510 \ifnum\value{bit} = \@ne
511 \@nameuse{bt@firstbit@\CopyStyle}%
512 \else
513 \@nameuse{bt@interbits@\CopyStyle}%
514 \fi
515 }
516 \ReserveCS\BitStyle
517 \ReserveCS\PreBitAll
518 % \end{macrocode}
519 % \end{macro}
520 % \end{macro}
521 % \end{macro}
522 %
523 % \subsection{Schemes}
524 %
525 % \subsubsection{The \cat{Z} scheme}
526 %
527 % \begin{macro}{\FullTitle}
528 % The \cat{Z} scheme is always the last resort deafult, and it corresponds to
529 % the standard copystyle and the generic bitstyle.
530 %
531 % FIXME: whenever we have a dummy we have to use DefName or else we error
532 % FIXME: Aak, when Promulgating we need defnames for everyting!
533 % \begin{macrocode}
534 \newcommand\bt@make@environment@Z [2] {% args: bitstyle dummy
535 \DefName{end#1}{}{}%
536 \DefName{#1}{##1##2} {%
537 \DefName{end#1}{} {%
538 \@nameuse{bt@end@bit@#1@\CopyStyle}{##1}%
539 }%
540 \@nameuse{bt@begin@bit@#1@\CopyStyle}{##1}{##2}%
541 }%
542 }
543 \newcommand\bt@make@interbits@Z [2] {% args: dummy copystyle
544 \DefName{bt@interbits@#2}{} {%
545 \relax
546 \par\pagebreak[2]\bigskip\bigskip
547 \@nameuse{bt@settitle@\BitStyle @#2}%
548 }%
549 }
550 \newcommand\bt@make@firstbit@Z [2] {% args: dummy copystyle
551 \DefName{bt@firstbit@#2}{} {%
552 \relax
553 \par\pagebreak[2]%
554 \thispagestyle{empty}%
555 \@nameuse{bt@setfirsttitle@\BitStyle @#2}%
556 }%
557 }
558 \newcommand\bt@make@begin@bit@Z [2] {% args: bitstyle copystyle
559 \DefName{PreBit#1}{}{}%
560 \DefName{bt@begin@bit@#1@#2}{##1##2} {%
561 \def\BitStyle{#1}%
562 \bt@begin@bit@common{##1}{##2}%
563 \PreBitAll
564 \@nameuse{PreBit#1}%
565 }%
566 }
567 \newcommand\bt@make@end@bit@Z [2] {% args: bitstyle copystyle
568 \DefName{bt@end@bit@#1@#2}{##1} {%
569 \TheEnd
570 }%
571 }
572 \newcommand\bt@make@settitle@Z [2] {% args: bitstyle copystyle
573 \DefName{bt@settitle@#1@#2}{} {%
574 \relax
575 \begin{center}\FullTitle\end{center}
576 }%
577 }
578 \newcommand\bt@make@setfirsttitle@Z [2] {% args: bitstyle copystyle
579 \DefName{bt@setfirsttitle@#1@#2}{} {%
580 \relax
581 \begin{center}\FullTitle\end{center}
582 \DTypeout{FIXME setfirsttitle in Z scheme}%
583 }%
584 }
585 % \end{macrocode}
586 % When there is no subtitle, it sometimes seems better for the title to be set
587 % one size larger than the copy; but when you have a subtitle, you need the
588 % title two sizes larger so that the subtitle can be an intermediate size.
589 % With CM fonts, because their boldface is extended, a bold subtitle at the
590 % same size as the copy looks good, and larger is too larger. So this is a
591 % tricky issue. A basic kludge that would work for me, given the font families
592 % I have an use, would be to check for CM fonts here, or on the other hand
593 % specifically for an extended boldface, or for Dante/Bulmer, or set a flag in
594 % my dante.sty or bulmer.sty.
595 % \begin{macrocode}
596 \newcommand\FullTitle {%
597 \relsize{2}\bfseries
598 % \relsize{1}\bfseries
599 \BitTitle\\%
600 \ifx\BitSubtitle\ShortEmpty
601 \else
602 \csname sbseries\endcsname % this way it's harmless if undefined
603 \relsize{-1}\BitSubtitle\\%
604 \fi
605 }
606 % \end{macrocode}
607 % \end{macro}
608 %
609 % \subsubsection{The \cat{P} scheme}
610 %
611 % \begin{macro}{\bt@make@setfirsttitle@P}
612 % \begin{macro}{\bt@make@settitle@P}
613 % \begin{macro}{\bt@make@end@bit@P}
614 % \begin{macro}{\bt@make@begin@bit@P}
615 % The \cat{P} scheme was created for the poem bitstyle.
616 % \begin{macrocode}
617 \newcommand\bt@make@begin@bit@P [2] {% args: bitstyle copystyle
618 \DefName{bt@begin@bit@#1@#2}{##1##2} {%
619 \def\BitStyle{#1}%
620 \bt@begin@bit@common{##1}{##2}%
621 \PreBitAll
622 \verse % FIX: why does the PreBitAll hook come before \verse and the
623 % BitHook come after? Why doesn't the PreBitAll come in
624 % @common@ -- well, so that a bit can put stuff before the hooks.
625 \@nameuse{PreBit#1}%
626 }%
627 }
628 \newcommand\bt@make@end@bit@P [2] {% args: bitstyle copystyle
629 \DefName{bt@end@bit@#1@#2}{##1} {%
630 \relax
631 \endverse
632 \TheEnd
633 }%
634 }
635 \newcommand\bt@make@settitle@P [2] {% args: bitstyle copystyle
636 \DefName{bt@settitle@#1@#2}{} {%
637 \relax
638 \begin{verse}\FullTitle\end{verse}
639 }%
640 }
641 \newcommand\bt@make@setfirsttitle@P [2] {% args: bitstyle copystyle
642 \DefName{bt@setfirsttitle@#1@#2}{} {%
643 \relax
644 \begin{verse}\FullTitle\end{verse}
645 \DTypeout{this is setfirsttitle in P scheme}%
646 }%
647 }
648 % \end{macrocode}
649 % \end{macro}
650 % \end{macro}
651 % \end{macro}
652 % \end{macro}
653 %
654 % \subsubsection{The \cat{R} scheme}
655 % For the prose bitstyle.
656 % \begin{macrocode}
657 \newcommand\bt@make@settitle@R [2] {%
658 \DefName{bt@settitle@#1@#2}{} {%
659 \relax
660 \ifx\BitTitle\ShortEmpty\else
661 \noindent
662 \begingroup
663 \relsize{1}%
664 \bfseries
665 \BitTitle
666 \endgroup
667 \par\smallskip
668 \fi
669 }%
670 }
671 % \end{macrocode}
672 %
673 % \subsubsection{The \cat{T} scheme} FIX: for what?
674 %
675 % \section{The standard copystyle and generic bitstyle}
676 %
677 % \begin{macrocode}
678 \@for\bt@e:=\bt@tasks \do {%
679 \PromulgateTaskAcrossBitstyles{\bt@e}{Z}{standard}
680 }
681 % \end{macrocode}
682 %
683 % \section{Bit Styles}
684 %
685 % \subsection{Story}
686 % This is the same as generic.
687 % \begin{macrocode}
688 \NewBitstyle{generic}
689 \NewBitstyle{story}
690 % \end{macrocode}
691 %
692 % \subsection{Poem}
693 %
694 % \begin{macrocode}
695 \NewBitstyle{poem}
696 \PromulgateTaskAcrossCopystyles{begin@bit}{P}{poem}
697 \PromulgateTaskAcrossCopystyles{end@bit}{P}{poem}
698 \PromulgateTaskAcrossCopystyles{settitle}{P}{poem}
699 \PromulgateTaskAcrossCopystyles{setfirsttitle}{P}{poem}
700 % \end{macrocode}
701 %
702 % \subsection{Prose}
703 %
704 % \begin{macrocode}
705 \NewBitstyle{prose}
706 \PromulgateTaskAcrossCopystyles{settitle}{R}{prose}
707 % \end{macrocode}
708 %
709 % \section{Copy Styles}
710 %
711 % \begin{macrocode}
712 \NewCopystyle{titlepage}
713
714 \newcommand\bt@make@setfirsttitle@T [2] {% args: bitstyle copystyle
715 \DefName{bt@setfirsttitle@#1@#2}{} {%
716 \thispagestyle{empty}%
717 \vspace*{\fill}%
718 \begin{center}
719 {\relsize{5}\BitTitle \\}%
720 \ifx\BitSubtitle\ShortEmpty\else
721 {\relsize{3}\BitSubtitle \\}%
722 \fi
723 \end{center}
724 \vfill
725 % \CoverNotes
726 % \vfill
727 \par
728 \begingroup
729 \sffamily
730 \hfill
731 \begin{tabular}{r@{\hspace{\@ne em}}r}
732 Copy of:&\todayabbrev \\%
733 Version of:&\Lastchange \\%
734 Date:&\Date \\%
735 \end{tabular}
736 \par\bigskip\bigskip
737 \begin{raggedleft}
738 \def\and{\\}%
739 \larger\scshape\Author
740 % \end{macrocode}
741 % A final |\par| is needed to close the paragraph in raggedleft mode.
742 % \begin{macrocode}
743 \par
744 \end{raggedleft}
745 \endgroup
746 \newpage
747 \setcounter{page}{\@ne}%
748 }%
749 }
750 \PromulgateTaskAcrossBitstyles{setfirsttitle}{T}{titlepage}
751 % \end{macrocode}
752 %
753 % \section{Bit counters and interbit skips}
754 %
755 % \begin{macro}{\c@bit}
756 % \begin{macro}{\c@bitbit}
757 % \begin{macro}{\c@bitbitbit}
758 % \mbox{}
759 % \begin{macrocode}
760 \providecounter{bit}
761 \providecounter{bitbit}[bit]
762 \providecounter{bitbitbit}[bitbit]
763 % \end{macrocode}
764 % \end{macro}
765 % \end{macro}
766 % \end{macro}
767 %
768 % \begin{macro}{\bt@bitskip}
769 % \begin{macro}{\InterBitBreak}
770 % \begin{macro}{\InterBitBitBreak}
771 % \begin{macro}{\InterBitBitBitBreak}
772 % \cs\medbreak is penalty -100; \cs\smallbreak is 50. FIXME: what's going on
773 % here?
774 % \begin{macrocode}
775 \newcommand\bt@bitskip[1] {%
776 \par
777 \ifdim \lastskip < \bigskipamount
778 \removelastskip
779 \penalty -500%
780 #1%
781 \fi
782 }
783 \newcommand\InterBitBreak {%
784 \bt@bitskip
785 \bigskip
786 }
787 \newcommand\InterBitBitBreak {%
788 \bt@bitskip
789 \medskip
790 }
791 \newcommand\InterBitBitBitBreak {%
792 \bt@bitskip
793 \smallskip
794 }
795 % \end{macrocode}
796 % \end{macro}
797 % \end{macro}
798 % \end{macro}
799 % \end{macro}
800 %
801 % \begin{macro}{\bitbit}
802 % \begin{macro}{\bitbitbit}
803 % \begin{macro}{\bt@bitbit}
804 % \begin{macro}{\bt@bitbitbit}
805 % FIXME: These should be made attributes of the Generic Bit Style.
806 % \begin{macrocode}
807 \newcommand\bitbit {%
808 \@ifstar {%
809 \bt@bitbit{}%
810 }{% ELSE
811 \refstepcounter{bitbit}%
812 \bt@bitbit{\thebitbit\ }%
813 }%
814 }
815 \newcommand{\bt@bitbit} [2] {%
816 \ifnum\value{bitbit}=\@ne \else
817 \InterBitBitBreak
818 \fi
819 \noindent #1{\relsize{-1}\bfseries #2}%
820 \par\nobreak
821 \smallskip
822 }
823 \newcommand\bitbitbit {%
824 \@ifstar {%
825 \bt@bitbitbit{}%
826 }{% ELSE
827 \refstepcounter{bitbitbit}%
828 \bt@bitbitbit{\thebitbitbit\ }%
829 }%
830 }
831 \newcommand\bt@bitbitbit [2] {%
832 \ifnum\value{bitbitbit}=\@ne \else
833 \InterBitBitBitBreak
834 \fi
835 \noindent #1{\relsize{-1}\bfseries #2}%
836 \par\nobreak
837 \smallskip
838 }
839 % \end{macrocode}
840 % \end{macro}
841 % \end{macro}
842 % \end{macro}
843 % \end{macro}
844 %
845 % \section{Userinfos}
846 %
847 % \begin{macro}{\Author}
848 % \begin{macro}{\author}
849 % \begin{macro}{\Lastchange}
850 % \begin{macro}{\lastchange}
851 % \begin{macro}{\Date}
852 % \begin{macro}{\date}
853 % \begin{macro}{\title}
854 % \begin{macro}{\BitTitle}
855 % \begin{macro}{\BitSubtitle}
856 % \begin{macro}{\Subtitle}
857 % \begin{macro}{\subtitle}
858 % When we redefine \cs\author, \cs\date, and \cs\title, we add a new action to
859 % the original meaning. This means that standard commands like \cs\maketitle
860 % will still perform as expected, if someone prefers to use that instead of the
861 % \Frankenstein commands.
862 % \begin{macrocode}
863 \SaveCS\date
864
865 \newcommand*\Date {%
866 \todayabbrev
867 }
868 \defcommand\date [1] {%
869 \MDSaveddate{#1}%
870 \def\Date{#1}%
871 }
872 \SaveCS\title
873 \ReserveCS\BitTitle
874
875 \defcommand\title [1] {%
876 \MDSavedtitle{#1}%
877 \def\BitTitle{#1}%
878 }
879 % \end{macrocode}
880 % Why did I originally want \cs\Subtitle to be a user command instead of \cs\subtitle?
881 % \begin{macrocode}
882 \NewUserInfo*[\subtitle]\BitSubtitle
883 %\NewUserInfo*[\Subtitle]\BitSubtitle
884 %\newlet\subtitle\Subtitle
885 \NewUserInfo*\Lastchange
886 \lastchange{\todayabbrev}
887 % \end{macrocode}
888 % \end{macro}
889 % \end{macro}
890 % \end{macro}
891 % \end{macro}
892 % \end{macro}
893 % \end{macro}
894 % \end{macro}
895 % \end{macro}
896 % \end{macro}
897 % \end{macro}
898 % \end{macro}
899 %
900 % \begin{macro}{\Copystyle}
901 % \begin{macro}{\copystyle}
902 % \mbox{}
903 % \begin{macrocode}
904 \NewUserInfo*\CopyStyle
905 \copystyle{standard}
906 % \end{macrocode}
907 % \end{macro}
908 % \end{macro}
909 %
910 % \section{Dates}
911 %
912 % \begin{macro}{\today}
913 % \begin{macro}{\todayabbrev}
914 % \mbox{}
915 % \begin{macrocode}
916 \def\today {%
917 \number\day\space\ifcase\month\or
918 January\or February\or
919 March\or April\or May\or June\or July\or August\or September\or
920 October\or November\or December\fi\space\number\year
921 }
922 \newcommand\todayabbrev {%
923 \number\day\space\ifcase\month\or
924 Jan\or Feb\or
925 Mar\or Apr\or May\or Jun\or Jul\or Aug\or Sep\or
926 Oct\or Nov\or Dec\fi\space\number\year
927 }
928 % \end{macrocode}
929 % \end{macro}
930 % \end{macro}
931 %
932 % \begin{macro}{\copywrite}
933 % This adds a copyright message to the beginning of \cs\Notes. Its single
934 % argument should be a year.
935 % \begin{macrocode}
936 \newcommand\copywrite [1] {%
937 \edef\Notes {%
938 \copyright#1 All rights reserved. \Notes
939 }%
940 }
941 % \end{macrocode}
942 % \end{macro}
943 %
944 % \section{Ends}
945 %
946 % \begin{macro}{\EndSign}
947 % It's very hard to attach this thing without allowing a page break before it. FIX.
948 % \begin{macrocode}
949 \newcommand\EndSign {%
950 \par\nobreak
951 \vspace{2\bigskipamount}% multiplication turns glue into dimen.
952 \hfill
953 % \end{macrocode}
954 % We do this so that |\Author| can have |\\|s in it.
955 % \begin{macrocode}
956 \begingroup
957 \scshape
958 \let\and\@tabularcr
959 \begin{tabular}{c}
960 \Author \\%
961 \relsize{-1}\itshape\Date
962 \end{tabular}%
963 \endgroup
964 }
965 % \end{macrocode}
966 % \end{macro}
967 %
968 % \begin{macro}{\theend}
969 % User command which (almost) always makes an \cs\EndSign:
970 % \begin{macrocode}
971 \newcommand\theend {%
972 \if@signed@
973 \EndSign
974 \fi
975 }
976 % \end{macrocode}
977 % \end{macro}
978 %
979 % \begin{macro}{\TheEnd}
980 % The end of a bit calls \cs\TheEnd. The default definition is either
981 % nothing or \cs\EndSign, depending on some condition.
982 % \begin{macrocode}
983 \newcommand\TheEnd {%
984 \def\sc@t@c {%
985 prizes%
986 }%
987 \let\sc@t@a\EndSign
988 \ifx\CopyStyle\sc@t@c
989 \InitCS*\sc@t@a
990 \else
991 \if@signed@
992 \if@ends@
993 % FIX: when you get the footer going...
994 % \ifnum\value{page} < 2%
995 % \InitCS*\sc@t@a
996 % \fi
997 \else
998 \InitCS*\sc@t@a
999 \fi
1000 \else
1001 \InitCS*\sc@t@a
1002 \fi
1003 \fi
1004 \sc@t@a
1005 }
1006 % \end{macrocode}
1007 % \end{macro}
1008 %
1009 % \section{Version control}
1010 %
1011 % We use macros instead of boxes, because at this point some of the macros in
1012 % the boxes may change their meaning.
1013 %
1014 % Algorithm: We will maintain two \cs\hbox es |to \textwidth| each time
1015 % \cs\MakeCover is called. Set the footboxes to |\v@idbox| here. Whenever
1016 % |\MakeCover| is called, it should stack another |\vbox| with the right
1017 % information in it into both boxes. The information is expanded, and thus the
1018 % macro contents can change between calls to |\MakeCover|, but the box being
1019 % built inserts two different |\vboxes| with their value at the moment.
1020 %
1021 % \begin{macro}{\bt@vcbox}
1022 % \begin{macro}{\VersionControlString}
1023 % \begin{macro}{\VersionControlAuthorString}
1024 % \mbox{}
1025 % \begin{macrocode}
1026 \newcommand\BTVersionWord {Version}
1027 \newcommand\BTCopyWord {Copy}
1028 \newcommand\bt@vcbox {%
1029 \footnotesize
1030 \ifx\Lastchange\ShortEmpty\else
1031 {\bfseries \BTVersionWord:} {\slshape \Lastchange}%
1032 \fi
1033 \hspace{\@ne em}%
1034 {\bfseries \BTCopyWord:} {\slshape \todayabbrev}%
1035 }
1036 \newcommand\VersionControlString {%
1037 \hfill \bt@vcbox \hfill
1038 }
1039 % \end{macrocode}
1040 % I should assign some names to the various meanings of and, like protect.
1041 % \begin{macrocode}
1042 \newcommand\VersionControlAuthorString {%
1043 \bt@vcbox \hfill {\scshape\def\and{\unskip, \ignorespaces}\Author}%
1044 }
1045 % \end{macrocode}
1046 % \end{macro}
1047 % \end{macro}
1048 % \end{macro}
1049 %
1050 % \begin{macro}{\whitespace}
1051 % \mbox{}
1052 % \begin{macrocode}
1053 \requirecommand\whitespace {%
1054 \bigbreak
1055 }
1056 % \end{macrocode}
1057 % \end{macro}
1058 %
1059 % \part{Configuration}
1060 %
1061 % We leave the rest to a configuration file.
1062 % \begin{macrocode}
1063 \InputIfFileExists{bits.cfg}{}{}
1064 % \end{macrocode}
1065 %
1066 % The contents of the distributed configuration file are below.
1067 %
1068 % \InputIfFileExists{bits.cfg}{}{}
1069 %
1070 % \Finale