Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
u-fischer opened this issue Mar 9, 2021 · 0 comments
Open

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

u-fischer opened this issue Mar 9, 2021 · 0 comments

Comments

@u-fischer
Copy link
Member

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}{}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant