14

The problem is simple, I have a link for a cite at the end of a page, the name of the author is on the first one and the year on the second, but the link with hyperref is continuous between the two pages (so the number of the page and the fancyfoot and head is on the link).

MWE:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[authoryear,round]{natbib}
\bibliographystyle{plainnat}
\usepackage[frenchb]{babel}
\usepackage[breaklinks=true]{hyperref}
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}
   \lipsum[1-3]
   \vspace*{25ex}
   I just want to be able to cite a great article talking about the image processing algorithm of the watershed. For this I will cite the article of \cite{watershed}.

   \lipsum[1-5]

    \bibliography{totobib}
\end{document}

.bib file:

@article{watershed,
  title={The morphological approach to segmentation: the watershed transformation},
  author={Beucher, S. and Meyer, F.},
  journal={OPTICAL ENGINEERING-NEW YORK-MARCEL DEKKER INCORPORATED-},
  volume={34},
  pages={433--433},
  year={1992},
  publisher={Marcel Dekker AG}
}

The cite at the end of the line gives:

reference link in tow page

How to break the link or forces the cite to be on a single line?

3
  • Welcome to TeX.SX! Please provide the code of a small complete LaTeX document that shows the problem. Add it to your question using the editbutton left below your post. This will help us to analyze and solve the problem.
    – gernot
    Sep 21, 2016 at 17:05
  • 1
    Are you committed to having the hyperlink being displayed as a colored rectangle? If you can set the option colorlinks=true, the problem you've encountered goes away automatically.
    – Mico
    Mar 28, 2017 at 23:59
  • This issue has been reported to the maintainer on github.com/ho-tex/hyperref/issues/54 Apr 6, 2018 at 13:39

2 Answers 2

5

The answers to this question suggested to me a workaround: you can put the citation that generates the anomaly in a \mbox{...}.

\begin{filecontents}{totobib.bib}
    @article{watershed,
    title={The morphological approach to segmentation: the watershed transformation},
    author={Beucher, S. and Meyer, F.},
    journal={OPTICAL ENGINEERING-NEW YORK-MARCEL DEKKER INCORPORATED-},
    volume={34},
    pages={433--433},
    year={1992},
    publisher={Marcel Dekker AG}
}
\end{filecontents}

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[authoryear,round]{natbib}
\bibliographystyle{plainnat}
\usepackage[frenchb]{babel}
\usepackage[breaklinks=true]{hyperref}
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}
    \lipsum[1-3]
    \vspace*{25ex}

    I just want to be able to cite a great article talking about the image processing algorithm of the watershed. For this I will cite the article of \mbox{\cite{watershed}}.

    \lipsum[1-5]

    \bibliography{totobib}
\end{document}

This is the output .pdf:

enter image description here

2
  • I can't get the same result, I'm using TeXLive 2019 updated... Jan 17, 2020 at 21:20
  • Thank you very much, now it works perfectly :) Jan 17, 2020 at 22:57
2

Solving this problem required new primitives to interrupt the links in the header and footer were needed. This new primitives are available in texlive 2022.

Using this new primitives requires the new PDF management and also requires currently to load some patches for the output routine.

Both can be done by starting a document with \DocumentMetadata:

\DocumentMetadata{testphase=new-or-1}
\documentclass{...} 

The link will then no longer spill over in the footer (and also change its default color).

More details can be found in https://tex.stackexchange.com/a/578405/2388

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .