1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
|
\input blue.tex \loadindexmacros \loadsmileys \report
\hfuzz=25pt\vbadness=1000
\bluechapter Text
\beginsummary
An introduction to the markup of text has been given.
BLUe's format structure of text is nested to three levels,
each preceded by a title.
The building block is a paragraph.
The markup for \TeX's standard paragraph shape,
the markup for the headings and
the markup for some special text elements have been given.
Examples of the latter are:
items,
quotations,
display text,
centering,
text to be set apart preceded and followed by lines,
PASCAL programs,
verbatims,
exercises and answers, and
footnotes.
\endsummary
\bluehead Introduction
Let us assume that we have ordinary text, to be typeset by computer.
What to do? Let us begin by the beginning and write it down.
\begincenterverbatim
An unexpected party
In a hole in the ground there lived a hobbit.
Not a nasty, dirty, wet hole filled with the ends
of worms and an oozy smell, nor yet a dry, bare
sandy hole with nothing in it to sit down on or
to eat:
it was a hobbit-hole and that means comfort.
It had a perfectly round door like a porthole,
painted green,...
!endcenterverbatim
We must instruct the computer\Dash that is, supply markup\Dash
to make something nice out of it. How?
As far as I understand it, ^{Knuth's\ markup} comes down to
just preceding the title by \cs{beginchapter}?!?
That is all. He makes use of the already available
visual markup of blank lines. These blank lines
separate document parts, be it a title from the text
or paragraphs from each other.
Is that all? Essentially, yes. But\Dash there is always a but\Dash
the role which \cs{beginchapter} has to play is not simple.
Happily, that is not our concern. That is the job of
the book designer in cooperation with the programmer.
I take for granted the niceties of \TeX's text processing\Dash
and which a regular user tends to forget\Dash
such as automatic handling of ligatures,
justification and hyphenation over paragraphs, and
ignoring of superfluous blanks (spaces and lines) in text.
All this is not necessarily restricted to English.
However, to quote {\TB} `and when you are using plain {\TeX} format,
you need to know that the ten characters
\begincenterverbatim
\ { } $ & # ^ _ % ~
!endcenterverbatim
cannot be used in the ordinary way when you are typing; each of them
will cause {\TeX} to do something special, \dots'
After this oversimplification let us go back to BLUe scripts,
full of the right spirit.
\bluehead BLUe script
BLUe's format allows text in print to be nested up to {\oldstyle3} levels deep.
The layout of the titles and the shapes of the paragraphs
contribute much to the look-and-feel.
The nesting is reflected in the markup tags
\cs{head}, \cs{subhead} and \cs{subsubhead}.
Also \cs{title} and \cs{subtitle} are there.
The tag \cs{author} has been filled-in by default,
meaning that you don't have to pay attention to it.
It's {\em your\/} format.
You are Ben Lee User.
\bluehead Headings
As a tribute to ^{manmac}, BLUe's format provides the following
outer level markup tags as an extra user-interface
on top of the rigorous two-part macros.
\begincenterverbatim
\blue(sub)title <(sub)titletext>
\bluekeywords <listofkeywords>
\blue(sub(sub))head <(sub(sub))sectionheadtext>
\blueexample <exampleheadtext>
!endcenterverbatim
A handful, but\Dash there is always a but\Dash the ^{processing on the fly}
has been lost.
Note that all have a blank line\Dash implicit markup\Dash or
\cs{par} as end separator. Reread page {\oldstyle202} of \TB, please.
I used them in this script, because they counter the ^{curly braces mania},
or to put it in Knuth's words
\displaycenterline{`\dots you needn't always enclose arguments in braces.'}
^^{heading,\ markup}
The regular markup for headings reads as follows.\ftn{Of course the long forms
|\begin<tag>| and |\end<tag>| can be used too.}
\displaycenterline{|\head{<headtext>}|}
Similar for \cs{subhead} and \cs{subsubhead}.
No terminating periods are automatically typeset.
\bluesubhead Parameterization
The text of a heading is preceded by \cs{prehead} and followed by \cs{posthead}.
Again, similarly for \cs{subhead} and \cs{subsubhead}.
By default the placement within context\Dash that is,
the tokens contained in |\pre<tag>| and |\post<tag>|\Dash
is determined by the following, apart from (stretchable) glue.\ftn{See for
those \TB{}{\oldstyle355}, especially \cs{beginsection}. `The macro first emits glue
and penalties designed to start a new page if the present page is nearly
full, \dots' This mechanism has been borrowed for the various
|\pre(sub(sub))head|-s.}
The latter fills up the page by a page break
to prevent an underfull \cs{vbox} message.
{\let\css\cs
\def\rowstblst{{\css{head}}{\css{sh}}{\css{ssh}}}
\def\data{\css{bigskip} \cs\css{nobreak}\css{medskip}\css{noindent}\rs
\css{medbreak}\css{noindent}\css{shindent} \cs\css{quad}\rs
\css{smallbreak}\css{noindent}\css{sshindent}\cs\css{quad}\rs}
\def\rowstbsep{\quad}
\def\tag{${<}tag{>}$}
\def\first{\css{}\tag}
\def\header{\css{}pre\tag\cs \css{}post\tag}
\def\footer{{\small*sh stands for subhead, ssh for subsubhead}}
\def\headersep{\kern.5ex\hrule\kern.75ex}
$$\fll\btable\data$$}
With defaults \cs{subheadindent}{\oldstyle0}pt and
\cs{subsubheadindent}\cs{generalindent}.
I used to mark up headings by the short form, i.e.,
by |\head{...}| instead of ^|\beginhead| \dots \cs{endhead}.
From now on\Dash back to the roots\Dash I will use manmac's minimal forms.
In headings I don't need much processing on the fly.
Automatic numbering is provided in the \cs{report} format.
The idea is to use |\<tag>numbering| token variables.
The above is only part of the story, just the top of the iceberg
In a document we also like to reuse the head titles for table of contents,
the index, and undoubtedly we need the head numbers sooner or later,
whether they are hidden or not.
So on the one hand we like to process a title on the fly, and
on the other hand we like to store head information, as general as possible,
for reuse.
In the \cs{report} format I had to face the music and deal with those issues.
Happily, the {\bluetex} kernel could do without it.
^^{heading,\ automatic numbering}
\bluehead Paragraphs
\TeX's building block is the ^{paragraph}.
This unit is split up into lines to be mapped on pages.
The markup for a paragraph is minimal, i.e.,
it is generally implicit and near to natural.
An occasional user is hardly aware of the markup.
In most cases
\begincenterblock
a paragraph starts by the first letter, and
ends by a blank line.
\endcenterblock
The blank line is substituted by \cs{par} automatically.
Explicit markup for a paragraph reads
\begincenterverbatim
\indent %starts a paragraph, an empty box (size \parindent) is inserted
%or \noindent, which just starts a paragraph
<paragraph>
\par %ends the paragraph, and resets defaults of par shape pars
%\hangindent and \hangafter
!endcenterverbatim
On encountering a vertical command in a paragraph,
like \cs{smallskip} and its ilks,
\TeX{} automatically inserts \cs{par}, and because of this
the paragraph is ended.
Each script, and this one is no exception, contains a lot of
ordinary paragraphs.\ftn{For an extensive treatment of paragraphs see
{\TB} chapter~{\oldstyle14}.}
\bluesubhead Parameterization
The parameters which govern the standard paragraph shape are given in the
following model.\ftn{Courtesy David Salomon. (A white lie, any
migrated vertical material has been omitted.)}
\def\Xfil{\xleaders\hbox{X}\hfil}
\beginquote\advance\leftskip.25\hsize
\advance\rightskip.25\hsize\small\noindent
\hfil\cs{parskip}\\\null
\hfil\cs{(base)lineskip}\\\null
\cs{parindent}\Xfil\break\null
\hfil\cs{clubpenalty}\\\null
\hfil\cs{(base)lineskip}\\\null
\Xfil\break\null
\hfil\cs{interlinepenalty}\\\null
\hfil\cs{(base)lineskip}\\\null
\hfil$\vdots$\\\null
\Xfil\break\null
\hfil\cs{widowpenalty}\\\null
\hfil\cs{(base)lineskip}\\\null
\Xfil\cs{parfillskip}\break\null
$\longleftarrow$\hfill\cs{hsize}\hfill$\longrightarrow$
\endquote
The left margin is \cs{hoffset} from the left.
The distance from the left side of the paragraph
to the left margin is the glue \cs{leftskip}.
At the right side the glue has the name \cs{rightskip}.
Between words the glue is \cs{spaceskip} and between
sentences \cs{xspaceskip}.
The contents of the token variable \cs{everypar} is inserted before
the paragraph text.
\exercise How can the parameters be set such that the last line
of a paragraph is centered\ftn{Courtesy Anne Br\"uggeman-Klein.}?
\answer \cs{leftskip}0pt plus1fil,
\cs{rightskip}0pt plus$-1$fil,
and \cs{parfillskip}0pt plus2fil.
End the paragraph with |\hskip0pt plus1fil|.
\exercise One of the problems induced by paragraphs as building blocks is that
it is not easy to provide for line numbering.
How can we achieve this\ftn{Courtesy Jan Kybic.}?
\answer Jan Kybic reported about the several ways he received as answers
to this problem on comp.text.tex.
Below is the solution due to Petr Olsak. Beware it is limited.
The general idea in the solutions collected by Kybic
is to take apart the lines set in a vbox either
starting at the end via \cs{lastbox} or starting at the begin
via \cs{vsplit}, collect these
lines extended by their line numbers, and reinsert these later.
\beginverbatim
%Due to Petr Olsak
%Disclaimer: Macros for plain prose line
%numbering only for ordinary paragraphs
%without display mathematics or other
%specialities.
%(Note added: no \footnote, \centerline.)
\newcount\linenum
\newcount\worknum
\newbox\allparagraph
\def\beginnum{\begingroup\linenum0
\def\par{\ifhmode\completepar\fi}%
\setbox\allparagraph\vbox\bgroup}
%
\def\endnum{\par\egroup\endgroup}
%
\def\completepar{\endgraf \global
\advance\linenum\prevgraf
\worknum\linenum \setbox0\null
\loop\unskip\unpenalty
\setbox2\lastbox
\ifhbox2 \global\setbox0\hbox
{\llap{$\scriptstyle\the\worknum.$
}\box2\penalty0\unhbox0}%
\advance\worknum-1
\repeat\egroup\noindent
\unhbox0\unpenalty\endgraf
\setbox\allparagraph\vbox\bgroup}
!endverbatim
The numbering of verbatim lines has been treated separately.
Another variant is mentioned by Salomon to number the lines on
{\it each page}.
This is handy for proofers to indicate more precisely the commented parts.
See his OTR articles as published in \TUB
\Dash or his courseware `Insights \& Hindsights'
MAPS Special {\oldstyle1992}\Dash
for the modified OTR.
Knuth in \tubissue8(2) {\oldstyle1987}\Dash about letting text
flow around figures\Dash provided the basics for
Hoenig's approach \tubissue{15}(3) {\oldstyle1994}, to let the OTR
create one-line pages\Dash i.e., one can lay hands on each line\Dash
and introduce a `mock'-\cs{everyline}. Promising.
\bluesubhead Why a paragraph as unit for line breaking?
Knuth did choose a paragraph as next larger unit than a line for line
breaking, i.e., for mapping the horizontal list onto lines.
This gives better results than using roughly a line.
\exercise What happens to accented words?
\answer They hyphenate, but only the part of the word up to the accent control
sequence is subject to hyphenation as such.
However, we can do much better and
use \cs{allowhyphens}\Dash from Appendix~D
{\sl Hanging punctuation}\Dash to be inserted after the place
where the hyphenation stopped. The conclusion is that \TeX{}
can hyphenate properly accented words.
For example the Dutch word
`|onge\"emancipeerde|' can better be input as `|onge\ee{}mancipeerde|'
with\ftn{Courtesy Bernd Raichle and Bas Romeny,
and a wink to dutch.sty.}
\beginverbatim
\def\ee{\nobreak\discretionary{e-}{e}{\"e}\allowhyphens}
\newskip\zzz\def\allowhyphens{\nobreak\hskip\zzz}
\hyphenation{man-ci-peer-de}
!endverbatim
Note that because of the Dutch rules with respect to a dieresis
use has to be made of \cs{discretionary} as well.
The explanation is that the search for hyphenation patterns is stopped
when an explicit kern, induced by the accent, is encountered.
To let \TeX{} resume hyphenation of the remainder
the zero glue \cs{hskip} is inserted. A line break is inhibited
by \cs{nobreak}. The first \cs{nobreak} is needed to isolate the effect
of the \cs{discretionary}. Normally when a discretionary is encountered
\TeX{} stops hyphenating the complete word.
\exercise What is wrong with |pretext\par\llap`Quotation'|?
\answer \cs{llap} does not start the horizontal mode. Insert \cs{leavevmode}
after \cs{par}.
\exercise What is the unexpected result of |\par{\bf New paragraph} blah blah|
with |\everypar{\hang}| active\ftn{Courtesy Alan Reese}?
And why?\ftn{Courtesy Jeremy Henty.}
Note that \cs{bf} is only there to make the pitfall look
realistic.
\answer Without braces the text comes out as a block. With the braces at the
beginning there is no effect of the automatically inserted \cs{hang}.
The explanantion reads as follows.
When processing ordinary text, \TeX{} does not enter horizontal mode
until it encounters a letter. In the troublesome paragraph the first
letter is inside a group. When the group ends all local assignments
are undone, and the effect of the \cs{hang} instruction\Dash
the contents of \cs{everypar} is inserted within the group\Dash
is forgotten.
A solution is to precede the group by \cs{leavevmode},
because the \cs{everypar} will be executed before the group then.
\exercise How can we allow for hyphenation in teletype font?
\answer This is handy when we set control sequences in \cs{tt}
in two-column. Provide
\beginverbatim
\hyphenchar\tentt=`-
!endverbatim
\exercise And what about page breaks?
\answer The fact is that Knuth did not implement a spread or a chapter
as next larger unit than a little more than `a page' for page breaking,
i.e., for mapping the main vertical list onto pages.
Perhaps this was dictated by the status of the hardware technology
when \TeX{} was designed.
\noindent The ^{hyphenation} process can be customized by
\beginverbatim
\lefthyphenmin=<number> \righthyphenmin=<number>
!endverbatim
which are {\oldstyle2} and {\oldstyle3} by default,
and via exceptions as argument to
\cs{hyphenation}. For \TB{} Knuth used as exceptions
\beginverbatim
\hyphenation{man-u-script man-u-scripts ap-pen-dix}
!endverbatim
Hyphenation assignments are global and cumulative.
For more details start with Appendix~H of \TB.
\bluesubhead Special paragraphs
\TeX{} provides \cs{parshape}, \cs{hangindent} and \cs{hangafter}
for special paragraph shapes. A captivating example is provided
in \TB{} {\oldstyle101}.
\blueexample Miniature
History has it to start the first paragraph of a chapter
with a `Miniature.' ^^{miniature}
Knuth in his `Preface' showed how to mark up such kinds of paragraphs.
This is an illustration of the use
of \cs{hangindent}\ftn{\cs{hang} assigns the value
of \cs{parindent} to \cs{hangindent}.}
and \cs{hangafter}, as well as of the use of
\cs{smash} outside math mode.
There is no need for a special `^{dropped capital}' macro, because it is
really simple.
\cs{cglpic} is the minitiature used from the picture database pic.dat.
For an nice application\ftn{Courtesy Huub Mulders.} see the miniature in the
NTG information, on the inside of the back cover.\ftn{Knuth in \tubissue8(2),
{\oldstyle1987}, touched upon the general problem how to
let text {\it flow around\/} figures.
Hoenig \tubissue{15}(3), {\oldstyle1994}, provided user-friendly macros.}
\begindemo
\pictures{\gpic}%load gpic
\parindent=24pt
\noindent\hang\hangafter-2
\smash{\lower13pt\hbox to0pt{%
\hskip-\hangindent\gpic
\hfil}}{\smc entle Reader}:
This is a handbook about \TeX,
a new typesetting system
intended for the creation of
beautiful books\Dash and
especially for books that
containa lot of mathematics.
!yields
\pictures{\gpic}
\parindent=24pt
\noindent\hangindent\parindent
\hangafter-2
\smash{\lower13pt\hbox to0pt{\hskip
-\hangindent\gpic\hfil}}{\smc entle Reader}:
This is a handbook about \TeX,
a new typesetting
system intended for the creation of beautiful
books\Dash and especially for books that contain
a lot of mathematics.
\par\noindent
\enddemo
Remark. Realize that the reference point for the \cs{smash}
is where the {\smc e} starts, and that the first ({\oldstyle2}) lines are
indented.
Within the \cs{smash} you can move around as you wish, leaving the
reference point and the other things outside invariant.
Note the use of \cs{smc} to smooth the transition from the miniature to the
rest of the text.
\exercise Compare the above simplified version of Knuth's opening
sentence with the real one in \TB{} script.
\exercise At the end of each paragraph \TeX{} resets the paragraph shape
parameters. How can we retain these values\ftn{Courtesy
Marek Ry\'cko and Bogus{\l}aw Jackowski.}?
\answer Use |{\par}| instead of \cs{par}. See
their article `From \cs{indent} to \cs{par},'
MAPS{\oldstyle94}.{\oldstyle2}, among other things.
The point is they are changed, but\Dash
there is always a but\Dash on encountering
a \cs{par} the paragraph shape parameters are reset {\sl locally},
within the group so to say.
After the group closing, the right curly brace,
the old values pop up again, which yields the effect.
Note. This method was first elucidated by the author of \TeX{}
and communicated in a private letter to Elizabeth Barnhart, of
{\oldstyle1987}.
\exercise Is the scope of \cs{leftskip} and \cs{rightskip} restricted
to a paragraph?
\answer No, it is not.
\blueexample Flushed right paragraphs
At the end of each chapter in \TB{}
quotations are set as flushed paragraphs. ^^{paragraphs,\ flushed}
A little simplified the following will
do the job. The key issue is the
use of \cs{leftskip} and the zero value
of \cs{rightskip} and \cs{parfillskip}.
\cs{manmacauthor} is the \cs{author} macro from manmac to
set the author part in those quotations.
\begindemo
\leftskip0pt plus40pc
minus\parindent
\rightskip0pt\parfillskip0pt
\everypar{\sl}\obeylines
I got the BLUes,
but I like it
\manmacauthor{Anonymous}
(20th Century)
\bigskip
It contains all
\manmacauthor{DeK}(1978) \TB
!yields
\leftskip 0pt plus 40pc minus\parindent
\rightskip0pt\parfillskip0pt
\everypar{\sl}\obeylines
I got the BLUes,
but I like it
\manmacauthor{Anonymous}(20th Century)
\bigskip
It contains all
\manmacauthor{DeK}(1978) \TB
\enddemo
\exercise Why is |\everypar{\sl}| needed, instead of just \cs{sl}\ftn{Courtesy
Staszek Wawrykiewicz}?
\answer In \cs{manmacauthor} \cs{rm} is switched on for the special
paragraph of the author line.
The next quotation, if there is one, takes \cs{sl} again, automatically.
Note that the \cs{noindent} in \cs{manmacauthor} is mandatory,
because it starts the new paragraph and therefore \cs{rm} will
be in effect. It will come after the automatically inserted
\cs{sl}.
\bluesubhead Customization
The hook for customization of paragraphs is
the token variable \cs{everypar}.
A nice application of \cs{everypar}, next to \cs{sl} above,
is to number lines automatically in verbatim texts.
\bluehead Accents and ligatures
Some ligatures come automatically while others have to marked up for.
\begindemo
TB ex9.2-3
{\AE}sop's {\OE}uvres en fran\c cais\\
p\^at\'es
!yields
$$\hbox{{\AE}sop's {\OE}uvres en fran\c cais}$$
$$\hbox{p\^at\'es}$$
\enddemo
Remark. From \TB~{\oldstyle54}. \dots`It's important to remember that these
conventions for ^{accents} and special letters are not built into {\TeX} itself;
they belong to the plain {\TeX} format, which uses the Computer Modern fonts.'
\bluehead Paragraphs with digits
^^{numbers in paragraphs}
When numbers occur in paragraphs they look irregular, they exceed the size
of lowercase letters. Typographers advise to use \cs{oldstyle}.
Minimal markup can be achieved via \cs{on}, for example |\on3|.\ftn{When a space
should follow the number end the number by |{}|{\tt\char32}.}
\bluehead Use of special text elements
Examples of special text elements are:
items, labeled by a bullet, by a number, or alphabetically;
centering,
quotations;
(non-centered) displays;
text to be set apart, preceded and followed by a line;
PASCAL text;
syntax diagrams;
verbatims;
exercises and answers; and
footnotes.
The markup for these elements will be shown by examples.
\bluesubhead Items
At the basis are plain's one-parameter \cs{item} and \cs{itemitem},
which take as argument the item marker.
The bulleted item, ^|\bitem|, comes from \TB{} ex{\oldstyle14}.{\oldstyle20}.
^|\nitem|\Dash numbered items\Dash
^|\aitem|\Dash alphabetically labeled items, lowercase\Dash
^|\Aitem|\Dash alphabetically labeled items, uppercase\Dash and
^|\eitem|\Dash enumerated items,
are similar extensions.
The extensions provide the marker automatically, no argument is needed.
Note that the closing tag is \cs{smallbreak}.\ftn{Knuth advised \cs{medskip}
before and after, \TB{} {\oldstyle102}. I sobered this and made use of
\cs{smallbreak}'s paragraph terminating function.}
\blueexample Items
\begindemo
\bitem first item
\itemitem{--} subitem
\bitem second item
\smallbreak
!yields
{\parindent=1pc
\bitem first item
\itemitem{--} subitem
\bitem second item
\smallbreak}
\enddemo
\bluesubhead Quotations
A special case of centering a block is the so-called quotation, indented
on the left and the right by the same (fixed) amount, usually the value
of \cs{parindent}. ^^|\beginquote|
\blueexample Quotations
\begindemo
pretext
\beginquote
Some text to be set apart,
indented on the left and
on the right
\endquote
posttext
!yields
pretext
\beginquote
Some text to be set apart,
indented on the left and on the right.
\endquote posttext
\enddemo
Add a little to this to obtain \cs{beginsummary} and
\cs{endsummary}, abstracting in the markup from formatting details.
A step towards descriptive or functional markup. The summaries
at the beginning of each chapter of PWT have been marked up in this way.
Perhaps it is also good to mention here that accents don't start horizontal
mode. If you like to quote then start with \cs{leavevmode}\Dash to enforce
horizontal mode\Dash followed by |\llap`| or so.
\bluesubhead Setting text apart
^|\beginlines| and |\endlines|, \TB{} {\oldstyle583}--{\oldstyle591},
is in display (zero-indented),
which obeys the line structure and inserts a \cs{hrule} for and aft.
For an example of use I borrowed the following from \TB, where it is
used in combination with in-line verbatim.
\cs{obeylines} is on.\ftn{Variant \cs{endlines} are
\cs{weak\-end\-li\-nes}, \cs{fi\-nal\-end\-li\-nes}.
The former uses a \cs{medskip} instead of a \cs{medbreak}.}
\blueexample Setting text apart
\thisverbatim{\catcode`\|=12 }
\begindemo
%TB 343
\beginlines
|%This is the plain TeX format |
|%that's described in The TeXbook.|
\dots
\endlines
!yields
\beginlines
|%This is the plain TeX format|
|%that's described in The TeXbook.|
\dots
\endlines
\enddemo
\bluesubhead Centering in display
Plain \TeX{} provides \cs{centerline}.
BLUe's format provides the extension ^|\displaycenterline|,
to center a line with display glue for and aft, and
^|\begincenter| \dots \cs{endcenter}, and ^|\begincenterblock| \dots
\cs{endcenterblock} to center each line of the block.
^^|\begincenterdisplay|
\blueexample Centering in display
\begindemo
pretext
\displaycenterline{I $\heartsuit$
\TeX{} \winksmiley}
text in between
\begincenterblock
Sign of times?
The extraordinary rate of change.
\endcenterblock
intermediate text
\begincenter
TLC
tender loving care
that is all there is
\endcenter
posttext
!yields
pretext
\displaycenterline{I $\heartsuit$ \TeX{} \winksmiley}
text in between
\begincenterblock
Sign of times?
The extraordinary rate of change.
\endcenterblock
intermediate text
\begincenter
TLC
tender loving care
that is all there is
\endcenter
posttext
\enddemo
Remarks.
Agreed, \cs{displaycenterline} is a special case and therefore superfluous.
An alternative for centering of a block\Dash although a little different\Dash
is \cs{raggedcenter}
`that partitions the words of a paragraph into as few as possible lines
of approximately equal size and centers each individual line.
Hyphenation should be avoided if possible.'
{\TB} ex{\oldstyle14}.{\oldstyle34}.
\exercise Do |\begincenter...\endcenter| and
|\begincenterblock...\endcenterblock| allow for page breaks?
\answer |\begincenter...\endcenter| does.
|\begincenterblock...\endcenterblock| does not,
because it is a \cs{vbox}.
\bluesubhead Non-centered displays: one-line, multi-lines and multi-columns
^|\begindisplay| and |\enddisplay|, \TB{} {\oldstyle434}--{\oldstyle439},
yields an indented display. Very powerful and user-friendly.
\blueexample Non-centered displays: one-line, multi-lines and multi-columns
\begindemo
pretext
%TB 3
\begindisplay
``I understand.''
\enddisplay
posttext
!yields
pretext\begindisplay
``I understand.''
\enddisplay posttext
\enddemo
Multi-line displays can be handled by ending each line
in the environment by the control sequence \cs{cr}. ^^{multi-line displays}
The indentation is the value of \cs{displayindent},
default {\oldstyle0}pt, next to the |\hbox to\parindent{}| because of the
\cs{indent} in the (hidden) template.
\begindemo
pretext
%TB 4
\begindisplay
a hyphen (-);\cr
an en-dash (--);\cr
an em-dash (---);\cr
a minus sign ($-$).\cr
\enddisplay
posttext
!yields
pretext
\begindisplay
a hyphen (-);\cr
an en-dash (--);\cr
an em-dash (---);\cr
a minus sign ($-$).\cr
\enddisplay
posttext
\enddemo
Another subtle point is that more-column copy can be displayed,
because a repetitive template has been used.
\begindemo
pretext
%TB 29
\begindisplay \hbadness10000
\hbox spread-.666667em{The
badness of this line is 100.}&
(very tight)\cr
\hbox spread-.333333em{The
badness of this line is 12.}&
(somewhat tight)\cr
...
\enddisplay
posttext
!yields
pretext
\begindisplay \hbadness10000
\hbox spread-.666667em{The
badness of this line is 100.}&
\ (very tight)\cr
\hbox spread-.333333em{The
badness of this line is 12.}&
\ (somewhat tight)\cr
...
\enddisplay
posttext
\enddemo
\exercise How can we center a \cs{begindisplay}\dots \cs{enddisplay}?
\answer Enclosing the construct with a \cs{vbox} in math display does
not work, which is the usual way to center a \cs{halign}.
This comes from the fact that the construct is recognized as an
alignment display. A solution is
\beginverbatim
{\def\enddisplay{\crcr\egroup\egroup$$}
\begindisplay\vbox\bgroup
<displaymaterial>
\enddisplay}
!endverbatim
Perhaps it is simpler for those cases to fall back on the following
usual markup
\beginverbatim
$$\vbox{\halign{<template>
<displaymaterial>
}}$$
!endverbatim
%end answer
\bluesubhead Syntax diagrams
Markup tags are
\begincenterdisplay
^|\beginsyntax|\dots |\endsyntax| &the environment\cr
^|\alt| &to start an alternative\cr
^|\is| &to define left element\cr
\thisverbatim{\unmc}|<| and \thisverbatim{\unmc}|>|
&to start and end a unit.\cr
\endcenterdisplay
When a line starts with
\thisverbatim{\unmc}|<| it is assumed
that a new rule starts. \cs{obeylines} is on.
The end-of-line is redefined to take the appropriate action.
In the example below a \cs{quad} is
used in the markup to prevent starting a new rule.
The \% sign at the end of a line annihilates the effect of
the e-o-l, and prevents a new rule to start.
\blueexample Syntax diagrams
\thisverbatim{\unmc}
\begindemo
%TB 268
\beginsyntax
<unitofmeasure>\is
\quad<optionalspaces>%
<internalunit>
\alt<optional {\tt true}>%
<physicalunit>
\endsyntax
!yields
\beginsyntax
<unit of measure>\is
\quad<optionalspaces><internalunit>
\alt<optional {\tt true}><physicalunit>
\endsyntax
\enddemo
\bluesubhead Programs
Program texts are special, due to the use of non-monospaced fonts.
\bluetex{} assumes that the ^{PASCAL texts} have been prepared in such
a way that they are insensitive to font spacing.\ftn{Courtesy Wilson
and Addyman. Compare the markup with \TB{} {\oldstyle234} and
ex{\oldstyle18}.{\oldstyle9},
and you will appreciate
the approach of BLUe's format typesetting of PASCAL.}
^^|\beginpascal|
\blueexample Programs
\begindemo
\beginpascal
(*Print length of third side of
triangle given two sides and
enclosed angle*)
program EX4A(input, output);
var a, b, c angle : real;
begin read(a, b, angle);
c:=sqrt(sqr(a)+sqr(b)-
2*a*b*cos(angle));
writeln('The third side is', c)
end.
\endpascal
!yields
\beginpascal
(*Print length of third side of
triangle given two sides and
enclosed angle*)
program EX4A(input, output);
var a, b, c, angle : real;
begin read(a, b, angle);
c:=sqrt(sqr(a)+sqr(b)-
2*a*b*cos(angle));
writeln('The third side is', c)
end.
\endpascal
\enddemo
Perhaps it is not nice to have the types in the same font as variables.
PASCAL can be extended with types,
and therefore names of types are also variable.
An open problem is the vertical alignment because of the monotype fonts in the input
and the variable-width fonts used in the typeset result. Proofing needed.
\exercise How can we use the macros for typesetting program fragments
in other languages?
\answer The set of reserved words has to be customized, next to
the handling of special symbols.
%end exercise
\bluesubhead Verbatims
The functionalities are ^{verbatim\ text} (in-line and in display),
and file verbatim inclusion.
The markup starts with ^|\beginverbatim| and ends with
^|<escapechar>endverbatim|. The default escape character is `!'.
`Options,' for among other things numbering and enabling of metacode,
are handled via the token variables
\cs{thisverbatim}, or globally via \cs{everyverbatim}.
The place within context is controlled via
the token variables ^|\preverbatim| and ^|\postverbatim|.
It is true that verbatims are heavily used
by authors who write in \AllTeX{} about \AllTeX,
and perhaps not so relevant for math authors.
\blueexample Verbatims: escape char use
\thisverbatim{\catcode`\|=12 \let\-=-
\catcode`\!=12
\catcode`\<=12
\catcode`\-=0 }
^^{verbatim,\ escape char}
\begindemo
%To handle via ! (escape char)
% -- other fonts
% -- emc (enable metacode)
\thisverbatim={\emc}
\beginverbatim
Some <metacode> and
blah, blah, ... !it
Now text in italics!tt
and back again in tt
!endverbatim
-yields
\thisverbatim={\emc}
\beginverbatim
Some <metacode> and
blah, blah, ... !it
Now text in italics!tt
and back again in tt
!endverbatim
\enddemo
\blueexample Verbatims: line numbering and file inclusion
\thisverbatim{\catcode`\|=12
\let\-=- \catcode`\!=12
\catcode`\<=12
\catcode`\-=0 }
^^{verbatim,\ line numbering}
^^{verbatim,\ file inclusion}
\begindemo
pretext
\everyverbatim={\numvrb}
\thisverbatim={%
\catcode`\!=12
\catcode`\|=12
% \input vrb.tex %<file>
\makeescape\*}%To terminate
\beginverbatim
Extras after file
*endverbatim
\noindent posttext
-yields\noindent
pretext
\everyverbatim={\numvrb}
\thisverbatim={\emc
\catcode`\!=12
\catcode`\|=12
% \input vrb.tex
\makeescape\*}%To terminate
\beginverbatim
<file>
Extras after file*nonum
*endverbatim
\noindent posttext
\enddemo
\blueexample Verbatims: line numbering
\thisverbatim{\catcode`\|=12
\let\-=- \catcode`\!=12
\catcode`\<=12
\catcode`\-=0 }
\begindemo
\thisverbatim={\numvrb
\catcode`\~=9
\catcode`\*=14 }
\beginverbatim
Just some text with
ligatures such as ?` switched
off (TB 381).
line numbers restarted via
<escapechar>numvrb.!nonum
<escapechar>nonum switches off
line numbering.
<escapechar>vrblin<number>
assigns
<number> to the line counter.
!numvrb~After two blank*
lines.!nonum
!endverbatim
-yields
\thisverbatim={\numvrb
\catcode`\~=9
\catcode`\*=14 }
\beginverbatim
Just some text with
ligatures such as ?` switched
off (TB 381).
line numbers restarted via
<escapechar>numvrb.!nonum
<escapechar>nonum switches off
line numbering.
<escapechar>vrblin<number> assigns
<number> to the line counter.
!numvrb~After two blank*
lines.!nonum
!endverbatim
\enddemo
\blueexample Verbatims: in line
\thisverbatim{\catcode`\|=12
\let\-=- %\catcode`\!=12
\catcode`\<=12
\catcode`\-=0 }
^^{verbatim,\ in-line}
{\def\-{\hbox{-}}
\begindemo
\thisverbatim{\emc}
Before |<in!-lineverbatim>| after.
-yields\indent
\thisverbatim{\emc}
Before |<in!-lineverbatim>| after.
\enddemo}
Also provided is \cs{unmc} to unable metacode.
For ^{long\ verbatim\ listing}s supply
\beginverbatim
\everyverbatim{\baselineskip12ptplus2ptminus1pt\lineskip1ptplus1ptminus1pt}
!endverbatim
to prevent underfull vbox messages.
\exercise How can we put \cs{it}, and \cs{tt} at the beginning of
the lines?
\answer The naive way introduces an unwanted space. We can get rid of
a space after a control sequence via the use of a control symbol
with category code 9 (to be ignored) after those control sequences.
\exercise How can we center verbatims? ^^|\begincenterverbatim|
\answer This is included in BLUe's format and reads as follows.
\thisverbatim{\catcode`\~=0 \catcode`\!=12 }
\beginverbatim
\def\boxlines{\obeyspaces\fifol}
%\gdef\fifol#1^^M{\ifx\lofif#1\lofif\fi
% \processl{#1}\fifol}
\def\begincenterverbatim{$$%
\def\processl##1{\hbox{##1}}%
\def\lofif##1\fifol{\fi\egroup
\egroup$$\thisverbatim{}}
\let\endcenterverbatim\lofif
\bgroup\tt\setupcopy
\let\!=!\catcode`\!=0
\the\everyverbatim\the\thisverbatim
\vbox\bgroup\boxlines}
~endverbatim
\exercise A math display does not end a paragraph, it is part of the
paragraph with the effect that paragraph parameters
are not reset to their defaults. What about \cs{beginverbatim}
|!!endverbatim|?
\answer It looks although all depends on the values of \cs{preverbatim} and
\cs{postverbatim}. The defaults are \cs{medskip} and
\cs{smallbreak}. The former does not insert a \cs{par}
while the latter does. As is well-known a \cs{par}
terminates a paragraph. However, the subtleness is that
\cs{begingroup} and \cs{endgroup} enclose the verbatim
which, \TB{} 279 `don't change the mode.' On reading I did not
understand the consequences of the quoted sentence.
A small experiment taught me that the paragraph parameters are not
reset. Therefore the \cs{beginverbatim} |<escapechar>endverbatim|
just {\it interrupt\/} the paragraph, similar to the math display.
%end exercise
Remark. As known \TeX{} makes use of special characters. For example
when \% is input the \% is not obtained in print, but rather the rest of
the input line is considered as comment.
Similar for $<$, $>$ and \vrt{} in horizontal mode, although for a different reason.
Because of this the less than and greater than symbols can be used nicely
for syntax charts and the vertical bar for in-line verbatim.
\bluesubsubhead Pitfalls
There are some pitfalls that I know of and that
a user might like to be aware of. ^^{verbatim,\ pitfalls}
\bitem Default \cs{emc} and when the less than and greater than signs are
used curious error messages occur. Remedy |\thisverbatim{\unmc}|.
\bitem Long verbatims give a bunch of underfull vbox messages.
Remedy |\everyverbatim{|\\
|\baselineskip12pt plus2pt minus1pt|\\
|\lineskip1ptplus1ptminus1pt}|
\bitem And \dots don't forget ! is the default escape character.
!endverbatim
\smallbreak
\bluesubhead Exercise and answer
Exercises and answers have to be marked up as follows.
\blueexample Exercise and answer
\begincenterverbatim
\exercise<exercisetext>
\answer<answertext>
%followed by a blank line
!endcenterverbatim
\bluesubhead Footnotes
Plain \TeX{} provides the \cs{footnote} command. ^^{footnote,
automatic numbering}
\TB{} ex{\oldstyle15}.{\oldstyle12} deals with how to number a footnote
automatically.
In \bluetex{} the markup for the latter is ^|\ftn||{<footnotetext>}|.
In the title part of an article\Dash or report\Dash
BLUe falls back on \cs{footnote}, because those footnotes
are some sort of out of order. That use reads as follows.
\blueexample Footnotes
\begincenterverbatim
\footnote*{<titlefootnotetext>}
%or
\footnote{**}{<titlefootnotetext>}
%etc.
!endcenterverbatim
The above is regular \TeX. Because of me using \cs{oldstyle} for the numbering
the {\oldstyle*} symbol will be obtained instead of *. To correct this
provide |{\rm *}|, or just forget about a marker and provide an empty group.
From the context it is clear enough that the note is about the title.
The footnotes are set in {\oldstyle8}pt.
^^{margin notes}
\exercise And what about notes in the margin?
\answer This is not implemented in \bluetex's OTR.
It is rather difficult to combine that with flexibility
with the number of columns.
If needed occasionally use \cs{vadjust}.
%end exercise
\bluehead Fonts and size switching
Default {\oldstyle10}pt is used. ^^{fonts\ and\ size\ switching\ macros}
For the moment I stay with Knuth and copied his size-switching
macros.\ftn{Because of this attitude
I could easily kameleon \cs{oldstyle} to all those sizes.
To achieve this with NFSS would have cost me much more time,
I guess.}
BLUe's format contains the size-switching macros
\cs{Large}, $\approx$\thinspace{\oldstyle17}pt, used for chapter headings,
\cs{large}, $\approx$\thinspace{\oldstyle14}.{\oldstyle5}pt,
used for transparencies,
and \cs{small}, that is, {\oldstyle8}pt, used for footnotes.
Next to these \cs{tenpoint}, \cs{ninepoint}, and
\cs{eightpoint} have been inherited from manmac.
\cs{tiny} has size {\oldstyle5}pt and has been setup similar to the
\cs{...type} macros from Knuth's concert format, Appendix~E of \TB.
A pedagogical stepping stone for size-switching macros,
and sufficient for just text.
\beginverbatim
\def\tiny{\fiverm\baselineskip7pt\let\it\fivei\let\bf\fivebf\let\oldstyle\it}
!endverbatim
\exercise How to setup a general \cs{twelvepoint} size-switching macro?
\answer Copy Knuth's \cs{tenpoint} and adjust for the size.
\beginverbatim
\def\twelvepoint{\def\rm{\fam0\twelvenrm}%
\textfont0=\twelverm\scriptfont0=\ninerm
\scriptscriptfont0=\sevenrm
\textfont1=\twelvi \scriptfont1=\ninei
\scriptscriptfont1=\seveni
\textfont2=\twelvesy\scriptfont2=\ninesy
\scriptscriptfont2=\sevensy
\textfont3=\twelveex\scriptfont3=\tenex
\scriptscriptfont3=\tenex
\def\it{\fam\itfam\twelveit}\def\oldstyle
{\fam1 \twelvei}\textfont\itfam=\twelveit
\def\sl{\fam\slfam\twelvesl}%
\textfont\slfam=\twelvesl
\def\bf{\fam\bffam\twelvebf}%
\textfont\bffam=\twelvebf
\scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\tt{\fam\ttfam\twelvett}%
\textfont\ttfam=\twelvett
\tt \ttglue=.5em plus.25em minus.15em
\normalbaselineskip=14pt minus1pt
\def\MF{{\manual META}\-{\manual FONT}}%fixed
\let\sc=\tenrm
\let\big=\fourteenbig
\setbox\strutbox=\hbox{\vrule
height10pt depth4pt width\z@}%
\normalbaselines\rm}
\def\fourteenbig#1{{\hbox{$\left#1\vbox
to12pt{}\right.\n@space$}}}
!endverbatim
Make sure all the used fonts are available, otherwise
provide scaled versions. See the script for \cs{Large}.
%end answer
\exercise What is the effect of |\bf\it|? And of |\it\bf|?
\answer Once you realize that \cs{bf} and \cs{it} are shortcuts
to the fonts \cs{tenbf} and \cs{tenit}, actually to the family,
the answer prompts itself: the last font, that is italics
respectively bold face roman.
One of the features of NFSS is that you will get bold italics
in both cases, that is these tags commute, or am I mistaken?
\exercise Experiment with the difference between \cs{twelvepoint}
and the use of \cs{magstep1}.\ftn{Courtesy Nico Temme.}
\bluehead Table of Contents
I must confess that my way of writing has changed.
Now I start keyboarding with a vague idea of the sections and their
structural dependence.
This style of working badly needs an automatically generated
table of contents, ^{ToC} for short.
The markup to achieve a ToC in the default {\bluetex} reads as follows.
\begincenterverbatim
\input blue.tex \loadtocmacros
\beginscript
<copyproper>
\pasteuptoc
\endscript
!endcenterverbatim
Remark.
The example titles are interspersed with the sections in the ToC,
because my purpose is to supply an overview while writing, and
not for finding the appropriate section to assist the reader.
However, this dynamically generated ToC can be inserted as part of the copy,
eventually enriched by hand, for the convenience of the reader.
For the \cs{report} format \cs{loadtocmacros} {\em must\/} be omitted.
The necessary macros come already with \cs{report}.
This ToC is aimed at the reader.
\bluehead Index
The \cs{report} format has been designed to provide also an index on the fly
if one wishes. There is nothing against it to play also with it
in the default format.
\begincenterverbatim
\input blue.tex \loadindexmacros
\beginscript
<copyproper>%marked up with IRs
\sortindex\pasteupindex
\endscript
!endcenterverbatim
\endinput
|