0

I have some smaller issue with the table of contents.

With having multiple figures and tables I wanted to put them all together in a list and display them. -> Done Now I wanted to display the respective list / the page size in a table of contents. The generating of the toc was also acchieved.

However, as you can see in the added screenshot, the toc does display each list two times. And so far it was independent of the length of each list. Also you can see, that the first instance of either list is displayed with a completely wrong page number. Yet I cant find the reason for the generation of this instance.

Sometimes I can acchive only one displayed list by shifting around \listofxxx before \addcontentsline, but this is not a proper solution as with restarting the TeXEditor the problem starts again.

I'm currently running my files with Biber and LuaLaTeX with scrbook as the documentclass.

Would really appreciate thoughts and suggestions. Thanks a lot!!

The compiling code

\RequirePackage[l2tabu,orthodox]{nag}


\documentclass[headsepline,footsepline,footinclude=false,oneside,fontsize=11pt,paper=a4,listof=totoc,bibliography=totoc,DIV=12]{scrbook} % one-sided

\input{settings}

\begin{document}
\selectlanguage{english}

\frontmatter{}

\microtypesetup{protrusion=false}
\tableofcontents{}


\microtypesetup{protrusion=true}
\mainmatter{}

\chapter{chap1}
\lipsum
\chapter{chap2}
\lipsum

\begin{figure}
    \centering
    \begin{adjustbox}{width=0.75\linewidth}%
        \includegraphics{example-image-duck}%
    \end{adjustbox}%
    \caption{Testfigure}
    \label{fig:TestFigure}
\end{figure}
\begin{figure}
    \centering
    \begin{adjustbox}{width=0.75\linewidth}%
        \includegraphics{example-image-duck}%
    \end{adjustbox}%
    \caption{TestFigure2}
    \label{fig:Test}
\end{figure}


\microtypesetup{protrusion=false}
\microtypesetup{protrusion=true}
\begin{singlespace}
    
\printbibliography
\setcounter{lofdepth}{2}
\setcounter{lotdepth}{2}


\addcontentsline{toc}{chapter}{\protect List of Figures}
\listoffigures


\addcontentsline{toc}{chapter}{\protect List of Tables}
\listoftables

\end{singlespace}

\end{document}

The settings file

\PassOptionsToPackage{table,svgnames,dvipsnames}{xcolor}


\usepackage[sc]{mathpazo}
\usepackage{mathptmx}
\usepackage{mathtools}
\usepackage[ngerman,english]{babel} % english is the same as american or USenglish
\usepackage[autostyle]{csquotes}
\usepackage[%
  backend=biber,
  url=true,
  style=chem-angew, % alphabetic, numeric
  sorting=none, % default == nty, https://tex.stackexchange.com/questions/51434/biblatex-citation-order
  maxnames=4,
  minnames=3,
  maxbibnames=99,
  giveninits,
  uniquename=init]{biblatex} 
\addbibresource{bibliography.bib}

\setlength{\parindent}{0pt}

\usepackage{graphicx}
\usepackage{scrhack} % necessary for listings package
\usepackage{listings}
\usepackage{lstautogobble}


\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{booktabs} % for better looking table creations, but bad with vertical lines by design (package creator despises vertical lines)
\usepackage[final]{microtype} %resize the text
\usepackage{caption}

\usepackage[hidelinks]{hyperref} % hidelinks removes colored boxes around references and links
\usepackage[capitalise]{cleveref} %referencing within

\usepackage{paralist} % for condensed enumerations or lists
\usepackage{subfig} % for having figures side by side


\usepackage{makecell} % allows nice manual configuration of cells with linebreaks in \thead and \makecell with alignments


\usepackage{adjustbox} % can center content wider than the \textwidth

\usepackage[vflt]{floatflt}
\usepackage[format=plain]{caption}


\usepackage{duckuments} %add random duck images
\usepackage{lipsum} %add lipsum text


\usepackage{fontspec}

\usepackage{setspace}
\doublespacing

% Add table of contents to PDF bookmarks
\BeforeTOCHead[toc]{{\cleardoublepage\pdfbookmark[0]{\contentsname}{toc}}}


% Settings for pgfplots
\pgfplotsset{compat=newest}

Current display of the toc

enter image description here

1
  • Please provide a Minimal Working Example with only the needed packages and lines of code to reproduce your problem
    – Mane32
    Commented Mar 8 at 23:00

1 Answer 1

1

To make easier, give just a example of your code that is:

  • Minimal: Only containts the necessary packages and lines to reproduce your problem.
  • Working: Is compilable (or almost compilable), without needing external or local files.

Now, for your problem:

The documentclass option listof=totoc for scrbook already adds the list of figures and list of tables to the table of contents.

And in your document, you use \addcontentsline{toc}{chapter}{List of..} to add them again.

Solution: Remove \addcontentsline

\documentclass[headsepline,footsepline,footinclude=false,oneside,fontsize=11pt,paper=a4,listof=totoc,bibliography=totoc,DIV=12]{scrbook} % one-sided
\usepackage{lipsum}

\begin{document}
    \frontmatter
    \tableofcontents
    
    \mainmatter
    \chapter{chap1}
    \lipsum
    \chapter{chap2}
    \lipsum
%   \addcontentsline{toc}{chapter}{\protect List of Figures}
    \listoffigures
    
%   \addcontentsline{toc}{chapter}{\protect List of Tables}
    \listoftables
\end{document}

With addcontentsline: enter image description here

Without addcontentsline: enter image description here

You must log in to answer this question.

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