# How to change title column style in numbered tcolorbox boxes?

I use some tcolorbox boxes, created using \newtcbtheorem with the option auto counter on so that they come with automatic numbering. That works fine, but in my language (French), there should be a space before columns (i.e. I want the box to display "My box n : title" instead of "My box n: title"). I have been able to achieve this result by styling the number, using option number freestyle={\noexpand\arabic{\tcbcounter}~}. The problem is, when I use the version of these boxes without a number (by using the starred environment, i.e. \begin{myBox*}), the title becomes "My box: title". How could I turn this to "My box : title"?

Below is a minimal working example.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[most]{tcolorbox}

\newtcbtheorem[auto counter, number freestyle={\noexpand\arabic{\tcbcounter}~}]{myBox}{My box}{}{myBox}

\begin{document}

\begin{myBox}{Title}{}
Text
\end{myBox}

\begin{myBox*}{Title}
Text
\end{myBox*}

\end{document}


Output:

What I would like (I edited the picture with Paint):

• Welcome to TeX.SX. If you include some complete but minimal code for testing, we don't have to worry about writing and guessing about it. Aug 13 '20 at 12:13
• Did you load babel with french option (option with the document class)? Aug 13 '20 at 13:04
• @Bernard I do have babel loaded with the french option. Aug 13 '20 at 13:44
• Probably not the mose elegant solution, but \newtcbtheorem[auto counter]{myBox}{My box}{separator sign={~:}}{myBox} should give you the desired result. Aug 13 '20 at 17:45
• This is exactly what I was looking for (unfortunately I could not find it in the documentation). Do you want to write this as an answer so I can validate it? @leandriis Aug 14 '20 at 9:54

The title of a tcolorbox theorem can be separated into 4 components: The type, the number, the separator sign and the title text itself. While the regule aversion of the box uses all four elements, the starred version uses all elements except of the number. Adding the space between the missing number and the seprator sign (: in your case) will therefore only add the space in the numbered version of the box, while it sill still be missing in the unnumbered version. Thus, it might be better, to directly change the separators sign and include the space there. Inspired by the definition of the dash separator sign (\ --) I suggest, redefining your colon separator as follows: separator sign={\ :}

To globally use this new separator sign for all myBox boxes, you can use

\newtcbtheorem[auto counter]{myBox}{My box}{separator sign={\ :}}{myBox}


A full MWE looks like the following and produces this output:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[most]{tcolorbox}

\newtcbtheorem[auto counter]{myBox}{My box}{separator sign={\ :}}{myBox}

\begin{document}

\begin{myBox}{Title}{}
Text
\end{myBox}

\begin{myBox*}{Title}
Text
\end{myBox*}

\end{document}