I'm having some problem with the \ref command I never had. And I guess it's caused by my own style created for definition's box and similars (token from Breaking Page with Boiboites Package TikZ).
\documentclass[11pt]{book}
%I HOPE THERE'S NO MISSING PACKAGES OR CONFLICTING COMBINATIONS.
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish, activeacute]{babel}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{hyperref}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{ntheorem} %Para crear estos nuevos comandos.
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\newcounter{ndefi}[chapter] %Counter created for definitions.
%Creating little box for the definition.
\newcommand{\defitit}{
\node[fill=green!20,
rounded corners,
draw=black,
text=black,
line width=1pt,
inner sep=4pt,
anchor=west,
xshift=12pt]
at (frame.north west){\bfseries Definición \stepcounter{ndefi} \thechapter.\thendefi -.};
}
%Creating the big box for the definition.
\newtcolorbox{defi}{
enhanced,
overlay unbroken and first={\defitit},
colframe=green,
boxrule=1pt,
arc=3mm,
breakable,
top=15pt,
before=\vskip18pt,
}
\begin{document}
\chapter{El capítulo fantasma de las cosas de prueba.}
\section{Donde las cajas de definición y demás se prueban.}
\begin{defi}[Prueba de título] \label{probando1}
Probando, probando... 1, 2, 3...
\end{defi}
\begin{defi}\label{probando2}
Probando, probando... 1, 2, 3...
\end{defi}
\begin{defi}
Probando, probando... 1, 2, 3...
\end{defi} \label{probando5}
\label{probando6}\begin{defi}
Probando, probando... 1, 2, 3...
\end{defi}
Trying the references of definitions \ref{probando1}, \ref{probando2}, \ref{probando5} and \ref{probando6}.
\end{document}
Wherever I fit the label, the reference works badly, just showing the section and referencing to it. I guess the problem is on the enviroment I created to make those boxes, but I have no idea. Or maybe the problem is I must use something different to \label or \ref...
