# How to automatically generate Venn diagrams given the inclusion relations? [closed]

I'm writing a paper about classes of formal languages, and I'd like to have a diagram showing their heirarchy.

Something similar to this (from Wikipedia:)

Is there a LaTeX package which, I can give the relationship between the classes to, and have automatically generate and lay-out a venn-diagram for me?

The idea is that I would give it the list of classes, and some relations between them, i.e. which were contained in each other, which were disjoint, which were incomparable but not disjoint. Containment is assumed to be transitive (i.e. if A is in B, B is in C, then A is in C).

Is there a way to do this programatically, or a package to do it automatically? The idea is that I'm continually adding new classes to the diagram, and would love if it would automatically update itself every time I discovered a new relation.

-

## closed as too broad by Claudio Fiandrino, Svend Tveskæg, Jesse, Benedikt Bauer, WernerMar 13 '14 at 14:26

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

Search for venn diagrams on this site. There are a number of questions & answers, such as tex.stackexchange.com/questions/78730/drawing-a-venn-diagram. I realize your question may go beyond them, in its hopes for automation... –  Steven B. Segletes May 30 '13 at 20:07
–  Werner May 30 '13 at 20:08
Drawing these things automatically, given just the inclusion relation, sounds rather ambitious to my mind. You might find the TikZ `fit` library handy -- given a set of points, you can tell TikZ to draw a shape that encompasses all of them. –  John Wickerson May 30 '13 at 20:11
@jmite I think that definitive answer is that it can be done but TikZ is not the right tool or should I say not enough. If I had to bid for the job I would propose PythonTeX as the way to attack this problem (it uses pgf as back-ends for plotting just like TikZ). I would ask a student to write Python parser for the relationship between classes first and when the student makes some progress I would write a PythonTeX wrapper. –  Predrag Punosevac May 30 '13 at 21:12
An alternative to PythonTex would be to use the package sagetex. This would follow the same than Punosevac's suggestion. –  boumol May 31 '13 at 8:31