# Package similar to upref for hyperrefs

I have been using upref to remove italics in \refs. Does there exist a package that does the same for \hyperrefs?

As per request, a minimal example:

\begin{theorem}
Each \hyperref[def:bounded_sequence]{bounded sequence} in $\mathbb{R}^n$
has a convergent subsequence.
\end{theorem}


Here, "bounded sequence" with the usual theorem style, but I would like to appear without it.

• Can you make an example of what you mean? Oct 2, 2015 at 15:39

Set the corresponding \hyperref entry with the font declaration \upshape:

\documentclass{article}

\usepackage{hyperref,amsfonts}

\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}\label{def:bounded_sequence}
Some bounded sequence theorem.
\end{theorem}

\begin{theorem}
Each \hyperref[def:bounded_sequence]{\upshape bounded sequence} in $\mathbb{R}^n$
has a convergent subsequence.
\end{theorem}

\end{document}


For a global setup you could add

\usepackage{letltxmacro}
\LetLtxMacro\oldhyperref\hyperref
\renewcommand{\hyperref}[2][]{\oldhyperref[#1]{\upshape #2}}


Instead of \upshape, you could use other declarations like \normalfont.

• Redefining \hyperref that way is not a good idea. Oct 2, 2015 at 21:27

The mandatory argument to \hyperref is actually managed by the auxiliary macro \label@@hyperref and it would be wrong to redefine \hyperref, because this disrupts all the setup the command must do for neutralizing special characters in link references.

\documentclass{article}

\usepackage{amsfonts}
\usepackage{etoolbox}
\usepackage{hyperref} % last one

\makeatletter
\patchcmd{\label@@hyperref}{\begingroup#3}{\begingroup\upshape#3}{}{}
\patchcmd{\label@@hyperref}{{#3}}{{\textup{#3}}}{}{}
\makeatother

\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}\label{def:bounded_sequence}
Some bounded sequence theorem.
\end{theorem}

\begin{theorem}
Each \hyperref[def:bounded_sequence]{bounded sequence} in $\mathbb{R}^n$
has a convergent subsequence.
\end{theorem}

\end{document}