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?
The code of above image is:
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 declareminimum height=...
. New syntax for text centering isalign=center
.