.\"	MACROES FOR EQUATIONS (file tmac.q5)
.\"
.\"		Th.A. Zoethout
.\"
.de EQ			\" START EQUATION
.\"	.EQ [$1] [$2] [ $3 $4 ] [ $5 $6 ] [$7]
.			\" $1 = Indented, Centered { C }
.			\" $2 = indent from Left margin (I) { 0 }
.			\" $3 = Left numbered, Right numbered {  }
.			\" $4 = equation number { }
.			\" $5 = Right numbered, Left numbered {  }
.			\" $6 = equation number { }
.			\" $7 = preceding vertical spacing { \n(VS }
.			\" eqn checks against nested equations.
.\"	WARNING: For "inline" equations the (almost) only reasonable
.\"		 delimeter character is "$". All other seemingly useful
.\"		 characters could be generated by t(a)b(e)l.
.ch Id
.nr EQ 0
.nr EN 1
.ie \&\\$1\&I\& .nr EQ 1
.el .if !\&\\$1\&C\& .nr EN 0
.nr EN +1
.nr Ex 0
.ie (\\$\\n(EN)=(\\$\\n(EN) .nr Ex \\$\\n(ENm
.el .nr EN -1
.if \\n(EN=1 .if \\n(Ex>0  .nr EQ 1
.nr EN +1
.ds E1 "
.nr Et 0
.if \&\\$\\n(EN\&L\& .nr Et 1
.if \\n(Et=1 .nr EN +1
.if \\n(Et=1 .ds E1 \\$\\n(EN
.if \\n(Et=1 .nr EN +1
.ds E2 "
.nr Et 0
.if \&\\$\\n(EN\&R\& .nr Et 1
.if \\n(Et=1 .nr EN +1
.if \\n(Et=1 .ds E2 \\$\\n(EN
.if \\n(Et=1 .nr EN +1
.nr Et 0
.if \&\\$\\n(EN\&L\& .nr Et 1
.if \\n(Et=1 .nr EN +1
.if \\n(Et=1 .ds E1 \\$\\n(EN
.if \\n(Et=1 .nr EN +1
.ie \\n(EN=\\n(.$ .nr EN \\$\\n(.$
.el .nr EN 0-1
.ev 1
.if !\&\\n(.z\&\& .br
.di Ex
..
.de EN			\" END EQUATION
.\"	.EN [$1]
.			\" $1 = succeeding vertical spacing { \n(VS }
.ie !\&\\n(.z\&Ex\& .Er W ".EN: no matching .EQ
.el \{\
.br
.di
.ev
.rm Ex
.ie \\n(dn=0 .if !\&\\*(E1\\*(E2\&\& .Et \\$1
.el .Et \\$1
.rm E1
.rm E2
.rm 10
.rm 11
.rm 12
.rm 13
.rm 14
.rm 15
.rm 16
.rm 17
.rm 18
.rm 19
.rm 20
.rm 21
.rm 22
.rm 23
.rr EN
.rr E1
.rr E2
.rr Et
.rr Ex
.rr EQ
.rr 10
.rr 11
.rr 12
.rr 13
.rr 14
.rr 15
.rr 16
.rr 17
.rr 18
.rr 19
.rr 20
.rr 21
.rr 22
.rr 23 \}
..
.de Et			\" final rediversion of equation
.			\" $1 = succeeding vertical spacing { \n(VS }
.ie \\n(EN>=0 .sp \\n(ENv
.el .sp \\n(VSu
.ti \\n(.iu
.ne \\n(NDv
.rs
.nr EN \\n(.u
.if \\n(EN>0 .nf
.nr Et \\n(.lu-\\n(.iu
.if \\n(EQ=0 .nr E1 \\n(Etu-\\w\&\\*(E1\&u-\\w\&\\*(10\&u-\\w\&\\*(E2\&u/2u
.if \\n(EQ=1 .nr E1 \\n(Exu-\\w\&\\*(E1\&u
.if \\n(E1<1m .nr E1 1m
.nr E1 1m/2u+\\w\&\\*(E1\&u+\\n(E1u/1m*1m-\\w\&\\*(E1\&u
.nr E2 \\n(Etu-\\w\&\\*(E2\&u
.pc
\&\\*(E1\h#\\n(E1u#\\*(10\h#|\\n(E2u#\\*(E2
.pc %
.if \\n(EN>0 .fi
.ie \\n(.$>0 .sp \\$1v
.el .sp \\n(VSu
..
.\*($0
.rm $0
