🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #6300

[nt]roff problem: hanging tags

#6300
From: Scott Simpson
Date: Thu, 04 May 1989 00:27
81 lines
2819 bytes
I wrote some [nt]roff macros to automatically figure out the width of 
hanging tags and to use the longest hanging tag to format a list of 
hanging tags (like an \halign in TeX).  I tried using them in the -man
macros for the FILE section like

	.SH FILES
	.FB /etc/motd
	The message of the day.
	.FE
	.FB /etc/rc.local
	Local system startup file.
	.FE
	.FS

but the output comes out too far over horizontally.  That is, I want

	/etc/motd The message of the day.
	/etc/rc   Local system startup file.

and I get
					/etc/motd The message of the day.
					/etc/rc   Local system startup file.

Any ideas?

Here are the macros (mostly comments):

.\" %W% %G%
.\" General purpose macros.	Scott Simpson.
.\" Macros provided:
.\"	.FB file_name		Begin a File Section line in the -man
.\"				macros.  For example, in the -man section
.\"				where you say .SH FILES, you could say
.\"					.FB /etc/motd
.\"					The message of the day.
.\"					.FE
.\"					.FS
.\"				to format the file line.  .TP inserts a 
.\"				blank line so we don't use it.  Each .FB
.\"				must end with a .FE and a final .FS must end
.\"				the last .FB-.FE pair.  The widest tag is
.\"				computed and used for all the .FS-.FE pairs.
.\"	.FE			Terminates an .FB command.
.\"	.FS			Flushes a file section.
.\"
.\" This file uses the following:
.\"	Number registers:
.\"		mw	maximum width of a hanging tag
.\"	Macros, diversions and strings:
.\"		FD	diversion for .FB, .FE, .FS
.\"
.nr mw 0	\"indent size of hanging tag
.de FB		\"File Begin section
.if \w'\\$1'u+1m>\\n(mw .nr mw \w'\\$1'u+1m
.nf		\"get output in no-fill mode
.da FD		\"start diversion
.ft R		\"put environment in sane state
.ps 10
.vs 12p
.br		\"start a new paragraph
.ti -\\n(mwu	\"dedent
\\$1\\t\c
..
.de FE		\"File section End
.di		\"end diversion
..
.de FS		\"Flush Section
.in +\\n(mwu	\"set indentation to size of largest tag
.ta \\n(mwu	\"set tab to size of hanging tag
.fi		\"set fill mode
.FD		\"output diversion
.\" Adding a comment to the end of the next line causes an infinite loop!
.\" Remove the macro request.
.rm FD
.in -\\n(mwu	\"dedent indent
.nr mw 0	\"reset hanging tag size
..
	Scott Simpson
	TRW Space and Defense Sector
	oberon!trwarcadia!simpson  	(UUCP)
	trwarcadia!simpson@usc.edu	(Internet)
Technical Details
Message-ID: <4961@wiley.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!wiley!trwarcadia!simpson

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!wiley!trwarcadia!simpson
From: simpson%trwarcadia.uucp@usc.edu (Scott Simpson)
Newsgroups: comp.text
Subject: [nt]roff problem: hanging tags
Keywords: nroff, troff, -man macros, horizontal space
Message-ID: <4961@wiley.UUCP>
Date: 4 May 89 00:27:28 GMT
Sender: news@wiley.UUCP
Reply-To: simpson%trwarcadia.uucp@usc.edu (Scott Simpson)
Organization: TRW Arcadia Project
Lines: 81