1

My question is similar to Using \clearpage breaks \hyperref bookmarks; I have the same problem using KomaScript: I use \addtokomafont{section}{\clearpage} to make sections start on a new page.

When using the hyperref package, the section bookmarks point to the end of the previous section instead of the start of the new one.

\documentclass{scrartcl}
\usepackage{hyperref}
\hypersetup{bookmarksnumbered=true}
\usepackage{bookmark}

\addtokomafont{section}{\clearpage}

\begin{document}
\section{First}
Some text    
\section{Second}
More Text    
\end{document}
2
  • Welcome to TeX.SX! Maybe \phantomsection would help.
    – Bobyandbob
    Dec 20, 2017 at 16:27
  • ... \addtokomafont{section}{\clearpage\phantomsection}
    – Bobyandbob
    Dec 20, 2017 at 16:35

2 Answers 2

3
\documentclass{scrartcl}
\usepackage{hyperref}
\hypersetup{bookmarksnumbered=true}
\usepackage{bookmark}

\let\Section\section
\renewcommand\section{\clearpage\Section}

\begin{document}
    \section{First}
    Some text    
    \section{Second}
    More Text    
\end{document}    
2
  • This solution works as well, like \addtokomafont{section}{\clearpage\phantomsection}. Which one is the better approach? Dec 20, 2017 at 16:50
  • you should use \addkomafont only for _ font_ setting and not for anything else ...
    – user2478
    Dec 20, 2017 at 18:24
1

You could use \addtokomafont{section}{\clearpage\phantomsection} instead. The \phantomsection command is nessesary for hyperref to get correct bookmarks/pages.

So your code gets:

\documentclass{scrartcl}
\usepackage{hyperref}
\hypersetup{bookmarksnumbered=true}
\usepackage{bookmark}

\addtokomafont{section}{\clearpage\phantomsection}

\begin{document}
\section{First}
Some text    
\section{Second}
More Text    
\end{document}

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.