4

Am I missing something here? Nobody else seems to have a breakable tcolorbox that center aligns on the second page. I'd like it to just top align, same as normal text

\documentclass[11pt,twoside]{report}
\usepackage[breakable,skins]{tcolorbox}
\usepackage{lipsum}
\usepackage[parfill]{parskip}

\newtcolorbox[auto counter,number within=chapter]{pabox}[2][!ht]{colbacktitle=black!70!white, colback=black!2!white, floatplacement=#1, float, enhanced jigsaw, breakable, height fill, fonttitle=\bfseries, parbox=false, toptitle=2mm, bottomtitle=2mm, title=Box.~\thetcbcounter: #2} %removed possibility of specifying other options, just position

\begin{document}

\begin{pabox}[t!]{Extremely annoying tcolorbox}\label{box:accuracy}
\lipsum[1-4]
\end{pabox}

\end{document}

enter image description here

  • It is quite impressing that tcolorbox can handle multipage floats. The second page is centered as it is a float page, see here if you want to get the text at the top: tex.stackexchange.com/questions/28556/… – Ulrike Fischer Mar 11 '18 at 21:33
  • ohhhh I see! Thanks, that clarifies things a lot and is really helpful, especially since it's not the first time I've had this problem... – Irene Mar 12 '18 at 15:05
2

remove floatplacement=#1, float, and accordingly correct pabox options:

\documentclass[11pt,twoside]{report}
\usepackage[breakable,skins]{tcolorbox}
\usepackage{lipsum}
\usepackage[parfill]{parskip}

\newtcolorbox[auto counter,number within=chapter]{pabox}[1][!ht]{% <-- chanded from 2 to 1
    colbacktitle=black!70!white, colback=black!2!white,
    %floatplacement=#1, float, % commented (remove)
    enhanced jigsaw,
    breakable,
    height fill,
    fonttitle=\bfseries, parbox=false, toptitle=2mm, bottomtitle=2mm,
    title=Box.~\thetcbcounter: #1} %removed possibility of specifying other options, just position

\begin{document}

\begin{pabox}{Extremely annoying tcolorbox}\label{box:accuracy}
\lipsum[1-4]
\end{pabox}
\end{document}

enter image description here

  • Ah. So does this mean I can't make it float? Like appear on the next page after it's specified, wrapping onto the next page after that, maybe have normal text continue on underneath the box on the second page... – Irene Mar 11 '18 at 20:22
  • so far i don't know for floats which can occupy tho pages. argument breakable, means, that the box can be break and be on more pages starting where is inserted and that text after it can continue with its flow. i suspect that this is what you looking for. – Zarko Mar 11 '18 at 20:30
  • ok, that sounds about right and should work. thanks! – Irene Mar 11 '18 at 21:10

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.