# Dynamic box size

Hi I would like to make a cheat sheet and the contents are inside the boxes for each topic. I would that the width will be fix but the height will automatically adjust based on the length of the content and if it exceeds the page length it will continue to the next column. How can I do this?

Another solution with tcolorbox, but with its new from version 4.10 poster library.

This library allows to flexibly place different boxes over an array structure. It's possible to say a certain column and/or row, but also make reference to other boxes. It's even possible to break a long tcolorbox in fragments placed over a sequence of places where text flows.

\documentclass{article}
\usepackage[a4paper,landscape]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\begin{document}
\pagestyle{empty}

\begin{tcbposter}[
poster = {%showframe,
columns=3, rows=3,},
boxes = {colframe=black, colback=white, enhanced, attach boxed title to top left={xshift=5mm, yshift*=-\tcboxedtitleheight/2},
boxed title style={colback=black, sharp corners}}
]

sequence=1 between B and bottom then
2 between top and bottom then
3 between top and D}{\lipsum[3-8]}
\end{tcbposter}

\end{document}


If you really need that the content continues in the next column, you could do it like this (I didn't fine tune the values, e.g. 9cm is not exact):

Create a content document with a paperwidth of 1/3 of your sheet with boxes which use the breakable key of tcolorbox:

\documentclass{article}
\usepackage{geometry}
\geometry{paperheight=21cm,paperwidth=9cm,margin=2mm}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\tcbset{breakable}
\begin{document}\pagestyle{empty}
\begin{tcolorbox}[title=Stuff 1]
\lipsum[1]
\end{tcolorbox}
\begin{tcolorbox}[title=Stuff 2]
\lipsum[2]
\end{tcolorbox}
\begin{tcolorbox}[title=Stuff 3]
\lipsum[3]
\end{tcolorbox}
\begin{tcolorbox}[title=Stuff 4]
\lipsum[4]
\end{tcolorbox}
\begin{tcolorbox}[title=Stuff 5]
\lipsum[5]
\end{tcolorbox}
\begin{tcolorbox}[title=Stuff 6]
\lipsum[6]
\end{tcolorbox}
\end{document}


Include this document with pdfpages or as graphicx in another one in 3x1 layout:

\documentclass{article}
\usepackage{geometry}
\geometry{paper=a4paper,landscape}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,nup=3x1]{content}
\end{document}