6

How to make a breakable tcolorbox which spans the total text height? I tried this:

\documentclass{article}

\usepackage[breakable]{tcolorbox}
\usepackage[top=2cm,bottom=2cm,hmargin=2.2cm]{geometry}

\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[breakable,height fill]
\lipsum[1-10]
\end{tcolorbox}

\end{document}

The problem is that the tcolorbox on the second page doesn't have \textheight (i.e. the box should like a border around the page):

enter image description here

9

One possibility is to use the height fixed for=all key.

This has the advantage that the height will be same for any part of the broken box, i.e. if there are more than two parts, say 3, the middle box will have the same height as well.

\documentclass{article}

\usepackage[breakable]{tcolorbox}
\usepackage[top=2cm,bottom=2cm,hmargin=2.2cm]{geometry}

\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[breakable,height fixed for=all]
\lipsum[1-10]
\end{tcolorbox}

\end{document}

enter image description here

3
  • Another possibility, if the frame is to go on every page, is to use a background. – egreg Feb 22 '17 at 17:54
  • I want to use tcolorbox because the look should be consistent with another document where I use tcolorboxes not only as a frame. I just noticed that this doesn't work with vfill, here is a follow up question to this: tex.stackexchange.com/q/355199/21557 – Julia Feb 22 '17 at 17:59
  • @Julia: \vfill can be enabled with text fill option, however, the box isn't breakable then :-( – user31729 Feb 22 '17 at 18:00

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.