hyperref
hyperref copied to clipboard
add configuration point in \Hy@raisedlink
From https://tex.stackexchange.com/a/612327/2388
varwidth needs a configuration point around the argument of \Hy@raisedlink in vmode so that it can add its wrapper:
\documentclass{article}
\usepackage{varwidth,etoolbox}
\usepackage{hyperref,color}
\makeatletter
\newcommand\hyper@configure@raisedlink@vmode[1]{#1}
\patchcmd\Hy@raisedlink{\ifvmode #1}{\ifvmode \hyper@configure@raisedlink@vmode{#1}}{}{\fail}
\appto\@vwid@setup{\let\hyper@configure@raisedlink@vmode\@vwid@wrap}
\makeatletter
\begin{document}
abc
\fbox{\begin{varwidth}{\textwidth}
\begin{enumerate}
\item One
\item Two
\end{enumerate}
\end{varwidth}}
\end{document}