# Cell placement in a Tikz matrix

I have a single column Tikz matrix, each cell containing one or more lines of text. I would like the first cell to have its text centered while all the other cells have their text left aligned. In addition, I would like the first cell to be centered in the column while all the other cells are to be placed at the left border of the column.

The following code

\begin{tikzpicture}[every node/.style={draw}]
\matrix [draw=red,column sep=1cm]
{
\node [align=center] {\textbf {Transition Record}};\\
\node [left,align=left]
{\textbf{Signatures} \\
signed by Ted};\\
\node [align=left] {\textbf{Transition} \\ $$\tau$$};\\
\node [align=left]
{\textbf{End State} \\
$$\mathtt{Alice2}\mid\mathtt{Carol2}\mid\mathtt{Ted}$$};\\
};
\end{tikzpicture}


appears to column center the first cell and center align its text while left aligning the second cell as well as left aligning its text. How might I position the third and fourth cells the same as the second cell? (That is to say, I want all the blocks with the headers, "Signatures", "Transition" and "End State" to align along their left boundaries. The "Transition Record" box is to remain centered in the column.)

• off-topic: you can use \texttt{}|\texttt{} instead of math mode. – Sigur Aug 19 '18 at 20:34

align=center only sets the alignment of the text inside the specific node, it says nothing about how that node is placed relative to other nodes, or the column. To have the left edge of the nodes at the same horizontal position, add anchor=west (or equivalently right) to the node options.

To get the appearance of a centered first cell, you could add a bit of xshift for the first node. (The align=center does nothing when you only have one line of text, so I removed that option for the first node.) One could probably find more elegant solutions that doesn't require a specific shift like here, but for a one off, it might do. Assuming this is what you're after:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.style={draw, anchor=west}] % added anchor=west
\matrix [draw=red,column sep=1cm]
{
\node [xshift=1mm] {\textbf {Transition Record}};\\ % added xshift=1mm
\node [align=left]
{\textbf{Signatures} \\
signed by Ted};\\
\node [align=left] {\textbf{Transition} \\ $$\tau$$};\\
\node [align=left]
{\textbf{End State} \\
$$\mathtt{Alice2}\mid\mathtt{Carol2}\mid\mathtt{Ted}$$};\\
};
\end{tikzpicture}
\end{document}