[Tex/LaTex] Tikz node text vertical align with linebreak

nodestikz-pgfvertical alignment

I want to vertical align text in a chain of nodes. One node has a linebreak. What is the best way to do this? This is my current example:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{chains}
\begin{document}
    \begin{tikzpicture}[
        start chain,
        every node/.style={
            draw,
            text height=1.5ex,
            text depth=.0ex,
            text width=7em,
            text centered,
            anchor=base,
            minimum height=3em
        }]

        \node[on chain, join] {node with\\linebreak};
        \node[on chain, join] {node};
    \end{tikzpicture}
\end{document}

I want my first node to be vertically aligned.

Best Answer

Like this?

enter image description here

The code of above image is:

\documentclass[border=3mm, tikz]{standalone}
\usetikzlibrary{chains}

\begin{document}
    \begin{tikzpicture}[
      start chain = going right,
every node/.style = {
    draw,
    minimum height=3em,
    text width=7em,
    align=center,
    on chain, join}
            ]
        \node  {node with\\linebreak};
        \node  {node};
    \end{tikzpicture}
\end{document}

As you can see, I only change parameters of your every node/.style .... If you define text height and depth, than TikZ use text height for the first line of text and other lines put below it. So better is to declare minimum height=.... New syntax for text centering is align=center.