TransWikia.com

Customising the Table of Contents

TeX - LaTeX Asked by Mughees Asif on February 17, 2021

I am new to using LaTeX and have a problem with the title of the chapters in my ToC:

enter image description here

I want to remove the word "Chapter" before every main listing. This is what I have in my .tex file:
enter image description here

I have removed the "Chapter" word in the actual document:
enter image description here

but can not figure out how to remove it from the actual Table of Contents. So the final result should be something like this:

enter image description here

Any suggestions? Thank you.

My document class is as follows:

newcommand{pointsize}{12pt}
documentclass[oneside, pointsize, reqno]{amsbook}
usepackage{titlesec}
usepackage{pdflscape}

usepackage[utf8]{inputenc}
usepackage{fourier, erewhon, cabin}
usepackage[english]{babel}
usepackage{titletoc}
usepackage{lipsum} 
addtocaptionsenglish{renewcommand*contentsname{centerline{Contents}}}

usepackage[
   %includehead,
   includefoot,
     left = 1in, 
      top = 1in, 
    right = 1in,
   bottom = 1in
]{geometry}
usepackage{fancyhdr}
usepackage{setspace}
usepackage{calc}

setlength{headheight}{pointsize + 2pt}
setlength{headsep}{0.5in - headheight} 

fancyheadoffset[R]{0.5in} 

fancypagestyle{prelim}{%    
   renewcommand{headrulewidth}{0pt} 
   fancyhf{}           
   pagenumbering{roman}    
   cfoot{-thepage-}       
}

fancypagestyle{maintext}{%
   pagenumbering{arabic}

   newcommand{chapfnt}{fontsize{21}{21}}
   newcommand{secfnt}{fontsize{17}{19}}
   newcommand{ssecfnt}{fontsize{14}{17}}
   newcommand{sssecfnt}{fontsize{10}{14}}

   titleformat{chapter}
   {normalfontchapfntbfseries}{thechapter}{20pt}{chapfnt}

   titleformat{section}
   {normalfontsecfntbfseries}{thesection}{1em}{}

   titleformat{subsection}
   {normalfontssecfntbfseries}{thesubsection}{1em}{}

   titleformat{subsubsection}
   {normalfontsssecfntbfseries}{thesubsubsection}{1em}{}

   titlespacing*{chapter} {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
   titlespacing*{section} {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
   titlespacing*{subsection} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
   titlespacing*{subsubsection} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
}

numberwithin{figure}{} 
numberwithin{table}{chapter}
numberwithin{equation}{}
numberwithin{section}{chapter}

usepackage{graphicx, float, listings, hyperref}
usepackage{overcite}
usepackage{amsmath, amssymb, bm}

begin{document}

makeatletter    
   defl@section{@tocline{1}{0,2pt}{2pc}{8mm}{  }} 
   frontmatter
   pagenumbering{gobble}
   input{TitlePage.tex}
   newpage
   input{Declaration.tex}
   
   pagestyle{prelim}
   fancypagestyle{plain}{%
      fancyhf{}
      cfoot{-thepage-}
   }%

   % Begin Double Spacing
   doublespacing
   newpage
   input{Abstract.tex}
   newpage
  
  % Contents Page  
    tableofcontents
    newpage
  %  

   mainmatter
   
   pagestyle{maintext}
   
   fancypagestyle{plain}{%
      renewcommand{headrulewidth}{0pt}
   }%
   
   chapter{Introduction}
   label{ch:IntroductionLabel}
   input{Chapters/1_Introduction/Introduction.tex}

   chapter{Proximal Policy Optimisation (PPO)}
   label{ch:PPOLabel}
   input{Chapters/2_PPO/PPO.tex}
   
   chapter{Aims & Objectives}
   label{ch:AimsLabel}
   input{DEN318_Template/Chapters/Aims_and_objectives}
 
   chapter{Conclusion}
   label{ch:ConclusionLabel}
   input{Chapters/Conclusions.tex}
   
   bibliographystyle{IEEEtran}
   bibliography{Bibliography}
   
   newpage
   begin{landscape}centering
   thispagestyle{empty}
   vspace*{fill}
   begin{figure}[htpb]
   centering
   includegraphics[height=0.8textheight, width=1.3textwidth]{DEN318_Template/Pictures/plagiarism_check.png}
   end{figure}
   vfill
   end{landscape}
   
 end{document}

One Answer

Add the following lines after documentclass{amsbook}.

renewcommandtocchapter[3]{indentlabel#2.quad#3}
renewcommandtocappendix[3]{indentlabel#3}

enter image description here

documentclass{amsbook}
renewcommandtocchapter[3]{indentlabel#2.quad#3}
renewcommandtocappendix[3]{indentlabel#3}
numberwithin{section}{chapter}
begin{document}
tableofcontents
chapter{First chapter}
section{First section of first chapter}
chapter{Second chapter}
section{First section of second chapter}
chapter{Third chapter}
section{First section of third chapter}
appendix
begin{thebibliography}{99}
  bibitem{xyz}
end{thebibliography}
end{document}

Correct answer by gernot on February 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP