[Tex/LaTex] hline inside a TikZ node

automatatikz-pgf

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}

Best Answer

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}

enter image description here

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.