Article View: comp.text
Article #3964Constant-width macros for MM
From: Dave Wolverton
Date: Wed, 26 Aug 1987 19:37
Date: Wed, 26 Aug 1987 19:37
71 lines
3503 bytes
3503 bytes
This posting contains a set of ditroff macros to supplement MM to provide
the same capabilities for constant-width (i.e. "typewriter") font which
the MM macro package provides for the Roman, italic, and bold fonts.
My initial approach was to copy the corresponding code for the existing
comparable macros from MM, but the code was so convoluted that I could never
have maintained it. This is my first attempt at writing a nontrivial macro,
so please excuse my (no doubt) amateur coding style.
The meaning is thus:
.C if 0 arguments, change the current font to the CW font;
if > 0 arguments, print the arguments in alternating fonts,
first in CW font, then in the current font, etc., up to
6 arguments, with no intervening whitespace
.CR like .C but alternate between CW and R fonts; 0 args is illegal
.CI like .C but alternate between CW and I fonts; 0 args is illegal
.CB like .C but alternate between CW and B fonts; 0 args is illegal
.RC like .C but alternate between R and CW fonts; 0 args is illegal
.IC like .C but alternate between I and CW fonts; 0 args is illegal
.BC like .C but alternate between B and CW fonts; 0 args is illegal
I have used these for about 6 months, outputting to an Imagen 8/300. In that
time the only strange behavior (which I would like to know how to fix) is:
1) There is a slight, but noticable, gap of space in front of a word set in
constant width type with any of .C, .CR, .CI, .CB
2) If the left margin is indented, such as by a display, TABs on the input may
cause different column alignment than on a terminal. (This may be inherent
in the CW font.)
Enjoy!
Dave Wolverton
AT&T
ihnp4!houxs!daw
---------------------------------------------------------------------------
\" Constant-width macros for MM by David Wolverton (ihnp4!houxs!daw).
\" Please send any useful modifications to the author.
.de C
.if \\n(.$>6 .tm Error: .C macro called w/ >6 arguments
.if \\n(.$=0 .ft CW
.if \\n(.$>0 \f(CW\\$1\fP\\$2\f(CW\\$3\fP\\$4\f(CW\\$5\fP\\$6
..
.de CR
.if (\\n(.$<1 || \\n(.$>6) .tm Error: .CR macro called w/ <1 or >6 arguments
\f(CW\\$1\fP\fR\\$2\fP\f(CW\\$3\fP\fR\\$4\fP\f(CW\\$5\fP\fR\\$6\fP
..
.de CI
.if (\\n(.$<1 || \\n(.$>6) .tm Error: .CI macro called w/ <1 or >6 arguments
\f(CW\\$1\fP\fI\\$2\fP\f(CW\\$3\fP\fI\\$4\fP\f(CW\\$5\fP\fI\\$6\fP
..
.de CB
.if (\\n(.$<1 || \\n(.$>6) .tm Error: .CB macro called w/ <1 or >6 arguments
\f(CW\\$1\fP\fB\\$2\fP\f(CW\\$3\fP\fB\\$4\fP\f(CW\\$5\fP\fB\\$6\fP
..
.de RC
.if (\\n(.$<1 || \\n(.$>6) .tm Error: .RC macro called w/ <1 or >6 arguments
\fR\\$1\fP\f(CW\\$2\fP\fR\\$3\fP\f(CW\\$4\fP\fR\\$5\fP\f(CW\\$6\fP
..
.de IC
.if (\\n(.$<1 || \\n(.$>6) .tm Error: .IC macro called w/ <1 or >6 arguments
\fI\\$1\fP\f(CW\\$2\fP\fI\\$3\fP\f(CW\\$4\fP\fI\\$5\fP\f(CW\\$6\fP
..
.de BC
.if (\\n(.$<1 || \\n(.$>6) .tm Error: .BC macro called w/ <1 or >6 arguments
\fB\\$1\fP\f(CW\\$2\fP\fB\\$3\fP\f(CW\\$4\fP\fB\\$5\fP\f(CW\\$6\fP
..
Technical Details
Message-ID:
<507@houxs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ames!lll-tis!ptsfa!ihnp4!homxb!houxs!dawShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ames!lll-tis!ptsfa!ihnp4!homxb!houxs!daw From: daw@houxs.UUCP (Dave Wolverton) Newsgroups: comp.text Subject: Constant-width macros for MM Message-ID: <507@houxs.UUCP> Date: Wed, 26-Aug-87 15:37:14 EDT Article-I.D.: houxs.507 Posted: Wed Aug 26 15:37:14 1987 Date-Received: Fri, 28-Aug-87 07:24:52 EDT Organization: AT&T, Holmdel, NJ Lines: 71 Keywords: ditroff CW