Does anyone know how to shade the background and put a border around a multicol environment, where page breaks are needed.

There is a couple of posts around, most notably, multicols within colorbox, but there seems to be problems.

The best looking environment is the tcolorbox, but, cant do pagebreaks.

mdframed appears to overflow when pagebreaks are required (ie when multicol env. across multiple pages)

I really don't have an MWE, given the above comments RE tcolorbox and mdframed.

-
– Werner Jan 10 '13 at 8:41
In my previous answer, if you need a border (since the background is already fixed), you just have to change the color colframe=white from the tcolorbox version or linecolor=white in the mdframed version. – Claudio Fiandrino Jan 10 '13 at 8:50
@Werner, Im getting errors with that solution. Im running Article, not memoir perhaps. – Nicholas Hamilton Jan 10 '13 at 8:58
@Claudio. tcolor box is the best, but it cant pagebreak.... – Nicholas Hamilton Jan 10 '13 at 8:59
@ADP: I agree with you :); my previous comment should be intended as a way to get the border that in the other question was not necessary. Notice, however, that in the solution suggested by Werner, the first example has article as documentclass: only the second goes under memoir. – Claudio Fiandrino Jan 10 '13 at 9:58

You might want to play with the spacing a bit but something like this

\documentclass{article}
\usepackage{multicol,color}

\makeatletter
\let\old@page@sofar\page@sofar
\let\old@box\box
\let\old@rlap\rlap
\def\page@sofar{%
\let\box\colorcolumn
\def\rlap{\let\box\old@box\old@rlap}%
\old@page@sofar
}
\def\colorcolumn#1{%
\kern\dimexpr-\fboxrule-\fboxsep\relax
{\let\box\old@box\fcolorbox{red}{yellow}{\box#1\llap{\phantom p}}}%
\kern\dimexpr-\fboxrule-\fboxsep\relax
}

\makeatother

\def\a{Red blue green yellow black white. }
\def\b{One two three four five six. }
\def\c{\stepcounter{enumi} \Roman{enumi}
\a\a\b\b\a\a\b\a\a\b\b\b\b\b\b\a\a\b}
\begin{document}

\begin{multicols}{3}
\c\c\c\c\c\c\c\c\c\c
\end{multicols}

\end{document}

-
Nice. So you actually hook into multicols "column output routine"? – Martin Schröder Jan 10 '13 at 12:25
yes @page@sofar is Frank's macro that lines up the boxes with the column text and inserts inter-column rules, This just patches it to add some colour at the same time. – David Carlisle Jan 10 '13 at 12:51
@DavidCarlisle How could I put rounded corners on the outside corners on this? – Nicholas Hamilton May 25 '13 at 2:15
\fcolorbox{red}{yellow}{....} is the standard (my) macro for butting colour behind a box, you can replace that by anything else that does the same but with more fancy features, tikz or tcolorbox or whatever. – David Carlisle May 25 '13 at 9:43
@DavidCarlisle If I want to apply this formatting to a duplicate environment (ie via \let\mymulticol\multicol and \let\myendmulticol\endmulticol), whilst retaining an unmodified version of the original, how is this possible, ie, how to distinguish the page@sofar, \box and \rlap commands between the duplicate and original environments. – Nicholas Hamilton Jun 5 '13 at 21:07