[Tex/LaTex] line break in tabular

line-breakingtables

I try to set a line break within a tabular environment where the column is not definded with p{$width}. I've tried the following without the expected result

\documentclass{article}
\begin{document}
expected result:

\begin{tabular}{|p{15mm}|l|l|}
\hline
X1\newline{}X2 & text & another text\\\hline
\end{tabular}

real result:

\begin{tabular}{|l|l|l|}
\hline
X1\newline{}X2 (no newline) & a text & another ext\\\hline
\begin{tabular}{l}
X1\\
X2
\end{tabular}
 & a text (not on top) & another text\\\hline
\end{tabular}
\end{document}

Are there any hints?

Best Answer

put into another tabular:

\documentclass{article}
\def\Stack#1{\tabular[t]{@{}l@{}}#1\endtabular}
\begin{document}
expected result:

\begin{tabular}{|p{15mm}|l|l|}\hline
X1\newline{}X2 & text & another text\\\hline
\end{tabular}

real result:

\begin{tabular}{|l|l|l|}\hline
\Stack{X1\\X2} & a text & another ext\\\hline
\begin{tabular}{@{}l@{}}
X1\\
X2
\end{tabular}
 & a text (not on top) & another text\\\hline
\end{tabular}
\end{document}

enter image description here