# Using hyperref makes enumerate in tables not aligned

This is what I want to do:

\documentclass[11pt]{report}
%\usepackage{hyperref} % without hyperref one line, with hyperref two lines
\begin{document}
Some text
\begin{minipage}[t]{10cm}
\begin{enumerate}
\item Some text
\end{enumerate}
\end{minipage}
\end{document}


And works just fine, as expected:

But if I uncomment the line

\usepackage{hyperref}


I obtain

Have you any ideas on how to solve the problem?

UPDATE:

What should I do if I need hyperref functionality inside the enumerate?

To get PDF links working, hyperref needs to insert the link targets, which are implemented in TeX as "whatsits". These whatsits are not invisible to TeX's treatment of boxes. The enumerate environment gets a whatsit at the top of the first item. Now, the top alignment of the minipage refers to this whatsit instead of the base line of the first line.

Workaround: If this enumerate do not need "hyper" features, then they can be turned off temporarily via environment NoHyper:

\documentclass[11pt]{report}
\usepackage{hyperref}
\begin{document}
Some text
\begin{minipage}[t]{10cm}
\begin{NoHyper}% <<<<<< HERE
\begin{enumerate}
\item Some text
\end{enumerate}%
\end{NoHyper}%   <<<<<< HERE
\end{minipage}
\end{document}


• Heiko, while you were preparing your answer, I reduced the working example to a minimal one, to make the issue clearer. However, it didn't match your answer anymore, so I now also edited your answer (edit waiting for review). The first solution applies directly also to the new MWE, but the automatic measuring (\heightof) in the second one yields a wrong height; for the moment I replaced it by a fixed value. Sorry for breaking your solution. Anyway, it shows that the second solution is quite fragile and does not carry over to similar contexts. Sep 10 '16 at 12:43
• Ah, great, even the picture has been magically adapted! So everything now matches ... Sep 10 '16 at 12:46
• @gernot Thanks for calling me a magician :-) (I got notified about the proposed editing and have recreated the image.) Sep 10 '16 at 12:48
• Which tool chain do you use to obtain these high resolution images with transparent background? When I use gimp to crop the pdfs and save them as jpg, the resolution turns bad. Is there any documentation on tricks how to produce the material for this forum? Sep 10 '16 at 12:52
• @gernot Never use JPEG for this kind of images, a lossless format (PNG) is much better. The images here are generated by ghostscript's device pngalpha. Sep 10 '16 at 13:37

The explanation was given by Heiko Oberdiek. Here is a sort of work-around. I didn't try very hard to get vertical spacing "right" whatever that means, below the enumerate. I use enumitem package to kill via parsep=0pt the glue added on top of enumerate.

\documentclass[11pt]{report}
\usepackage{hyperref}
\usepackage{enumitem}
\begin{document}
Some text
\raisebox{\ht\strutbox}{%\tracingmacros1
\begin{minipage}[t]{10cm}%
\begin{enumerate}[parsep=0pt]
\item \label{zoo}\strut Some text
\item  Some text
\item  Some text
\item  Some text
\item \label{foo}Some text
\item  Some text
\end{enumerate}
\strut
\end{minipage}\relax}

\vspace{-\baselineskip}

Next paragraph, see \ref{zoo}.

Next paragraph, see \ref{foo}.

%\showoutput
\end{document}