Example using the eqn preprocessor:

After defining delimiters

 delim $$
the following can be used in line of text
 $$1 over 100$$ is less than $$1 smallover 1000$$

Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> : The following is only a version which I judge by eye to be about right, in that it seems to give the same results for the composed fraction when applied to "1/2" for which there is a single glyph.

 .de frac
 .nr n0 \\n[.s]
 .nr n1 \\n[n0]*6/10
 .nr dn (\\n[n0]-\\n[n1])*8/10

The macro now can be used:

 This is some fraction
 .frac 1 2
 as well as this
 .frac 999 1000
 Compare this \f[TR]\s[30]\(12 and this
 .frac 1 2
 or this
 .frac 999 1000

Jeff Conrad" <jeff_conrad?@msn.com> : A somewhat less elegant version that I wrote for use with MM about 20 years ago (and haven't bothered to update). The actual code uses real BEL characters for delimiters, as was the MM style.

 .\ ****************************************************************************
 .\"  FR: FRaction
 .\"  Usage: .FR <numerator> <denominator>
 .\"         .FR <numerator> <denominator> <anything>
 .\"         .FR <anything> <numerator> <denominator> <anything>
 .\" ****************************************************************************
 .de FR
 .ie \\n(.$>3 \{\
 .if ^G\\$3^G4^G \h'-.05m'\c
 .el \{\
 .if ^G\\$2^G4^G \h'-.05m'\c

Usage exampe of all three variants:

 Version 1:
 .FR 11 22
 and two:
 .FR 111 222 anything
 and three
 .FR anything 222 111 anything

Back to: GroffTips

Edit TypesetFractions FrontPage PageList RecentChanges PageHistory