groff
[Top][All Lists]
Advanced

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

Re: [Groff] cross-references


From: ralph
Subject: Re: [Groff] cross-references
Date: Mon, 18 Mar 2002 23:22:47 +0000

Hi Erich,

> > If you're using the -mm macros then take a look at the groff_mm man
> > page and search for the INITR macro.  
> 
> I'm have been using -me, but gave it a try with -mm.  (Actually I
> thought that the Unix in a Nutshell was as exhaustive as the manpage,
> so I didn't look into it.  Will be more careful next time.)
> 
> OK. this ist not very flattery to my capacities, but the .INITR
> macros didn't work.  .INITR wants a filename.  Not the name of the
> input file, but which?

It wants the base of the two files mm stores the reference database in.
>From groff_mm(7).

       INITR filename
              Initialize the refencemacros.  References  will  be
              written  to filename.tmp and filename.qrf.

> SETR accepts a refname, but .GETPN prints the page number 2 lines
> away from the line where I call it, .GETST produces nothing.  No
> initr-.tmp or .qrf-files are produced, the one I touched myself have
> not been used, it seems.  (Debian Potato 2.2)

OK, here's a hacked version of a document where I used INITR.  It's
followed by the shell script I use to process the document twice, as
mentioned by groff_mm(7).  Afterwards, you can look at ref.qref and see
the database.

=============== start of ref.tr ========
.PH "''''"
.PF "''Page %.''"
.\"
.INITR ref
.ds Litb Table
.\"
.\" Make it easier to start a section.
.\"     .section "Title" refname [unnumbered]
.\"
.de section
.SP 2
.ds tmp "\\$1
.ie \\n[.$]<3 .H 1 "\\*[tmp]"
.el .HU "\\*[tmp]"
.SETR sect_\\$2 "\\n(H1, \fI\\*[tmp]\fP"
..
.de refsection
\&.refsection \\$1
.br
Section:
.GETST sect_\\$1
Section number:
.GETHN sect_\\$1
Page:
.GETPN sect_\\$1
.br
..
.\"
.EQ
delim $$
.EN
.\"
.pl 4i
.\"
.section "Introduction" intro
.\"
.refsection networktraf
.\"
.section "Database Corruption" dbcorrupt
.\"
.refsection searchimpact
.\"
.section "Network Traffic" networktraf
.\"
.P
Table
.GETST tbl_breakdown_packet
page
.GETPN tbl_breakdown_packet
\ shows...
.P
.DF
.TS
center;
l.
=
Table
_
Data
_
.TE
.TB "Breakdown of recorded packets." "" 0 tbl_breakdown_packet
.DE
.\"
.P
.refsection intro .
.\"
.section "Impact of Search on Performance" searchimpact
.\"
.refsection dbcorrupt
Table
.GETST tbl_search
page
.GETPN tbl_search
\ shows...
.P
.DF
.TS
center;
l.
=
Table
_
Data
_
.TE
.TB "Number of XXX select statements performed by search." "" 0 tbl_search
.DE
.\"
.P
Figure
.GETST fig_searchstat
page
.GETPN fig_searchstat
\ gives...
.P
.DF
.VERBON 16
Some example stats.
.VERBOFF
.FG "Example statistics from new search." "" 0 fig_searchstat
.DE
.\"
.P
No more.
=============== end of ref.tr ========

=============== start of ref.mk ========
#! /bin/bash

i=ref.tr
o=${i%%.tr}.ps
r=${i%%.tr}.qrf

groff -mm -e -t -z -Z -rRef=1 $i 2>$r.new || {
    cat $r.new
    exit 1
}
mv $r.new $r

groff -mm -e -t $i >$o
=============== end of ref.mk ========

Here, that produces correct page numbers, etc.  Hopefully, it's enough
for you to pick up what you need.  IIRC, you were originally interested
in adding reference macros of your own to your document.  If so, the mm
macro set source would be a good place to look.  The INITR, etc.,
macros are an easy read compared to some things.

> Either I return to LaTeX, or I read a book.  Can You name one?

I know of no book that covers these reference (extensions?) to mm,
sorry.


Ralph.

reply via email to

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