1

I'm working on a software for which I need to write up a LaTeX template. I've been able to glue together the rest of the template somehow since I'm a beginner. But I'm facing huge difficulty in getting the Table of Contents right. I personally like the layout of the TOC used in G.F. Simmon's book on Differential Equations and was hoping that I could implement it in my template.

The TOC Layout

I don't care about the image before the title. Also, the dark background is actually the job of my reader, Okular, so I need the background to be white as usual.

Thanks in advance.

I know this might sound lazy of me to just ask up how to achieve this, but I've actually invested a couple of days on this. I came to know about packages, tocloft etc, tried reading the documentation too, but it's just taking too much time and I can't force myself to be spending any more time on this. My current state is that I can't go out exploring the docs and stuff, but will be able to understand and implement the layout if I have a starting point at least.

2
  • 1
    Which class are you using?
    – hesham
    Aug 14, 2020 at 2:11
  • I'm currently using the book class. Aug 14, 2020 at 2:18

1 Answer 1

6

Is this close to what you want?

enter image description here

\documentclass{book}
\usepackage{titlesec}
\usepackage{titletoc}
%
\renewcommand{\contentsname}{\raggedleft \sffamily \MakeUppercase{Table of Contents}}
%
%
\titlecontents{chapter}[-7em]{\sffamily \bfseries \addvspace{5ex}}%
{\MakeUppercase \chaptername{} {\huge \thecontentslabel} \quad \Large \MakeUppercase}%
{}%
{\hfill \Large \contentspage}%
[\addvspace{1ex}]%
%
%
\titlecontents{section}[1em]{}%
{\thecontentslabel \quad}%
{}%
{\hfill \contentspage}%
%
%
\titlecontents{subsection}[3.2em]{}%
{\thecontentslabel \quad}%
{}%
{\hfill \contentspage}%
%
%
\usepackage{blindtext}
%
\begin{document}
\tableofcontents
%
\blinddocument
\blinddocument
\blinddocument
\end{document}
4
  • Maybe chapter titles in toc in mdseries would look better than bold.
    – Bernard
    Aug 14, 2020 at 7:22
  • Thanks for your help. This is exactly what I needed. I'll keep it in mind to credit you once the software's done. Aug 14, 2020 at 8:02
  • @hesham Just a doubt. Why have you commented out the empty lines? Aug 19, 2020 at 7:57
  • No special reason. I just wanted to improve the readability of the code. You can delete the commented lines and still obtain the same results.
    – hesham
    Aug 19, 2020 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .