latex3 / latex3/hyperref

Customize table of contents hyperref

Open
#163 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Right now the section numbers and section names are used as link when using hyperref in the table of contents. However, I find the amount of color on the table of contents too overwhelming, but I want to be consistent with coloring all links. I considered changing the links of the table of contents to page only, by using the linktocpage as stated on p.10 of https://mirror.lyrahosting.com/CTAN/macros/latex/contrib/hyperref/doc/manual.pdf

Now only the page numbers are blue, which is to be expected. However, I would like the section numbers to also be links. That would be a nice feature to have. E.g. set linktoc = numpage.

MWE

\documentclass{article}
\usepackage[hidelinks, colorlinks=true, allcolors=blue]{hyperref}
\usepackage{lipsum}

\begin{document}
    \tableofcontents
    
    \section{First}
    \lipsum[66]
    
    \subsection{First first}
    \lipsum[66]
    
    \section{Second}
    \lipsum[66]
    
    \subsection{Second second}
    \lipsum[66]
\end{document}

https://tex.stackexchange.com/questions/574842/change-hyperlinks-in-table-of-contents-to-section-number-and-page-number-only

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the supplied minimal working example and compare its table-of-contents links with the hyperref manual's linktoc and linktocpage options. Trace how hyperref builds table-of-contents entries, then verify that a numpage-style setting links both section numbers and page numbers while leaving section names unlinked.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.