# \phantomsection - how to jump to the chapter title instead of the center of the page (only)

I use \phantomsection in my document, because I have nonnumbered chapters in Table of Contents:

\chapter*{Chapter title}
\phantomsection
\addcontentsline{toc}{chapter}{Chapter title}


Command \phantomsection works not correctly - jump properly to page, but the center of the page, not on top. View as a pdf is 'fit to horizontal' so I cannot see 'Chapter title' without scroll through the page. Command \chapter{} works fine.

-
Welcome! \cleardoublepage\phantomsection\chapter*{Chapter Title}. If you use a KOMA class you can use \addchap –  Marco Daniel May 19 '12 at 17:40
Works perfectly. Thank you! –  rgb May 19 '12 at 19:51

## 2 Answers

The command \phantomsection sets the label at the current position. However the command chapter has previous and and skip below the title. Based on the last skip the position of \phantomsection is specified. To provide the label at the top of the page use the following order:

\cleardoublepage%\clearpage in onside mode
\phantomsection
\chapter*{Chapter Title}


If you use a KOMA class you can also use the command \addchap which simplefy the the lines above to

\addchap{Chapter Title}

-

Can you use something like this:

\documentclass{report}

% \makeatletter% <-- another useful trick
% \renewcommand\@seccntformat[1]{}
% \makeatother%

\usepackage{hyperref}

\begin{document}

\tableofcontents

\chapter{First Chapter}

Text.

\newpage
\section{First Section}

Text.

\newpage
\setcounter{secnumdepth}{-1}% must reset if you want to bring numbering back
\chapter{Second Chapter}
\section{Another First Section}

More text.

\end{document}

-
One has to remember to reset tocdepth and secnumdepth afterwards, if the unnumbered chapter is not the last. –  egreg May 19 '12 at 20:16
Your changing doesn't work. tocdepth must be changed in the preamble or by \addcontentsline. –  Marco Daniel May 19 '12 at 20:55
@MarcoDaniel -- well, it works for me when I do it. Have you tried the example? EDIT: oh! you are referring to the tocdepth. True, and that part should be taken out since it doesn't have anything to do with the question.... –  jon May 19 '12 at 21:12
@jon: lol -- have fun –  Marco Daniel May 19 '12 at 21:19