I have the problem that when I add parbox=false to the options of tcolorbox, the text within the box is not breaking properly. Do you have an idea what might be the issue?

Here is the code:





  [use counter*=thm,number within=chapter,crefname={example}{examples},Crefname={Example}{Examples}]%
    before skip=10pt,after skip=10pt,
    toprule at break=0.2cm,
    sharp corners,
  }% options
  {ex}% prefix




I am using the parskip package and want it to be applied to the contents of the tcolorbox too. That's why I want to set the parbox option to false.

With parbox=false: with parbox=false

Without parbox=false: without parbox=false

  • Please add the missing parts to your code, so we can copy and run it.
    – MS-SPO
    Jun 23 at 14:02
  • 1
    @MS-SPO I changed the code so that you can copy/paste and run it :)
    – heroxav
    Jun 23 at 15:32
  • 1
    Seems to be related to the default ragged text setting in tufte-book document class. Jun 23 at 19:32
  • @muzimuzhiZ thank you for your pointer! interestingly, adding the option halign=flush left (so \raggedright to every box) fixes things
    – heroxav
    Jun 24 at 5:15

1 Answer 1


By using parbox=false, a customized \@parboxrestore is used for that tcolorbox.

% default definition in latex2e kernel
% $ latexdef -s \@arrayparboxrestore
% latex.ltx, line 11974:
  \parindent\z@ \parskip\z@skip
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip

% customized one
% tcolorbox.sty


Among all those differences, the one relevant to OP's case is \sloppy (and the ragged text setting introduced by tutfe-book class), which is defined as

% $ latexdef -s \sloppy
% latex.ltx, line 13894:
  \tolerance 9999%
  \emergencystretch 3em%
  \hfuzz .5\p@

Hence inserting \sopply is a direct solution. For better result and since tutfe-book class has loaded and configured ragged2e package, \justifying would help.

As for where to pass these commands, the best choice is some halign=<arbitrary alignment code> option which is not yet supported by tcolorbox. As a workaround, you can put them in font options like fontupper and fontlower.


  \begin{tcolorbox}[title=\texttt{\detokenize{#1}}, #1]

Base case

Simulate \verb|parbox=true|
\test{parbox=false, fontupper=\sloppy}

Try better
\test{parbox=false, fontupper=\justifying}

enter image description here

  • great answer, thank you!
    – heroxav
    2 hours ago

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.