Skip to content

Instantly share code, notes, and snippets.

@stefankuehnel
Last active January 3, 2021 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefankuehnel/2b858ca0888bd56c4e6bb59e8c8f6fb2 to your computer and use it in GitHub Desktop.
Save stefankuehnel/2b858ca0888bd56c4e6bb59e8c8f6fb2 to your computer and use it in GitHub Desktop.
Creates a 2D-graphic of a coffee machine, which was realized as a deterministic finite state machine.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\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}
@stefankuehnel
Copy link
Author

stefankuehnel commented May 12, 2020

Usage

1. Download and install MiKTex:
Download here: https://miktex.org/download

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

References:

License:

Copyright (c) 2020 Stefan Kühnel, licensed under the Academic Free License version 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment