Skip to content

redefine \hyper@natlinkbreak to avoid problems with natbib, see https://tug.org/pipermail/tex-live/2026-March/052345.html#961

Closed
samcarter wants to merge 1 commit into
josephwright:mainfrom
samcarter:natbib
Closed

redefine \hyper@natlinkbreak to avoid problems with natbib, see https://tug.org/pipermail/tex-live/2026-March/052345.html#961
samcarter wants to merge 1 commit into
josephwright:mainfrom
samcarter:natbib

Conversation

@samcarter

Copy link
Copy Markdown
Collaborator

Test document:

\begin{filecontents}{refs.bib}
@article{vaswani2017attention,
  title={Attention is all you need},
  author={Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N and Kaiser, {\L}ukasz and Polosukhin, Illia},
  journal={Advances in neural information processing systems},
  volume={30},
  year={2017}
}
\end{filecontents}

\documentclass{beamer}
\usepackage[authoryear,round]{natbib}

\begin{document}

\begin{frame}
Observed \citep{vaswani2017attention} (Missing comma)

Observed \citet{vaswani2017attention} (Missing parentheses around year)
\end{frame}

\begin{frame}[fragile]{References}
\bibliographystyle{plainnat}
\bibliography{refs.bib}
\end{frame}

\end{document}

@samcarter

Copy link
Copy Markdown
Collaborator Author

@u-fischer Do you think this would be a good idea?

@samcarter

Copy link
Copy Markdown
Collaborator Author

@samcarter samcarter closed this Mar 29, 2026
@samcarter samcarter deleted the natbib branch March 29, 2026 10:35
@u-fischer

Copy link
Copy Markdown

Yes it is a typo, but actually I think this reveals a problem in beamer. beamer does define \hyper@natlinkstart and \hyper@natlinkend to add the link commands (which hyperref doesn't do due to implicit), but it doesn't redefine the break command.

\def\hyper@natlinkbreak#1#2{%
  \hyper@linkend#1\hyper@linkstart{cite}{cite.#2}%
}

@samcarter

Copy link
Copy Markdown
Collaborator Author

@u-fischer Thanks a lot for having a look -- great to have a hyperref expert!

I'll add the break command.

samcarter added a commit to samcarter/beamer that referenced this pull request Mar 29, 2026
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

Successfully merging this pull request may close these issues.

2 participants