Hi Branden, thank you for taking the time to look into this.
On Mon Oct 7, 2024 at 2:09 PM CEST, G. Branden Robinson wrote: > [...] > At 2024-10-05T23:32:33+0200, onf wrote: > > sit \*[1 A "\\*[2 "B\\\\*[3 C D]E" F]G" H] amet. > > > > Once I change it to be an actual macro, though, it reports this: > > troff: backtrace: 'FILE.tr':17: macro '1' > > troff: backtrace: file 'FILE.tr':25 > > troff:FILE.tr:25: error: missing ']' > > > > [...] > > > > What am I doing wrong? > > [...] > > Unless...hmm. Unless maybe the problem that this trick of punning a > macro to a string won't work when quotation marks surround the macro > interpolation, because quotation marks can't span lines in GNU troff. > Or any roff, really. (But only in GNU troff can string interpolations > take arguments, so it probably arises only for us.) > > [...] If that was the case, this interpolation on line 23 should fail similarly, but it works just fine: Lorem ipsum \*[1 "\\*[2 A B]" C] dolor I previously tried it without doubling the number of backslashes with every nesting, which produced wrong results even in the above case. My understanding is that when it's doubled like that, the argument is simply that escape (rather than its contents), and it gets evaluated only when the argument is used somewhere. (I might be wrong.) This seems to be confirmed by the fact that both instances break when I try to use the argument in an expression, such as by doing this: @@ -13,6 +13,9 @@ . .de 1 \" converted into an actual macro \\$0\\c +. ie !'\\$*'' .tm \\$* . ps +5 <\\$1:\\$2>\\c . ps -5 which gives me a bunch of these errors (backtraces omitted): troff:FILE.tr:24: warning: missing closing delimiter in output comparison operator (got a newline) troff:FILE.tr:26: error: missing ']' troff:FILE.tr:26: error: '\c' is not allowed in an escape sequence parameter So even if such nesting worked properly, its utility would be limited since the only thing one can do with such an argument is output it. ~ onf