summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-13 23:54:13 +0000
committerKarl Berry <karl@freefriends.org>2010-09-13 23:54:13 +0000
commita81b00b60192cde6eceb35cca61ea7f3e08898a5 (patch)
tree337396c5c4d6dfd159a202d0dfd4366f91285eef /Master/texmf-dist/doc/metapost
parent19908bf03185813a2c3bb24b2db83f04978c28b9 (diff)
automata update (13sep10)
git-svn-id: svn://tug.org/texlive/trunk@19717 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost')
-rw-r--r--Master/texmf-dist/doc/metapost/automata/README5
-rw-r--r--Master/texmf-dist/doc/metapost/automata/example.mp55
-rw-r--r--Master/texmf-dist/doc/metapost/automata/example.pdfbin56311 -> 90447 bytes
-rw-r--r--Master/texmf-dist/doc/metapost/automata/example.tex5
4 files changed, 36 insertions, 29 deletions
diff --git a/Master/texmf-dist/doc/metapost/automata/README b/Master/texmf-dist/doc/metapost/automata/README
index 9345ec96569..ee2805fc3c6 100644
--- a/Master/texmf-dist/doc/metapost/automata/README
+++ b/Master/texmf-dist/doc/metapost/automata/README
@@ -1,4 +1,4 @@
-AUTOMATA.MP - version 0.2
+AUTOMATA.MP - version 0.3
This package is a collection of macros for METAPOST to
make easier to draw finite-state machines, automata,
@@ -38,5 +38,4 @@ License and it can be downloaded from the web page
by following the link "Other links".
-Gabriele Puppis - gabriele.puppis@dimi.uniud.it
-University of Udine - Italy
+Gabriele Puppis - gabriele.puppis@gmail.com
diff --git a/Master/texmf-dist/doc/metapost/automata/example.mp b/Master/texmf-dist/doc/metapost/automata/example.mp
index 88cbc2eca43..79adb2f68e3 100644
--- a/Master/texmf-dist/doc/metapost/automata/example.mp
+++ b/Master/texmf-dist/doc/metapost/automata/example.mp
@@ -12,56 +12,65 @@ verbatimtex
etex
-% SIMPLE EXAMPLE FOR THE PACKAGE automata.mp
+% EXAMPLE FOR THE PACKAGE automata.mp
beginfig(0);
- % settings for some global parameters
+ % Setting of some global parameters.
+
size := 15;
incominglength := 25;
loopsize := 22;
- % instead of using `spacing := (36,29)'
- % one could use `with spacing((36,29))' to temporarily change the value of the parameter
+ % The following command defines a grid of nodes with 7 rows and 10 columns.
+ % Instead of using "spacing := (36,29)" and thus change the global parameter for the ditance
+ % between nodes, one can use `with spacing((36,29))' to temporarily change the value of this
+ % parameter.
+
with spacing((36,29)) matrix.a(7,10);
- % one can use directives btex etex to include LaTeX-compiled labels
+ % Next, one declares the shape of the nodes and possibly their labels. One can use the directives
+ % "btex" and "etex" to include LaTeX-compiled labels in nodes, or just "" to leave them unlabeled.
+ % Moreover, one can use several shapes for the nodes. There are some predefined shorhands for
+ % modified styles of nodes and arrows (e.g., "node_double" is equivalent to "with border(double) node")
+
node.a[4][0](btex $s_0$ etex);
- node.a[4][2](btex $s_1$ etex);
- node.a[4][4](btex $s_2$ etex);
- node.a[4][6](btex $s_3$ etex);
- node.a[4][8](btex $s_4$ etex);
+ with shape(boxed) node.a[4][2](btex $s_1$ etex);
+ with shape(fixedbox) node.a[4][4](btex $s_2$ etex);
+ with size(18) with shape(diamond) node.a[4][6](btex $s_3$ etex);
+ with size(22) with shape(utriangle) node.a[4][8](btex $s_4$ etex);
node.a[2][2](btex $s_5$ etex);
node.a[2][5](btex $s_6$ etex);
node.a[1][6](btex $s_7$ etex);
- % there are some predefined shorhands for modified styles of nodes and arrows
- % (e.g., `node_double ...' is equivalent to `with border(double) node ...')
node_double.a[1][8](btex $s_8$ etex);
+ % One can define arrows of different forms. Each arrow follow a path from an initial node to a
+ % final node and this path must be explicitly given as a MetaPost path expression (e.g., point..point--point).
+ % Note that labels of nodes and arrows can be rotated using the MetaPost directive "rotated".
+
incoming(0, "") (a[4][0]) 120;
loop.bot(.65, btex \small $a$ etex) (a[4][0]) -165;
- % paths can be simple expressions (e.g., point..point) ...
arrow_dash.bot(.5, btex \small $b$ etex) (a[4][0],a[4][2]) a[4][0].c..a[4][2].c;
arrow.bot(.5, btex \small $a$ etex) (a[4][2],a[4][4]) a[4][2].c..a[4][4].c;
arrow.bot(.5, btex \small $a$ etex) (a[4][4],a[4][6]) a[4][4].c..a[4][6].c;
arrow.bot(.5, btex \small $a$ etex) (a[4][6],a[4][8]) a[4][6].c..a[4][8].c;
- % ...or more complex expressions (e.g., point..point---point...point)
- % (BUG: directive `{dir <angle>}' does not work with arrows, but `{up}' does)
arrow.bot(.5, btex \small $c$ etex) (a[4][8],a[4][0]) a[4][8].c..a[5][7].c---a[5][1].c..a[4][0].c;
- % one can rotate labels as usual in MetaPost
arrow_dash.rt(.5, btex \small $a$ etex rotated 90) (a[4][2],a[2][2]) a[4][2].c..a[2][2].c;
arrow.bot(.5, btex \small $c$ etex rotated 39) (a[2][2],a[4][0]) a[2][2].c..a[4][0].c;
- arrow_dash.bot(.5, btex \small $a$ etex) (a[2][2],a[2][5]) a[2][2].c..a[2][5].c;
+ arrow_dash.bot(.5, btex \small $a$ etex) (a[2][2],a[2][5]) a[2][2].c{dir-30}..a[2][5].c;
arrow_dash.rt(.5, btex \small $a$ etex rotated 90) (a[4][6],a[1][6]) a[4][6].c..a[1][6].c;
arrow.top(.5, btex \small $a$ etex) (a[1][6],a[1][8]) a[1][6].c..a[1][8].c;
- % again some complex paths for arrows...
- arrow.bot(.38, btex \small $c$ etex) (a[2][5],a[4][0])
- a[2][5].c..a[1][4].c---a[1][2].c shifted(-10,0)..a[2][1].c shifted (-10,0)---a[4][0].c;
- arrow_bold.bot(.5, btex \small $c$ etex) (a[1][8],a[4][0])
- a[1][8].c..a[2][9].c---a[5][9].c..a[6][8].c---a[6][1].c..a[5][0].c---a[4][0].c;
- arrow_bold.top(.38, btex \small $c$ etex) (a[1][8],a[4][0])
- a[1][8].c..a[0][7].c---a[0][1].c..a[1][0].c---a[4][0].c;
+ arrow.bot(.38, btex \small $c$ etex) (a[2][5],a[4][0]) a[2][5].c..a[1][4].c---a[1][2].c shifted(-10,0)..a[2][1].c shifted (-10,0)---a[4][0].c;
+ arrow_bold.bot(.5, btex \small $c$ etex) (a[1][8],a[4][0]) a[1][8].c..a[2][9].c---a[5][9].c..a[6][8].c---a[6][1].c..a[5][0].c---a[4][0].c;
+ arrow_bold.top(.38, btex \small $c$ etex) (a[1][8],a[4][0]) a[1][8].c..a[0][7].c---a[0][1].c..a[1][0].c---a[4][0].c;
+
+ % Finally, one may want to highligh a given set of nodes. This can done using the macro
+ % "enclose"/"enclosure", which draws/returns a path that goes around the given sequence
+ % of vertices (it is always a good idea if the sequence is given in clockwise order and
+ % if it defines a convex region!).
+ with enclosuremargin(20) draw enclosure(a[4][4].c--a[2][5].c--a[1][6].c--a[4][6].c--cycle) withcolor light.light.green withpen pencircle scaled 3;
+
endfig;
end. \ No newline at end of file
diff --git a/Master/texmf-dist/doc/metapost/automata/example.pdf b/Master/texmf-dist/doc/metapost/automata/example.pdf
index 0d2ab2d5735..8fa83dc5c45 100644
--- a/Master/texmf-dist/doc/metapost/automata/example.pdf
+++ b/Master/texmf-dist/doc/metapost/automata/example.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/metapost/automata/example.tex b/Master/texmf-dist/doc/metapost/automata/example.tex
index d84c855c67f..4544ebb0325 100644
--- a/Master/texmf-dist/doc/metapost/automata/example.tex
+++ b/Master/texmf-dist/doc/metapost/automata/example.tex
@@ -10,8 +10,7 @@
\title{An example of automaton generated\\with the MetaPost package \url{automata.mp}}
\author{Gabriele Puppis\\
- \emph{Dipartimento di Matematica e Informatica, Università di Udine, Italy}\\
- \url{gabriele.puppis@dimi.uniud.it}}
+ \url{gabriele.puppis@gmail.com}}
\maketitle
@@ -30,7 +29,7 @@ and the transitions of the automaton (you can find some documentation inside the
\begin{figure}[!!h]
\centering\includegraphics{example.0}
-\caption{An example pf automaton}\label{fig:example}
+\caption{An example of automaton}\label{fig:example}
\end{figure}
\end{document} \ No newline at end of file