I am currently trying to use the comment
package to conditionnaly hide some custom tcolorbox
, but I keep getting errors. I suspect this answer addresses the root of the problem, but I don't understand how to apply the suggested fix to my own use of newtcolorbox
...
Here is a MWE (inspired by but a lot more simplified than my current code, of course):
\documentclass[a4paper, 11pt]{article}
\usepackage{comment}
\usepackage{tcolorbox}
\newtcolorbox{myTestTCB}[1][title={default title}]{
#1
}
\excludecomment{myTestTCB}
\begin{document}
\begin{myTestTCB}[title=custom title]
hidden content
\end{myTestTCB}
\end{document}
which gives me the following error (this is an extract, but as far as I know, it is the first useful message in the log):
[...] Excluding 'myTestTCB' comment.
/.../mwe.tex:12: Undefined control sequence.
\endtcolorbox ->\tcb@insert@after@part
\end {tcb@savebox}\tcb@reset@color \t...
l.12 \end{myTestTCB}
/.../mwe.tex:12: Too many }'s.
\endtcb@savebox ...efalse \color@endgroup \egroup
\expandafter \@iiiparbox \...
l.12 \end{myTestTCB}
[...]
This MWE works fine when not using excludecomment
.
How should I proceed to fix this?