Skip to content

Instantly share code, notes, and snippets.

@0x00b1
Last active December 16, 2015 08:58
Show Gist options
  • Save 0x00b1/5409198 to your computer and use it in GitHub Desktop.
Save 0x00b1/5409198 to your computer and use it in GitHub Desktop.
\documentclass{standalone}
\usepackage{standalone}
\usepackage{tikz}
\newcommand { \U } { (-2, -2) rectangle ( 3, 2) (-2, 2) }
\newcommand { \A } { ( 0, 0) circle ( 1) ( 0, 1) }
\newcommand { \B } { ( 1, 0) circle ( 1) ( 1, 1) }
\newcommand { \venn } {
\draw \U node [text = black, below right] { $U$ }
\A node [text = black, above] { $A$ }
\B node [text = black, above] { $B$ } ;
}
\newcommand { \union }[2] {
\scope
\fill[red] { #1 } ;
\fill[red] { #2 } ;
\endscope
}
\newcommand { \intersection }[2] {
\scope
\clip { #1 } ;
\fill[red] { #2 } ;
\endscope
}
\newcommand { \difference }[2] {
\scope[even odd rule]
\clip { #2 } (-1, -1) rectangle ( 1, 1) ;
\fill[red] { #1 } ;
\endscope
}
\begin{document}
\begin{tikzpicture}
\difference{ \A } { \B }
\venn
\end{tikzpicture}
\end{document}
@0x00b1
Copy link
Author

0x00b1 commented Apr 18, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment