0

I have a problem with the table of contents, the section numbers overlap with their names, because I use a larger font for sections and subsections. Does anyone have an idea how I can improve this, or just move the numbers slightly to the left? enter image description here

\documentclass[10pt,a4paper,twoside]{exam}
\usepackage{sectsty}
\usepackage{setspace}
\usepackage{tocloft}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
    pdftitle={calosc}
    }
\usepackage{geometry}
\newgeometry{tmargin=2.6cm, bmargin=2.6cm, lmargin=2.5cm, rmargin=2.5cm}
\urlstyle{same}

\sectionfont{\LARGE} \subsectionfont{\Large} \subsubsectionfont{\large} \paragraphfont{\large}

\renewcommand\cftsecfont{\LARGE\bfseries} \renewcommand\cftsubsecfont{\Large} \renewcommand\cftsubsubsecfont{\large}

\renewcommand\cftsecpagefont{\LARGE\bfseries} \renewcommand\cftsubsecpagefont{\Large} \renewcommand\cftsubsubsecpagefont{\large} \setcounter{section}{9} \begin{document}

\doublespacing \tableofcontents \singlespacing \newpage

\section{Section 1} \subsection{Subsection 1.1} \subsubsection{subsubsection 1.1.1} \subsubsection{subsubsection 1.1.2} \subsection{Subsection 1.2} \subsection{Subsection 1.3} \subsubsection{subsubsection 1.3.1} \subsubsection{subsubsection 1.3.2} \subsubsection{subsubsection 1.3.3} \section{Section 2} \end{document}

1 Answers1

2

Adding three command of into your code, it works correctly.

\usepackage{tocloft}
\addtolength{\cftsecnumwidth}{12pt}
\addtolength{\cftsubsecnumwidth}{12pt}

\documentclass[10pt,a4paper,twoside]{exam}
\usepackage{sectsty}
\usepackage{setspace}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
    pdftitle={calosc}
    }
\usepackage{geometry}
\newgeometry{tmargin=2.6cm, bmargin=2.6cm, lmargin=2.5cm, rmargin=2.5cm}
\urlstyle{same}

\usepackage{tocloft} \addtolength{\cftsecnumwidth}{12pt} \addtolength{\cftsubsecnumwidth}{12pt}

\sectionfont{\LARGE} \subsectionfont{\Large} \subsubsectionfont{\large} \paragraphfont{\large}

\renewcommand\cftsecfont{\LARGE\bfseries} \renewcommand\cftsubsecfont{\Large} \renewcommand\cftsubsubsecfont{\large}

\renewcommand\cftsecpagefont{\LARGE\bfseries} \renewcommand\cftsubsecpagefont{\Large} \renewcommand\cftsubsubsecpagefont{\large} \setcounter{section}{9} \begin{document}

\doublespacing \tableofcontents \singlespacing \newpage

\section{Section 1} \subsection{Subsection 1.1} \subsubsection{subsubsection 1.1.1} \subsubsection{subsubsection 1.1.2} \subsection{Subsection 1.2} \subsection{Subsection 1.3} \subsubsection{subsubsection 1.3.1} \subsubsection{subsubsection 1.3.2} \subsubsection{subsubsection 1.3.3} \section{Section 2} \end{document}

enter image description here

Sebastiano
  • 54,118