[comp.unix.questions] Need information for using man and mm together

jdw1@whuts.UUCP (WILLIAMS) (01/08/88)

Has anyone written a shell script that utilizes the mm and man
macros in the same document?  I am having some trouble getting
the two packages to run in the same document, and would appreciate
hearing from anyone who has encountered this problem and found
a solution.

I have experimented with several different scripts and am convinced
that the combination of the two packages is possible, but I seem
to continue doing something wrong.

Thanks in advance.

John Williams      ..!whuts!jdw1

gwyn@brl-smoke.ARPA (Doug Gwyn ) (01/08/88)

In article <3532@whuts.UUCP> jdw1@whuts.UUCP (WILLIAMS) writes:
>Has anyone written a shell script that utilizes the mm and man
>macros in the same document?

Some, maybe most, implementations of troff simply do not support
two -m options at the same time.  However, since the -m option is
just an abbreviation for a file name, you can explicitly name the
file(s) instead.  Usually, for example, -mm corresponds to
/usr/lib/tmac/tmac.m

Be aware that macro packages keep state information in various
troff number registers, and assume certain conventions, so two
concurrent macro packages could easily step on each other's toes.
I don't know if this is true of -mm and -man.

wnp@killer.UUCP (Wolf Paul) (01/08/88)

In article <3532@whuts.UUCP> jdw1@whuts.UUCP (WILLIAMS) writes:
>
>Has anyone written a shell script that utilizes the mm and man
>macros in the same document?  I am having some trouble getting
>the two packages to run in the same document, and would appreciate
>hearing from anyone who has encountered this problem and found
>a solution.
>
>I have experimented with several different scripts and am convinced
>that the combination of the two packages is possible, but I seem
>to continue doing something wrong.

I would be extremely interested in the general manner in which you
think that can be done.

From my experience with troff and macro packages it would be nearly
impossible to use them together; the only alternative I can think
of would be a sed or awk script which would convert requests unique
to one macro package into equivalent requests for the other macro
package.

What is the purpose or application for this effort, by the way?

Wolf Paul
ihnp4!killer!wnp

pls@sortac.UUCP (Pat Sullivan) (01/11/88)

In article <2721@killer.UUCP> wnp@killer.UUCP (Wolf Paul) writes:
>In article <3532@whuts.UUCP> jdw1@whuts.UUCP (WILLIAMS) writes:
>>Has anyone written a shell script that utilizes the mm and man
>>macros in the same document?  ...
I replied to this in att.unix, then saw the same request and several replies
but no answerts here ... I'm reposting my followup below in case anyone
who's interested missed the reply there.

>What is the purpose or application for this effort, by the way?
We use it mainly for things like lists on manual pages.

This reply addresses straight DWB2.0; if you're using something different,
your solution will probably be similar, but not exactly the same.

The real problem is that ``man'' and ``mm'' use the same internal macro and
register names for different things.  
The source files for the macros are under /usr/src/cmd/text/macros.d: an.src
is for man, mmt.src is for mm with troff, and mmn.src is for mm with nroff.
We edited an.src to use only names that were not used by mmn.src or mmt.src
for its internal stuff.

The following substitutions worked for us:
	CHANGE	TO
	------	--
	)E	)e
	)I	)H
	)L	)c
	)M	)d
	)R	)P
	)p	)g
	)s	)i
	)t	)j
	:U	:K
	:m	:O
	}f	}s

We occasionally have problems when we do *NOT* use the ``-rs1'' argument
for reduced size pages; I can't recall a failure that was not due to bad
input when ``-rs1'' *WAS* specified.  Typical command line:

	troff -Tlj -man -mm -rs1 | dlj | lp

===================================================================
Pat Sullivan - {gatech|akgua|ihnp4}!sortac!pls - voice 404-257-7382