0

I have some very specific style requirements for the TOC on my document. Namely, the list of figures/tables and the bibliography should be numbered. And the sections/subsections should be styled the same (both with dots from title to the page number, same spacing from section number to title, same spacing between all lines). I found the tocbibind package to solve the first problem to number the LOF, LOT and BIB, according to their doc:

\renewcommand{\listoftables}{\begingroup
    \tocsection
    \tocfile{\listtablename}{lot}
\endgroup}

This works as expected. I then used the tocloft package to change to styling of TOC by adjusting some of the indents. This also works on its own. However when importing the tocloft package the numbering of the LOT and LOF from before doesn't work anymore and I can't figure out way.

My MWE document I use for testing is this:

\documentclass{article}

\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}

\renewcommand{\listoftables}{\begingroup
    \tocsection
    \tocfile{\listtablename}{lot}
\endgroup}

\renewcommand{\listoffigures}{\begingroup
    \tocsection
    \tocfile{\listfigurename}{lof}
\endgroup}

\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}

\cftsetindents{section}{0em}{2.5em}
\cftsetindents{subsection}{0em}{2.5em}
\setlength{\cftbeforesecskip}{0.25em} 
\setlength{\cftbeforesubsecskip}{0.25em}

\begin{document}
    
\tableofcontents

\section{First}
\subsection{Sub First}
\section{Second}
\subsection{Sub Second}

\tocsection
\begin{thebibliography}{test}
    \bibitem{foo} Bar
\end{thebibliography}

\listoffigures

\listoftables

\end{document}

According to the doc of tocbibind it should work together with tocloft, but maybe this specific use-case wasn't tested. Is there a way to achieve those requirements? Maybe there are some other packages that would help.

3
  • Do you want section numbers for the \tableofconentts etc.? BTW, I have always found tthese toc packages to be more trouble than they are worth. They make simple problems much more complicated. – John Kormylo Sep 6 '20 at 17:01
  • @JohnKormylo Yes, the List of Figures and Tables should have section numbers in the TOC. What would be the alternative to those packages? Those where the first things that came up after searching. – Sebastian Stern Sep 8 '20 at 7:37
  • Each entry in the list of figures or tables is formatted by \l@figure or \l@table. One can fix most problems just by copying and modifying them. – John Kormylo Sep 8 '20 at 13:20
1

Use the titles option to tocloft. tocloft provides its own methods for formatting the titles of the LoF, etc, which tocbibind does not understand.

\usepackage[titles]{tocloft}

reverts the titles code to the regular style which tocbibind does understand and can alter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.