3

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?

  • Learning if there is way to solve this problem without a output routine. – Justin Bailey Dec 22 '11 at 16:29
  • You can hook into the \shipout with Heiko Oberdiek's atbegshi package. 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 the zpos package (just a vague recollection)? – Bruno Le Floch Dec 22 '11 at 17:51
  • @JustinBailey Yes, you could the solution was rather overcomplicated. You could after placing the par in a vbox, split it per line iteratively at baselineskip, add rule and then release into stream. – yannisl Dec 22 '11 at 17:54
  • @YiannisLazarides as egreg is pointing out on chat, whatsits are not removable, so you may have some trouble doing that if the text contains marks (used for indices?). – Bruno Le Floch Dec 22 '11 at 18:14
  • @BrunoLeFloch - I don't see a zpos package on CTAN. – Justin Bailey Dec 22 '11 at 18:30
  • @BrunoLeFloch Will check this out. This used to be the standard way to add line numbers for a long time. Might even be in the TeXbook or TeX by Topic. – yannisl Dec 22 '11 at 18:32
  • @JustinBailey zpos is part of the oberdiek bundle. – yannisl Dec 22 '11 at 18:32
  • 1
    @JustinBailey: I am sorry, I was thinking of the zref-pos package, 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 the atbegshi package, (3) on each such page, check if there is a highlighted block (perhaps several), using info from zref-pos, and add the appropriate vertical rules in the margin (overlayed on the page). – Bruno Le Floch May 26 '13 at 08:44

1 Answers1

7

Unless you are prepared to support only a limited number of situations (and even then ...) the answer is no. It is true that you could split collected vertical material using a suitable loop and \vsplit, however, in comparison to an OR the \vsplit operation lacks the following:

  • no handling of insertion material (could be ok for this application)
  • no record of the penalty associated with the split (available in the OR via \outputpenalty)

The latter at least is important if you want to disect a vertical list, add something to it and then rebuild it again so that normal break points can be found in the same places.