GeneralCustomizing the line spacing on the ToC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Shandy Verdyo
Posts: 5
Joined: Fri Jul 31, 2020 8:15 am

Customizing the line spacing on the ToC

Post by Shandy Verdyo »

i want my ToC exactly looks like this:
https://ibb.co/yBcHtJh

By default, we know the space between chapter and section shorter than the space between chapter to chapter. if i can, as shown on the image link description above, i want The gap between ToC title and list contents has `4` line spacing, the first part has `0.5` line spacing as well as the line spacing of the second part and the third part, and the gap between each part has `3` line spacing.

On the second part, i want the space between chapter and section has `0.5` line spacing as well, so there is no default short space between chapter and section anymore. Please note and notice that my image link on the second part might have difference as i described here, that is the space between the chapter and the section.

This is my attempt:

Code: Select all

\documentclass[a4paper,12pt,oneside,openany]{book}
    \usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
    \usepackage{blindtext}
    \usepackage{fancyhdr}
    \usepackage{titlesec}
    \usepackage{setspace}
    \usepackage[titles]{tocloft}
    \usepackage{tocbibind}
    \fancyhf{}
    \cfoot{\thepage}
    \linespread{1.5}
    \pagestyle{plain}
    \renewcommand\cftchapdotsep{\cftdotsep}
    \titleformat{\chapter}[display]
    	{\normalfont\bfseries\centering}
    	{\chaptertitlename \thechapter}{12pt}{}
    \titlespacing*{\chapter}{0pt}{10pt}{40pt}
    
    \addtocontents{toc}{\protect\null\protect\hfill{Pages}\protect\par}
    \setlength\parindent{1.25cm} 
    \begin{document}
    
    \clearpage
    \thispagestyle{empty}
    
    \frontmatter 
    
    \pagestyle{fancy}	
    \renewcommand{\headrulewidth}{0pt}
    
    %PART ONE:
    \chapter*{DEDICATION}
    \addcontentsline{toc}{chapter}{\textbf{DEDICATION}}
    \blindtext
    \chapter*{ABSTRACT}
    \addcontentsline{toc}{chapter}{\textbf{ABSTRACT}}
    \blindtext
    \chapter*{PREFACE}
    \addcontentsline{toc}{chapter}{\textbf{PREFACE}}
    \blindtext

    \begin{spacing}{0.1}

    \tableofcontents
    \listoffigures
    \listoftables

    \end{spacing}
    
    \mainmatter %
    
    %PART TWO:
    \chapter*{CHAPTER 1 HELLO}
    \addcontentsline{toc}{chapter}{\textbf{HELLO}}
    \blindtext
    \section{HELLO 2}
    \blindtext
    \section{HELLO 3}
    \blindtext
    \chapter*{CHAPTER 2 HELLO 4}
    \addcontentsline{toc}{chapter}{\textbf{HELLO}}
    \blindtext
    \section{HELLO 5}
    \blindtext
    \section{HELLO 6}
    \blindtext
    
    %PART THREE:
    \chapter*{APPENDIX}
    \addcontentsline{toc}{chapter}{\textbf{APPENDIX}}
    \blindtext
    \chapter*{VIT}
    \addcontentsline{toc}{chapter}{\textbf{VIT}}
    \blindtext
    
    \end{document}
Can you help me please? Thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Customizing the line spacing on the ToC

Post by Bartman »

There is a crosspost.

Please read sections 2.5 Attachments and 4.1 Crosspostings of the board rules.
Post Reply