Text FormattingToC: Flush left front and end matters

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Mimi_Mikhail
Posts: 10
Joined: Sat May 02, 2015 11:22 am

ToC: Flush left front and end matters

Post by Mimi_Mikhail »

Hello!

Here's my MWE and in the ToC, I would like to have
  • (i) the entries of front and end matters to be aligned with CHAPTER;
    (ii) the entries and pages of front and end matters to be made non-bold.
How do I achieve that?

Code: Select all

\documentclass[a4paper,12pt]{report}

\usepackage[a4paper,lmargin=4cm,rmargin=2cm,tmargin=2cm,bmargin=2cm]{geometry}

\usepackage{lipsum}

\usepackage{setspace}
\doublespacing

\usepackage{titlesec}
\renewcommand{\chaptername}{CHAPTER}
\titleformat{\chapter}[hang]{\normalfont\normalsize\bfseries\centering}{\chaptertitlename\ \thechapter:}{2mm}{\normalsize\uppercase}
\titlespacing{\chapter}{0pt}{-1\baselineskip}{\baselineskip}

\usepackage{tocloft}

\begin{document}

\chapter*{Abstract}
\addcontentsline{toc}{chapter}{\numberline{}Abstract}
\pagenumbering{roman}
\setcounter{page}{3}

\chapter*{Acknowledgements}
\addcontentsline{toc}{chapter}{\numberline{}Acknowledgements}

\clearpage
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\cfttoctitlefont}{\hfill\normalfont\normalsize\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill} 
\setlength{\cftbeforetoctitleskip}{-1\baselineskip}
\setlength{\cftaftertoctitleskip}{\baselineskip}
\renewcommand{\cftchappresnum}{CHAPTER }
\renewcommand{\cftchapaftersnum}{: }
\newlength{\mylen} % a "scratch" length
\settowidth{\mylen}{\cftchappresnum\cftchapaftersnum} % extra space
\addtolength{\cftchapnumwidth}{\mylen} % add the extra space
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\setlength{\cftsecindent}{0em}
\setlength{\cftsubsecindent}{2.3em}
\tableofcontents
\addcontentsline{toc}{chapter}{\numberline{}Table of Contents}

\clearpage
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\cftloftitlefont}{\hfill\normalfont\normalsize\bfseries}
\renewcommand{\cftafterloftitle}{\hfill} 
\setlength{\cftbeforeloftitleskip}{-1\baselineskip}
\setlength{\cftafterloftitleskip}{\baselineskip}
\listoffigures
\addcontentsline{toc}{chapter}{\numberline{}List of Figures}

\clearpage
\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand{\cftlottitlefont}{\hfill\normalfont\normalsize\bfseries}
\renewcommand{\cftafterlottitle}{\hfill} 
\setlength{\cftbeforelottitleskip}{-1\baselineskip}
\setlength{\cftaftertoctitleskip}{\baselineskip}
\listoftables
\addcontentsline{toc}{chapter}{\numberline{}List of Tables}

\chapter*{List of symbols and abbreviations}
\addcontentsline{toc}{chapter}{\numberline{}List of Symbols and Abbreviations}

\chapter{INTRODUCTION}
\pagenumbering{arabic}
\lipsum

\section{History}
\lipsum

\section{Main Ideas}
\lipsum

\chapter{METHODOLOGY}
\lipsum

\chapter{RESULTS}
\lipsum

\section{Result 1}
\lipsum

\subsection{Result 1a}
\lipsum

\subsection{Result 1b}
\lipsum

\section{Result 2}
\lipsum

\section{Result 3}
\lipsum

\chapter{OPEN PROBLEMS}
\lipsum

\addcontentsline{toc}{chapter}{\numberline{}References}
\renewcommand{\bibname}{REFERENCES}

\end{document}

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: ToC: Flush left front and end matters

Post by Johannes_B »

I haven't looked into this so far, as i am pretty tired and not an expert with titlesec and titletoc and others. There is a pretty good reason for that.
Both packages extend the LaTeX standard classes. I myself on the other hand am using KOMA-script, a bundle of classes and packages available for LaTeX.

Most of the stuff (but really, not everything) can be done with KOMA-script alone. No need for extra, maybe incompatible, packages. In europe, KOMA-script is widespread. There is also memoir, following pretty much the same approach, but more widespread in the rest of the world.



Please, have a look at KOMA script. skim the documentation a little bit. I am sure you will enjoy it. Tomorrow, i will be looking into the problem at hand. Not entirely sure if it is doable with titletoc, thoug.

It certainly is with KOMA-script ;-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply