# Wrong anchors in bookmarks and TOC

I am having some trouble with some anchors for sections, which automatically start at a new page. The TOC shows the right page numbers, where the PDF bookmarks show the page number of the previous page, which is also used by the anchor referenced by both.

Putting a `\clearpage` just before `\section` would solve the problem and defeat the purpose of using LaTeX for layouting.

My LaTeX preamble starts with

``````\documentclass[fleqn,titlepage=firstiscover,bibliography=totoc]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{bookmark}
\usepackage{url}
\usepackage{hyperref}
...
``````

Is there an adaptable solution to this problem? I really do not want to put `\clearpage` where it does not belong.

• have you run latex enough times for the page numbers to stabalize? with an unusable fragment it is very hard to suggest how to change your code, you should probably try to make a small complete document that you can add that shows the problem. – David Carlisle Jan 24 '15 at 22:38
• The build is stable. I'm running latex hundreds of times a day. I'll see, if I can make a small example document tomorrow, after beeing finished with the contents. – tynn Jan 24 '15 at 22:46
• It would be even more interesting how your preamble and your document ends ;-) – user31729 Jan 25 '15 at 0:23
• Try loading `bookmark` after `hyperref` package. Does it work? – user11232 Jan 25 '15 at 0:40
• `bookmark` wasn't the problem. While writing a short example, I discovered a solution. It was a problem with `hyperref` after all. – tynn Jan 25 '15 at 16:00

``````\usepackage{hyperref}
from the `hyperref` documentation. So I put `\usepackage{hyperref}` as far at the end of the preamble as possible and everything worked fine. `titlesec` might have been causing my issue as well.
• `titlesec` will break internal features of KOMA-script as well. Since version 3.15, KOMA has a very own interface of defining sectioning commands. – Johannes_B Jan 31 '15 at 16:51