Page LayoutTable of Contents Hyperlinks on Page Numbers too

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Table of Contents Hyperlinks on Page Numbers too

Post by 0Jam »

Hello all, I would like to extend my ToC linking, using the hyperref package and documentclass scrartcl, to not only be linked at the left (section numbering) and the title of the section, but to go all the way to the right. Therefore when mouse clicking on the dotted lines and the page number of the section, it would take me there as well.
Thanks!

Red: how it is
latex question toc linking 1.PNG
Blue: How I want it
latex question toc linking 2.PNG

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Table of Contents Hyperlinks on Page Numbers too

Post by MjK »

hyperref does not provide links for the complete entry. You can select linking the number + text, linking the page number, linking number + text + page number, or not linking anything. Links at the whole thing inclusive the dotted line is not supported. See section 5.13 of the manual (link at the very beginning of my reply). So the best you can get is:

Code: Select all

\documentclass{scrartcl}
\usepackage[linktoc=all]{hyperref}% See hyperref manual section 5.13
\usepackage{mwe}
\begin{document}
\tableofcontents
\blinddocument
\end{document}
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Table of Contents Hyperlinks on Page Numbers too

Post by 0Jam »

Thank you so much MjK, perfect answer! <3
Post Reply