TeX - LaTeX Asked by Bromind on December 10, 2020
I have a box with a modified border style, but when I nest two of such boxes, the style of the inner one is not the one that I set. I know, from the doc and from other questions on this stackexchange, that nesting breakable
boxes can create problem, but I don’t remember having read anything about styles.
So my question: how can I nest boxes while preserving the style like if the inner one is not nested ?
documentclass{article}
usepackage[skins, breakable]{tcolorbox}
tcbset{
enhanced,
frame hidden,
sharp corners,
}
newtcolorbox{sidebox}{
borderline={1pt}{0pt}{gray!80!cyan},
colback=gray!80!cyan!5,
}
begin{document}
begin{sidebox}
[A=B]
end{sidebox}
begin{sidebox}
begin{sidebox}
[A=B]
end{sidebox}
end{sidebox}
end{document}
Notice that, in this MWE, I nest the same kind of box (i.e. a sidebox
in a sidebox
), but in practice, it is not necessarily the case, and the box might have been created with tcolorboxenvironment
.
I suggest to read section 4.16 Layered Boxes and Every Box Settings in tcolorbox
documentation where relation between layered styles are explained.
With your example, it seems that changing tcbset
by tcbsetfoereverylayer
works.
documentclass{article}
usepackage[skins, breakable]{tcolorbox}
tcbsetforeverylayer{
enhanced,
frame hidden,
sharp corners,
}
newtcolorbox{sidebox}{
borderline={1pt}{0pt}{gray!80!cyan},
colback=gray!80!cyan!5,
}
begin{document}
begin{sidebox}
[A=B]
end{sidebox}
begin{sidebox}
begin{sidebox}
[A=B]
end{sidebox}
end{sidebox}
end{document}
Correct answer by Ignasi on December 10, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP