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.
https://tex.stackexchange.com/questions/561563/numbered-table-of-contents-figures-while-using-tocloft
tex.stackexchange.com
crawl=CC-MAIN-2021-21
168073
application/http; msgtype=response
sha1:A7OYZTVOSVGYGR3WZMHSAZ746RBJ53OC
<urn:uuid:c01a1ad3-079e-4a2c-9e56-2b6c30219347>
2021-05-16T00:33:48Z
151.101.65.69
text/html
sha1:F2AILHGSYRSUJLLJFPZMJ4RAJ5SD5NC7
<urn:uuid:69973687-96fd-4a0c-9d81-bf920c5ca1f6>
https://tex.stackexchange.com/questions/561563/numbered-table-of-contents-figures-while-using-tocloft
response
<urn:uuid:aec78b5b-b8d3-4996-9d5e-cee477b76adc>
isPartOf: CC-MAIN-2021-21
publisher: Common Crawl
description: Wide crawl of the web for May 2021
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-67.ec2.internal
software: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/