=================================================================== RCS file: /cvs/mandoc/eqn.7,v retrieving revision 1.32 retrieving revision 1.39 diff -u -p -r1.32 -r1.39 --- mandoc/eqn.7 2015/01/20 19:39:34 1.32 +++ mandoc/eqn.7 2020/01/10 11:55:04 1.39 @@ -1,4 +1,4 @@ -.\" $Id: eqn.7,v 1.32 2015/01/20 19:39:34 schwarze Exp $ +.\" $Id: eqn.7,v 1.39 2020/01/10 11:55:04 schwarze Exp $ .\" .\" Copyright (c) 2011 Kristaps Dzonsons .\" Copyright (c) 2014 Ingo Schwarze @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 20 2015 $ +.Dd $Mdocdate: January 10 2020 $ .Dt EQN 7 .Os .Sh NAME @@ -44,59 +44,47 @@ specification (see .Sx SEE ALSO for references). .Pp -Equations within -.Xr mdoc 7 -or -.Xr man 7 -documents are enclosed by the standalone -.Sq \&.EQ -and -.Sq \&.EN -tags. -Equations are multi-line blocks consisting of formulas and control -statements. -.Sh EQUATION STRUCTURE -Each equation is bracketed by -.Sq \&.EQ -and -.Sq \&.EN -strings. -.Em Note : -these are not the same as -.Xr roff 7 -macros, and may only be invoked as -.Sq \&.EQ . +An equation starts with an input line containing exactly the characters +.Sq \&.EQ , +may contain multiple input lines, and ends with an input line +containing exactly the characters +.Sq \&.EN . +Equivalently, an equation can be given in the middle of a single +text input line by surrounding it with the equation delimiters +defined with the +.Cm delim +statement. .Pp The equation grammar is as follows, where quoted strings are case-sensitive literals in the input: .Bd -literal -offset indent eqn : box | eqn box box : text - | \*q{\*q eqn \*q}\*q - | \*qdefine\*q text text - | \*qndefine\*q text text - | \*qtdefine\*q text text - | \*qgfont\*q text - | \*qgsize\*q text - | \*qset\*q text text - | \*qundef\*q text - | \*qsqrt\*q box + | \(dq{\(dq eqn \(dq}\(dq + | \(dqdefine\(dq text text + | \(dqndefine\(dq text text + | \(dqtdefine\(dq text text + | \(dqgfont\(dq text + | \(dqgsize\(dq text + | \(dqset\(dq text text + | \(dqundef\(dq text + | \(dqsqrt\(dq box | box pos box | box mark - | \*qmatrix\*q \*q{\*q [col \*q{\*q list \*q}\*q ]* - | pile \*q{\*q list \*q}\*q + | \(dqmatrix\(dq \(dq{\(dq [col \(dq{\(dq list \(dq}\(dq]* \(dq}\(dq + | pile \(dq{\(dq list \(dq}\(dq | font box - | \*qsize\*q text box - | \*qleft\*q text eqn [\*qright\*q text] -col : \*qlcol\*q | \*qrcol\*q | \*qccol\*q | \*qcol\*q -text : [^space\e\*q]+ | \e\*q.*\e\*q -pile : \*qlpile\*q | \*qcpile\*q | \*qrpile\*q | \*qpile\*q -pos : \*qover\*q | \*qsup\*q | \*qsub\*q | \*qto\*q | \*qfrom\*q -mark : \*qdot\*q | \*qdotdot\*q | \*qhat\*q | \*qtilde\*q | \*qvec\*q - | \*qdyad\*q | \*qbar\*q | \*qunder\*q -font : \*qroman\*q | \*qitalic\*q | \*qbold\*q | \*qfat\*q + | \(dqsize\(dq text box + | \(dqleft\(dq text eqn [\(dqright\(dq text] +col : \(dqlcol\(dq | \(dqrcol\(dq | \(dqccol\(dq | \(dqcol\(dq +text : [^space\e\(dq]+ | \e\(dq.*\e\(dq +pile : \(dqlpile\(dq | \(dqcpile\(dq | \(dqrpile\(dq | \(dqpile\(dq +pos : \(dqover\(dq | \(dqsup\(dq | \(dqsub\(dq | \(dqto\(dq | \(dqfrom\(dq +mark : \(dqdot\(dq | \(dqdotdot\(dq | \(dqhat\(dq | \(dqtilde\(dq | \(dqvec\(dq + | \(dqdyad\(dq | \(dqbar\(dq | \(dqunder\(dq +font : \(dqroman\(dq | \(dqitalic\(dq | \(dqbold\(dq | \(dqfat\(dq list : eqn - | list \*qabove\*q eqn + | list \(dqabove\(dq eqn space : [\e^~ \et] .Ed .Pp @@ -125,7 +113,7 @@ int (integral), sum (summation), grad (gradient), del differential), times (multiply), cdot (center-dot), nothing (zero-width space), approx (approximately equals), prime (prime), half (one-half), partial (partial differential), inf (infinity), >> (much greater), << -(much less), \-> (left arrow), <\- (right arrow), +\- (plus-minus), != +(much less), <\- (left arrow), \-> (right arrow), +\- (plus-minus), != (not equal), == (equivalence), <= (less-than-equal), and >= (more-than-equal). The character escape sequences documented in @@ -146,7 +134,7 @@ is used as the delimiter for the value .Ar val . This allows for arbitrary enclosure of terms (not just quotes), such as .Pp -.D1 Cm define Ar foo 'bar baz' +.D1 Cm define Ar foo \(aqbar baz\(aq .D1 Cm define Ar foo cbar bazc .Pp It is an error to have an empty @@ -166,8 +154,8 @@ created. Definitions can create arbitrary strings, for example, the following is a legal construction. .Bd -literal -offset indent -define foo 'define' -foo bar 'baz' +define foo \(aqdefine\(aq +foo bar \(aqbaz\(aq .Ed .Pp Self-referencing definitions will raise an error. @@ -178,6 +166,25 @@ statement is a synonym for while .Cm tdefine is discarded. +.It Cm delim +This statement takes a string argument consisting of two bytes, +to be used as the opening and closing delimiters for equations +in the middle of text input lines. +Conventionally, the dollar sign is used for both delimiters, +as follows: +.Bd -literal -offset indent +\&.EQ +delim $$ +\&.EN +An equation like $sin pi = 0$ can now be entered +in the middle of a text input line. +.Ed +.Pp +The special statement +.Cm delim off +temporarily disables previously declared delimiters and +.Cm delim on +reenables them. .It Cm gfont Set the default font of subsequent output. Its syntax is as follows: @@ -434,7 +441,7 @@ implementation (including GNU troff). .Bl -dash -compact .It The text string -.Sq \e\*q +.Sq \e\(dq is interpreted as a literal quote in troff. In mandoc, this is interpreted as a comment. .It @@ -457,11 +464,6 @@ The and .Cm down Ar n commands are also ignored. -.It -Inline equations and the -.Cm delim -control statement are not yet implemented in -.Xr mandoc 1 . .El .Sh SEE ALSO .Xr mandoc 1 , @@ -475,7 +477,7 @@ control statement are not yet implemented in .%T System for Typesetting Mathematics .%J Communications of the ACM .%V 18 -.%P 151\(en157 +.%P pp. 151\(en157 .%D March, 1975 .Re .Rs