2

I am searching means to create a multicol document in which each column has a background color like illustrated below. The colored areas (red rectangles) should be filled with the background color. Since the document has many columns (4 in the example, but 10 in reality) splitting the text in minipages or similar is not my favored option.

enter image description here

  • Perhaps with tcolorbox and it's breakable/magazine features? – user31729 Feb 5 '16 at 20:57
3

If we assume that you are using unbalanced columns and want to have the column borders on all of the pages of your document, then you can insert them in the background as part of an overlay using eso-pic (or some other package; there are multiple options):

enter image description here

\documentclass{article}

\usepackage{lipsum,multicol}
\usepackage[paper=a3paper,margin=1in]{geometry}

\usepackage{xcolor,eso-pic}
\newlength{\columnwidths}
\AtBeginDocument{\setlength{\columnwidths}{\dimexpr.25\textwidth-.75\columnsep}}
\AddToShipoutPictureBG{% Add to *all* pages in the BackGround
  \AtTextLowerLeft{%
    \hspace{\dimexpr-\fboxsep-\fboxrule}%
    \fcolorbox{red}{white}{\rule{\columnwidths}{0pt}\rule{0pt}{\textheight}}% First column
    \hspace{\dimexpr\columnsep-2\fboxsep-2\fboxrule}%
    \fcolorbox{red}{white}{\rule{\columnwidths}{0pt}\rule{0pt}{\textheight}}% Second column
    \hspace{\dimexpr\columnsep-2\fboxsep-2\fboxrule}%
    \fcolorbox{red}{white}{\rule{\columnwidths}{0pt}\rule{0pt}{\textheight}}% Third column
    \hspace{\dimexpr\columnsep-2\fboxsep-2\fboxrule}%
    \fcolorbox{red}{white}{\rule{\columnwidths}{0pt}\rule{0pt}{\textheight}}% Fourth column
  }%
}

\begin{document}

\sloppy% Just for this example
\begin{multicols*}{4}
\lipsum[1-50]
\lipsum[1-9]
\end{multicols*}

\end{document}
  • You can adjust \fboxsep and \fboxrule to suit your needs; the boxes will adjust accordingly. – Werner Feb 5 '16 at 22:48
  • Thanks! I have it running for a simple document. For unrelated reasons I need to put the multicols environment into a minipage. In this case the rectangles are drawn, but with wrong size and wrong positions, even if the minipage covers the whole page. Seemingly some of the length change their meaning ... – highsciguy Feb 6 '16 at 10:05
  • @highsciguy: Well then, I can't do much more without some guidance in the form of a MWE. – Werner Feb 6 '16 at 14:12

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.