# How to make whole longtable align to the top?

\item
\begin{longtable}[l]{l l}
1 & 2 \\
3 & 4 \\
5 & 6 \\
\end{longtable}


Inside an enumerate environment, the above code produces a longtable that is not beside the item number but rather before it. If I don't need a multi-page table, the following does exactly what I want:

\item
\begin{tabular}[t]{l l}
1 & 2 \\
3 & 4 \\
5 & 6 \\
\end{tabular}


but I do need a multi-page table. How to make longtable vertically align to the top (like the tabular example)? I am open to replacing longtable with tabularx, xtabular, or longtabu if they can do this.

Elaborating a little on Harish Kumar's answer, you'll probably want the longtable to the left.

To do that, don't use the optional argument for longtable but issue

\setlength{\LTleft}{\leftmargin}


This should give you what you want:

\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{enumerate}
\item \mbox{}\vspace*{-1.68\baselineskip}\setlength{\LTleft}{\leftmargin}
\begin{longtable}{l l}
1 & 2 \\
3 & 4 \\
5 & 6 \\
\end{longtable}
\item another item
\end{enumerate}
\end{document}


Output

or, if you prefer perfect alignment (thanks Mico for the comment)

\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{enumerate}
\item \mbox{}\vspace*{-1.68\baselineskip}\setlength{\LTleft}{\leftmargin}
\begin{longtable}{@{} l l}
1 & 2 \\
3 & 4 \\
5 & 6 \\
\end{longtable}
\item another item
\end{enumerate}
\end{document}


Output

• Refining this approach even further, one could specify \begin{longtable}{@{} l l} instead of \begin{longtable}{l l}. This will align the left-hand edge of the table with the starting position of the other items. – Mico Jan 16 '15 at 6:33

Things can get dirty always, but that is life. Here is a dirty and quick method..

\documentclass{article}
\usepackage{longtable,mathtools}
\begin{document}
\hrule\vspace{-0.8\baselineskip}
\begin{enumerate}
\item \mbox{}\vspace{-1.66\baselineskip}  %% adjust this 1.66
\begin{longtable}{l l}
1 & 2 \\
3 & 4 \\
5 & 6 \\
\end{longtable}
\end{enumerate}
\end{document}