For the following MWE hyperref complains that it can not find a target for the link, and thus does not create a link. What can I do to make it work?

\documentclass{article}

\usepackage[pagewise]{lineno}
\usepackage{lipsum}

\pagewiselinenumbers

\begin{document}
\lipsum[1-2]
foo\linelabel{l:foo}

\lipsum[3]
Line~\ref{l:foo} on page~\pageref{l:foo}.
\end{document}

• Does the code I posted at tex.stackexchange.com/a/129570/15925 help? – Andrew Swann Aug 22 '13 at 14:14
• @AndrewSwann Hi Andrew, that is quite good! The other question is newer, but has an accepted answer, so I would not want to close it as duplicate. So I'd like to suggest that you give another answer here, maybe even proposing something for the nonworking \pageref. Acceptance guaranteed ;-) – mafp Aug 22 '13 at 22:54

The work-around I gave in Hyperref and lineno: always jumping to first page is easily extended to page references via a new command \lpageref:

\documentclass[11pt]{article}

\usepackage{blindtext}
\usepackage[right]{lineno}
\usepackage{hyperref}

\newcommand{\llabel}[1]{\hypertarget{llineno:#1}{\linelabel{#1}}}