Instantly share code, notes, and snippets.

# stefankuehnel/coffee-machine-dfa.svg Secret

Last active Jan 3, 2021
Creates a 2D-graphic of a coffee machine, which was realized as a deterministic finite state machine.
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{automata,positioning,arrows} \tikzset{node distance=4.5cm, every state/.style={ semithick, fill=gray!10}, initial text={}, double distance=4pt, every edge/.style={ draw, ->,>=stealth', auto, semithick}} \begin{document} \begin{tikzpicture}[shorten >=1pt,node distance=6cm,on grid,auto] \node[state, initial, accepting] (q1) {$\textrm{Bereitschaft}$}; \node[state, right of=q1] (q2) {$\textrm{Menüanzeige}$}; \node[state, right of=q2] (q3) {$\textrm{Geldeingabe}$}; \node[state, right of=q3] (q4) {$\textrm{Zahlung abschließen?}$}; \node[state, above of=q4] (q5) {$\textrm{Geldrückgabe}$}; \node[state, right of=q4] (q6) {$\textrm{Zubereitung}$}; \draw (q1) edge node{$\textrm{Start}$} (q2) (q2) edge[bend left, below] node[anchor=south]{$\textrm{Abbruch}$} (q1) (q2) edge node{$\textrm{Gewünschter Kaffee}$} (q3) (q3) edge[bend left, below] node[anchor=south]{$\textrm{Zurück}$} (q2) (q3) edge[bend left, below] node[anchor=south]{$\textrm{Abbruch}$} (q1) (q3) edge node{$\textrm{Geld}$} (q4) (q4) edge node{$\textrm{Abbruch}$} (q5) (q4) edge node{$\textrm{Weiter}$} (q6) (q5) edge[bend right, below] node[anchor=east]{$\textrm{Geldentnahme}$} (q1) (q6) edge[bend left=60, below] node{$\textrm{Entnahme}$} (q1); \end{tikzpicture} \end{document}

### Usage

2. Set system environment variables correctly:
To use the latex command in your command line, it is necessary to define the system environment variables correctly. To do this, copy the path to your MiKTex installation and paste it into the system environment variables configuration:

Note: The path may vary depending on your installation.

C:\Program Files\MiKTeX 2.9\miktex\bin\x64\

2. Check compiler version:
Run latex in your command prompt and check for the following output.

Note: The version number may be different depending on the version you're using.

> pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 2.9.7300 64-bit)

3. Run the following commands in the dfa.tex source directory:

$latex dfa.tex$ dvisvgm dfa.dvi