# Vertically aligning text after baseline changed

\documentclass{article}
\usepackage{tabularx}
\usepackage{tikz}

\begin{document}

\begin{tabularx}{\linewidth}{c|X}
\begin{tikzpicture}[
scale=.6,
every node/.style={scale=.6}
]
\path[draw] (0,0) rectangle
+(3,2) node [pos=.5] {rectangle}
+(3,1.5) node[anchor=east] (a)  {A}
+(3,0.5) node[anchor=east] (b) {B};
\end{tikzpicture}
&
\begin{tabular}{l}
This line is not aligned vertically top\\
This is another line below the first one
\end{tabular}
\end{tabularx}

\end{document}


In this example a small tikz picture changes the baseline of the text so that the next cell starts at the bottom of the cell. i would like the baseline to stay where it was and have the tikz picture insert itself without changing it. that way my subsequent inputs would stay at the top of the cell.

How can i make my second cell align vertically topside?

-
the picture hasn't moved the baseline. It has its baseline at the bottom and the tabular (as you haven't use [t]) has its baseline through the centre, so when these two items are placed on the baseline of the outer tabularx, the bottom of the tikzpicture aligns with the centre of the tablular –  David Carlisle Feb 25 '13 at 14:02
and where would that '[t]' go? I tried to pass a '[t]' to the tabular inside the tabularx but it did not change anything. –  Johannes Feb 25 '13 at 14:22

If you just add [t] to the tabular, initially it will move down as the top row will align with the bottom of the picture. Then you want to put the baseline of the picture somewhere other than the bottom, eg the baseline of the node a.:

\documentclass{article}
\usepackage{tabularx}
\usepackage{tikz}

\begin{document}

\begin{tabularx}{\linewidth}{c|X}
\begin{tikzpicture}[
baseline={(a.base)},
scale=.6,
every node/.style={scale=.6}
]
\path[draw] (0,0) rectangle
+(3,2) node [pos=.5] {rectangle}
+(3,1.5) node[anchor=east] (a)  {A}
+(3,0.5) node[anchor=east] (b) {B};
\end{tikzpicture}
&
\begin{tabular}[t]{l}
This line is not aligned vertically top\\
This is another line below the first one
\end{tabular}
\end{tabularx}

\end{document}

-