1

I would like to have such a table of contents:

I. Table of contents

II.   List of figures ..................... 3
III.  List of tables ...................... 4
1.    Section ............................. 5
1.1     Subsection ........................ 6
2.    Section ............................. 7
2.1     Subsection ........................ 8
IV.   Bibliography ........................ 9

All my section should have an arabic number and toc, lof, lot and bibliography should have an roman number in the headline. And I want although that the numbers in the headline appear in the table of contents.

MWE:

\documentclass[12pt, a4paper]{article}
\usepackage{tocloft}
\let \savenumberline \numberline
\def \numberline#1{\savenumberline{#1.}}¬

\begin{document}
    \tableofcontents
    \newpage

    \addcontentsline{toc}{section}{\listfigurename}
    \listoffigures
    \newpage

    \addcontentsline{toc}{section}{\listtablename}
    \listoftables
    \newpage

    \section{Section}
    \subsection{Subsection}
    \newpage

    \section{Section}
    \subsection{Subsection}
    \newpage

    \addcontentsline{toc}{section}{Bibliography}
    \bibliography{sources}
\end{document}
  • Welcome to TeX.SX! This is related: tex.stackexchange.com/questions/83628/… – egreg Aug 15 '15 at 15:27
  • The answer from the linked question doesn't work for me. It's throws no error when compiling. But it doesn't change the headlines. Maybe cause its using KOMA? – Bene Aug 15 '15 at 15:39
  • Of course it doesn't work; I was just suggesting a related question, that could help in solving your problem. Do you plan to have some usage for \section*? – egreg Aug 15 '15 at 15:42
0

Patch the commands producing the lists and the bibliography; I add also better ways for adding periods to the sectional numbers, both in the text and in the TOC.

\documentclass[12pt, a4paper]{article}
\usepackage[titles]{tocloft}
\usepackage{etoolbox}

\patchcmd{\listoffigures}
  {\section*}
  {\specialsection}
  {}{}
\patchcmd{\listoftables}
  {\section*}
  {\specialsection}
  {}{}
\patchcmd{\thebibliography}
  {\section*}
  {\specialsection}
  {}{}
\newcounter{specialsection}
\setcounter{specialsection}{1}
\renewcommand{\thespecialsection}{\Roman{specialsection}}
\renewcommand{\contentsname}{\thespecialsection.\quad Table of contents}

\makeatletter
\renewcommand{\@seccntformat}[1]{%
  \csname the#1\endcsname.\quad
}
\makeatother

\newcommand{\specialsection}[1]{%
  \refstepcounter{specialsection}
  \section*{\thespecialsection.\quad#1}%
  \addcontentsline{toc}{section}{\protect\numberline{\thespecialsection}#1}%
}
\renewcommand{\cftsecaftersnum}{.}
\renewcommand{\cftsubsecaftersnum}{.}
\setlength{\cftsubsecindent}{0pt}
\AtBeginDocument{%
  \setlength{\cftsecnumwidth}{2.5em}%
  \setlength{\cftsubsecnumwidth}{2.5em}%
}


\begin{document}
\tableofcontents
\newpage

\listoffigures
\newpage

\listoftables
\newpage

\section{Section}
\subsection{Subsection}
\newpage

\section{Section}
\subsection{Subsection}
\newpage

\begin{thebibliography}{1}

\bibitem{X} Y

\end{thebibliography}

\end{document}

Note: the image has been produced using A5 paper, just for better showing the results.

enter image description here

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.