7

In the example below, the title of the starred section is moved to the left in the TOC but not the corresponding hyperref anchor link:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section*{Introduction}
\addcontentsline{toc}{section}{\hspace*{-1cm}Introduction}
\section{Title}
\end{document}

How is it possible to move it as well?

enter image description here

8

The formattting of the entry in the table of contents for sections are controlled by macro \l@section. The following example defines \l@leftsection that puts the entry 1cm to the left. \toclevel@leftsection defines the level number for the bookmarks.

\documentclass{article}
\usepackage{hyperref}

\usepackage{etoolbox}
\makeatletter
\let\l@leftsection\l@section
\let\toclevel@leftsection\toclevel@section
\patchcmd\l@leftsection{\hskip}{\kern-1cm\hskip}{}{}
\makeatother

\begin{document}
\tableofcontents
\section*{Introduction}
\addcontentsline{toc}{leftsection}{Introduction}
\section{Title}
\end{document}

Result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.