add tag
samcarter
In a koma script document, how to make the whole line in the table of contents a link to the respective chapter/section/etc.?

The `linktoc=all` option of hyperref will make the number, title and page number a link, but the leaders between the title and page number aren't a link. In a specific document, which has very short section titles, I'd like to include the leaders in the link to make it easier to click.

```
\documentclass{scrartcl}

\makeatletter
\RedeclareSectionCommand[
  toclinefill=\TOCLineLeaderFill,
]{section}
\makeatother

\usepackage[linktoc=all]{hyperref}

\begin{document}

\tableofcontents

\section{title}
\section{title}

\end{document}
```

![Screenshot 2025-01-02 at 19.24.39.png](/image?hash=5f091bc7ac02b5b0ed6e0a796163b82a20b69bbe16a4a7f3ab4d5a1e388a31ef)
Top Answer
samcarter
One can smuggle in a link around the leaders like shown in the following example. Strictly speaking, there are still some tiny gaps between the links, but most of the line is covered.

```
\documentclass{scrartcl}

\makeatletter
\RedeclareSectionCommand[
  toclinefill=\hyper@linkstart{link}{\Hy@tocdestname}\TOCLineLeaderFill\hyper@linkend,
]{section}
\makeatother

\usepackage[linktoc=all]{hyperref}

\begin{document}

\tableofcontents

\section{title}
\section{title}

\end{document}
```

![Screenshot 2025-01-02 at 19.23.10.png](/image?hash=ceb3b770628be81015837a8a2185a0e7830ab98c645e124e8b4c35b24e93a977)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.