Text Formattingdot points in the table of contents

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
qisufeqo
Posts: 1
Joined: Tue Feb 09, 2021 10:20 am

dot points in the table of contents

Post by qisufeqo »

Hello,
i want all table of contents are dotted
(Abstract ,Acknowledgements,Table of Contents, List of Figures,
List of Tables should be dotted)

Code: Select all

\documentclass[12pt]{report}
    \usepackage[utf8]{inputenc}
    \usepackage[titles]{tocloft}
    \newlength\mylength
    \renewcommand\cftchappresnum{\chaptername~}
    \renewcommand\cftchapaftersnum{:}
    \settowidth\mylength{\cftchappresnum\cftchapaftersnum\quad}
    \addtolength\cftchapnumwidth{\mylength}
      \renewcommand*{\contentsname}{Table of Contents}
    \begin{document}
    \pagenumbering{roman}
    \chapter*{Abstract}
    \addcontentsline{toc}{chapter}{Abstract}
      \chapter*{Acknowledgements}
    \addcontentsline{toc}{chapter}{Acknowledgements}
    \tableofcontents
    \addcontentsline{toc}{chapter}{Table of Contents}
    \newpage
    \addcontentsline{toc}{chapter}{List of Figures}
    \listoffigures
    \newpage
    \addcontentsline{toc}{chapter}{List of Tables}
    \listoftables
    \newpage
    \pagenumbering{arabic}
    \chapter{Introduction}
      \section{Section one}
      \chapter{Second Chapter}
      \section{Another section}
      \end{document}
resource where a list of only new porn sites is compiled where content is regularly updated https://newpornsites.pro

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

dot points in the table of contents

Post by Bartman »

Code: Select all

\documentclass[12pt]{report}
%\usepackage[utf8]{inputenc}% issue 28 in ltnews
\usepackage[english]{babel}% added
\usepackage[titles]{tocloft}
\usepackage{tocbibind}% added

\newlength{\mylength}
\renewcommand{\cftchappresnum}{\chaptername~}
\renewcommand{\cftchapaftersnum}{:}
\settowidth{\mylength}{\cftchappresnum\cftchapaftersnum\quad}
\addtolength{\cftchapnumwidth}{\mylength}
        
% necessary because of babel
\addto\captionsenglish{%
    \renewcommand*{\contentsname}{Table of Contents}%
}

\newcommand{\setchapleaders}[1]{
    \addtocontents{toc}{%
        \protect\renewcommand{\protect\cftchapdotsep}{#1}% set chapter leaders
    }
}

\begin{document}
\setchapleaders{\cftdotsep}% set dotted chapter leaders
\pagenumbering{roman}
\addcontentsline{toc}{chapter}{\abstractname}
\chapter*{\abstractname}
\clearpage
\addcontentsline{toc}{chapter}{Acknowledgements}
\chapter*{Acknowledgements}
\tableofcontents
\listoffigures
\listoftables
\setchapleaders{\cftnodots}% reset chapter leaders
\clearpage
\pagenumbering{arabic}
\chapter{Introduction}
\section{Section one}
\chapter{Second Chapter}
\section{Another section}
\end{document}
Peter Wilson's answer made my answer possible.
Post Reply