Also be sure to restart Dwarf Fortress every time you make any changes to a macro. At least on Linux macros appear to be loaded when Dwarf Fortress launches.
Same on mac and windows.
To be more specific, I think the macros are actually read the first time you press "Ctrl+L", at least that's when the errors show up
. The point is they only get loaded once.
Another potential macro pitfall that I just remembered - if you make a copy of an existing macro, you need to make sure to change the name in the first line. Otherwise DF will only recognize one of the two macros with the same name (probably the one with the first file name alphabetically, but I'm not sure).
And, finally, the answer to my own question. If you don't mind DF spamming errors to the terminal/errlog, adding random text which is not on the same line as any other commands seems to work fine. In particular, I added text of the form ****THIS IS A COMMENT**** in a few different places, and my macro worked just fine and just gave errors of the form:
Quantity not numeric or Unexpected tab(s) while loading macro: End of group
Binding name unknown while loading macro: ****THIS IS A COMMENT****
This is good enough for me, so I will try that. I want to write a macro that places ~2000 dorfs in rows of 75, and it will be much easier if I can mark ****BEGIN NEW ROW**** etc.
The error about tabs makes me wonder if macros care about tabs/spaces, which is something I had suspected but not confirmed. I always just copy and paste from recorded macros, and then delete the unnecessary commands, so I think I usually preserve the spacing. By messing around, I confirmed that the first character of each line is not read as a command. If I place "ARENA_CREATURE_SIDE_UP" at the beginning of a line with no space in front of it, I get "Binding name unknown while loading macro:RENA_CREATURE_SIDE_UP". However, if I put "XARENA_CREATURE_SIDE_UP", where "X" can be a character or space, it works fine. This make me wonder if the first character of a macro line serves as a flag, as in FORTRAN where placing a "C" at the beginning of a line indicates a comment (this does not get rid of the errors from my comment lines, by the way). Maybe Toady was planning to use line flags, but didn't implement them yet? I tried pretty much every typeable character, and none of them seems to do anything.
Thanks very much to i2amroy for your help!