# Tikz draw automata..

I've been able to draw the states, and the arrows between the states. It's the "labeling" around the automata I've got issues with ( I, E, P, and R).. Any ideas?

• Welcome to TeX.SE! Could you please provide us with what you have achieved to do?
– user121799
Oct 1, 2018 at 21:46
• Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See minimal working example (MWE). Oct 1, 2018 at 22:01
• TikZ has a whole library for drawing automata. Are you using it? It makes lablelling connections between states simple. But without showing your code it's hard to tell what you are doing. See Which package can be used to draw automata?. Oct 2, 2018 at 1:51
• I agree with @AlanMunn. I also find it very hard to guess what your doing after my crystal ball got stolen. ;-)
– user121799
Oct 2, 2018 at 2:04

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,positioning,calc}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes,nodes in empty cells,column sep=3.14mm,row sep=3.14mm,
nodes={draw,circle,fill=cyan!50,minimum size=1cm}] (mat) {
& & & \\
& & & \\
};
\node[left=3.14mm of mat-1-1,font=\sffamily] {P};
\node[left=3.14mm of mat-2-1,font=\sffamily] {R};
\path ($(mat-1-1.north)!0.5!(mat-1-2.north)$) coordinate (x1)
($(mat-1-2.north)!0.5!(mat-1-3.north)$) coordinate (x2)
($(mat-1-3.north)!0.5!(mat-1-4.north)$) coordinate (x3)
($(mat-2-2.south)!0.5!(mat-2-3.south)$) coordinate (x4);
\node[above=3.14mm of x1,font=\sffamily] {I};
\node[above=3.14mm of x3,font=\sffamily] {E};
\draw[dotted] (x2) -- (x4);
\end{tikzpicture}
\end{document}


• 61k rep and still not tired of answering do-it-for-me questions. That's some real dedication. Oct 2, 2018 at 0:25
• @HenriMenke My willingness is inversely proportional to the reputation of the user. (You could just upvote those users to prevent me from answering these questions. ;-) A bit more seriously, there is a long discussion on whether or not one should "educate" users. I see and respect the arguments of both sides, but my take on this is that (a) I do not educate users and (b) the answer is for everyone, not just the asker.
– user121799
Oct 2, 2018 at 0:29