# Metapost use venn package

I use TexShop, and I have successfully compiled an example which uses metapost code directly in LaTeX code ( by running pdflatex, then metapost, then finally pdflatex again). this code uses mpfic option

Now I want to use the venn ( http://ctan.org/tex-archive/graphics/metapost/contrib/macros/venn ) package in my document. But \usepackage{venn} is causing not found error, and any command without venn package is not working as well.

So how do I setup the usage of venn package with metapost. I have installed it already using TeX live utility.

I have never tried to include the source directly inside the .tex file but in case your trouble is with the metapost code it may help to start with a known-good stand-alone source.

I did this recently, so I suspect that it still works (although I have edited out some stuff I think is not needed so do let me know if it fails). Here is the input file. It draws the Venn diagram for the union.

% set.mp
%  MetaPost input file with chapter one pictures.
verbatimtex
%&latex
\documentclass{book}
\begin{document}
etex

input venn

outputtemplate := "%j-%2c.mps";
beginfig(0);
draw_venn_two(false,true,true,true);
% Label the sets (from pp 29 pf MetaPost manual)
picture pa, pb;
pa = thelabel(btex \tiny $A$ etex,   (.9venn_circle_left_shift,1.15venn_circle_top_shift));
pb = thelabel(btex \tiny $B$ etex, (1.1venn_circle_right_shift,1.15venn_circle_top_shift));
unfill bbox pa;
draw pa;
unfill bbox pb;
draw pb;
endfig;

end


At a (Linux) command line I ran the four commands

• mpost set.mp followed by
• tex mproof set-00.mps followed by
• dvips -Pwww -omproof.ps mproof finally followed by
• gv mproof.ps;

this last pops up a viewer for the figure.

To include it in my doc I used this.

\begin{center}
\includegraphics[width=0.33\textwidth]{set-00.mps}
\end{center}


This is inside Beamer. I don't see that I did anything special to get the graphicx system to recognize the .mps ending but I may have forgot the details; let me know.

(Edit: someone changed what I wrote and in particular dropped the necessary initial paragraph. I added something like it back.)

• Could you please include a picture showing off the Venn diagrams your method outputs? You can just press the image icon in the editing dialogue to upload one. – N.N. Aug 17 '11 at 13:25

I know this is an old question, but the workflow is much simpler now with luamplib.

This is the source:

\documentclass[margin=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
input venn
beginfig(1);
draw_venn_two(false, true, true, true);
picture pa, pb;
pa = thelabel("\footnotesize A", center venn_box shifted 13 left);
pb = thelabel("\footnotesize B", center venn_box shifted 13 right);
unfill bbox pa; draw pa;
unfill bbox pb; draw pb;
endfig;
\end{mplibcode}
\end{document}


And the workflow

• compile with lualatex to produce a PDF file
• er, that's it.