T-F-S / tcolorbox

A LaTeX package to create highly customizable colored boxes.
http://www.ctan.org/pkg/tcolorbox
LaTeX Project Public License v1.3c
232 stars 16 forks source link

Package hyperref Info: bookmark level for <list type> unknown defaults to 0 #296

Open muzimuzhi opened 3 weeks ago

muzimuzhi commented 3 weeks ago

tcolorbox shares a similar with thmtools (https://github.com/muzimuzhi/thmtools/issues/70): when hyperref is loaded, using /tcb/new/list inside to add boxes to some list may cause a hyperref info

Package hyperref Info: bookmark level for <list type> unknown defaults to 0 on input line ...

when the corresponding \toclevel@<list type> is undefined. Here <list type> is the value of /tcb/new/list type which defaults to tcolorbox.

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{hyperref}

\newtcolorbox[list inside=lotcb, auto counter]{mytcb}[1][]{title={Box \thetcbcounter: #1}}

\makeatletter
%\def\toclevel@tcolorbox{0}
\makeatother

\begin{document}
\tcblistof{lotcb}{List of mytcb}

\begin{mytcb}[Title]
  content
\end{mytcb}

\begin{mytcb}[Title]
  content
\end{mytcb}

\end{document}

From the hyperref manual, sec. 4.1 Counters

\toclevel@<counter>

This is a variable which should contain a number. It is used for the level in the bookmarks. It should be defined for all counters which are used in toc like lists and \addcontentsline. Typical values are [...]

(Actually it need not be a <counter>, but <list type>.)

T-F-S commented 2 weeks ago

Thank you for reporting this! I will add the needed code line to the next version.