Path: utzoo!attcan!uunet!wiley!trwarcadia!simpson From: simpson%trwarcadia.uucp@usc.edu (Scott Simpson) Newsgroups: comp.text Subject: A Troff Challenge Keywords: troff macros, \halign Message-ID: <4971@wiley.UUCP> Date: 11 May 89 16:54:04 GMT Sender: news@wiley.UUCP Reply-To: simpson%trwarcadia.uucp@usc.edu (Scott Simpson) Organization: TRW Arcadia Project Lines: 74 I didn't get a satisfactory answer last time I posed this question so now I will turn it into a challenge to see if I get a better response. :-) Can you implement TeX's equivalent of an \halign in troff? What I want to do is create hanging tags where the longest hanging tag is the width of the paragraph indent. For example, I would like to get the output /etc/motd The message of the day. Continuation lines such as these continue here. /usr/lib/tmac/tmac.s The -ms macros. Notice that the longest hanging tag is used as the indent for all the paragraphs Also, how does the net world debug troff macros? The .tm request helps somewhat but it is always executed as soon as it read and you cannot delay its output to print out when the macro is executed, not when it is defined. Scott Simpson Here is my non-working (but close) solution to the above problem. I don't know why it doesn't work. I'm using Sun OS 3.5 [nt]roff. .\" %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 0 \"set tab to indent size .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)