tcolorbox – Problem Solving for Newtcbtheorem Issues in Document Formatting

tcolorboxtheorems

I'd like delete the separator sign={\ ---} of \newtcbtheorem below. I mean: I'd like a tcolorbox-latex-function that produces the last tcolorbox in this photo.

SOLEX

I tried writting in \newtcbtheorem this:

\newtcbtheorem[number within=subsection]{SolEx}{Soluzione dell'\Exref{\pgfkeysvalueof{/tcb/exercise ref}} --- }{enhanced, colback=red!5!white, colframe=black, sharpish corners, breakable, separator sign none, fonttitle=\bfseries, coltitle=orange}{ex}

Is it possible? Thank you so much

\PassOptionsToPackage{svgnames, x11names}{xcolor}
\documentclass[openany]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage[svgnames,x11names]{xcolor}
\usepackage{amscd}
\usepackage{color}
\usepackage{stix}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{imakeidx}
\usepackage[tight, italian]{minitoc}
\usepackage[most]{tcolorbox}
\tcbuselibrary{breakable,theorems,skins}
\usepackage[colorlinks=true]{hyperref}
\hypersetup{pdfstartview=FitH}
\usepackage{cleveref}

% New Exercises

\newtcbtheorem[number within=subsection] {exercise}{Esercizio}{%
enhanced, colback=red!5!white, colframe=gray, sharpish corners, breakable, fonttitle=\bfseries, coltitle=green, separator sign={\ ---},#1, description delimiters={$\bigl($}{$\bigr)$}}{ex}

\newtcbtheorem[use counter from=exercise] {solex}{}{enhanced, colback=red!5!white, colframe=gray, sharpish corners, breakable, separator sign none, fonttitle=\bfseries, coltitle=green, #1}{solex}

\newtheorem{esercizio}{Esercizio}[subsection]

% For solutions

\tcbset{exercise ref/.initial=,}

\newtcbtheorem[number within=subsection]{SolEx}{Soluzione dell'\Exref{\pgfkeysvalueof{/tcb/exercise ref}} --- }{enhanced, colback=red!5!white, colframe=black, sharpish corners, breakable, separator sign none, fonttitle=\bfseries, coltitle=orange}{ex}

% New ref

\newcommand{\Exref}[1]{\textcolor{red}{Esercizio} \ref{ex:#1}}

\begin{document}

\Large

\begin{exercise}{Esercizio d'esempio}{EX1}

\end{exercise}

\begin{SolEx*}[exercise ref={EX1}]

\end{SolEx*}

But I'd like something like this

\begin{tcolorbox}[enhanced, colback=red!5!white, colframe=black, sharpish corners, breakable, separator sign none, fonttitle=\bfseries, coltitle=orange, title={Soluzione dell'\Exref{EX1}}]

\end{tcolorbox}

\end{document}

Best Answer

Change your

\newtcbtheorem[number within=subsection]{SolEx}{Soluzione dell'\Exref{\pgfkeysvalueof{/tcb/exercise ref}} --- }{enhanced, colback=red!5!white, colframe=black, sharpish corners, breakable, separator sign none, fonttitle=\bfseries, coltitle=orange}{ex}

into

\newtcbtheorem[number within=subsection]{SolEx}
  {Soluzione dell'\Exref{\pgfkeysvalueof{/tcb/exercise ref}}}{
  enhanced,
  colback=red!5!white,
  colframe=black,
  sharpish corners,
  breakable,
  separator sign none,
  fonttitle=\bfseries,
  coltitle=orange
}{ex}

Not only this eases maintenance, but would show that you had

Soluzione dell'\Exref{\pgfkeysvalueof{/tcb/exercise ref}} --- 

so, of course, TeX added an em-dash as requested.