[t] with tabularx 

Newsgroups: comp.text.tex
Date: 2003-09-18 07:06:35 PST
> I'm trying to use tabularx and to align the content of the cell in the
> table to the top of the cell. I'm trying:
>
> \begin{tabularx}[t]{\linewidth}{|p{0.2\linewidth}|X|}

The [t] goes after the {linewidth}. And it has nothing to do with the aligment of the content of the cells which is as default aligned to the top in your example. Sent a minimal document that demonstrates you problem.

Ulrike Fischer

[t] with tabularx 

Here is the shortest document that illustrate my question.

Thanks Shai

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\linewidth}[t]{|l|X|}
\hline
\begin{tabular}{l}
Put \\
some \\
text\\
here\\
\end{tabular}
& Why this is NOT in the top of the cell? \\
\hline
\end{tabularx}

Just some text to separate the two tabularx environments

\begin{tabularx}{\linewidth}[t]{|l|X|}
\hline
\begin{tabular}[t]{l} %the only difference between the two tabularx
Put \\
some \\
text\\
here\\
\end{tabular}
& Why this is aligned to the top of the cell? \\
\hline
\end{tabularx}
\end{document}

[t] with tabularx 

> & Why this is NOT in the top of the cell? \\

it is. The top of the cell is the baseline of the first line. The problem only is that this first line is rather height.

Your problem has nothing to do with tabularx. You don't seem to know how the inner tabular is aligned. In the first case the middle of the tabular is used to align it with other object on the same line. In the second case the first line of the tabular is used to align it with other objects.

Look at the folowing example:

\documentclass{article}

\parskip5ex %to better see the par
\parindent0pt
\begin{document}
a first line \\
some words to start a second line
\begin{tabular}{l}
     Put \\
     some \\
     text\\
     here\\
\end{tabular}
which ends here\\
a third line

\hrulefill

a first line\\
some words to start a second line
\begin{tabular}[t]{l}
     Put \\
     some \\
     text\\
     here\\
\end{tabular}
 which ends here \\
a third line
\end{document}

Ulrike Fischer