0

I have the following code :

\documentclass[12pt, times new roman, a4paper, onecolumn, oneside, final]{report}
\usepackage{tocbibind}
\usepackage{tocloft}
\newcommand{\addChapter}[1]{\phantomsection \addcontentsline{toc}{chapter}{#1}}
\begin{document}
\tableofcontents
\addChapter{Costum1}
\addChapter{Costum2}
\addChapter{Costum3}
\chapter{A}
\chapter{B}
\chapter{C}
\end{document

which gives enter image description here

Notice that Costum1, Costum2 and Costum3 follows the style of A, B, C. What I want is Costum1, Costum2, and Costum3 to have no style at all, just plain 12 pt times new roman, no bold, no italic, with one spacing.

Below is what roughly I want ( I make this using word ) enter image description here Also, I dont need the dot. It's there because it's default on Word.

Edit : I do need the dot, but only for custom1, custom2 and custom3.

\hline

After trying the solution in Remove bold style for chapter names in table of contents I was able to unbold custom1, custom2 and custom3 in TOC. Here's the full code.

\documentclass[12pt, times new roman, a4paper, onecolumn, oneside, final]{report}
\usepackage{tocbibind}
\usepackage{tocloft}
\usepackage{hyperref}
\newcommand{\addChapter}[1]{\phantomsection \addcontentsline{toc}{chapter}{#1}}

\newcommand*{\enableboldchapterintoc}{%
  \addtocontents{toc}{\string\renewcommand{\protect\cftchapfont}{\protect\normalfont\protect\bfseries}}
  \addtocontents{toc}{\string\renewcommand{\protect\cftchappagefont}{\protect\normalfont\protect\bfseries}}
  \addtocontents{toc}{\string\renewcommand{\protect\cftchapleader}{\protect\bfseries\protect\cftdotfill{\protect\cftsecdotsep}}}% dot leaders in bold
}
\newcommand*{\disableboldchapterintoc}{%
  \addtocontents{toc}{\string\renewcommand{\protect\cftchappagefont}{\protect\normalfont}}
  \addtocontents{toc}{\string\renewcommand{\protect\cftchapfont}{\protect\normalfont}}
  \addtocontents{toc}{\string\renewcommand{\protect\cftchapleader}{\protect\normalfont\protect\cftdotfill{\protect\cftsecdotsep}}}% 
}

\begin{document}
\tableofcontents
\disableboldchapterintoc
\addChapter{Costum1}
\addChapter{Costum2}
\addChapter{Costum3}
\enableboldchapterintoc

\chapter{A}
\chapter{B}
\chapter{C}
\end{document}

which gives enter image description here

How do I reduce the space in the red line?

  • What is the purpose of \addChapter? It is not working since hyperref is not loaded (so \phantomsection fails) and the \addChapter calls are at the wrong place... \chapter adds the correct ToC line already – user31729 Jan 30 at 17:23
  • @ChristianHupfer Yeah, I forgot to add hyperref, but somehow it works. What I want is to have costum style chapter title in the TOC. So, costum1, costum2 and costum3 will have its own style and will not follow the usual chapter style like A,B,and C. If I use the usual chapter \chapter command on costum1 , costum2 and costum3. The toc of costum1, costum2, and costum3 will be numbered, I want to make them unnumbered and have simple style (12 pt times new roman). Do you have any other idea how I could solve this problem? – aaaaaa Jan 30 at 17:41
  • You mean custom, not costum, by the way ;-) – user31729 Jan 30 at 17:44
  • @ChristianHupfer I was coming across one question that you answered tex.stackexchange.com/questions/419555/… I was able to unbold custom1, custom2, and custom3 chapter. The only problem left is the spacing between custom1 and costum2 is too big, also applies to custom 3. I was wondering if you know how to make it smaller, basically singlespacing for all these custom-styled chapter? Thanks in advance – aaaaaa Jan 30 at 19:21
  • @ChristianHupfer I've updated my question – aaaaaa Jan 31 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.