I want to a sequence of nodes, finished by a line. I tried this:
\documentclass{article}
\usepackage{tikz}
\tikzstyle{st1}=[circle, inner sep=1.5pt, draw]
\tikzstyle{st2}=[rectangle, inner xsep=2pt, inner ysep=0pt, draw]
\begin{document}
\begin{tikzpicture}[grow=down, level distance=10pt, every node/.style={st1}]
\path node{} child {node{} child {node[st2]{}}};
\end{tikzpicture}
\end{document}
but this gives
, i.e. the node has some height. Is there some (simple) way to make the last node into a line? If possible using definition of st2, so it it simple to use.
The closest thing I managed is:
\documentclass{article}
\usepackage{tikz}
\tikzstyle{st1}=[circle, inner sep=1.5pt, draw]
\tikzset{st2/.style={rectangle, inner sep=-2pt, draw=none}}
\begin{document}
\begin{tikzpicture}[grow=down, level distance=10pt, every node/.style={st1}]
\path node{} child {node{} child {node[st2]{\textbf{--}}}};
\end{tikzpicture}
\end{document}
but this is more a dirty hack. In addition, it needs needs having \textbf{--} in every such node .. and it won't work if I ever need the sequence to be horizontal.
Thanks.


\tikzsetinstead of\tikzstyle, as explained in Should \tikzset or \tikzstyle be used to define TikZ styles?. However, I leave it as it is, since it works and the accepted answer uses this as well.. – Michal Kaut Dec 06 '12 at 11:44