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:

  1. 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?

  2. using package mdframed (which is based on framed): Left-hand vertical rule applied to flalign environment with automatic pagebreak

  3. avoiding 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?


\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}}

\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}


\parindent0pt \lineskip20pt \xdef\currentvskip{\lineskip}
\section*{Attempt 1}
\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.}

\section*{Attempt 2}
\vbox{\hbox{\rules \minibox \bigskip}}%
\vbox{\hbox{\ruless \strut The vertical rules on the left should continue above!}}
\vbox{\hbox{\ruless \strut One more line...}}
\vbox{\hbox{\rules \strut The vertical rules on the left should not continue below because of the page break.}}
\vbox{\hbox{\rules \minibox}}

1 Answer 1


If you first build your paragraphs off the main vertical list you can remove inter box skips and replace them by leaders:

enter image description here




\def\a{One two three four. }
\def\b{\refstepcounter{enumi} \Roman{enumi} \a\a\a}



\parbox[t]{\dimexpr\textwidth-(#1)*2\relax}{#2}}%  2 times 2pt is 4pt not 22pt





\zbox{3pt}{Hello. \c}




\zbox{3pt}{Red \b\c}

\zbox{4pt}{Yellow \a\c}

\zbox{2pt}{Goodbye. \b\c}


  • Clear code, down to the point! - So \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 \vbox in 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
    Commented Feb 3, 2013 at 1:29
  • Yes sounds like you got it:-) Commented Feb 3, 2013 at 1:49
  • Focusing on separate rules, I replaced the line \leaders\vrule\@width#1..... with \leaders\copy\vrules..... where \vrules is 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
    Commented Feb 3, 2013 at 16:41
  • 1
    If you want multiple rules rather than just different thickness you need to do something like that: you could put a small negative kern in the leader box so it overlaps and you get no gap, but if you put too much it will overlap the text. Commented Feb 3, 2013 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .