Update
Since memoir
is being used, then things are easier since memoir already provides all the required tools to produce the desired list using \newlistof
and associates; in particular now \listofboxes
comes with a starred variant that won't add to the ToC an entry for the new list:
\documentclass[a4paper,11pt,twoside,openany,showtrims,strict,extrafontsizes]{memoir}
\usepackage[skipabove=25pt,skipbelow=25pt,leftmargin=10pt,rightmargin=10pt,framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\newenvironment{infobox}[1][]{%
\refstepcounter{infobox}%
\begin{mdframed}[%
frametitle={Box \theinfobox\ #1},
skipabove=\baselineskip plus 2pt minus 1pt,
skipbelow=\baselineskip plus 2pt minus 1pt,
linewidth=0.5pt,
frametitlerule=true,
repeatframetitle=true,
font=\small,
]%
\addcontentsline{lob}{infobox}{\numberline{\theinfobox}#1}%
}{%
\end{mdframed}
}
\makeatletter
\newcommand\listboxname{Boxes}
\newlistof{listofboxes}{lob}{\listboxname}
\newlistentry[chapter]{infobox}{lob}{0}
\cftsetindents{infobox}{0em}{2.3em}
\renewcommand{\theinfobox}{\thechapter.\arabic{infobox}}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\listofboxes
\chapter{Test chapter}
\section{Test section}
\lipsum[4]
\begin{infobox}[Title of the first test box]
\label{orgspecialblock1}
\lipsum[4]
\end{infobox}
\begin{infobox}[Title of the second test box]
\label{orgspecialblock2}
\lipsum[4]
\end{infobox}
\begin{figure}
\caption{\label{orgspecialblock3}A test figure}
\end{figure}
\end{document}
An image of the result showing the ToC, the LoF and te new list:
mdframed
version
Here's one possibility:
\documentclass[11pt]{article}
\usepackage[skipabove=25pt,skipbelow=25pt,leftmargin=10pt,rightmargin=10pt,framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\newcounter{infobox}
\newenvironment{infobox}[1][]{%
\refstepcounter{infobox}%
\begin{mdframed}[%
frametitle={Box \theinfobox\ #1},
skipabove=\baselineskip plus 2pt minus 1pt,
skipbelow=\baselineskip plus 2pt minus 1pt,
linewidth=0.5pt,
frametitlerule=true,
repeatframetitle=true,
font=\small,
]%
\addcontentsline{lob}{section}{\numberline{\theinfobox}#1}%
}{%
\end{mdframed}
}
\makeatletter
\newcommand\listboxname{List of Boxes}
\newcommand\listofboxes{
\section*{\listboxname}
\@starttoc{lob}
}
\makeatother
\begin{document}
\tableofcontents
\listofboxes
\section{Heading}
\lipsum[4]
\begin{infobox}[Title of the first test box]
\label{orgspecialblock1}
\lipsum[4]
\end{infobox}
\begin{infobox}[Title of the second test box]
\label{orgspecialblock2}
\lipsum[4]
\end{infobox}
\end{document}
An image of the result showing the ToC and the new list of boxes:
tcolorbox
version
Here I present a version using tcolorbox
which already provides the tools to easily generate a list of boxes:
\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\usepackage{xparse}
\newtcolorbox[auto counter,list inside=infobox]{infobox}[2][]{
breakable,
enhanced jigsaw,
before=\vskip25pt,
after=\vskip25pt,
colback=white,
colbacktitle=white,
coltitle=black,
fonttitle=\bfseries,
arc=0pt,
outer arc=0pt,
boxsep=0pt,
toptitle=5pt,
bottomtitle=5pt,
left=10pt,
right=10pt,
enlarge left by=10pt,
enlarge right by=10pt,
width=\textwidth-20pt,
boxrule=0.4pt,
title={\strut Box~\thetcbcounter\ #1\strut},
label={#2}
}
\newcommand\listboxname{List of Boxes}
\begin{document}
\tableofcontents
\tcblistof[\section*]{infobox}{\listboxname}
\section{Heading}
\lipsum[4]
\begin{infobox}[Title of the first test box]{orgspecialblock1}
\lipsum[4]
\end{infobox}
\begin{infobox}[Title of the second test box]{orgspecialblock2}
\lipsum[4]
\end{infobox}
\end{document}
An image of the result showing the ToC and the new list of boxes:
Best Answer
The error you are getting comes from loading the
tocloft
andsubfigure
packages simultaneously, as the following example swhows:As soon as one processes this document, the following error shows up:
The problem is that both packages define the counters
lofdepth
andlotdepth
. To prevent the error, simply loadtocloft
with thesubfigure
option; i.e., load the packages like this:By the way,
sufigure
is an obsolete package and shouldn't be used anymore;subfig
orsubcaption
are valid alternatives