2

My when i am referring a theorem box it is including only the chapter number and section number but not theorem number. Here is the code of theorem tcolorbox


\tcbuselibrary{theorems,skins,hooks}
\newtcbtheorem[number within=section]{Theorem}{Theorem}
{%
    enhanced
    ,breakable
    ,colback = mytheorembg
    ,frame hidden
    ,boxrule = 0sp
    ,borderline west = {2pt}{0pt}{mytheoremfr}
    ,sharp corners
    ,detach title
    ,before upper = \tcbtitle\par\smallskip
    ,coltitle = mytheoremfr
    ,fonttitle = \bfseries\sffamily
    ,description font = \mdseries
    ,separator sign none
    ,segmentation style={solid, mytheoremfr}
}
{th}

Now when i am creating a theorem with a label

\begin{Theorem}{}{} 
    \label{limitpoint} $x$ is a limit point of $S$ $\iff$ every neighborhood of $x$ in $X$ contains a point of $S$ other than $S$.
\end{Theorem}
\ref{limitpoint}

It is only printing 1.1 where as it should print 1.1.1.

1
  • As always here, please extend your example to full example, such that those who want to test the code does not have to add anything in order to do so.
    – daleif
    Commented Feb 8, 2022 at 17:02

1 Answer 1

2

The label limitpoints has to be placed in the last mandatory argument and you need to reference it as th:limitpoint because th is what you declared when defining the theorem environment.

\documentclass{book}

\usepackage[many]{tcolorbox}
\tcbuselibrary{theorems,skins,hooks}
\newtcbtheorem[number within=section]{Theorem}{Theorem}{
  enhanced,
  breakable,
  colback = mytheorembg,
  frame hidden,
  boxrule = 0sp,
  borderline west = {2pt}{0pt}{mytheoremfr},
  sharp corners,
  detach title,
  before upper = \tcbtitle\par\smallskip,
  coltitle = mytheoremfr,
  fonttitle = \bfseries\sffamily,
  description font = \mdseries,
  separator sign none,
  segmentation style={solid, mytheoremfr},
}
{th}

\colorlet{mytheorembg}{blue!20}
\colorlet{mytheoremfr}{red!20!blue}

\begin{document}

\chapter{Title}
\section{Title}

\begin{Theorem}{}{limitpoint}
$x$ is a limit point of $S$ if and only if every neighborhood of $x$ in $X$ 
contains a point of $S$ other than $x$.
\end{Theorem}

\ref{th:limitpoint}

\end{document}

enter image description here

I changed the position of all commas because I can't stand seeing them at the left, as they refer to the preceding line.

I also changed $\iff$ into “if and only if”: it costs little to use words instead of mysterious symbols (and fixed the statement).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .