> Each item I put in a temporary diversion which I use to calc > the height. If the height exceeds the page height a .ne or .bp > should be put in the large diversion, then the temp diversion > is added. So the large diversion contains the heading, some > items, .bp, some items again, ... And my page titels and > footer should work as everywhere in the book.
You got it almost right -- using a temporary diversion for testing the height and then appending to the main bibliography diversion. That's also how I would do it. However, there is a major difference between the top-level "page diversion" and other diversions. The top-level diversion can have multiple "page traps", but a diversion is limited to a single "diversion trap" (which you may, however, move around). Normal diversions are expected to contain formatted text, but there is no provision for separate "pages" inside a diversion. That's why your approach doesn't make sense in the current *roff implementations. For your purposes, fortunately, pagination inside the diversion is also not needed. (But it could be faked in principle, see below.) The trick is to "transparently" embed ".ne" requests for every bibliography item, that will become active when the main bibliography diversion is finally output (see the attached example). (You could also embed ".bp" requests, but you don't need to. If all you want to accomplish is that an item is not split in the middle, the ".ne" is sufficient.)
.\" .\" ---------------------------------------------------------------- .pl 29.7c .po 2.5c .ll 16c .lt 16c .ev 1 .ll 16c .lt 16c .ev .wh 0 HD .wh -2c FT .\" ---------------------------------------------------------------- .de HD .ev 1 .sp 2 .tl 'My document''%' .sp -.5 \D'l 16c 0' .sp 2 .ev .. .de FT .ev 1 .bp .ev .. .\" ---------------------------------------------------------------- .de RS \\$* .ev 2 .di RX .nf .. .de RF .br .di .nf .da RZ \!.ne \\n(dnu .RX \!.sp .di .ev .. .\" ---------------------------------------------------------------- Hello world. .RS [reference 1] Author 1 Title 1 Journal/Book 1 Year 1 .RF .RS [reference 2] Author 2 Title 2 Journal/Book 2 Year 2 .RF Text text text text text text text text text text. .\" Put more references and text here... .\" ---------------------------------------------------------------- .bp .nf .RZ