Hello everybody out there using TeX,

Is there a possibility to draw a frame over a columnbreak when using for example the multicol package?

I've already tried several possibilities and done extensive websearch. Interestingly, there seem to be several people having this problem, but there's no solution available in the web.

Unfortunately, the framed and mdframed package don't work with the multicol package according to their manuals.

The listings package, seems to have a bug: it does split text on different columns correctly, but the colour highlights wrong sections:

       \section{First section}

I would be very grateful for any hints towards a solution.

One additional step in the right direction might be the boites package:


But this does not allow for background colouring using pdflatex.

  • 1
    What do you mean with "draw a frame over a columnbreak"? – Keks Dose Jun 18 '12 at 14:49
  • I believe the question is related to the \colorbox{} - how to make it automatically split between columns instead of being in it's total height either at the end of column 1 or at the top of column 2. (I do have the same problem.) Or more generic: how to have a multi-line box with border or background color split in half when necessary. – TeXter Jun 18 '12 at 18:58
  • Maybe tex.stackexchange.com/questions/59340/… is what you are looking for. – TeXter Jun 22 '12 at 12:19

enter image description here





       \section{First section}



Werner commented in chat that this answer was less than completely documented.

\page@sofar is the multicol internal macro responsible for assembing the column boxes that have been produced into a row across the page together with inter-column rules and space. this just inserts a black rule and some space either side. (The \intercolumnsep parameter is increased a bit to make space for these) and a full width green rule is added at the start of the box, then negative space inserted so the column boxes come on top.

  • why not patch a little bit more "high-level" using etoolbox or so? very efficient above, but probably not understandable to many without a lot of thinking. – Frank Mittelbach Sep 23 '13 at 21:11
  • @FrankMittelbach feel free to edit my answer:-) I'd have to check the etoolbox patch syntax but can write the delimited argument form in my sleep. But yes it would be better, I should try harder:-) – David Carlisle Sep 23 '13 at 21:14
  • it wouldn't hurt if you do :-) it is easy enough ... but I know the feeling ... had a copy of the code lying around for cut and paste from one answer to the next for a while – Frank Mittelbach Sep 23 '13 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.