# footnote with a link split into next page makes all of the text clickable

I have this weird issue where my footnote containing a link is split into the next page because the link URL is too long. This would be fine. What is weird is that the text on the next page where the foot note is split into is all clickable with the URL that has been split.

Is this fixable and how?

Image for illustration:

MWE:

\documentclass[12pt,czech,]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
}{}
\usepackage[a4paper]{geometry}
\usepackage{bookmark}
\hypersetup{unicode=true,
pdftitle={Test},
pdfauthor={Václav Haisman},
pdfborder={0 0 0},
\urlstyle{same}  % don't use monospace font for urls
\usepackage{polyglossia}
\setmainlanguage[]{czech}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines

% This makes sure that linked text's links shows as a footnote.
\makeatletter
\let\oldhref=\href
\renewcommand\href[2]{\oldhref{#1}{#2}\footnote{\url{#1}}}
\makeatother

\PassOptionsToPackage{backref}{hyperref}

% This allows line breaks in URL in more places.
\def\UrlBreaks{\do\/\do-\do.\do=\do_\do?\do\&\do\%\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9}

\usepackage{blindtext}

\title{Test}
\author{Václav Haisman}
\date{}

\begin{document}
\maketitle

{
\setcounter{tocdepth}{3}
\tableofcontents
}
\section{Test}\label{test-id}

\blindtext[2]

More text here more text here more text here more text here\footnote{\url{https://jjj.ilcyagb.pm/ernyvmbinar-cehmxhzl/prfv-n-ceiav-frk}}
až 10 \%\footnote{\url{http://www.example.com/prfv-znwv-ceiav-frk-cehzrear-i-17-yrgrpu-10-zynqvfgilpu-qbxbapr-b-qin-ebxl-qevir}}
more text here more text here more text here more text here more text here
more text here more text here more text here more text here more text here
more text here more text here more text here more text here more text here
more text here more text here more text here more text here more text here
more text here more text here more text here more text here more text here
more text here more text here more text here more text here more text here
more text here more text here more text here more text here more text here.

\end{document}


UPDATE 1

Here is the test on Overloaf: https://www.overleaf.com/read/cmgygpypqzcb

One thing, I am using Evince. Could it be that Acrobat Reader does not have the problem but Evince does? It shows the text clickable in all viewers I have tested: Evince, Acrobat Reader and Firefox.

UPDATE 2

I have found out that if I change \setmainlanguage[]{czech} to \setmainlanguage[]{english} then the wrapping result changes and the last foot note is not split into the next page.

• The example does not show the problem for me. The workaround would be to avoid link breaks across pages. Also the link could be manually split in two at the break point: \href{<url>}{\nolinkurl{<url part 1>}}\linebreak\href{<url>}{\nolinkurl{<url part 2>}}. – Heiko Oberdiek Feb 28 '16 at 10:39
• BTW, \PassOptionsToPackage should be used before the package is loaded. Afterwards it is too late to have an effect on the package loading in the past. – Heiko Oberdiek Feb 28 '16 at 10:40
• @HeikoOberdiek: I use XeLaTeX and LuaLaTeX and it shows in both. – wilx Feb 28 '16 at 10:40
• The footnotes start at the second page in both cases. The example loads package fixltx2e, which causes a warning, because the fixes are now in the recent LaTeX kernels already. Maybe you are using older software than me resulting in different page breaks. – Heiko Oberdiek Feb 28 '16 at 10:44
• @HeikoOberdiek: Parts of this are generated by Pandoc's template. – wilx Feb 28 '16 at 10:45