1

I need to include my table of contents in my table of contents itself. My table of contents starts at page II but appears as III (the last page). I used the package \tocbibind but then it appears as chapters which I do not want. I want it to appear as a section. I´m still a beginner so I am very unsure on how to include something in the table of contents.

\documentclass[a4paper, 12pt, oneside, nenglish]{scrreprt}
\usepackage[paper=a4paper,left=30mm,right=15mm,top=20mm,bottom=25mm]{geometry}\pagestyle{plain}

\usepackage[pdf]{pstricks}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx, subfigure}
\graphicspath{{img/}}
\usepackage{fancyhdr}
\usepackage{lmodern}
\usepackage{color}
\usepackage{transparent}
\usepackage{float}
\usepackage{setspace}
\restylefloat{figure}
\usepackage{tikz}
\usepackage[locale=DE]{siunitx}
\usepackage{cancel}
\usepackage{pdfpages}
\usepackage{textpos}
\usepackage{blindtext}
\usepackage{natbib}
\usepackage{mdframed}
\usepackage{tcolorbox}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tocbasic}

\begin{document}

\pagestyle{plain}
\pagenumbering{Roman}
\tableofcontents
\addcontentsline{toc}{section}{Contents}
\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\listoftables
\addcontentsline{toc}{section}{List of Tables}


\chapter{Introduction}
 
bla bla

\chapter {results}

bla bla

\end{document}
6

2 Answers 2

0

\addcontentsline{toc} is a correct way to add things to toc.

Anyway, you're using a KOMA-Script class which provides many options to handle what you required.

\KOMAoptions{toc=listof}

adds lists of figures and tables to toc.

\setuptoc{lof}{leveldown}
\setuptoc{lot}{leveldown}

format lof and lot titles with \section (as the class is scrreprt).

\setuptoc{toc}{leveldown, totoc}

formats toc title with \section and include it to the toc itself.

You don't need to load tocbasic as it's used internally by scrreprt.

\documentclass[a4paper, 12pt, oneside, nenglish]{scrreprt}
\usepackage[paper=a4paper,left=30mm,right=15mm,top=20mm,bottom=25mm]{geometry}\pagestyle{plain}

\usepackage[pdf]{pstricks}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx, subfigure}
\graphicspath{{img/}}
\usepackage{fancyhdr}
\usepackage{lmodern}
\usepackage{color}
\usepackage{transparent}
\usepackage{float}
\usepackage{setspace}
\restylefloat{figure}
\usepackage{tikz}
\usepackage[locale=DE]{siunitx}
\usepackage{cancel}
\usepackage{pdfpages}
\usepackage{textpos}
\usepackage{blindtext}
\usepackage{natbib}
\usepackage{mdframed}
\usepackage{tcolorbox}
\usepackage{multicol}
\usepackage{multirow}

\KOMAoptions{toc=listof}

\setuptoc{toc}{leveldown, totoc}
\setuptoc{lof}{leveldown}
\setuptoc{lot}{leveldown}

\begin{document}

\pagestyle{plain}
\pagenumbering{Roman}
\tableofcontents

\listoffigures

\listoftables

\chapter{Introduction}

bla bla

\chapter {results}

bla bla

\end{document}
0

You should simply use the options and configuration features, KOMA-Script provides. In this case class option listof=totoc and additionally tocbasic feature \setuptoc{toc}{totoc}:

\documentclass[12pt,listof=totoc]{scrreprt}
\usepackage[paper=a4paper,left=30mm,right=15mm,top=20mm,bottom=25mm]{geometry}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\setuptoc{toc}{totoc}% nonsense, but you've asked for

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\listoffigures
\listoftables

\chapter{Introduction}
 
bla bla

\chapter {results}

bla bla

\end{document}

enter image description here

Note, that I've remove several irrelevant packages and not needed options.

Note also, that

  • usage of package fancyhdr results in a warning, that recommends to use scrlayer-scrpage instead;
  • from LaTeX 2018-04-01 \usepackage[utf8]{inputenc} is not longer needed;
  • usage of \restylefloat{figure} significantly changes the behaviour of figure environments;
  • loading of package tocbasic is not needed when using a KOMA-Script class, because the class already uses this package.

If you really want the ToC entries be section entries you should also make corresponding lists be sections instead of chapters:

\documentclass[12pt,listof=totoc,listof=leveldown]{scrreprt}
\usepackage[paper=a4paper,left=30mm,right=15mm,top=20mm,bottom=25mm]{geometry}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\setuptoc{toc}{totoc,leveldown}

\begin{document}

\pagenumbering{Roman}
\addchap{Contents and Other Lists}
\tableofcontents
\listoffigures
\listoftables

\chapter{Introduction}
 
bla bla

\chapter {results}

bla bla

\end{document}

enter image description here

Using section level in the ToC for all not numbered chapters would also be possible but not recommended:

\documentclass[12pt,listof=totoc]{scrreprt}
\usepackage[paper=a4paper,left=30mm,right=15mm,top=20mm,bottom=25mm]{geometry}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\setuptoc{toc}{totoc}
\NewCommandCopy{\OriginalAddChapterTocEntry}{\addchaptertocentry}
\renewcommand*{\addchaptertocentry}[2]{%
  \IfArgIsEmpty{#1}{\addsectiontocentry}{\OriginalAddChapterTocEntry}{#1}{#2}%
}

\begin{document}

\pagenumbering{Roman}

\tableofcontents
\listoffigures
\listoftables

\chapter{Introduction}
 
bla bla

\chapter {results}

bla bla

\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 .