Asked
Active
Viewed 164 times
0
B612
- 153
- 6
-
https://texample.net/tikz/examples/nodetutorial/ might serve as a starting point – Apr 23 '22 at 15:50
-
https://www3.nd.edu/~kogge/courses/cse30151-fa17/Public/other/tikz_tutorial.pdf ; https://www.youtube.com/watch?v=tbiwHzjPUmw ; https://hayesall.com/blog/latex-automata/ ; https://texample.net/tikz/examples/feature/automata-and-petri-nets/ from search term: tikz automata // see also links to the right, like: https://tex.stackexchange.com/questions/20784/which-package-can-be-used-to-draw-automata – MS-SPO Apr 23 '22 at 15:52
1 Answers
1
Here is a solution using plain tikz:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[node distance=1.5cm]
% position the nodes a..d
\node (a) [] {$\textrm{I}$};
\node (b) [right of=a] {};
\node (c) [right of=b] {};
\node (d) [right of=c] {};
% draw the bullets/circles at the above defined positions
\draw (b) circle (5pt);
\filldraw (b) circle (1.5pt);
\filldraw (c) circle (1.5pt);
\draw (d) circle (5pt);
\filldraw (d) circle (1.5pt);
% draw arrows/connections, use 'shorten' to finetune space
\draw[->, shorten >=3pt, shorten <=-2pt] (a) -- (b) ;
\draw[->, shorten >=1pt, shorten <=3pt] (b) -- (c)
node [above=0pt, pos=0.5, font=\footnotesize]{$\varepsilon$};
\path[->, shorten >=3pt, shorten <=1pt, bend left]
(c) edge node [above=0., pos=0.5, font=\footnotesize]{$0$} (d) ;
\path[->, shorten >=1pt, shorten <=3pt, bend left]
(d) edge node [below=0., pos=0.5, font=\footnotesize]{$\varepsilon$} (c);
\end{tikzpicture}
\end{document}
I guess the code should be relatively clear. In case of doubt I can also add some comments and explanations. update: just added a few comments.
BanDoP
- 578
-
-
I'll reply with a link to a highly decorated answer: https://tex.stackexchange.com/questions/147143/whats-the-difference-between-path-and-draw-in-tikz In my code, the first \path[draw... can actually replaced by \draw (roughly speaking, a path is invisible until drawn, the draw command is already visible). Does my code answer your original question? – BanDoP Apr 23 '22 at 16:57
-
Answered. Thank you. But I still don't understand the difference between \path and \draw. To me they seem to be the same thing. – B612 Apr 23 '22 at 17:12
-
The main difference is: If you don't want to draw the "connections" then you only use path. If you want to draw the connections then you use \draw or \path[draw]. Also, please mark my answer/code above as correct if this solved your problem, thanks! – BanDoP Apr 23 '22 at 17:19

