Last active
December 16, 2015 08:58
-
-
Save 0x00b1/5409198 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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} |
Author
0x00b1
commented
Apr 18, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment