summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/schule/latex/syntaxdi.sty
blob: 8a7c3a3b4a6f73db3e1993ad8e523df7d2052b69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
% \subsection{Das Paket \texttt{syntaxdi}}
%	Die ausführliche Beschreibung des Pakets ist in der
%	Paketbeschreibung (\ref{paket:syntaxdi}) zu finden.
%
%  Beginn der Definition, Voraussetzung der \LaTeXe{} Version und die
%  eigene Identifizierung
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{syntaxdi}[2014/11/18 v0.5 %
                           Syntaxdiagramme mit TikZ]
%    \end{macrocode}
% Einbinden der benötigten Pakete
%    \begin{macrocode}
\RequirePackage{tikz}
\usetikzlibrary{chains}
\usetikzlibrary{arrows,shadows,shapes.misc,scopes}
%    \end{macrocode}
%
% \subsubsection{TikZ-Definitionen}
%
% 	Definition für nicht terminale Symbole für Syntaxdiagramme in TikZ
%    \begin{macrocode}
\tikzset{
	fnonterminal/.style={
		rectangle,
		minimum size=6mm,
		text height=1.5ex,text depth=.25ex,
		very thick,
		draw=red!50!black!50,  % 50% red und 50% black,
		top color=white,              % oben: weisser Schatten ...
		bottom color=red!50!black!20, % unten: anderer Schatten
		font=\itshape
	}
}
\tikzset{
	nonterminal/.style={
		% Die Form:
		rectangle,
		% Die Größe:
		minimum size=6mm,
		text height=1.5ex,text depth=.25ex,
		% Der Rand:
		very thick,
		draw=red!50!black!50,  % 50% red und 50% black,
		% gemischt mit 50% white
		% Füllfarbe:
		top color=white,              % oben: weisser Schatten ...
		bottom color=red!50!black!20, % unten: anderer Schatten
		% Font
		font=\itshape
	}
}
%    \end{macrocode}
%
% 	Definitionen für terminale Symbole im Syntaxdiagramm in TikZ
%    \begin{macrocode}
\tikzset{
	fterminal/.style={
		rounded rectangle,
		minimum size=6mm,
		very thick,draw=black!50,
		text height=1.5ex,text depth=.25ex,
		top color=white,bottom color=black!20,
		font=\ttfamily
	}
}
\tikzset{
	terminal/.style={
		% Die Form:
		rounded rectangle,
		minimum size=6mm,
		% Der Rest ...
		very thick,draw=black!50,
		text height=1.5ex,text depth=.25ex,
		top color=white,bottom color=black!20,
		font=\ttfamily
	}
}
%    \end{macrocode}
%
% 	Definitionen eines Punktes für das Syntaxdiagramm in TikZ
%    \begin{macrocode}
\tikzset{
	point/.style={
		circle,
		inner sep=0pt,
		minimum size=0pt
	}
}
%    \end{macrocode}
%
% 	Definition eines Endpunktes für das Syntaxdiagramm in TikZ
%    \begin{macrocode}
\tikzset{
	endpoint/.style={
		circle,
		inner sep=0pt,
		minimum size=0pt
	}
}
%    \end{macrocode}
%
% 	Definition der Syntaxdiagramme in TikZ
%    \begin{macrocode}
\tikzset{
	syntaxdiagramm/.style={
		start chain,
		node distance=7mm and 5mm,
		every node/.style={on chain},
		nonterminal/.append style={join=by ->},
		terminal/.append style={join=by ->},
		endpoint/.append style={join=by ->},
		point/.append style={join=by -},
		skip loop/.style={to path={-- ++(0,-.5) -| (\tikztotarget)}}
	}
}
%    \end{macrocode}
%
% Ende des Pakets \texttt{syntaxdi}