Hi Eric,
check the last version (v5). I have changed things around, added comments, and added some formatting to make thing easier to read.

NisusUser wrote:
The marker \p can be mid-verse – not necessarily at the beginning of the verse or at the beginning of the line. If it's mid-verse, it does not start on a new line. Then there is no new \v marker until the next verse.

In v5 I have separated the two cases, so you should be able to adjust the latter case to make it come out the way you want it.

NisusUser wrote:
Re: \nd (names of diety). This is going to take some tweaking. That formatting should only be applied (best I can tell) if it is one isolated word in all caps. That's not foolproof, though, so I'll have to think this through. That's because in SS there is other text in all caps also – citations from the OT presented in the NT.

In v5 I have treated words in All-Caps of 3 letters or more as deity names. Again if you find a better rule you should be able to adjust it. Since those cases need to have their case change, dealing with them turned out be more complicated than a simple Find and Replace, but hopefully the way to deal with that should be clear enough from the code.

I commented out the \nd part from v5 for now. I'll have to study it out later.

I found a problem with the way the refences are added to the footnotes (e.g., "1:4" in the footnote in Gen 1:4). There needs to be an ending marker \ft so it is "\fr ch:v \ft" (where "ch" is chapter digit(s) and "v" is verse digit(s). Otherwise, USFM thinks the "fr" is just part of the footnote text.

NisusUser wrote:I found a problem with the way the refences are added to the footnotes (e.g., "1:4" in the footnote in Gen 1:4). There needs to be an ending marker \ft so it is "\fr ch:v \ft" (where "ch" is chapter digit(s) and "v" is verse digit(s). Otherwise, USFM thinks the "fr" is just part of the footnote text.

Okay I didn't read the specification carefully. You'll have to change the line:

Philip,
I can't thank you enough for your help. Version 5 is working great (except that I commented out the \nd, as I mentioned before). I hope (!) to come back to this next week, but until then I'll be busy with other things.

Unfortunately, I haven't yet reaped the benefits of your "didactic moment(s)", since you did all the work. I understand some of it – not a lot. Hopefully I'll be able to study this out sometime and learn to do my own macros like this. But it obviously is not for the faint-hearted, and I'm going to have to have my heart checked first