2

I'm trying to span the tcolorbox over entire page under each section. The MWE is as shown below (after referring to this answer)

\documentclass[11pt,letterpaper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}
\begin{document}
    
    \newtcolorbox{ubox}
    {
        breakable,height fixed for=all,colback=white,arc=0mm,outer arc=0pt,width=1.01\linewidth,boxrule=.7pt,
        before upper={\parindent24bp},left=1.2pt,right=1.2pt,top=0mm,
    }
    
    \section{Section 1}
    \begin{ubox}
        \lipsum
    \end{ubox}
    \section{Section 2}
    \begin{ubox}
        This is a short sentence in section 2, however, I would like the box to span the entire page as well.
    \end{ubox}
    
\end{document}

section 1 section 1 page 2 section 2

However, as shown on the third page, the box does not expand to the entire page. I would like the box to span the entire page regardless of the length of the content.

7
  • 3
    According to the doc of tcolorbox, the doc for option height fill, "This height control key is only applicable to unbreakable boxes, ...". – muzimuzhi Z Jan 24 at 9:16
  • @muzimuzhiZ Thanks for the information! So can I achieve the result that the box extends to the entire page while breakable at the same whether it's using tcolorbox or whatever it works? – Charlie Lee Jan 24 at 10:25
  • The package doc says "no". Not sure if this could be easily extended. – muzimuzhi Z Jan 24 at 11:45
  • 2
    @muzimuzhiZ Alright, thanks for pointing out the core of this problem! I found a solution in tex.stackexchange.com/a/355196/216060 – Charlie Lee Jan 24 at 12:37
  • 2
    Using height fill (works for unbroken boxes only) together with height fixed for=all (works for broken boxes only) seems to meet OP's need. – muzimuzhi Z Jan 24 at 17:00

Browse other questions tagged or ask your own question.