exxpjp@gdr.bath.ac.uk (P J Phillips) (06/29/90)
Is there a way to put an 'action' column in troff/mm documents ? That is, a macro so that you could do the following when writing minutes of meetings ---------------- It was decided that Peter phillips would write to the chairman of the XX committee .AC PP regarding further funding. ---------------- which would come out as follows: ---------------- ACTION ------ It was decided that Peter phillips would write to the chairman of the XX committee regarding further funding. PP I've tried the following and variations but they don't seem to give me what I need: .de AC \kx \h'|6.0i' \\$1 \h'|\nxu' .. Any help appreciated, Pete Phillips.
jaap@mtxinu.COM (Jaap Akkerhuis) (07/04/90)
In article <1990Jun29.120610.3486@gdr.bath.ac.uk> exxpjp@gdr.bath.ac.uk (P J Phillips) writes: > > Is there a way to put an 'action' column in troff/mm documents ? > That is, a macro so that you could do the following when writing minutes > of meetings as in: > > ---------------- > It was decided that Peter phillips would write to the chairman of the > XX committee > .AC PP > regarding further funding. > ---------------- > which would come out as follows: > ---------------- > ACTION > ------ > It was decided that Peter phillips would write to the chairman > of the XX committee regarding further funding. PP > I've tried the following and variations but they don't seem to give me > what I need: > .de AC > \kx > \h'|6.0i' > \\$1 > \h'|\nxu' > .. There are obviously quite some things wrong with this code. First you set register x, but the macro actually uses the value on the moment it is defined. An extra backslash is needed. Furthermore, you are spacing to somewere outside the current margin in fill & adjust mode and then issues a space due to the newline after the local motion. This will effectively give a newline before \\$1 is put out. Another thing you don't think about is any breaks that might appear. Also, the l;ine length might be differnrent then -6 inch. The next macro works better: .de Ac .br .nr x \\n(.n .sp -1 .mk y \h'|\\n(.lu+1m'\\$1 .sp |\\nyu \h'|\\nxu' .. First we do a break, then we register the current position on the output line. Next we compensate for the break, and mark the current vertical position. Then we move outside the margin and put down the argument. We prevent the fill mode to interfere by the concatenation of the local motion and the argument string. After that, space to were we started and continue. This might solve your problem for now, but of course, there are a lot of things wrong with this code: 1) We never look were we are before we do all this jazz, more important, whether the next word (of the body text) still fits on the current line. 2) When the current line is the last on the page, we are in a lot of trouble. 3) The margin note will be dumped out in the current font, which might not be what we want. 4) if there is a space in the argument (like in .AC "Mr Ed should do this"), the fill mode will still take over. 5) There is no garantee that the stuff will fit in the margin. 6) If there is more then one tag in the same line, they will be smashed on top of each other. 7) We don't take the current indentation into consideration etc. All these problems can be solved with a different approach, but is left as an exercise to the reader. For the casual use you mention it is probably good enough. jaap