0

I have been working on a thesis file. I had two specific issues.

  1. extra space between the left margin and ToC as shown in the figure ToC with extra extra space between left margin and ToC

  2. extra space between the left margin and LoF & LoT

I solved the second issue by making \@dottedtocline{1}{1.5em} to \@dottedtocline{1}{0em} as shown in the code below. But for the first issue of ToC, I haven't found any solution yet.

\makeatletter
\xpatchcmd\@dottedtocline
{\leaders\hbox{$\m@th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}}
{}
{}{\fail}

% enlarge label width
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{4em}}
\renewcommand*\l@table{\@dottedtocline{1}{0em}{5em}}
\makeatother

An MWE is given below

\documentclass[12pt,a4paper]{report}


%%--------------Basic Packages------------%%
\usepackage{amsmath,amssymb,amsfonts} 
\usepackage[top=2.54cm, bottom=2.54cm, left=3.56cm, right=2.54cm]{geometry}
%\usepackage[labelfont=bf, labelsep=space]{caption} 
%\usepackage[belowskip=4pt, labelformat=simple]{subcaption} 

\usepackage{titletoc}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{graphicx}



\usepackage{titletoc} % Chapter title formatting in ToC
\titlecontents{chapter}[17pt]{\vskip8pt}{\fontsize{14}{16.8}\selectfont\bfseries\MakeUppercase{chapter}~\thecontentslabel\quad}{\bfseries}{\bfseries\hfill\contentspage}[\vskip5pt]




\begin{document}
\tableofcontents
\listoffigures
\chapter{Introduction}
    \section{Introduction}
    \lipsum[2-3]
    \begin{figure}[!htb]
        \centering
        \includegraphics[width=6cm]{example-image}
        \caption{Light Clock}
    \end{figure}
    \begin{figure}[!htb]
        \centering
        \includegraphics[width=6cm]{example-image}
        \caption{Light Clock}
    \end{figure}
    \begin{figure}[!htb]
        \centering
        \includegraphics[width=6cm]{example-image}
        \caption{Light Clock}
    \end{figure}
    
\end{document}

1 Answer 1

1

I changed 17pt in \titlecontents{chapter}[17pt]... to 0pt, and added

\dottedcontents{section}[2.3em]{}{2.3em}{1pc}
\dottedcontents{figure}[2.3em]{}{2.3em}{1pc}
\dottedcontents{table}[2.3em]{}{2.3em}{1pc}

Full example

\documentclass[12pt,a4paper]{report}


%%--------------Basic Packages------------%%
\usepackage{amsmath,amssymb,amsfonts} 
\usepackage[top=2.54cm, bottom=2.54cm, left=3.56cm, right=2.54cm]{geometry}
\geometry{showframe}
%\usepackage[labelfont=bf, labelsep=space]{caption} 
%\usepackage[belowskip=4pt, labelformat=simple]{subcaption} 

%\usepackage{titletoc}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{graphicx}



\usepackage{titletoc} % Chapter title formatting in ToC
\titlecontents{chapter}[0pt]{\vskip8pt}{\fontsize{14}{16.8}\selectfont\bfseries\MakeUppercase{chapter}~\thecontentslabel\quad}{\bfseries}{\bfseries\hfill\contentspage}[\vskip5pt]

\dottedcontents{section}[2.3em]{}{2.3em}{1pc}
\dottedcontents{figure}[2.3em]{}{2.3em}{1pc}
\dottedcontents{table}[2.3em]{}{2.3em}{1pc}

\begin{document}
\tableofcontents
\listoffigures
\chapter{Introduction}
    \section{Introduction}
    \lipsum[2-3]
    \begin{figure}[!htb]
        \centering
        \includegraphics[width=6cm]{example-image}
        \caption{Light Clock}
    \end{figure}
    \begin{figure}[!htb]
        \centering
        \includegraphics[width=6cm]{example-image}
        \caption{Light Clock}
    \end{figure}
    \begin{figure}[!htb]
        \centering
        \includegraphics[width=6cm]{example-image}
        \caption{Light Clock}
    \end{figure}
    
\end{document}

enter image description here enter image description here

3
  • Thanks a lot. It actually works. But I don't understand why I added this 17pt here. This is the reason why I couldn't find the solution. Thanks again. Commented Jul 5, 2022 at 7:38
  • I only changed the 17pt to 0pt. Nothing elese Commented Jul 5, 2022 at 7:39
  • With titletoc loaded, it's better to use commands/interfaces from this package to configure list-of styles, instead of directly redefining \l@figure etc. Commented Jul 5, 2022 at 8:22

You must log in to answer this question.

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