2

The question might sound weird due to my bad English.

In short: I want a multicol page to be filled with tcolorboxes of different heights but (visually) evenly spaced between each other.

In image: 1 no good, 2 good, 3 good evenly spaced tcolorbox More space between the boxes is also a possibility though I didn't draw. (and i'm not apologizing for my bad drawing ;D haha)

MWE:

\documentclass[twoside,12pt,openany,a4paper]{memoir}
\usepackage{multicol}
\usepackage{tcolorbox}
\tcbuselibrary{listings,skins,hooks,breakable}
\newcounter{mycounter}
\newtcolorbox[auto counter,number within=chapter,number freestyle={\noexpand\arabic{\tcbcounter}},]%
    {myFrame}[2][]{%
        enhanced,colback=white,
        colframe=black,
        boxsep=0.1pt,
        sharpish corners,
        halign=left,
        }
\begin{document}
\begin{multicols}{2}[\chapter{}]
\begin{myFrame}

Any text Any text Any text Any text Any text Any text Any text Any text.
\end{myFrame}
\begin{myFrame}

\rule{2cm}{2cm}

Small image
\end{myFrame}
\begin{myFrame}

Any text Any text Any text Any text Any text Any text Any text Any text.
\end{myFrame}
\begin{myFrame}

\rule{4cm}{4cm}

Medium image
\end{myFrame}
\begin{myFrame}

\rule{5cm}{6cm}
big image
\end{myFrame}
\begin{myFrame}[height fill]

Any text Any text Any text Any text Any text Any text Any text Any text.
\end{myFrame}

\begin{myFrame}

\rule{5cm}{6cm}
\end{myFrame}
\end{multicols}
\end{document}

I have tried the [height fill] option but the box just jumped to the next page to fill the whole column alone. I've also read about the raster distribute but doesn't seem to support different size of boxes or I simply didn't catch the idea.

Edit: I need each box to be numbered separately, they are like steps, so maybe the magazine library isn't suitable. I am typesetting a user manual.

Edit 2: Trying to use the raster, still not getting all the space used in a smart way. I also need the numbering to be top-to-bottom and not left-to-right. Check my MS Paint art:

too large box

\documentclass[twoside,12pt,openany,a4paper,]{memoir}
\usepackage{showframe}
\usepackage{multicol}
\usepackage{tcolorbox}
\tcbuselibrary{listings,skins,hooks,raster}
\newcounter{mycounter}

\newtcolorbox[auto counter,number within=chapter,number freestyle={\noexpand\arabic{\tcbcounter}},]%
    {myFrame}[2][]{%
        enhanced,colback=white,
        colframe=black,
        boxsep=0.1pt,
        sharpish corners,
        halign=left,
        }

\begin{document}
\begin{tcbitemize}[raster columns=2,raster equal height=rows,raster row skip=25pt,raster every box/.style={colframe=blue!50!black,colback=blue!10!white,colbacktitle=blue!80!white,
title={Box \# \thetcbrasternum}}]
%
\tcbitem[blankest]
\begin{tcbitemize}[raster columns=1,]
\tcbitem Any text Any text Any text Any text Any text Any text Any text Any text Any text Any text.
\tcbitem \rule{2cm}{2cm} 
\tcbitem Any text Any text Any text Any text Any text Any text Any text Any text Any text Any text.
\tcbitem \rule{4cm}{4cm}
\end{tcbitemize}
\tcbitem \rule{5cm}{6cm}
\tcbitem Any text
\tcbitem \rule{5cm}{6cm}
\end{tcbitemize}
\end{document}
G. Bay
  • 2,047
  • Is multicols mandatory? –  Jun 03 '16 at 19:20
  • 1
    I think, you should try the magazine feature of tcolorbox –  Jun 03 '16 at 19:37
  • @Hupfer multicols is not exactly mandatory, I just need to be able to have two column and one column mixed in the document, and maybe same page too. Magazine? I will have a closer look, thanks for the advice! – G. Bay Jun 03 '16 at 21:00
  • You can use the raster approach, but you have to provide the raster setup yourself. However, in the raster, you can't use breakable boxes. –  Jun 04 '16 at 06:42
  • 1
    There's a new library in tcolorbox calles poster which allows more flexible distribution of boxes on a page. The poster is not breakable, so you should design a distribution for each page, but boxes inside the poster are breakable and their contents can flow from one box to another. You can see some examples: https://tex.stackexchange.com/a/378438/1952, https://tex.stackexchange.com/a/451673/1952, – Ignasi Oct 03 '18 at 10:42

0 Answers0