# hline inside a TikZ node

How can I draw a horizontal line inside a TikZ node? I want the name of the state to be seperated from the rest of the node. How can i achieve this?

\documentclass[tikz,border=2pt]{standalone}

\usetikzlibrary{automata}

\begin{document}
\begin{tikzpicture}[%
every node/.style={%
align=center,
state
}
]

\node (T0)  {
\textbf{State$_1$} \\
\hline \\ % <--- This is not working!
$\overline{A}$      \\
$B$
};

\end{tikzpicture}
\end{document}

-
Either put them inside a tabular or use TikZ for drawing things inside a TikZ picture. –  percusse Apr 1 '14 at 22:16
You could just use \underline{\textbf{State$_1$}}. What is the \hline supposed to do? Draw a line from one end of the circle to the other? In that case use multi part nodes. –  Peter Grill Apr 1 '14 at 22:17
You could use \node[circle split] and divide both parts with \nodepart{lower}. This will generate a split-circle node with everything in the upper half, except for the stuff after the \nodepart{lower} command. — Nicolás was a few seconds quicker than me … :D –  Otaka-san Apr 1 '14 at 22:20
Only a couple of seconds quicker. –  Nicolás Apr 1 '14 at 22:30
You are all awesome. :) –  David Kristiansen Apr 1 '14 at 22:37

You could try circle split:

\documentclass[tikz,border=2pt]{standalone}

\usetikzlibrary{automata,shapes.multipart}

\begin{document}
\begin{tikzpicture}[%
every node/.style={%
align=center,
state,
circle split
}
]

\node (T0)  {
\textbf{State$_1$} \\
\nodepart{lower}
$\overline{A}$      \\
$B$
};

\end{tikzpicture}
\end{document}


The keys are:

1. adding to the style circle split
2. drawing the separator as \nodepart{lower} instead of \hline

One drawback of this method is that the split line is drawn exactly at the middle of the circle. I don't know if that bothers you.

-
Yes. Excatly what I was looking for. Thank you! –  David Kristiansen Apr 1 '14 at 22:24

In TikZ the hline is not defined (as far as i know). If i correctly understood, what you like to achieve, then for node use shape for multiple text parts, like in the following example:

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{automata,shapes.multipart}
\begin{document}
\begin{tikzpicture}[%
every node/.style = {%
align=center,
state
}
]
\node[circle split] (T0)  { \textbf{State$_1$} \\
\nodepart{lower}
$\overline{A}$     \\
$B$
};
\end{tikzpicture}
\end{document}

-
Yes thanks. That's excatly what I was looking for! –  David Kristiansen Apr 1 '14 at 22:25