# Why do line-broken glossary entries contaminate “marginpar”s with cross-referencability?

The following MWE shows the effect of a line-broken glossary entry on an adjacent marginpar, as opposed to a non-line-breaking glossary entry. Why does line-brokenness contaminate the marginpar?

\documentclass[a4paper]{memoir}
\usepackage[xetex]{hyperref}
\hypersetup{colorlinks=true}
\usepackage{glossaries}
\makeglossaries
\loadglsentries{glossary}

\begin{document}

Here\marginpar{Here is a margin paragraph.} is a reference to the glossary word \glsname{tst-a}, \\\

and here\marginpar{Here is another margin paragraph.} is a reference to the glossary word \glsname{tst-b},

\glsaddall
\printglossaries

\end{document}


My glossary entries are defined as follows:

\newglossaryentry{tst-a}{%
name={a-short-glsname},
description={Definition of tst}}

\newglossaryentry{tst-b}{%
name={a-very-long-glsname-likely-to-line-break},
description={Definition of tsp}}


-

## 2 Answers

This is not restricted to glossary entries. When hyperlinks are broken e.g. between two pages, then between the beginning of a link at one page and the end of the link on the next page everything is enclosed in the link: footnotes, pagenumbers, pageheader on the new page. In your case it is the link starting in one line and ending in the next one, therefore everything placed in the margin of the first line is linked (and because the margin entry is one "object", the whole one is made into a link). (Good that you only asked for "why" and not "how to get rid of it". If Heiko Oberdiek, the maintainer of the hyperref package, would know how to do it, he would have done it, but afaik there is currently no known solution to break the hyperlinks at line-/page-/column-borders.)

-

The same problem occurred to me using the hyperref package in combination with the glossaries package. A solution is found in FAQ, but you should use version 2.03.

From their site

How do I suppress the hyperlink for the first use just for acronyms? Use the footnote package option and do: \defglsdisplayfirst[\acronymtype]{#2#4 (\firstacronymfont{#1})} Note that this won't work for acronyms that belong to a glossary not given by \acronymtype. As from version 2.03, you can also use the package option hyperfirst=false to suppress the first use link for all terms (including acronyms).

-