problema en la referencia sobre \newtcbtheorem

problema en la referencia sobre \newtcbtheorem

Considere el siguiente código:

\documentclass[a4paper,12pt,openany]{book}
\usepackage[most]{tcolorbox}
\usepackage{cleveref}
\makeatletter
\makeatother
\newtcbtheorem[auto counter, number within = section]{defn}{Définition}{
colback=green!5,
colframe=green!35!black,
fonttitle=\bfseries,}
{defn}
\newtcbtheorem[auto counter, number within = section]{theo}{Théorème}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{theo}
\newtcbtheorem[auto counter, number within = section]{prop}{Proposition}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{prop}
\newtcbtheorem[auto counter, number within = section]{lem}{Lemme}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{lem}
\newtcbtheorem[auto counter, number within = section]{coro}{Corollaire}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{coro}
\begin{document}
\chapter{CH 1}
\begin{theo}{}{}\label{A}
A
\end{theo}
\section{sec 1}
\begin{prop}{}{}\label{B}
B
\end{prop}
\section{sec 2}
\begin{lem}{}{}\label{C}
C
\end{lem}
\section{sec 3}
\begin{coro}{}{}\label{D}
D
\end{coro}
Théorème ({\color{blue}\ref{A}}), proposition ({\color{blue}\ref{B}}), lemme ({\color{blue}\ref{C}}), corollaire ({\color{blue}\ref{D}}).
\end{document}

el resultado obtenido es:

ingrese la descripción de la imagen aquí

Mi problema es que quiero que la última oración sea:

"Teorème (1.0.1), proposición (1.1.1), déjame (1.2.1), corolario (1.3.1)."

Una idea por favor.

Respuesta1

Las referencias cruzadas con entornos similares a teoremas funcionan de manera diferente. La etiqueta debe estar en el tercer argumento posterior \beginy la referencia debe tener como prefijo el último elemento de la definición.

Dado que define theocon el último elemento theo, las referencias deberían ser similares \ref{theo:A}.

No creo que haya mucho que hacer al respecto aparte de usar un prefijo más simple para todo, aquí t.

\documentclass[a4paper,12pt,openany]{book}
\usepackage[most]{tcolorbox}
\usepackage{cleveref}

\newtcbtheorem[auto counter, number within = section]{defn}{Définition}{
  colback=green!5,
  colframe=green!35!black,
  fonttitle=\bfseries,
}{t}
\newtcbtheorem[auto counter, number within = section]{theo}{Théorème}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{t}
\newtcbtheorem[auto counter, number within = section]{prop}{Proposition}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{t}
\newtcbtheorem[auto counter, number within = section]{lem}{Lemme}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{t}
\newtcbtheorem[auto counter, number within = section]{coro}{Corollaire}{
    colback=green!5,
    colframe=green!35!black,
    fonttitle=\bfseries,
}{t}

\begin{document}
\chapter{CH 1}
\begin{theo}{}{A}
text A
\end{theo}
\section{sec 1}
\begin{prop}{}{B}
text B
\end{prop}
\section{sec 2}
\begin{lem}{}{C}
text C
\end{lem}
\section{sec 3}
\begin{coro}{}{D}
text D
\end{coro}

Théorème (\textcolor{blue}{\ref{t:A}}), 
proposition (\textcolor{blue}{\ref{t:B}}), 
lemme (\textcolor{blue}{\ref{t:C}}), 
corollaire (\textcolor{blue}{\ref{t:D}}).

\end{document}

ingrese la descripción de la imagen aquí

Puede agregar soporte para cleveref; ajústelo para adaptarse a las características del paquete.

\documentclass[a4paper,12pt,openany]{book}
\usepackage[most]{tcolorbox}
\usepackage{cleveref}

\newtcbtheorem[auto counter, number within = section]{defn}{Définition}{
  colback=green!5,
  colframe=green!35!black,
  fonttitle=\bfseries,
  label type=defn,
}{t}
\newtcbtheorem[auto counter, number within = section]{theo}{Théorème}{
  colback=green!5,
  colframe=green!35!black,
  fonttitle=\bfseries,
  label type=theo,
}{t}
\newtcbtheorem[auto counter, number within = section]{prop}{Proposition}{
  colback=green!5,
  colframe=green!35!black,
  fonttitle=\bfseries,
  label type=prop,
}{t}
\newtcbtheorem[auto counter, number within = section]{lem}{Lemme}{
  colback=green!5,
  colframe=green!35!black,
  fonttitle=\bfseries,
  label type=lem,
}{t}
\newtcbtheorem[auto counter, number within = section]{coro}{Corollaire}{
  colback=green!5,
  colframe=green!35!black,
  fonttitle=\bfseries,
  label type=coro,
}{t}

\crefname{defn}{définition}{définitions}
\crefname{theo}{théorème}{théorèmes}
\crefname{prop}{proposition}{propositions}
\crefname{coro}{corollaire}{corollaires}
\crefname{lem}{lemme}{lemmes}
\begin{document}
\chapter{CH 1}
\begin{theo}{}{A}
text A
\end{theo}
\section{sec 1}
\begin{prop}{}{B}
text B
\end{prop}
\section{sec 2}
\begin{lem}{}{C}
text C
\end{lem}
\section{sec 3}
\begin{coro}{}{D}
text D
\end{coro}

\Cref{t:A}, \cref{t:B}, \cref{t:C}, \cref{t:D}.

Théorème (\textcolor{blue}{\ref{t:A}}), 
proposition (\textcolor{blue}{\ref{t:B}}), 
lemme (\textcolor{blue}{\ref{t:C}}), 
corollaire (\textcolor{blue}{\ref{t:D}}).

\end{document}

ingrese la descripción de la imagen aquí

información relacionada