latex3 / latex3/hyperref

`\if@hyper@item` it not reset after an item with optional argument

Open
#181 0 comments 0 reactions 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

This leads to wrong destination names (and so can affect autoref), but the links should be okay, so not a serious problem.

see also https://tex.stackexchange.com/q/586551/2388

\documentclass[11pt]{article}
\usepackage{hyperref}
\usepackage{xpatch}
\begin{document}

\newcounter{test}
Some text \makeatletter
\begin{enumerate}
\item   \if@hyper@item true \else false \fi
 \refstepcounter{test}\label{a}
\item[a] \if@hyper@item true \else false \fi 
 \refstepcounter{test}\label{b}
\end{enumerate}

\xpatchcmd\@item{\ignorespaces}{\@hyper@itemfalse\ignorespaces}{}{\fail}

\begin{enumerate}
\item   \if@hyper@item true \else false \fi
\refstepcounter{test}\label{c}
\item[a] \if@hyper@item true \else false \fi
\refstepcounter{test}\label{d}
\end{enumerate}

\end{document}
\newlabel{a}{{1}{1}{}{test.1}{}}
\newlabel{b}{{2}{1}{}{Item.2}{}}
\newlabel{c}{{3}{1}{}{test.3}{}}
\newlabel{d}{{4}{1}{}{test.4}{}}

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 minimal document from the issue and inspect the behavior of \if@hyper@item around \item and \item[a]. Use the @item entry point and compare the generated .aux labels for a, b, c, and d. Done means the state is reset after an optional item argument so later destinations no longer receive the wrong name.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.