Example using the eqn preprocessor:
After defining delimiters
.EQ delim $$ .ENthe 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 \v'-\\n[dn]p'\s[\\n[n1]]\\$1\s0\v'\\n[dn]p'\[f/]\s[\\n[n1]]\\$2\s0 ..
The macro now can be used:
This is some fraction .frac 1 2 as well as this .frac 999 1000 .sp 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 \{\ \%\&\\$1\^\ \v'-.3m'\s-4\&\\$2\s0\ \v'+.3m'\h'-.05m'\(f/\c .if ^G\\$3^G4^G \h'-.05m'\c \s-5\\$3\s0\^\\$4 .\} .el \{\ \%\&\v'-.3m'\s-4\&\\$1\s0\ \v'+.3m'\h'-.05m'\(f/\c .if ^G\\$2^G4^G \h'-.05m'\c \s-4\\$2\s0\ \^\\$3 .\} ..
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