5

I am using the venndiagram package to... well, draw Venn diagrams.

I know it's considered a very basic package, but it works well for my purposes.

Except for one thing.

Both the venndiagram2sets and venndiagram3sets environments introduced by the package automatically draw rectangular outlines around the diagrams.

This is defined by the following line in the code:

\draw (venn bottom left) rectangle (\@venn@w,\@venn@h);

Is there any way to deactivate this?

6
  • 1
    I think the easiest solution will be to copy venndiagram.sty on a local folder, comment out this line and be sure your system loads your version of venndiagram.
    – Ignasi
    Jun 7 '18 at 9:24
  • After that you can write to venndiagram author and suggest to add an option to avoid these rectangles.
    – Ignasi
    Jun 7 '18 at 9:25
  • How can I make sure that my system loads the local *.sty?
    – poxx
    Jun 7 '18 at 9:48
  • 1
    TeX systems use a local folder when you can store your own or modified packages. But if you store the modified .sty inside your working folder, this version will be loaded. In any case, you can read the .log file where all loaded packages are detailed with information about their path.
    – Ignasi
    Jun 7 '18 at 9:55
  • Maybe this helps: tex.stackexchange.com/questions/69487/…
    – Ignasi
    Jun 7 '18 at 9:58
3

After quickly reading through venndiagram.sty, it seems to me that these rectangles around diagrams are hardcoded with

\draw (venn bottom left) rectangle (\@venn@w,\@venn@h);

and there is no special color to fade or option to skip drawing them. Therefore the best solution I can provide is to copy venndiagram.sty in your working folder and comment out these lines.

If you store modified .sty files in same folder as your document, the modified package will be loaded instead of the official one.

If you have to use the modified package with documents in different folders, will be better to use a local texmf tree (Purpose of local texmf trees) and store your version in it. This way you don't have to keep a copy inside every working folder.

Finally, if you consider that this modification could be usefull, you can always write to packege author and suggest to include in future versions of venndiagram.

7

Another option could be to use xpatch to patch those two environments, either removing the line altogether, or adding a style to the path, like this:

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{venndiagram}
\usepackage{xpatch}
\tikzset{
  vennframe/.style={draw=none} % define a new style for the frames
}
\makeatletter
\xpatchcmd{\endvenndiagram3sets}
{\draw (0,0) rectangle (\@venn@w,\@venn@h);} % replace this
{\draw [vennframe] (0,0) rectangle (\@venn@w,\@venn@h);} % with this -- add the style
{}{}

\xpatchcmd{\endvenndiagram2sets}
{\draw (venn bottom left) rectangle (\@venn@w,\@venn@h);}
{\draw [vennframe] (venn bottom left) rectangle (\@venn@w,\@venn@h);}
{}{}
\makeatother

\begin{document}
\begin{venndiagram3sets}
\fillA \fillB \fillC
\end{venndiagram3sets}

\begin{venndiagram2sets}
\fillA \fillB
\end{venndiagram2sets}

\end{document}
4

Version 1.2 (2018-06-07)¹ has a new boolean option showframe that governs whether to use \draw or \path for the frame. (The bounding rectangle always needs to be defined but this option now allows it to be hidden.)


¹Allow a few days for the new version to reach the TeX distributions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.