groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] groff: eqn: Nicer round brackets


From: Ted Harding
Subject: [Groff] groff: eqn: Nicer round brackets
Date: Thu, 16 Dec 1999 21:11:11 -0000 (GMT)

Folks,

You who use groff/eqn for maths may like to try the following,
which makes vertically-extended (and slightly laterally
extended) round brackets where you used to do something
like

   left ( expression right )

before. Instead of building it as a vertical pile of bracket
components (which can lok ugly in PostScript), it takes a simple
"(" and scales it vertically (and, less so, horizontally).

It looks as though I have got it more or less right, but there's
probably room for minor tweaking.

Put the code below into your 'eqnrc' file, and use it like

   brkt{ expression }

instead of the above. NB This is only guaranteed to work for
the PostScript device (-Tps); reports for other devices are
welcome.

Cheers,
Ted.

----8<--- cut here ------------------
.de brktsrc
.nr 00d \\n[0d]u*2/3u
.nr 00h \\n[0h]u++(\\n[0d]u*2u)
.nr 00ps (\\n[00h]u-\\n[.ps]u)/5u
.nr 00dw \w'\s+[\\n[00ps]u]()\s0'u+(\w'n'u/2u)
.nr 00w \\n[0w]u+\\n[00dw]u)u+\\n[00dw]u
.nr 0w \\n[00w]u
.ds 0s \
\Z'\
\v'\\n[00d]u'\
\H'\\n[00h]u'\
\s+[\\n[00ps]u]\
\fR(\fP\
\s0\
\H'0'\v'-\\n[00d]u'\
\h'0.25n'\
\\*[0s]\
\v'\\n[00d]u'\
\h'0.25n'\
\H'\\n[00h]u'\
\s+[\\n[00ps]u]\
\fR)\fP\H'0'\
\s0\
\v'-\\n[00d]u'\
'\
\h'\\n[0w]u'
.rm 00d
.rm 00h
.rm 00ps
.rm 00dw
.rm 00w
..
.EQ
define brkt ' special brktsrc '
.EN
----8<--- cut here ------------------

NB The first chunk (above .EQ) should be OUTSIDE any .EQ ... .EN
pairs in the file, and must NOT introduce any blank lines.

The scond chunk (the line between .EQ ... .EN above) may be placed
anywhere within a .EQ ... .EN block in the file.

Or, of course, you can plant this in your troff source file for
any document.



--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Date: 16-Dec-99                                       Time: 21:11:10
                                                1306130 seconds left
------------------------------ XFMail ------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]