I want to draw individual vertical rules on the left side of consecutive paragraphs/vertical boxes covering the vertical skips. In my case for every paragraph/vertical box, there can be different vertical rules. Each paragraph itself is short and not breakable, that is why I am calling them vertical boxes. The rules of a paragraph should start directly after the previous paragraph and cover the vertical skip between the two paragraphs. The main problem is how to cover this skip properly with vertical rules.
Similar questions have been asked:
one solution aimed at source code listings (where new lines are obeyed), and another solution using the package
framed: How to make continuous (but breakable) vertical rule along left side of paragraph?using package
mdframed(which is based onframed): Left-hand vertical rule applied to flalign environment with automatic pagebreakavoiding to write a new output routine seems impossible: Can I write a macro for placing a vertical, breakable rule along arbitrary paragraphs without an output routine?
The common approach of 1. and 2. is to do the page breaking "manually" by own code instead of completely automatically by TeX. That is, to create a vertical list of all the lines or paragraphs, and use \vsplit to cut this list into piece to fill the pages. Another common characteristic is that this takes at least 50 lines of TeX code and is not easy...
I came about box leaders and it seems that \leaders could do the job. I am wondering whether my attempts can be made working.
Attempt 1: Tell TeX never to insert any glue after a paragraph and instead insert a standard amount of glue. (The amount can be changed setting \currentvskip.)
Attempt 2: Ask TeX how much space is inserted between two paragraphs (during or after page breaking) and then cover this vertical skip with rules.
Not tried since it seems complicated: extending the framed package to work for multiple rules...
The attempts are not completely working. For example, the vertical rules are not continuous on one page, and there is something wrong with the usage of \lastskip. The following document shows my attempts. Is there a way to fix one of them?
\documentclass[12pt,english]{article}
\usepackage{babel}
\usepackage{blindtext}
\def\rules{\vrule width2pt \kern8pt \vrule \kern10pt}
\def\ruless{\vrule width2pt \kern8pt \vrule \kern8pt \vrule \kern10pt}
\newbox\vrules \setbox\vrules=\vbox{\hbox{\vrule width0pt height1pt \rules}}
\newbox\vruless \setbox\vruless=\vbox{\hbox{\vrule width0pt height1pt \ruless}}
\newbox\vl
\def\line#1{\setbox\vl=\vbox{\hbox{\rules \strut #1\unskip}}%
\leaders\copy\vrules\vskip\currentvskip \unvbox\vl}
\def\linee#1{\setbox\vl=\vbox{\hbox{\ruless \strut #1\unskip}}%
\leaders\copy\vruless\vskip\currentvskip \unvbox\vl}
\def\minibox{\begin{minipage}{5cm}\blindtext\end{minipage}}
\begin{document}
\parindent0pt \lineskip20pt \xdef\currentvskip{\lineskip}
\section*{Attempt 1}
\line{\minibox\bigskip}
{\edef\currentvskip{\bigskipamount}%
\linee{The vertical rules on the left should continue above (problem with bigskip)!}
}
\linee{One more line...}
\line{The vertical rules on the left should not continue below because of the page break.}
\line{\minibox}
\section*{Attempt 2}
\vbox{\hbox{\rules \minibox \bigskip}}%
\leaders\copy\vruless\vskip\lastskip%
\vbox{\hbox{\ruless \strut The vertical rules on the left should continue above!}}
\leaders\copy\vruless\vskip\lastskip%
\vbox{\hbox{\ruless \strut One more line...}}
\leaders\copy\vrules\vskip\lastskip%
\vbox{\hbox{\rules \strut The vertical rules on the left should not continue below because of the page break.}}
\leaders\copy\vrules\lastskip%
\vbox{\hbox{\rules \minibox}}
\end{document}

\lastbox,\lastskip, etc. cannot be used when TeX is building the pages, that is in the external vertical mode. But they work in the internal vertical mode, which is started by\vboxin your code. In this mode the vertical material with possible points for page breaking (but not broken yet) is collected. I think I have understood... – e-birk Feb 03 '13 at 01:29\leaders\vrule\@width#1.....with\leaders\copy\vrules.....where\vrulesis as in my code above. That introduces some vertical white space - probably 1pt. If I reduce the height in\setbox\vrules=\vbox{\hbox{\vrule width0pt height0.01pt \rules}}then the white space will be invisible. Is this approach okay or should a different approach be chosen? – e-birk Feb 03 '13 at 16:41