TransWikia.com

In tufte-book.cls the breakable option is incompatible with putting a tcolorbox in a fullwidth environment

TeX - LaTeX Asked on May 3, 2021

In my preamble:

documentclass[twoside,nobib,leqno,ls]{tufte-book}
...
usepackage[most,breakable]{tcolorbox}
AtBeginDocument{tcbset{after={parnoindent}}}
newcounter{myBox}
newtcolorbox[use counter = myBox, number within = chapter]{myBox}[2][]{%
  boxrule = 0.5pt, breakable, colback = gray!5, colbacktitle = gray!10, coltitle = black,
  fonttitle = sffamily, label type = myBox, sharp corners = all,
  title = Box~thetcbcountersecsptextcolor{gray!80}{|}secsp #2,#1}

In order to have the box span the width of the page I have to put the myBox environment within a fullwidth environment. But that produces the following error messages

! Extra else.
<argument> ...t =tcb@split@USL fi fi fi else 
                                                  tcb@split@upper@box ifdi...
l.1092 end{fullwidth}
                      
I'm ignoring this; it doesn't match any if.

! Argument of tikzexternal@laTeX@collect@until@end@tikzpicture has an extra }.
<inserted text> 
                par 
l.1092 end{fullwidth}
                      
I've run across a `}' that doesn't seem to match anything.
For example, `defa#1{...}' and `a}' would produce
this error. If you simply proceed now, the `par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
[]tcb@tikz@begin@hook tcb@bbdraw tcb@apply@graph@patches tcb@extensions@pre
frame ETC.
! Paragraph ended before tikzexternal@laTeX@collect@until@end@tikzpicture was 
complete.
<to be read again> 
                   par 
l.1092 end{fullwidth}
                      
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

! Extra }, or forgotten endgroup.
<recently read> }
                 
l.1092 end{fullwidth}

Clearly the fullwidth environment doesn’t survive a page break.

I wonder if it’s possible to tell tcolorbox to use fullwidth or, alternatively to treat it as a float that doesn’t force a new page after pushing out all the content that precedes it.

One Answer

The problem is solved by using the float option of tcolorbox:

newtcolorbox[use counter = myBox, number within = chapter]{myBox}[2][]{%
  boxrule = 0.5pt, breakable, colback = gray!5, colbacktitle = gray!10,
coltitle = black, floatplacement = t, float, fonttitle = sffamily,
label type = myBox, sharp corners = all, title = Box~thetcbcountersecsptextcolor{gray!80}{|}secsp #2,#1}

Answered by mk9y on May 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP