Open dbitouze opened 3 months ago
The error was raised by \newcounter{<conter name>}
on an existing <counter name>
. Not sure if it's feasible for LaTeX2e to make that general message more specific for counters.
Possible patch on tcolorbox
side
\documentclass{article}
\usepackage{tcolorbox}
\makeatletter
\def\tcb@proc@counter@auto#1{%
%% begin patch
\ifcsdef{c@tcb@cnt@#1}
{\tcb@error{Auto counter for environment '#1' already defined}{}}
{}%
%% end patch
\newcounter{tcb@cnt@#1}%
\csxdef{tcb@cnt@#1}{tcb@cnt@#1}%
\tcb@proc@counter@autoanduse{#1}%
}
\makeatother
\DeclareTColorBox[auto counter]{pabox}{}{}
\DeclareTColorBox[auto counter]{pabox}{}{}
\begin{document}
\end{document}
Now compile it will throw two errors
! Package tcolorbox Error: Auto counter for environment 'pabox' already defined
.
! LaTeX Error: Command \c@tcb@cnt@pabox already defined.
Or name \end... illegal, see p.192 of the manual.
I think this is a useful patch and I will add it to the next version. Thank you.
The following MCE:
fails to compile with the following cryptic message:
Maybe it is worth to provide a more meaningful message in such a case.