2013-10-01 11:17:56 +00:00
|
|
|
# Generate graph in PNG using metapost
|
|
|
|
|
2013-10-01 11:35:29 +00:00
|
|
|
First you need to install `LaTeX`, `metapost` and `imagemagick`.
|
2013-10-01 11:17:56 +00:00
|
|
|
|
2013-10-01 11:35:29 +00:00
|
|
|
Then this repo provide a metapost lib to draw automata using LaTeX labels.
|
|
|
|
Then the script use the solarized color theme and also generate PNG optimized for the web.
|
2013-10-01 11:17:56 +00:00
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
~~~
|
2013-10-01 11:28:37 +00:00
|
|
|
z0=origin;
|
|
|
|
z1=(gu,0);
|
|
|
|
z2=(2gu,0);
|
|
|
|
z3=(3gu,0);
|
|
|
|
|
|
|
|
drawState(z0,"A");
|
|
|
|
drawState(z1,"B");
|
|
|
|
drawState(z2,"C");
|
|
|
|
drawState(z3,"D");
|
|
|
|
|
|
|
|
drawEdge(z1,z2,"g");
|
|
|
|
|
|
|
|
drawoptions(withcolor blue);
|
|
|
|
drawEdgeAngle(z0,z2,"g\circ f",35);
|
|
|
|
drawEdge(z2,z3,"h");
|
|
|
|
|
|
|
|
drawoptions(withcolor green);
|
|
|
|
drawEdge(z0,z1,"f");
|
|
|
|
drawEdgeAngle(z1,z3,"h\circ g",-35);
|
|
|
|
|
|
|
|
drawoptions(withcolor yellow);
|
|
|
|
drawEdgeAngle(z0,z3,"(h\circ g)\circ f = h\circ (g\circ f)",50);
|
2013-10-01 11:17:56 +00:00
|
|
|
~~~
|
|
|
|
|
2013-10-01 11:20:23 +00:00
|
|
|
Generate the following image:
|
2013-10-01 11:17:56 +00:00
|
|
|
|
2013-10-01 11:28:37 +00:00
|
|
|
<img src="./associativecomposition.png" alt="Composition is associative"><br/>
|
2013-10-01 11:17:56 +00:00
|
|
|
|
|
|
|
|