summaryrefslogtreecommitdiff
path: root/info/laan/pwt/pwt.mat
blob: 9ad24d59b59233c2711df380bfc3e8ad2968ce83 (plain)
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
\input blue.tex
\loadindexmacros
\report
\font\grkop=cmr12 scaled\magstep3
\bluechapter Mathematics

\beginsummary
On top of plain \TeX{} \bluetex{} provides facilities for:
automatic numbering,
cross-referencing for formulas,
matrix icons,
multi-alignment points in eqalign,
primed summation symbols,
arrows for commutative diagrams, and
some special symbols.
Examples borrowed from literature are incfluded to illustrate 
how \TeX{} can be used to mark up mathematics.
This anthology shows that many details have to be prescribed.
To give a math manuscript to a keyboarder without markup guidance
is doomed to yield mediocre results.
\endsummary

\noindent^{Swanson} {\oldstyle1986} is a good source for what math should 
look like in print. 
Very nice is also `^{Mathematical Writing},' a report from 
a Stanford Workshop organized by Knuth.
\TeX{} is already very rich for math markup, 
because in his Preface to \TB{} Knuth states
\beginquote
\noindent\llap`\dots \TeX, a new typesetting system intended for the
creation of beautiful books\Dash and especially
for books that contain a lot of mathematics.'
\endquote

\bluehead What's the problem, Doc?

If we assume that mathematicians write math manuscripts
in the classical sense, then there is a problem when those mathematicians
wish to have their work formatted via computer-assisted 
document-preparation tools like \TeX. 
What has to be keyboarded looks much different from the manuscript.
Examples of this phenomenon are omni-present in this work.

\blueexample Disparity math notation and markup notation

\thisverbatim{\catcode`!=12
   \catcode`~=0 }
\begindemo
x=1+\left({y^2\over k+1}
      \right)^{\!\!1/3}
~yields
$$x=1+\left({y^2\over k+1}\right)^
                       {\!\!1/3}$$
\enddemo
Because of this disparity, the problem is how to get a correct\ftn{Not
   only in the sense that the \TeX{} formatter does not complain, 
   no, correct in the sense of complying with tradition of mathematical 
   typesetting.} 
\TeX script, starting from a mathscript.
This is difficult\ftn{In the example at hand the keyboarder has to be 
  aware of \cs{over} and $/$ respectively, and when to use which. 
  Moreover, the correct size of the parentheses must be supplied, and 
  some kernings have to be inserted!}
due to the inherent complexity of math typesetting, and due to
the unusual nature of \TeX, if not because of the bewildering and
confusing flavours of \TeX-based products.
Even a fancy and friendly, {\smc wysiwyg} user-interface is not enough.
Optical scanners of math\Dash or systems which understand
  spoken mathematics\Dash are still science fiction.

\bluehead The extras

\bluetex{} provides as extras to plain {\TeX} facilities for:
automatic numbering,
cross-referencing for (display) formulas,
macros for ^{matrix icons},
an extension of ^|\eqalign| with respect to multi-alignment points,
primed summation symbols,
arrows for commutative diagrams, 
^|\beginmathdemo| and |\endmathdemo| from manmac, and
poor man's ^{blackboard bold} and some other special symbols.
These extras are introduced via examples.

\blueexample Automatic numbering and cross-referencing

^^{formula,\ cross-referencing}
^^{formula,\ automatic numbering}
^^{formula,\ labeled}
This is a compatible extension.
For the markup of math ^{cross-referencing} insert 
instead of plain's explicit (reference) number

\bitem \noindent^|\ref|, for creation of the number, and 
       \thisverbatim{\emc}|\ref\<name>|, for attaching
       a name to the automatically generated number, and
\bitem ^|\crsref||\<name>|, for cross-referencing.
\smallbreak

\begindemo
%Automatic numbering
$$a+b\eqno\ref$$
!yields
$$a+b\eqno\ref$$
\enddemo


\begindemo
%Automatic numbering, and 
%symbolic cross-referencing
$$c*d\eqno\ref\cgl$$
Text, \crsref\cgl
!yields
$$c*d\eqno\ref\cgl$$
Text, \crsref\cgl
\par\noindent
\enddemo
\exercise And what about forward referencing?
\answer This is not possible in a one-pass job. Therefore a note
        is printed in the margin while proofing. The correct
        number has to be filled in ultimately.

%end answer
Handy token variables are ^|\prenum|
and ^|\postnum|.\ftn{Courtesy Michael Spivak.} 
Their contents is inserted before, respectively 
after, the automatically generated number in \cs{ref} and \cs{crsref}. 
Because of this one can get labels and crossrefs like {\oldstyle13}a, 
or enclosing numbers by parenthesis. 
The latter are the defaults of these token variables. 
If in such a case the formula counter must keep its value, provide
|\advancefalse|. 
\exercise How can we  retain the number, and suffix a letter, as
          label of a formula to come?
\answer Provide \cs{advancefalse}, and |\postnum{a)}|.

\blueexample Matrix icons

Useful icons concern the matrices: 
rectangular, via ^|\icmat|, 
triangular (lower left and upper right), 
via ^|\icllt| or ^|\icurt|, and
upper Hessenberg, via ^|\icuh|.
The arguments are dimensionless numbers. 
The first argument reflects the vertical size, and 
the second the horizontal size. 
In case of \cs{icuh} the second argument is the Hessenberg bandwidth
and the third is the difference between the first and the second.
        

\begindemo
\unitlength1ex
$$\icmat44\kern\unitlength\icllt44=
    \icllt44\icuh413\qquad 
    \hbox{AL}=\hbox{LH}$$
!yields
\unitlength1ex
$$\icmat44\kern\unitlength\icllt44=
    \icllt44\icuh413\qquad 
    \hbox{AL}=\hbox{LH}$$
\enddemo

\exercise Another matrix factorization reads
\begincenterverbatim
$$\icmat63=\icmat63\kern\unitlength
  \icurt63\qquad\hbox{A}=\hbox{QR}$$
!endcenterverbatim
When used together with the example above, 
align on the =-signs, that is, on the =-sign in the icons and on the
=-sign in the formulas.
\answer Use \cs{eqalign} as follows.
\beginverbatim
$$\unitlength1ex
  \eqalign{
   \icmat44\kern\unitlength\icllt44={}&
      \icllt44\icuh413&
      \qquad \hbox{AL${}={}$LH}\cr
   \icmat63={}&
      \icmat63\kern\unitlength\icurt63&
      \qquad \hbox{\phantom{A}A${}={}$QR}}
$$
!endverbatim

\blueexample Compatible extension of eqalign %
             with multiple alignment points

^^|\eqalign|
\begindemo
$$\eqalign{
\cos(z\sin\theta)={}&
  J_0(z)&
  {}+2\sum_{n=1}^\infty 
    J_{2n}(z)\cos2n\theta\cr
  \sin(z\sin\theta)={}&      
        &
  {}+2\sum_{n=1}^\infty
J_{2n+1}(z)\sin(2n+1)\theta\cr
}$$
!yields
$$\eqalign{
\cos(z\sin\theta)={}&J_0(z)&
  {}+2\sum_{n=1}^\infty J_{2n}(z)\cos2n\theta\cr
\sin(z\sin\theta)={}&      &
  {}+2\sum_{n=1}^\infty
J_{2n+1}(z)\sin(2n+1)\theta\cr
}$$
\enddemo
\exercise Why is the empty formula used in the markup?
\answer The empty formula $\{\}$ is used to coerce the + to behave
        as a dyadic operator, and the = to behave similarly.
        In other words to yield the correct spacing.

\blueexample Macros for showing math markup and the result

^|\beginmathdemo| (and variants) and |\endmathdemo|, 
are used in the \TB{} script, {\oldstyle444}--{\oldstyle466}, 
for indented display Math,  see \TB{} chapters 
{\oldstyle16}--{\oldstyle19}.\ftn{There 
   is only one second part macro for all these cases. 
   Its replacement text is modified into \cs{crcr}\cs{egroup}\$\$.}
^^|\begindemo|^^|\yields|
They are used to typeset the marked up copy and the
typeset result side-by-side. 
The user does not have to bother about the template for the 
alignment display used.  
The functionality provided is similar, but a little restricted, 
to the (\LaTeX) styles for switching from 
one-column to two-column format and vice versa. 
But, \dots\thinspace it is much simpler and more efficient\Dash 
IMHO with all respect\Dash
because it does not entail OTR processing.

\thisverbatim{\catcode`\|=12 }
\begindemo
%TeXbook 128
\beginmathdemo
   \it Input&\it Output\cr
   \noalign{\vskip2pt}
   |$x^2$|&x^2\cr
\endmathdemo
!yields
\beginmathdemo
   \it Input&\it Output\cr
   \noalign{\vskip2pt}
   |$x^2$|&x^2\cr
\endmathdemo
\enddemo

\thisverbatim{\catcode`\|=12 }
\begindemo
%TeXbook 139
\begindisplaymathdemo
   |$$x+y^2\over k+1$$|&
            x+y^2\over k+1\cr
   \noalign{\vskip2pt}
   |$${x+y^2\over k}+1$$|&
            {x+y^2\over k}+1\cr
\endmathdemo
!yields
\begindisplaymathdemo
  |$$x+y^2\over k+1$$|&
            x+y^2\over k+1\cr
   \noalign{\vskip2pt}
   |$${x+y^2\over k}+1$$|&
            {x+y^2\over k}+1\cr
   \noalign{\vskip-1pt}
\endmathdemo
\enddemo
Remark. Note that we have to supply the input and the output, 
due the \TeX's rigidness of the category codes once assigned.

\blueexample Poor man's blackboard bold and some special symbols

^^{blackboard bold}
Now and then other symbols than those provided in the font tables 
of Appendix~F of \TB{} are needed.\ftn{Generally, non-standard fonts are 
    already available somewhere. For math consult AMS.}
These can be constructed approximately.

{\gutter4em
\def\boxit#1{\vbox{\hrule\hbox{\vrule
             #1\vrule}\hrule}}
\begindemo
$$\halign{#\hfil\quad&
              \hfil#\hfil\cr
 natural numbers    &$\IN$ \cr
 integers           &$\Z$ \cr
 rational numbers   &$\Q$ \cr
 reel numbers       &$\R$ \cr
 and complex numbers&$\C$ \cr
 next to\cr
 greater or less &$\gtrless$\cr
 external tensor product&
               $\boxtimes$\cr}$$
!yields
$$\def\IN{{\rm I\kern-.5ex N}}
\halign{#\hfil\quad&\hfil#\hfil\cr
 natural numbers    &$\IN$ \cr
 integers           &$\Z$ \cr
 rational numbers   &$\Q$ \cr
 reel numbers       &$\R$ \cr
 and complex numbers&$\C$ \cr
 next to\cr
 greater or less &$\gtrless$\cr
 external tensor product&
               $\boxtimes$\cr}$$
\enddemo}
\cs{IN}, \cs{Z}, et cetera are incorporated in \bluetex.
\exercise On the \TeX-NL network there was a request for the pro mille
          token. How to get it?
\answer It is in the wasy font. A poor man's version is an open problem
        as yet, because the lower 0 is neither 5pt, nor 6pt, and therefore
        the symbol can't be built from \% and an appropriate sized 0.
        A very, very poor man's version reads |\%\lower.2ex\hbox{\fiverm 0}|,
        in fact unacceptible.
        Building it from \cs{frac}, |\frac0/{00}|, is different from \%.

\bluehead Use

Many ingredients are supplied by plain. 
It is just a matter of what-and-how, what to use from the wealth offered.
It has all to do with what the script should look like in print
{\em within the context}.
In the sequel some more math markup will be shown, not restricted to
markup tags from \bluetex{}.
A classical example is the markup for the various uses of O.

Noteworthy is further that
punctuation symbols are also used with spacing before them, 
ditto for the vertical bars and the backslash.
The size of delimiters is dependent on the context,
which can't be completely automated.
The variants can be obtained via special markup, for example via 

\bitem ^{coercion macro}s 
   (to guide \TeX{} with respect to spacing before and after,
    for example via \cs{mathdelimiter},
    or to positioning of embellishments below and on top,
    for example via  \cs{mathop})
\bitem the use of the ^{empty formula}, $\{\}$, 
       to coerce binary behaviour of the operator 
\bitem macros to impose the size of delimiters 
   (\cs{biggl} et cetera)
\bitem special control sequences
   (like \cs{colon}).
\smallbreak
    
\bluesubhead Plain's display maths

Most displays belong to one of the categories given below.

\blueexample A labeled formula in display

Spaces are neglected in math mode. ^^{formula,\ labeled}
The kern |\,| is needed to coerce the correct spacing.
\begindemo
$$\sin2x=2\sin x\,\cos x
     \eqno({\rm TB186})$$
!yields
$$\sin2x=2\sin x\,\cos x
     \eqno({\rm TB186})$$
\enddemo

\blueexample Formula hyphenation; shifting of lines

A hyphenated formula via \cs{displaylines}. ^^{formula,\ hyphenation}
With the use of \cs{hfill} we can shift lines to the
left or right.
\begindemo
$$\displaylines{F(z)=
a_0+{a_1\over z}+{a_2\over z^2}
  +\cdots+{a_{n-1}\over z^{n-1}}
  +R_n(z),\hfill\cr
\hfill n=0,1,2,\dots\,,\cr
F(z)\sim\sum_{n=0}^\infty 
  a_nz^{-n},\quad z\to\infty
  \hfill\llap{(TB ex19.16)}}$$
!yields
$$\displaylines{F(z)=
a_0+{a_1\over z}+{a_2\over z^2}
  +\cdots+{a_{n-1}\over z^{n-1}}
  +R_n(z),\hfill\cr
\hfill n=0,1,2,\dots\,,\cr
F(z)\sim\sum_{n=0}^\infty 
  a_nz^{-n},\quad z\to\infty
  \hfill\llap{(TB ex19.16)}}$$
\enddemo

\blueexample Alignment and centered labeling

\begindemo
$$\eqalign{\cos2x
      &=2\cos^2x-1\cr
      &=\cos^2x-\sin^2x}
  \eqno({\rm TB193})$$
!yields
$$\eqalign{\cos2x
      &=2\cos^2x-1\cr
      &=\cos^2x-\sin^2x}
  \eqno({\rm TB193})$$
\enddemo

\blueexample Alignment and labels per line

\begindemo
$$\eqalignno{\cosh2x
     &=2\cosh^2x-1&({\rm TB192})\cr
     &=\cosh^2x+\sinh^2x}$$
!yields
$$\eqalignno{\cosh2x
     &=2\cosh^2x-1&({\rm TB192})\cr
     &=\cosh^2x+\sinh^2x}$$
\enddemo

Remark. %In not too narrow columns the last formulas 
        %are both centered.
If one wants \cs{eqalignno} to behave like 
\cs{displaylines}\Dash that is, left-justified\Dash
then modify in \cs{eqalignno} the first
\cs{tabskip}=\cs{centering} assignation into 
\cs{tabskip}= \cs{z@skip}.

\blueexample Subscripts

The depth of a ^{subscript} depends on whether there is
a superscript. With a superscript a subscript sinks a little. 
In order to obtain uniformly placed subscripts
the solution is to adjust the following font dimension 
parameters, see \TB{} {\oldstyle179}.
\begindemo
\fontdimen16\textfont2=2.7pt
\fontdimen17\textfont2=2.7pt
$$X_1+Y_1^2=1$$
!yields
\fontdimen16\textfont2=2.7pt
\fontdimen17\textfont2=2.7pt
$$X_1+Y_1^2=1$$
\enddemo

\thissubhead{\runintrue}
\bluesubhead A snapshot of examples\par borrowed from \TB, 
to illustrate the need for extra markup. 
\TB{} chapters {\oldstyle16}\dash{\oldstyle19} contain many examples, 
well-ordered and appropriately explained.   

\blueexample Dots and the comma after

^^{dots and the comma after}
\begindemo
$${\bf S^{\rm-1}TS=dg}(\lambda_1,
   \ldots\,,\lambda_n)=\bf\Lambda$$
!yields
$${\bf S^{\rm-1}TS=dg}(\lambda_1,
   \ldots\,,\lambda_n)=\bf\Lambda$$
\enddemo

\blueexample Summation with limits

\begindemo
$$\sum_{k=1}^\infty{1\over2^k}=1$$
!yields
$$\sum_{k=1}^\infty{1\over2^k}=1$$
\enddemo
\exercise In line we usually have subscripts and superscripts.
          How can we get those?
\answer Automatically! \TB{} 144: ` A displayed sum usually occurs 
        with `limits,' i.e., with subformulas that are to appear above
        and below it. \dots\thinspace According to the normal conventions 
        of mathematical typesetting, \TeX{} will change this to 
        `$\sum_{k=1}^\infty{1\over2^k}=1$' (i.e., without limits) if it
        occurs in text style rather than in displaystyle.' Explicit control
        is possible via the control sequences \cs{limits}, respectively
        \cs{nolimits}.

%end answer

\blueexample Overlining; accents

If there is an example with various markup possibilities, this is the one,
although the various O-s comes close. ^^{overlining}^^{accents in math}
\begindemo
$$\bar z,\ \overline z,\
\bar P,\ \overline P,\
\bar h,\ \hbar,\
\overline{AB}$$
!yields
$$\bar z,\ \overline z,\
\bar P,\ \overline P,\
\bar h,\ \hbar,\
\overline{AB}$$
\enddemo

\blueexample Square roots

\begindemo
$$\sqrt{1+\sqrt{1+\sqrt{1+x}}}$$
!yields
$$\sqrt{1+\sqrt{1+\sqrt{1+x}}}$$
\enddemo

\blueexample Roman texts in math, \TB~{\oldstyle163}; accents

^^{roman texts in math}
\begindemo
$${f(x+\Delta x)-f(x)\over
     \Delta x}\to f'(x)\quad
  {\rm as}\quad\Delta x\to0$$
!yields
$${f(x+\Delta x)-f(x)\over
     \Delta x}\to f'(x)\quad
  {\rm as}\quad\Delta x\to0$$
\enddemo
Remark. \TeX{} uses special conventions for accents in formulas, so the 
accents in ordinary text and the ^{accents in math} have different markup, 
\TB~{\oldstyle135}.


\blueexample Kerning; positive and negative

^^{kerning; positive and negative}
\thisverbatim{\catcode`\!=12
              \catcode`\~=0 }
\begindemo
$$       \int\!f(x)\,dx,   \quad
 \Gamma_{\!2}+\Delta^{\!2},\quad
 \sum^\infty_{n=-\infty}\!
                \!\!\cos nt$$
~yields
$$         \int\!f(x)\,dx,        \quad
 \Gamma_{\!2}+\Delta^{\!2},       \quad
\sum^\infty_{n=-\infty}\!\!\!\cos nt$$
\enddemo

\blueexample Empty formula and subscripting

^^{empty formula and subscripting}
\begindemo
(\lambda)_2\,{}_2F_1 
!yields
$$(\lambda)_2\,{}_2F_1$$ 
\enddemo

\blueexample Math operator

^^{math\ operator}
\begindemo
$$\mathop{\hbox{\rm Res}}_
  {s=e^{i\pi}}f(s)=-e^{i\pi z}$$
!yields
$$\mathop{\hbox{\rm Res}}_
  {s=e^{i\pi}}f(s)=-e^{i\pi z}$$
\enddemo

\blueexample Colon markup; punctuation vs.\ operator

^^{colon markup}
\begindemo
$$f\colon A\to B,\quad \{x:x>5\}$$
!yields
$$f\colon A\to B,\quad \{x:x>5\}$$
\enddemo

\blueexample Context-dependent size

\begindemo
$$\bigl\!vrt\,\alpha(\sqrt
   {\mathstrut a}+\sqrt
   {\mathstrut b}\,)\,
  \bigr\!vrt
\leq!vrt\alpha!vrt\,
  \bigl\!vrt\sqrt
   {\mathstrut a}+\sqrt
   {\mathstrut b}\,
  \bigr\!vrt$$
!yields
$$\bigl\Vert\,\alpha(\sqrt{\mathstrut a}+
       \sqrt{\mathstrut b}\,)\,\bigr\Vert
  \leq\vert\alpha\vert\,
  \bigl\Vert\sqrt{\mathstrut a}+
   \sqrt{\mathstrut b}\,\bigr\Vert$$
\enddemo
It is tempting to insert a multiplication dot. Don't!

\blueexample Vertical bars, \TB{} {\oldstyle146}, {\oldstyle147},
             ex{\oldstyle18}.{\oldstyle21}

\begindemo
$$\big\{\,x^3\bigm\vert h(x)\in
       \{-1,0,+1\}\,\bigr\}$$
!yields
$$\bigl\{\,x^3\,\bigm\vert\,h(x)\in
       \{-1,0,+1\}\,\bigr\}$$
\enddemo

\blueexample Halves variety \TB{} ex{\oldstyle11}.{\oldstyle6}, ex{\oldstyle19}.{\oldstyle2}

Essential is the use of \cs{textstyle}.
\begindemo
$$D^\lambda_0(z)=
  4a_\lambda\, z\,{}_2F_1(%
  \textstyle
  \lambda+{1\over2},{1\over2};
  {3\over2};z)$$
%Typographer's 1/2
Typographer's $\fracdek1/2$,
(recipes), which works better 
than a mathematician's $1\over2$
!yields
$$D^\lambda_0(z)=
4a_\lambda\, z\,{}_2F_1(\textstyle\lambda+{1\over2},{1\over2};
{3\over2};z)$$
Typographer's $\fracdek1/2$,
(recipes), which works better 
than a mathematician's $1\over2$
\enddemo

\blueexample Under and overbraces

Subtle use of fonts, and \cs{mathstrut} to enforce size.
For under and over parentheses see TTN 3.4. ^^{underbraces}^^{overbraces}
\begindemo
$$\{\underbrace{\overbrace
 {\mathstrut a,\ldots,a}^
     {k\;a\mathchar`'\rm s},
 \overbrace{\mathstrut b,\ldots
    ,b}^{l\;b\mathchar`'\rm s}}
      _{k+l\rm\;elements}\}$$
!yields
$$\{\underbrace{\overbrace{\mathstrut 
  a, \ldots,a}^{k\;a\mathchar`'\rm s},
    \overbrace{\mathstrut b,\ldots,b}
      ^{l\;b\mathchar`'\rm s}}
      _{k+l\rm\;elements}\}$$
\enddemo

\blueexample Diagonal dots, coercions, \TB{} ex{\oldstyle18}.{\oldstyle45}

^^{diagonal dots}
\begindemo
$$2\uparrow\uparrow k
   \mathrel{\mathop=^{\rm def}}
   2^{2^{2^{\cdot^{\cdot^
            {\cdot^2}}}}}\vbox
  {\hbox{$\Big\}\scriptstyle k$}
   \kern0pt}$$
!yields
$$2\uparrow\uparrow k\mathrel{\mathop=
  ^{\rm def}}
  2^{2^{2^{\cdot^{\cdot^{\cdot^2}}}}}
  \vbox{\hbox{$\Big\}\scriptstyle k$}
  \kern0pt}$$
\enddemo

\exercise What is the function of the \cs{kern}0pt?
\answer To set the curly brace on the baseline.

\exercise Can the \cs{cdot} be replaced by just a period?
\answer It looks like it. Used within the picture environment
        I stumbled on lack of scaling invariance for the latter case?!?
        As far as I see it now the \cs{cdot} yields nicer result anyway.
        Because of the explicit \cs{Big} the above markup is not
        scaling invariant.

\blueexample Undoing mathsurround space

\begindemo
$2{\times}3$-matrix
!yields
\hfil$2{\times}3$-matrix
\enddemo

\blueexample All those O-s

\begindemo
$\emptyset$, (the empty set)
$f\circ g\colon
  x\mapsto f\bigl(g(x)\bigr)$,
  (composition), and 
   order symbols
$o(h^2)$,
$O(h^2)$.
!yields
\par $\emptyset$, {(the empty set)},
\par $f\circ g\colon x\mapsto f\bigl(g(x)\bigr)$
(composition),
\par and the order symbols $o(h^2)$ and $O(h^2)$
\enddemo

\blueexample Set difference vs.\ cosets

^^{set difference}^^{cosets}
\begindemo
$A\setminus A=\emptyset,
 \hbox{and the cosets of $G$ 
 by $H$:\ }G\backslash H$
!yields
$A\setminus A=\emptyset,
\hbox{and the cosets of $G$ by $H$:\ }
  G\backslash H$
\enddemo

\blueexample The Cardano solution to third-order equation

\begindemo
%x^3+px=q, p,q\ge0
$$\root3\of{\sqrt{p^3/27-q^2/4}+
  q/2}-\root3\of{\sqrt{p^3/27+
  q^2/4}-q/2}$$
!yields
$$\root3\of{\sqrt{p^3/27-q^2/4}+q/2}-
 \root3\of{\sqrt{p^3/27+q^2/4}-q/2}$$
\enddemo

\blueexample Derivatives

The problem is the three dotted derivative, ^^{derivatives}
\TB~{\oldstyle136}.
\begindemo
$$\dot y\,\ddot y\, 
  \skew3\dot{\ddot y}\quad
  y'\,y''\,y'''        \quad
\partial_xy\,\partial_x^2y\,
\partial_x^3y$$
!yields
$$\dot y\,\ddot y\, 
  \dot{\ddot y\kern2pt}\quad
  y'\,y''\,y'''        \quad
\partial_xy\,\partial_x^2y\,
\partial_x^3y$$
\enddemo

\blueexample Bessel equation

^^{Bessel equation}
\begindemo
$$z^2w''+zw'+(z^2-\nu^2)w=0$$
solutions:
$J_{\pm\nu}(z)$, 
$Y_{\pm\nu}(z)$, 
$H_\nu^{(1)}(z)$,  
$H_\nu^{(2)}(z)$
!yields
$$z^2w''+zw'+(z^2-\nu^2)w=0$$
solutions:
$J_{\pm\nu}(z)$, 
$Y_{\pm\nu}(z)$, 
$H_\nu^{(1)}(z)$, 
$H_\nu^{(2)}(z)$
\enddemo

\blueexample Primed summation symbols and split formula

Subtle use of the prime and the right font. 
Nice is the nested use of the coercions \cs{mathop} and 
\cs{mathrel}. A minor detail is to preserve the dyadic 
character of the + in the last term. \cs{acclap} is
incorporated in \bluetex. See \TB{} ex{\oldstyle18}.{\oldstyle44}.
\begindemo
$$\displaylines{
  \mathop{{\sum}\acclap'}_{k=0}^n
  a_kT_k(x)
  \mathrel{\mathop=^{\rm def}}
 .5\kern1pt a_0+a_1 x+a_2T_2(x)+
  \cdots                  \hss\cr
  \hfill{}+a_nT_n(x)}$$
!yields
$$\displaylines{
     \mathop{{\sum}\acclap'}_{k=0}^n
 a_kT_k(x)\mathrel{\mathop=^{\rm def}}
 .5\kern1pt a_0+a_1 x+a_2T_2(x)+\cdots
                               \hss\cr
                \hfill{}+a_nT_n(x)}$$
\enddemo
\exercise How can we prevent the line distance from growing larger 
          than the regular value?
\answer Give the summation symbol depth 0.

\blueexample Hypergeometric function

^^{hypergeometric function}
Subtle subscripting, size of parentheses, and positioning of arguments. 
\begindemo
$$M_n(z)={}_{n+1}F_n\Bigl({k+a_0,
   \atop\phantom{kc_1}}
   {k+a_1,\dots,k+a_n
   \atop k+c_1,\dots,k+c_n};z\Bigr)
$$
!yields
$$M_n(z)={}_{n+1}F_n\Bigl({k+a_0,
   \atop\phantom{kc_1}}
   {k+a_1,\dots,k+a_n
   \atop k+c_1,\dots,k+c_n};z\Bigr)
$$
\enddemo
\exercise Why has the \cs{phantom} argument |kc_1|?
\answer   It could have been anything representative for the lower part.
          With the k and the subscript in the \cs{phantom} we are sure
          that the vertical positioning will be OK.

%end answer
\blueexample From \TB{} {\oldstyle177}, (p)matrix as formula part. % 
             proclaim is used too

\begindemo
\proclaim Definition. $x$ is called 
an eigenvector with 
eigenvalue $\lambda$ of the matrix
$$A=\pmatrix{
    a_{11}&a_{12}&\ldots&a_{1n}\cr
    a_{21}&a_{22}&\ldots&a_{2n}\cr
    \vdots&\vdots&\ddots&\vdots\cr
    a_{n1}&a_{n2}&\ldots&a_{nn}\cr}$$
if $Ax=\lambda x$.
\par
!yields
\proclaim Definition. $x$ is called 
an eigenvector with 
eigenvalue $\lambda$  
of the matrix
$$A=\pmatrix{
    a_{11}&a_{12}&\ldots&a_{1n}\cr
    a_{21}&a_{22}&\ldots&a_{2n}\cr
    \vdots&\vdots&\ddots&\vdots\cr
    a_{n1}&a_{n2}&\ldots&a_{nn}\cr}$$
if $Ax=\lambda x$.

\enddemo%blank line is necessary

\blueexample Split equation and context-sized delimiters

\begindemo
From Swanson (1986, Section 3.3
              Math in Display)
Because it is a large formula
I used \displaylines. 
For the integral we need \nolimits
to inactivate the default placement
of limits.
Furthermore, there is subtle use of
subscripting and delimiters of
varying sizes.
Finally the shifting of parts
has to handled corrrectly.
See the script for the details.
!yields
$$\displaylines{
  \int\nolimits_U\delta(I)\mu(I)
                   \leq{}\hfill\cr
  \quad{}\sum_{{\cal D}}
         \sum_{{\cal D}_{I'}}
  \biggl[\int\nolimits_J
  \alpha(J')\mu(J')-\alpha(J)\mu(J)
                         \hfill\cr
  \hfill    {}-\int\nolimits_J
    [\{s(\alpha\eta)(J')\}
       /\eta(J')]\mu(J')\biggr]\cr
  \quad{}+\biggl[
       \sum_{{\cal D}}
       \sum_{{\cal D}_{I'}}
   |\alpha(J)-[\{s(\alpha\eta)(J)\}
   /\eta(J)]|\mu(J)\biggr]\hfill\cr
  \hfill
   {}\times\biggl[
       \sum_{{\cal D}}
       \sum_{{\cal D}_{I'}}
   |\alpha(J)-[\{s(\alpha\eta)(J)\}
   /\eta(J)]|\eta(J)\biggr] \cr} $$
\enddemo

\blueexample Rhombus scheme

^^{rhombus\ scheme}
\begindemo
The idea is to align vertically.
Pseudo markup reads
\setbox\ru={</ line>}
\setbox\rl={<\ line>}
$$\halign{<template>\cr
1st &   &e...\cr
    &\ru&    &\rl&    \cr
q...&   &    &   &q...\cr
    &\rl&    &\ru&    \cr
    &   &e...&\omit...
              \hidewidth\cr}$$
For the details consult the script.
!yields
{\hfuzz=30pt
\newbox\ru %
\newbox\rl %
\setbox\ru=\hbox{\unitlength=1ex
   \xdim{4}\ydim{2}
   \beginpicture
     \put(0,0){\line(2,1){4}}
   \endpicture}
%\diagline . 4ex wd +2ex ht\relax}%
\setbox\rl=\hbox{\unitlength=1ex
   \xdim{4}\ydim{2}
   \beginpicture
     \put(0,2){\line(2,-1){4}}
   \endpicture}
%\diagline . 4ex wd -2ex ht\relax}%
$$\quad\vbox{\offinterlineskip
\halign to\displaywidth
{\tabskip=0pt   \hfil$#$%left element
&\hfil$\vcenter{#}$\hfil%left lines
&\hfil$#$\hfil          %middle elements
&\hfil$\vcenter{#}$\hfil%right lines
&$#$\hfil               %right elements
\tabskip=\centering\cr  %end template
1^{st}\/{\rm RS}\hfill
         & &e^{(s)}_k&&     \cr
&\copy\ru& &\copy\rl&       \cr
q^{(s+1)}_k&&&&q^{(s)}_{k+1}\cr
&\copy\rl& &\copy\ru&       \cr
&     &e^{(s+1)}_k
   &\omit$={q^{(s)}_{k+1}\over q^{(s
+1)}_k}\,e^{(s)}_k$\hfil\hidewidth\cr
\noalign{\vskip1ex}
2^{nd}\/{\rm RS}\hfill
         & &q^{(s)}_k&&     \cr
&\copy\ru& &\copy\rl&       \cr
e^{(s+1)}_{k+1}&&&&e^{(s)}_k\cr
&\copy\rl& &\copy\ru&       \cr
&     &q^{(s+1)}_k
   &\omit$=q^{(s)}_k+(e^{(s)}_k-
    e^{(s+1)}_{k+1})$\hfil\hidewidth
                    \cr}%end halign
}% end vbox element
$$}
\enddemo

\blueexample Commutative diagram, confer \TB{} ex{\oldstyle18}.{\oldstyle46}

Nice use of two-sided \cs{hidewidth}, ^^{commutative diagram}
and the subtle \cs{strut} to place the superscript of {$\cal F$}.
There is no strict alignment. The elements at the nodes overflow
into the space of the arrows. As a consequence we need arrows of
various lengths.
\begindemo
\let\normalbaselines
    \adaptedbaselines
$$\matrix{
  f&\lmapright\otimes&a_f\cr
  \mapdown{{\cal F}}&&\mapup{%
           {\cal F}\strut^{-}}\cr
  \hidewidth{\cal F}(f)\hidewidth
    &\mapright\times\hfil&
    \hidewidth\bigl({\cal F}(f)
         \bigr)^2\hidewidth\cr}$$
!yields
\let\normalbaselines\adaptedbaselines
$$%Diagram
\matrix{f&\lmapright\otimes&a_f\cr
    \mapdown{{\cal F}}&&\mapup{%
            {\cal F}\strut^{-}}\cr
    \hidewidth{\cal F}(f)\hidewidth
    &\mapright\times\hfil&
    \hidewidth\bigl({\cal F}(f)
          \bigr)^2\hidewidth\cr}$$
\enddemo

\blueexample Partitioning

^^{partitioning}
\begindemo
$$\def\data{$I_{n-r}$\cs 0       \rs
                0\cs $I-2v_rv_r^T$}
P_r=\left(\vcenter{\ruled
          \btable\data}\right)$$
!yields
$$\def\lft{\hfil$}\def\rgt{$\hfil}
\def\data{I_{n-r}\cs 0       \rs
                0\cs I-2v_rv_r^T}
P_r=\left(\vcenter{\ruled
          \btable\data}\right)$$
\enddemo
\exercise How can we avoid \$-s in the  markup of the data?
\answer Define \cs{lft} and \cs{rgt} equal to \$ with
        \cs{hfil} added left, respectively right, for centering.

\exercise How can we construct partitioned matrices in general?
\answer Make use of nested tables. Consider the partitioned matrix,
        a \cs{ruled}\cs{btable}, to be built from blocks  
        with each block a non-ruled matrix.

%end answer

\blueexample Continued fractions with alignment on =, and interruption

^^{continued fraction}
\begindemo
Many details come together in
this markup. Not in the least
the alignment on = where one is
an =-def. Also the space
saving variants, borrowed from
literature are relevant.
The special `\over'-line is a 
poor man's use of \atop and 
\over, because \over is a
primitive.
Peruse the script. 
!yields
\def\cfsym{\mathop{\grkop \Phi}}
$$\eqalignno{
1+\cfsym_{k=1}^n{a_k\over b_k}
&{}\buildrel{\rm def}\over=
 1+{a_1\over\displaystyle b_1+
   {\strut a_2\over\strut
    \vrule height3ex width0pt\relax
    \displaystyle b_2 +
     \lower2.0ex\hbox{$\ddots\,
      \lower1.25ex\hbox{$+
      {\displaystyle a_{n-1}\over
        \displaystyle b_{n-1}+
                 {\strut a_n\over
           \displaystyle b_n}}$}
                        $}
    }
   }\cr
\noalign{%\noindent %not necessary
with (space saving)
         variant notations}
&{}\buildrel{\rm\phantom{def}}\over=
1+\cf{a_1}{b_1}+\cf{a_2}{b_2}+\cdots+\cf{a_n}{b_n}\cr
%
&{}\buildrel{\rm\phantom{def}}\over=
1+
{a_1\over\textstyle\strut
    \vrule height2.5ex width0pt
    b_1\,+\,}
{a_2\over\textstyle\strut
    \vrule height2.5ex width0pt
    b_2\,+\,}
    \cdots
{a_n\over\textstyle\strut
    \vrule height2.5ex width0pt
    b_n}
\cr}%end\eqalignno
$$
\enddemo
\exercise How can we  replace the division line by $\cf{}{}$ \ ?
\answer This is an open problem. If you have an elegant solution,
        let me know.

%end answer
\blueexample Context sensitivity

Certain accents can grow a little with what has to be accented, \TB~{\oldstyle136}. 
^^{context sensitivity}^^{accents in math}
\begindemo
$$\widehat{xy},
 \widetilde{xyz}$$
!yields
$$\widehat{xy},
  \widetilde{xyz}$$
\enddemo

\blueexample Matrix equation

^^{matrix equation}
\begindemo
$$\displaylines{\indent
\bordermatrix{
   &      &\rm A &      \cr
   &\times&\times&\times\cr
   &\times&\times&\times\cr
   &\times&\times&\times}
\bordermatrix{
   & &\rm N & \cr
   &1&      & \cr
   &0&1     & \cr
   &0&\times&1}
\hfill\cr\hfill=
\bordermatrix{& &\rm N & \cr
              &1&      & \cr
              &0&1     & \cr
              &0&\times&1}
\bordermatrix{
   &      &\rm H &      \cr
   &\times&\times&\times\cr
   &\times&\times&\times\cr
   &0     &\times&\times}
}$$
!yields
$$\displaylines{\indent
\bordermatrix{&      &\rm A &      \cr
              &\times&\times&\times\cr
              &\times&\times&\times\cr
              &\times&\times&\times\cr}
\bordermatrix{& &\rm N & \cr
              &1&      & \cr
              &0&1     & \cr
              &0&\times&1\cr}\hfill\cr
\hfill=
\bordermatrix{& &\rm N & \cr
              &1&      & \cr
              &0&1     & \cr
              &0&\times&1\cr}
\bordermatrix{&      &\rm H &      \cr
              &\times&\times&\times\cr
              &\times&\times&\times\cr
              &0     &\times&\times\cr}
}$$
\enddemo


\blueexample Braces and matrices

^^{braces and matrices}
\begindemo
This is a complex problem, with a lot 
of fine-tuning. However, it is 
possible to systemize much. 
The approach is to look at it as
a bordered table with a 
parenthesized matrix as data.
The handling of the row stub and
the header are separated from
the data (the pmatrix). 
The pseudo code reads as follows.
\setbox1=\hbox{$\pmatrix{<data>}$}
Define header and row stub list, and
switch off defaults of btable, 
especially the separators. 
Finally invoke
$$\btable{$\vcenter{\copy1}$}$$.
Alignment left braces courtesy 
Alan Jeffrey communicated by
J\"org Knappen.
For the details see the script.
!yields
\def\fatlbrace{\delimiter"4000338 }
%Set the block
\setbox1=\hbox{$\pmatrix{%
\times&\times&\times&\times&\times&\times&\times\cr
0     &\times&\times&\times&\times&\times&\times\cr
0     &0     &\times&\times&\times&\times&\times\cr
0     &0     &0     &\times&\times&\times&\times\cr
0     &0     &0     &0     &\times&\times&\times\cr
0     &0     &0     &0     &\times&\times&\times\cr
0     &0     &0     &0     &\times&\times&\times}$}
%Define header and row stub list (each one element)
\def\header{\hbox to\wd1{\hfil
$\overbrace{\vrule height0pt width.4\wd1  depth0pt}^p$\hfil
$\overbrace{\vrule height0pt width.3\wd1 depth0pt}^{n-p}$\hfil}}
\tvsize=\ht1\advance\tvsize\dp1
\def\rowstblst{{$\vcenter to\tvsize{\vss
  \hbox{${\scriptstyle\phantom{n{-}}p}
    \left\fatlbrace\vrule height.55\ht1 width0pt depth 0pt\right.$}\vss
  \hbox{${\scriptstyle n{-}p}
    \left\fatlbrace\vrule height.15\ht1 width0pt depth 0pt\right.$}\vss}$}}
%
\def\data{$\vcenter{\copy1}$}
%Switch off defaults in btable
\let\rowstbsep\relax%kind of row stub separator
\let\headersep\relax%kind of header separator
\let\colsepsurround\relax%space around column separator
\def\hs{\cr\nxtrs}%function of header separator: yield next row stub
$$\vcenter{\btable\data}$$
\enddemo

\exercise Add partitioning to the braces and matrices example.
\answer In pic.dat a trial-and-error solution is included.
        Not elegant. Improve, enjoy, and let me know!

\endinput
\bye