0

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}
\hypersetup{hidelinks}
...

loading and defining some more math and formatting stuff later.

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
0

While reducing the preamble, I found it working suddenly. After having a look around again, I found Using \clearpage breaks \hyperref bookmarks stating

This package can be used with more or less any normal LaTeX document by specifying in the document preamble

\usepackage{hyperref}

Make sure it comes last of your loaded packages, to give it a fighting chance of not being over-written, since its job is to redefine many LaTeX commands.

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.

  • 1
    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

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.