[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Footnotes/Endnotes formatting



Paul wrote:
In footnotes you could replace ≪PN≫ with XX and use the XPL loop (by using the tags as beginning and ending field markers) to cut "XX" and insert the current page number;
Just what I was thinking--i.e., put in each fn some unique string, e.g.,
QQQYY, then do a loop to finding each, replace it with the current page
number ≪VA$PG≫, then go on.
But actually, this is all unnecessary--we already have a unique string:
≪FN Why not use it?
To sustain re-running, each endnote has to typographically isolate the page
number you've inserted from the previous pass, so it can be deleted and
replaced by the updated page number. Fortunately, that is already the case:
the endnotes look like this:
≪MDFN≫28≪MDNM≫
So all you need do is replace everything *between* ≪MDFN≫ and ≪MDNM≫ with the correct page value (and any formatting you want--such as "p. 15" but I'll omit that in the below. If it interests you, I can make it into actual XPL for you.
≪sx10,0≫;*; initialize this s/g which stores the position in the file of
the next endnote
TF ;*; top of file, expanded mode, show page numbers
;*; start of loop
XP ;*; shift to expanded mode in order to be able to do search that folows
BX se /≪fn/Q2 ;*; find the start of footnote in text
≪if≪ER≫≪glb≫≪ei≫;*; exit if a footnote is not found (i.e., past the last one)
SP ;*; shift to show page mode, necessary to get page number
≪sx01,≪VA$PG≫≫;*; store the page number of the fn
≪sx02,≪CP≫≫;*; store the cursor position for returning here on next loop
BX jmp ≪pv10≫Q2 ;*; jump to next end note (first time through loop, will be top of file)
BX se /≪MDFN≫/Q2 ;*; find the beginning of the first/next endnote
DF ;*; start define
BX se/≪MDNM≫/Q2 ;*; find the end of the page number of that endnote
DF ;*; end define--page number (or, at first just the footnote number) now defined
RD ;*; rubout defined text--i.e., delete the old/bad number
≪PV01≫;*; insert new number, and any formatting if you want--e.g., Page ≪PV01≫ ≪SX10,≪CP≫≫;*; save the cursor position in the end notes, for next time through
BX jmp ≪pv02≫Q2 ;*; jump back to where you were in body of file
≪gla≫;*; loop until done
≪lbb≫≪ex≫;*; done



Harry Binswanger
hb@xxxxxxxx