1

How can the List of Figures and List of Tables be included in the Table of Contents when they have been placed under the control of the tocbasic package? Ordinarily, these listings can be included by using the package tocbibind without the options notlof and notlot.

MWE:

\documentclass{report}
\usepackage[nottoc]{tocbibind}% load before tocbasic
\usepackage{tocbasic}

% reset vertical spacing of LoF and LoT
\renewcommand{\listoffigures}{\listoftoc[\listfigurename]{lof}}
\renewcommand{\listoftables}{\listoftoc[\listtablename]{lot}}

% place LoF and LoT under control of tocbasic
\DeclareTOCStyleEntries{tocline}{figure,table}

% define custom listing
\DeclareNewTOC[%
    type=thing,
    float,
    name=Thing,
    listname={List of Things},
    counterwithin=chapter,
    setup=totoc,%                add this list to the Table of Contents
    tocentryindent:=figure,
    tocentrynumwidth:=figure
]{lop}

% match vertical spacing of LoF and LoT
\usepackage{xpatch}
\makeatletter
\xapptocmd{\@chapter}
  {\addtocontents{lop}{\protect\addvspace{10\p@}}}
  {}{\PatchFailed}
\makeatother

\begin{document}
    \tableofcontents
    \listoffigures
    \listoftables
    \listofthings

    \chapter{First}
    \begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 1} \end{figure}
    \begin{table}[ht]  \centering\fbox{Table} \caption{Table 1}  \end{table}
    \begin{thing}[ht]  \centering\fbox{Thing} \caption{Thing 1}  \end{thing}

    \chapter{Second}
    \begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 2} \end{figure}
    \begin{table}[ht]  \centering\fbox{Table} \caption{Table 2}  \end{table}
    \begin{thing}[ht]  \centering\fbox{Thing} \caption{Thing 2}  \end{thing}
    \begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 3} \end{figure}
    \begin{table}[ht]  \centering\fbox{Table} \caption{Table 3}  \end{table}
    \begin{thing}[ht]  \centering\fbox{Thing} \caption{Thing 3}  \end{thing}
\end{document}

Contents page, lacking the LoF and LoT:

enter image description here

1 Answer 1

1

You can use \setuptoc{lof}{totoc} and \setuptoc{lot}{totoc} in your preamble to add the two to your ToC:

\documentclass{report}
\usepackage[nottoc]{tocbibind}% load before tocbasic
\usepackage{tocbasic}


% reset vertical spacing of LoF and LoT
\renewcommand{\listoffigures}{\listoftoc[\listfigurename]{lof}}
\renewcommand{\listoftables}{\listoftoc[\listtablename]{lot}}

% place LoF and LoT under control of tocbasic
\DeclareTOCStyleEntries{tocline}{figure,table}

% define custom listing
\DeclareNewTOC[%
    type=thing,
    float,
    name=Thing,
    listname={List of Things},
    counterwithin=chapter,
    setup=totoc,%                add this list to the Table of Contents
    tocentryindent:=figure,
    tocentrynumwidth:=figure
]{lop}

\setuptoc{lof}{totoc}
\setuptoc{lot}{totoc}

% match vertical spacing of LoF and LoT
\usepackage{xpatch}
\makeatletter
\xapptocmd{\@chapter}
  {\addtocontents{lop}{\protect\addvspace{10\p@}}}
  {}{\PatchFailed}
\makeatother

\begin{document}
    \tableofcontents
    \listoffigures
    \listoftables
    \listofthings

    \chapter{First}
    \begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 1} \end{figure}
    \begin{table}[ht]  \centering\fbox{Table} \caption{Table 1}  \end{table}
    \begin{thing}[ht]  \centering\fbox{Thing} \caption{Thing 1}  \end{thing}

    \chapter{Second}
    \begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 2} \end{figure}
    \begin{table}[ht]  \centering\fbox{Table} \caption{Table 2}  \end{table}
    \begin{thing}[ht]  \centering\fbox{Thing} \caption{Thing 2}  \end{thing}
    \begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 3} \end{figure}
    \begin{table}[ht]  \centering\fbox{Table} \caption{Table 3}  \end{table}
    \begin{thing}[ht]  \centering\fbox{Thing} \caption{Thing 3}  \end{thing}
\end{document}

enter image description here

You must log in to answer this question.

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