LaTeX forum ⇒ Community talkCustomizing the line spacing on the ToC

General discussion about this LaTeX community.
Please no LaTeX topics here! Just community topics!
Shandy Verdyo
Posts: 5
Joined: Fri Jul 31, 2020 8:15 am

Customizing the line spacing on the ToC

Postby Shandy Verdyo » Fri Jul 31, 2020 8:33 am

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] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[a4paper,12pt,oneside,openany]{book}
  2. \usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
  3. \usepackage{blindtext}
  4. \usepackage{fancyhdr}
  5. \usepackage{titlesec}
  6. \usepackage{setspace}
  7. \usepackage[titles]{tocloft}
  8. \usepackage{tocbibind}
  9. \fancyhf{}
  10. \cfoot{\thepage}
  11. \linespread{1.5}
  12. \pagestyle{plain}
  13. \renewcommand\cftchapdotsep{\cftdotsep}
  14. \titleformat{\chapter}[display]
  15. {\normalfont\bfseries\centering}
  16. {\chaptertitlename \thechapter}{12pt}{}
  17. \titlespacing*{\chapter}{0pt}{10pt}{40pt}
  18.  
  19. \addtocontents{toc}{\protect\null\protect\hfill{Pages}\protect\par}
  20. \setlength\parindent{1.25cm}
  21. \begin{document}
  22.  
  23. \clearpage
  24. \thispagestyle{empty}
  25.  
  26. \frontmatter
  27.  
  28. \pagestyle{fancy}
  29. \renewcommand{\headrulewidth}{0pt}
  30.  
  31. %PART ONE:
  32. \chapter*{DEDICATION}
  33. \addcontentsline{toc}{chapter}{\textbf{DEDICATION}}
  34. \blindtext
  35. \chapter*{ABSTRACT}
  36. \addcontentsline{toc}{chapter}{\textbf{ABSTRACT}}
  37. \blindtext
  38. \chapter*{PREFACE}
  39. \addcontentsline{toc}{chapter}{\textbf{PREFACE}}
  40. \blindtext
  41.  
  42. \begin{spacing}{0.1}
  43.  
  44. \tableofcontents
  45. \listoffigures
  46. \listoftables
  47.  
  48. \end{spacing}
  49.  
  50. \mainmatter %
  51.  
  52. %PART TWO:
  53. \chapter*{CHAPTER 1 HELLO}
  54. \addcontentsline{toc}{chapter}{\textbf{HELLO}}
  55. \blindtext
  56. \section{HELLO 2}
  57. \blindtext
  58. \section{HELLO 3}
  59. \blindtext
  60. \chapter*{CHAPTER 2 HELLO 4}
  61. \addcontentsline{toc}{chapter}{\textbf{HELLO}}
  62. \blindtext
  63. \section{HELLO 5}
  64. \blindtext
  65. \section{HELLO 6}
  66. \blindtext
  67.  
  68. %PART THREE:
  69. \chapter*{APPENDIX}
  70. \addcontentsline{toc}{chapter}{\textbf{APPENDIX}}
  71. \blindtext
  72. \chapter*{VIT}
  73. \addcontentsline{toc}{chapter}{\textbf{VIT}}
  74. \blindtext
  75.  
  76. \end{document}


Can you help me please? Thanks in advance!

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

Postby Bartman » Fri Jul 31, 2020 1:42 pm

There is a crosspost.

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


Return to “Community talk”

Who is online

Users browsing this forum: No registered users and 1 guest