| 1 |
% Copyright 2018 by Till Tantau |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Public License. |
| 7 |
% |
| 8 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 9 |
|
| 10 |
\ProvidesFileRCS{tikzlibraryautomata.code.tex} |
| 11 |
|
| 12 |
\usetikzlibrary{shapes.multipart}% |
| 13 |
|
| 14 |
% Styles for states: |
| 15 |
|
| 16 |
\tikzset{every state/.style= {}}% |
| 17 |
|
| 18 |
\tikzset{state without output/.style= {circle,draw,minimum size=2.5em,every state}}% |
| 19 |
\tikzset{state with output/.style= {circle split,draw,minimum size=2.5em,every state}}% |
| 20 |
|
| 21 |
\tikzset{accepting by arrow/.style= {after node path= |
| 22 |
{ |
| 23 |
{ |
| 24 |
[to path= |
| 25 |
{ |
| 26 |
[->,double=none,every accepting by arrow] |
| 27 |
-- |
| 28 |
([shift=(\tikz@accepting@angle:\tikz@accepting@distance)]\tikztostart.\tikz@accepting@angle) |
| 29 |
node [shape=rectangle,anchor=\tikz@accepting@anchor] {\tikz@accepting@text} |
| 30 |
}] |
| 31 |
edge () |
| 32 |
} |
| 33 |
}}}% |
| 34 |
\tikzset{every accepting by arrow/.style={}}% |
| 35 |
\tikzset{accepting by double/.style= {double,outer sep=.5\pgflinewidth+.3pt}} % .3pt is half double width distance |
| 36 |
|
| 37 |
\tikzset{initial by arrow/.style= {after node path= |
| 38 |
{ |
| 39 |
{ |
| 40 |
[to path= |
| 41 |
{ |
| 42 |
[->,double=none,every initial by arrow] |
| 43 |
([shift=(\tikz@initial@angle:\tikz@initial@distance)]\tikztostart.\tikz@initial@angle) |
| 44 |
node [shape=rectangle,anchor=\tikz@initial@anchor] {\tikz@initial@text} |
| 45 |
-- (\tikztostart)}] |
| 46 |
edge () |
| 47 |
} |
| 48 |
}}}% |
| 49 |
\tikzset{every initial by arrow/.style={}}% |
| 50 |
|
| 51 |
\tikzset{initial by diamond/.style={shape=diamond}}% |
| 52 |
|
| 53 |
|
| 54 |
\tikzoption{initial text}{\tikzaddafternodepathoption{\def\tikz@initial@text{#1}}}% |
| 55 |
\tikzoption{accepting text}{\tikzaddafternodepathoption{\def\tikz@accepting@text{#1}}}% |
| 56 |
|
| 57 |
\tikzoption{initial where}{\tikzaddafternodepathoption{\csname tikz@initial@compute@#1\endcsname}}% |
| 58 |
\tikzoption{accepting where}{\tikzaddafternodepathoption{\csname tikz@accepting@compute@#1\endcsname}}% |
| 59 |
|
| 60 |
\tikzoption{initial distance}{\tikzaddafternodepathoption{\def\tikz@initial@distance{#1}}}% |
| 61 |
\tikzoption{accepting distance}{\tikzaddafternodepathoption{\def\tikz@accepting@distance{#1}}}% |
| 62 |
|
| 63 |
\def\tikz@initial@text{start}% |
| 64 |
\def\tikz@accepting@text{}% |
| 65 |
|
| 66 |
\def\tikz@initial@distance{3ex}% |
| 67 |
\def\tikz@accepting@distance{3ex}% |
| 68 |
|
| 69 |
\def\tikz@initial@compute@above{\def\tikz@initial@angle{90}\def\tikz@initial@anchor{south}}% |
| 70 |
\def\tikz@initial@compute@below{\def\tikz@initial@angle{270}\def\tikz@initial@anchor{north}}% |
| 71 |
\def\tikz@initial@compute@left{\def\tikz@initial@angle{180}\def\tikz@initial@anchor{east}}% |
| 72 |
\def\tikz@initial@compute@right{\def\tikz@initial@angle{0}\def\tikz@initial@anchor{west}}% |
| 73 |
|
| 74 |
\def\tikz@initial@angle{180}% |
| 75 |
\def\tikz@initial@anchor{east}% |
| 76 |
|
| 77 |
\def\tikz@accepting@compute@above{\def\tikz@accepting@angle{90}\def\tikz@accepting@anchor{south}}% |
| 78 |
\def\tikz@accepting@compute@below{\def\tikz@accepting@angle{270}\def\tikz@accepting@anchor{north}}% |
| 79 |
\def\tikz@accepting@compute@left{\def\tikz@accepting@angle{180}\def\tikz@accepting@anchor{east}}% |
| 80 |
\def\tikz@accepting@compute@right{\def\tikz@accepting@angle{0}\def\tikz@accepting@anchor{west}}% |
| 81 |
|
| 82 |
\def\tikz@accepting@angle{0}% |
| 83 |
\def\tikz@accepting@anchor{west}% |
| 84 |
|
| 85 |
|
| 86 |
\tikzset{initial above/.style= {initial by arrow,initial where=above}}% |
| 87 |
\tikzset{initial below/.style= {initial by arrow,initial where=below}}% |
| 88 |
\tikzset{initial left/.style= {initial by arrow,initial where=left}}% |
| 89 |
\tikzset{initial right/.style= {initial by arrow,initial where=right}}% |
| 90 |
|
| 91 |
\tikzset{accepting above/.style= {accepting by arrow,accepting where=above}}% |
| 92 |
\tikzset{accepting below/.style= {accepting by arrow,accepting where=below}}% |
| 93 |
\tikzset{accepting left/.style= {accepting by arrow,accepting where=left}}% |
| 94 |
\tikzset{accepting right/.style= {accepting by arrow,accepting where=right}}% |
| 95 |
|
| 96 |
|
| 97 |
% Defaults: |
| 98 |
|
| 99 |
\tikzset{state/.style= {state without output}}% |
| 100 |
\tikzset{accepting/.style= {accepting by double}}% |
| 101 |
\tikzset{initial/.style= {initial by arrow}}% |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
\endinput |