4

According to the answer posted by Thomas F. Sturm in this thread: https://tex.stackexchange.com/a/180000/62477 the next MWE should be able to use the autoreferencing name 'Voorbeeld' to my newtcbtheorem. However i'm only getting the number without the autoreferencing name, could someone point me out what i'm overlooking?

\documentclass{article}

\usepackage[most,listings]{tcolorbox}
\usepackage{hyperref}

\tcbuselibrary{listings,theorems}

\newcounter{voorbeeld}

\newtcbtheorem[use counter=voorbeeld]{Voorbeeld}{Voorbeeld}%
{colframe=red!25, colback=red!25, coltitle=black, arc=0pt,outer arc=0pt, fonttitle=\bfseries}{vb}

\newcommand{\Voorbeeldautorefname}{Voorbeeld}

\begin{document}

This is a reference to \autoref{vb:test}.

\begin{Voorbeeld}{This is a test}{test}
 Some text goes here
\end{Voorbeeld}

\end{document}

It should say 'This is a reference to Voorbeeld 1' in the main text.

1 Answers1

6

The referencing has to follow the counter name not the environment name. So, here:

\newcommand{\voorbeeldautorefname}{Voorbeeld}

The following works:

\documentclass{article}

\usepackage[most,listings]{tcolorbox}
\usepackage{hyperref}

\tcbuselibrary{listings,theorems}

\newcounter{voorbeeld}

\newtcbtheorem[use counter=voorbeeld]{Voorbeeld}{Voorbeeld}%
{colframe=red!25, colback=red!25, coltitle=black, arc=0pt,outer arc=0pt, fonttitle=\bfseries}{vb}

\newcommand{\voorbeeldautorefname}{Voorbeeld}

\begin{document}

This is a reference to \autoref{vb:test}.

\begin{Voorbeeld}{This is a test}{test}
 Some text goes here
\end{Voorbeeld}

\end{document}

enter image description here