I answered a question last week about creating a continuous but breakable rule next to an arbitrary number of paragraphs in Plain TeX. My solution gathered the paragraphs to rule in a vbox; my output routine put that content into an hbox and added a vrule. If the content overflowed, I used vsplit to place as much as a I could, then deferred the rest to the next page.
Could I have done this (in Plain TeX) without a custom output routine?
\shipoutwith Heiko Oberdiek'satbegshipackage. That's after the OR, and thus doesn't interfere with it. To know where to place the rule, you need to save the position, perhaps using thezpospackage (just a vague recollection)? – Bruno Le Floch Dec 22 '11 at 17:51zpospackage on CTAN. – Justin Bailey Dec 22 '11 at 18:30standardway to add line numbers for a long time. Might even be in the TeXbook or TeX by Topic. – yannisl Dec 22 '11 at 18:32oberdiekbundle. – yannisl Dec 22 '11 at 18:32zref-pospackage, which provides commands\zsavepos,\zposx, and\zposy, which store the current position on the page, and access it. The idea would be to (1) store the position and page at the start of the block and the position and page at the end, (2) catch pages when they are shipped out to the pdf/dvi, thanks to theatbegshipackage, (3) on each such page, check if there is a highlighted block (perhaps several), using info fromzref-pos, and add the appropriate vertical rules in the margin (overlayed on the page). – Bruno Le Floch May 26 '13 at 08:44