0

I found a nice template for my notes but I'm having trouble getting it to reference definitions and theorems correctly, as \ref displays the section number instead of the definition number.

\documentclass{report}

\usepackage{xcolor} \usepackage[most]{tcolorbox}

\definecolor{primary}{RGB}{60, 0, 163}

\NewDocumentCommand\caja{m O{\Large #1} O{grisfondo} O{primary} O{number within=section}} { \newtcbtheorem[#5]{#1}{\large #2} {% enhanced ,breakable ,colback = #3 ,frame hidden ,boxrule = 0sp ,borderline west = {2pt}{0pt}{#4} ,sharp corners ,detach title ,before upper = \tcbtitle\par\smallskip ,coltitle = #4 ,fonttitle = \bfseries\sffamily ,separator sign none ,segmentation style={solid, #4} } {th} }

\caja{defi}[Definición][primary!12][primary]

\newcommand{\dfe}[2]{\begin{defi}{#1}{}#2\end{defi}}

\begin{document} \chapter{} \section{Section} \section{The thing that appears in the reference}

\dfe{What I want to appear in the reference}{ This is a definition \label{def:firstdef} }

A reference \ref{def:firstdef} whose expected outcome is 1.2.1.

\end{document}

The output of the code above. Particularly, a definition numbered 1.2.1. in a section numbered 1.1, and a line that says "A reference 1.1 whose expected outcome is 1.2.1."

Rucy
  • 1
  • 2
    Have a look in the tcolorbox manual. I'm pretty sure that construction does not support a free standing \label like that. It has to be set via an option. – daleif Dec 30 '23 at 13:57

0 Answers0