I would like to be able to draw a nice concurrency diagram in my homework for a class I am taking. An ascii version would look something like the following. Is there any way to do this using latex that would make it look really nice and clean?

Thread A ----|=====read(7)=====|----------------------------------->
Thread B -------------|======write(-3)=====|-----|===read(-7)===|--->

Or at least something like this.

+1  A: 

There are a quite a few drawing languages that integrate into tex.

As suggested in the comment, Dia, at least on linux, can dump to metapost code, which can be processed and inserted in your tex document.

You can also create a graphics file (jpg, png, pdf, eps) from your graphics program of choice, and just include that graphics file. This is probably the easiest route to go.

Off the top of my head, the drawing languages compatible with latex (non-exhaustive) are: PGF, TIKZ, MetaPost

TIKZ and PGF are pretty powerful, and you can check out a bunch of examples at texample.net

You could also use graphviz, and optionally dot2tex, which will translate your graphviz file into code latex can understand.


The timing macros for PGF/TikZ look like they could be used to do what you want.