Page 1 of 1

\documentclass{article}

% Required packages
\usepackage{lipsum} % For generating dummy text
\usepackage{titletoc} % For customizing TOC
\usepackage{etoc} % For advanced control over TOC

\usepackage{hyperref}

\hypersetup{
    colorlinks=true,
    linkcolor=black
}

% Change depth of sections
\setcounter{tocdepth}{3} % Include subsubsections

% Customize formatting
\titlecontents{section}[0pt]{\bfseries}{\thecontentslabel\quad}{}{\hfill\bfseries\contentspage}



\begin{document}

% Change TOC title
\renewcommand{\contentsname}{My Table of Contents with dots}

\tableofcontents

% Change dots to spaces in TOC
\makeatletter
\renewcommand{\@dotsep}{10000} % Set dot separation to a large negative value
\makeatother

\renewcommand{\contentsname}{My Table of Contents with spaces}

\tableofcontents

\hypersetup{
    linkcolor=red
}
\renewcommand{\contentsname}{Change toc colors with hyperref}


\tableofcontents


\clearpage

\section{Section 1}
\lipsum[1]

\subsection{Subsection 1.1}
\lipsum[2]

\subsubsection{Subsubsection 1.1.1}
\lipsum[3]

\subsubsection{Subsubsection 1.1.2}
\lipsum[4]

\subsection{Subsection 1.2}
\lipsum[5]

\section{Section 2}
\lipsum[6]

\subsection{Subsection 2.1}
\lipsum[7]

\subsubsection{Subsubsection 2.1.1}
\lipsum[8]

\subsubsection{Subsubsection 2.1.2}
\lipsum[9]

\subsection{Subsection 2.2}
\lipsum[10]

\end{document}


Leave a comment if you like this content أترك تعليقا إن أعجبك المحتوى

Class: Templates
Views:  85




0 Comments, Latest

No comments yet. Be the first to Comment

Most viewed courses: