# Aligning top of tabular with surrounding text

How can a tabular environment with a top line be aligned with the surrounding text, so that no space is inserted above the top line of the tabular?

\documentclass{standalone}

\begin{document}

LEFT
\begin{tabular}[t]{ll}
First
&
\begin{tabular}[t]{|l|l|} \hline
Line & 1 \\ \hline
Line & 2 \\ \hline
\end{tabular}

\end{tabular}
RIGHT

\end{document}


I want the top line of the tabular to be upper than what LaTeX is giving me. How can I get it aligned to the top of the surrounding text?

The first \hline command is causing the trouble. If you remove it, the table is aligned. If you want a horizontal line on top, use the array-package and the \firsthline command.

MWE:

\documentclass{standalone}

\usepackage{array}

\begin{document}

LEFT
\begin{tabular}[t]{ll}
First
&
\begin{tabular}[t]{|l|l|} \firsthline
Line & 1 \\ \hline
Line & 2 \\ \hline
\end{tabular}

\end{tabular}
RIGHT

\end{document}

• Do you have a way to tweak the tabular environment to fix that hline bug for tabular[t]? – user21820 Oct 4 at 3:41