Frank Mittelbach <[log in to unmask]> writes: > Laurent, > > > << currently involved with programming a footnote package, I was trying > > to get a clue about just when to insert \color@begingroup and > > \color@endgroup >> > > > > Some years ago, you discussed misfeatures of the TeX 3 > > '\mark' mechanism and ideas for fixing it. Are those ideas > > adequate for David Kastrup's present purposes? > > i'm not sure what you are precisely referring with respect to marks > at to be honnest, but i doubt it. the problem wih footnotes is that > they split apart boxes without a decent way to interact with the > mechanism. that is okay if \mark's are concerned (or specials if > they simply mark a point in the stream but fails miserably if the > special is trying to implement a stack of regions I don't know what a stack of regions is. My implementation by now works. What I do is actually record the complete color stack for the footnote with a mark whenever a color command gets executed. I switch off color stack recording with \color@begingroup since I am assuming that the concerned box will not be split or land elsewhere altogether. The problem was a bit acerbated by the fact that I am using plain-style footnotes that don't mind \verb and its ilk. That means that I catch the end of the footnote with \aftergroup, and the color-stack related \aftergroup tokens will only make it afterwards and I can't catch them without reliquishing control, or sweeping them up with \futurelet or something. Since I don't like that, I instead set up effectively a count that tells how many color stack pops are to be expected and then relinquish control. The various \reset@color commands then get executed, do nothing at all, and the last of them closes the outer group and switches off color stack tracking. Whenever I split a footnote, I take the relevant color stack info from my mark, unwind the color stack at the end of the first part of the footnote, and set it up again at the second part (actually, I do the color stack setup within a setbox command for the second part that is nested within a setbox for the first part, so all \aftergroup\reset@color commands register in the first part). It's all a bit sick in the head, but tested pretty fine. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum