On 09/06/2021 19:35, Oliver Corff wrote: > All .dot requests MUST be at the beginning of the line; in your code > example, the dot is not recognized.
No, that is not so. The issue with Hans' example, (apart from the under escaping of register references within his macro definitions, as Peter has already noted), is that he is not specifying the appropriate end marker for his .ig request. Since the effect of his SOLUTION macro ends with a following SOLEND macro rather than: > .de SOLUTION > .if (\n[s] == 0) .ig ++ > .br > .. > .de SOLEND > .++ > .. he should have: .de SOLUTION . if (\\n[s] == 0) .ig SOLEND . br .. .de ENDSOL . \" Any clean-up required, at end of solution. .. This toy example does, for me, what I believe Hans is trying to achieve: $ cat foo.roff .pl 10 .in 5m .nr QNR 0 1 .de QUESTION . br . ti -5m . nop \Z'Q\\n+[QNR].'\h'5m'\c .. .de SOLUTION . ie '\\$1'' .ds SOLHT 3v . el .ds SOLHT \\$1 . el ' . if !\\n[SOLUTIONS] .ig SOLEND . br . ti -5m . nop \Z'A.'\h'5m'\c .. .de SOLEND . \" Insert any required code here, . \" to adjust state after a solution; . \" (e.g. to insert blank space, . \" when solutions are hidden). . ie \\n[SOLUTIONS] .sp . el .sp \\*[SOLHT] .. .QUESTION Solutions are not normally shown. How can they be made visible? .SOLUTION 5v Run the formatter, specifying the "-rSOLUTIONS=1" register assignment, on the command line. .SOLEND . .in 0 .pl 1 Here is some arbitrary text, following the Q&A section. $ nroff foo.roff Q1. Solutions are not normally shown. How can they be made visible? Here is some arbitrary text, following the Q&A section. $ nroff -rSOLUTIONS=1 foo.roff Q1. Solutions are not normally shown. How can they be made visible? A. Run the formatter, specifying the "‐rSOLUTIONS=1" register assignment, on the command line. Here is some arbitrary text, following the Q&A section. -- Regards, Keith.