# Resizing hyperref box

I've included two boxes in the attached screenshot. The first one has normal size. The second one, however, has a larger height because I used \displaystyle for the \prod command later that line. I used \ref{} for both. Is there any way to reduce the height of the second box so that it looks the same as the first one?

Just an aside, is it possible to change the width of the boxes? I have a period after "proposition 5.4.5" but the period gets almost entirely covered by the red box.

• You can remove the boxes altogether yet still have the links clickable. That seems to be an optimal solution here. – Werner Mar 18 '20 at 6:33
• Don't show only a screenshot, show a small but complete example that can be used for tests. You should also say how you compile. – Ulrike Fischer Mar 18 '20 at 6:41
• Also, do try to avoid using \displaystyle in inline math material; you'd just be shooting yourself (or at least your document) in the foot. Moreover, ask yourself if it's essential to mention the lower and upper limits of the product in full. I would be willing to bet that $p(x)\mid\prod_i a_i(x) is every it as readable and intelligible as$\displaystyle p(x) \mid \prod_{i=2}^{k+1} a_i(x)\$ is. – Mico Mar 18 '20 at 8:31

Just put the \ref inside an \mbox to isolate it from the rest of the line. The \strut keeps it from becoming too small.
\documentclass{article}
`