summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-er.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-er.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-er.tex142
1 files changed, 142 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-er.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-er.tex
new file mode 100644
index 00000000000..174bfd98d13
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-er.tex
@@ -0,0 +1,142 @@
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Free Documentation License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+
+\section{Entity-Relationship Diagram Drawing Library}
+
+\begin{tikzlibrary}{er}
+ This packages provides styles for drawing entity-relationship
+ diagrams.
+\end{tikzlibrary}
+
+This library is intended to help you in creating E/R-diagrams. It defines
+only very little new styles, but using these style |entity| instead of
+saying |rectangle,draw| makes the code more expressive.
+
+
+\subsection{Entities}
+
+The package defines a simple style for drawing entities:
+
+\begin{itemize}
+ \itemstyle{entity}
+ This style is to be used with nodes that represent entity types. It
+ causes the node's shape to be set to a rectangle that is drawn and
+ whose minimum size and width are set to sensible values.
+
+ Note that this style is called |entity| despite the fact that it is
+ to be used for nodes representing entity \emph{types} (the
+ difference between an entity and an entity type is the same as the
+ difference between an object and a class in object-oriented
+ programming). If this bothers you, feel free to define a style
+ |entity type| instead.
+\begin{codeexample}[]
+\begin{tikzpicture}[node distance=2cm]
+ \node[entity] (sheep) {Sheep};
+ \node[entity] (genome) [right of=sheep] {Genome};
+\end{tikzpicture}
+\end{codeexample}
+
+ \itemstyle{every entity}
+ This stype is envoked by the style |entity|. To change the
+ appearance of entities, you can change this style.
+\begin{codeexample}[]
+\begin{tikzpicture}[node distance=2cm]
+ \tikzstyle{every entity}=[draw=blue!50,fill=blue!20,thick]
+ \node[entity] (sheep) {Sheep};
+ \node[entity] (genome) [right of=sheep] {Genome};
+\end{tikzpicture}
+\end{codeexample}
+\end{itemize}
+
+
+
+\subsection{Relationships}
+
+Relationships are drawn using styles that are very similar to the
+styles for entities.
+
+\begin{itemize}
+ \itemstyle{relationship}
+ This style works like |entity|, only it is to be used for
+ relationships. Again, |relationship|s are actually relationship types.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[entity] (sheep) at (0,0) {Sheep};
+ \node[entity] (genome) at (2,0) {Genome};
+ \node[relationship] at (1,1.5) {has}
+ edge (sheep)
+ edge (genome);
+\end{tikzpicture}
+\end{codeexample}
+ \itemstyle{every relationship}
+ works like |every entity|
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \tikzstyle{every entity}=[fill=blue!20,draw=blue,thick]
+ \tikzstyle{every relationship}=[fill=orange!20,draw=orange,thick,aspect=1.5]
+ \node[entity] (sheep) at (0,0) {Sheep};
+ \node[entity] (genome) at (2,0) {Genome};
+ \node[relationship] at (1,1.5) {has}
+ edge (sheep)
+ edge (genome);
+\end{tikzpicture}
+\end{codeexample}
+\end{itemize}
+
+
+
+\subsection{Attributes}
+
+\begin{itemize}
+ \itemstyle{attribuate}
+ This style is used to indicate that a node is an attribute. To
+ connect an attribute to its entity, you can use, for example, the
+ |child| command or the |pin| option.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[entity] (sheep) {Sheep}
+ child {node[attribute] {name}}
+ child {node[attribute] {color}};
+\end{tikzpicture}
+\end{codeexample}
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \tikzstyle{every pin edge}=[draw]
+ \node[entity,pin={[attribute]60:name},pin={[attribute]120:color}] {Sheep};
+\end{tikzpicture}
+\end{codeexample}
+ \itemstyle{key attribute}
+ This style is intended for key attributes. By default, the will
+ cause the attribute to be typeset in italics. Typcially, underlining
+ is used instead, but that looks ugly and it is difficult to
+ implement in \TeX.
+ \itemstyle{every attribute}
+ This style is used with every (key) attribute.
+\begin{codeexample}[]
+\begin{tikzpicture}[text depth=1pt]
+ \tikzstyle{every attribute}=[fill=black!20,draw=black]
+ \tikzstyle{every entity}=[fill=blue!20,draw=blue,thick]
+ \tikzstyle{every relationship}=[fill=orange!20,draw=orange,thick,aspect=1.5]
+ \node[entity] (sheep) at (0,0) {Sheep}
+ child {node [key attribute] {name}};
+ \node[entity] (genome) at (2,0) {Genome};
+ \node[relationship] at (1,1.5) {has}
+ edge (sheep)
+ edge (genome);
+\end{tikzpicture}
+\end{codeexample}
+\end{itemize}
+
+
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "pgfmanual-pdftex-version"
+%%% End: