groff
[Top][All Lists]
Advanced

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

[Groff] xref.tmac & mm and refer?


From: Robert D. Goulding
Subject: [Groff] xref.tmac & mm and refer?
Date: Fri, 4 Oct 2002 17:18:44 -0400 (EDT)

Someone mentioned recently that they were going to put the mm
cross-reference macros into a separate package (xref.tmac, say) for use
with other macro sets.  I tried this quite some time ago, and it seemed to
work - but I haven't tested it at all rigorously.  Attached below is the
qrf section of mm, adapted for use with ms.  There are probably some
errors, so please check it out.

While on the subject: why is it that mm has no refer support?  Is this for
historical reasons - and is there any great opposition to adding it?  It
seems to me that it would be pretty easy to adapt the refer support in ms
for mm.  I tried it recently and got it to work, but the formatting looked
terrible because I couldn't figure out how to translate ms internal
macros etc to mm ones.  Does anyone want to take this on?  mm with refer
really would be a complete macro set for a large project.

Robert.

-- 
Robert Goulding
Society of Fellows
Joseph Henry House
Princeton NJ 08544

Begin xref.tmac
.ie !r Ref \{\
.       nr Ref 0
.\}
.el .warn 0
.\"########################### module qrf ############################
.\" forward and backward reference thru special files.
.\"
.\" init reference system
.de INITR
.ds qrf*file \\$1.qrf
.nr qrf*pass 2
.if \\n[D]>1 .tm INITR: source \\*[qrf*file]
.ie \\n[Ref] \{\
.       tm .\\\\" Rfilename: \\*[qrf*file]
.\}
.el 'so  \\*[qrf*file]
..
.\"---------------
.\" set a reference.
.de SETR
.if \\n[.$]<1 address@hidden "SETR:reference name missing"
.if !r qrf*pass .tm "SETR: No .INITR in this file"
.if \\n[Ref] \{\
.       ds qrf*name qrf*ref-\\$1
.       if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[SN],\\n[%]
.       \" heading-number
.       ds \\*[qrf*name]-hn \\*[SN]
.       \" page-number
.       ds \\*[qrf*name]-pn \\n[%]
.       \"
.       if \\n[Ref] \{\
.               tm .ds \\*[qrf*name]-hn \\*[SN]
.               tm .ds \\*[qrf*name]-pn \\n[%]
.               if !'\\$2'' .tm .ds \\*[qrf*name]-xx \\$2
.       \}
.\}
..
.\"---------------
.\" get misc-string
.\" If two arg -> set var. arg to misc-string.
.de GETST
.if \\n[.$]<1 address@hidden "GETST:reference name missing"
.if !r qrf*pass .tm "GETST: No .INITR in this file"
.ds qrf*name qrf*ref-\\$1
.       if d \\*[qrf*name]-xx \{\
.               ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
.               el \\*[\\*[qrf*name]-xx]\c
.       \}
.\}
..
.\"---------------
.\" get header-number
.\" If two arg -> set var. arg to header-number.
.de GETHN
.if \\n[.$]<1 address@hidden "GETHN:reference name missing"
.if !r qrf*pass .tm "GETHN: No .INITR in this file"
.ds qrf*name qrf*ref-\\$1
.if d \\*[qrf*name]-hn \{\
.       ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
.       el \\*[\\*[qrf*name]-hn]\c
.\}
..
.\"---------------
.\" get page-number
.\" If two arg -> set var. arg to page-number.
.de GETPN
.if \\n[.$]<1 address@hidden "GETPN:reference name missing"
.if !r qrf*pass .tm "GETPN: No .INITR in this file"
.ds qrf*name qrf*ref-\\$1
.if d \\*[qrf*name]-pn \{\
.       ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
.       el \\*[\\*[qrf*name]-pn]\c
.\}
..
.\"----------
.de GETR
.if \\n[.$]<1 address@hidden "GETR:reference name missing"
.ie !r qrf*pass \{\
.       tm "GETR: No .INITR in this file"
.\}
.el \{\
.       GETHN \\$1 Qrfh
.       GETPN \\$1 Qrfp
\\*[Qrf]
.\}
..
.de SETRF
.SETR \\$1 \\n[fn*note-num]
..

End xref.tmac


reply via email to

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