0

I want to change the default background color of the \tcolorbox environment. I really like /.append style but I know that's a TiKZ thing.

When you uncomment the \renewenvironment in the header, Overleaf gives this warning:

TeX capacity exceeded, sorry [grouping levels=255].

I tried some variations on it but I can't seem to fix the problem.

It seems like the available documentation for \newenvironment is a lot more thorough than for \renewenvironment.

\documentclass{article}
\usepackage{tcolorbox}

%%%%%%%%%This didn't work in the header. I tried putting in [1] and that didn't seem to matter
%\renewenvironment{tcolorbox}{\begin{tcolorbox}[colback=white]}{\end{tcolorbox}}


\begin{document}

\begin{tcolorbox}
The default background is gray
\end{tcolorbox}

\begin{tcolorbox}[colback=white]
    I want it to default to white
\end{tcolorbox}


\end{document}

tcolorboxes mwe

1
  • 1
    You can use \tcbset{colback=white} to set a different "default". (The cleaner option may be to define your own style with all the "default" values you want, and use the style wherever needed.)
    – user299596
    Commented Jun 24, 2023 at 21:08

1 Answer 1

1

@user26305 answered in a comment

\documentclass{article}
\usepackage{tcolorbox}

\tcbset{colback=white} %This fixed it

\begin{document}

\begin{tcolorbox}
The default background has been changed from gray to white!
\end{tcolorbox}


\end{document}

Thank you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .