# space before and after enumerate in a longtable, when hyperref was applied

I am quite confused about how to remove the space before and after the items within enumerate within the cell of longtable.

The tex code is listed below:

\begin{longtable}{>{\centering}p{108pt}@{\hspace{7pt}}>{}p{375pt}}
\textcolor{lightgray}{factors} & \textcolor{darkgray}{
\begin{enumerate}[leftmargin=*,topsep=-1em,parsep=0pt]
\item  a
\item  b
\item  c
\item  d
\end{enumerate}
}
\end{longtable}


The two cells cannot be top aligned, unless I put some words before enumerate.

\begin{longtable}{>{\centering}p{108pt}@{\hspace{7pt}}>{}p{375pt}}
\textcolor{lightgray}{factors} & \textcolor{darkgray}{
Some words here
\begin{enumerate}[leftmargin=*,topsep=-1em,parsep=0pt]
\item  a
\item  b
\item  c
\item  d
\end{enumerate}
}
\end{longtable}


The question is how to realize this without using vspace before enumerate?

#######UPDATE

I happened to find that it is the problem of hyperref, which will add a unsatishfied space around the items. The only way I found is to use the NoHyper to wrap the content.

Is there any other good solution to easily fix this? Especially adding the command to re-write the enviroment?

• Welcome to TeX SX! Could you post a full compilable code? – Bernard Mar 24 '17 at 2:14

Here is a solution:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\usepackage[svgnames]{xcolor}
\usepackage{enumitem}
\usepackage{array, longtable}

\begin{document}

\begin{longtable}{>{\centering}p{108pt}@{\hspace{7pt}}>{}p{375pt}}%
\textcolor{lightgray}{factors} &
\begin{enumerate}[leftmargin=*, topsep=0em, parsep=0pt, before=\leavevmode\vspace{-\baselineskip}\color{SlateGray!80}, after =\vspace*{-\baselineskip}]
\item a
\item b
\item c
\item d
\end{enumerate}
\end{longtable}

\end{document}


• Adding vspace could easily fix the problem, however, if there are some words before items, the items content will overlap the lines. – Junfeng Jiang Mar 24 '17 at 5:23
• Yes, but with enumitem you can define a new enumerate environment, say tabenum, with these characteristics, which you'll use only if there is nothing else in the cell. – Bernard Mar 24 '17 at 9:47