[OS X TeX] set difference using TikZ and beamer

Alain Matthes alain.matthes at mac.com
Fri Mar 20 14:11:21 EDT 2009


Le 20 mars 09 à 18:54, Alain Matthes a écrit :

>
> Le 20 mars 09 à 18:22, Art Werschulz a écrit :
>
>> Hi.
>>
>> I'm trying to do a slide that contains a Venn diagram and some  
>> commentary.  I found Til's Venn diagram example at
>> 	http://www.texample.net/tikz/examples/venn-diagram
>> and I'm trying to somewhat blindly modify same.
>>
>> Here's the code for such a page:
>>
>> couic ...
>>
>> Unfortunately, the diagram starts way too low on the page.  As a  
>> result, the last two lines of text don't appear on the slide.
>>
>> Any ideas on how to fix?  Thanks.
>
>
> Hi,
>
>
>       \clip \circleA (-2,-2) rectangle (4,4);
> |
> |
> |----->      \clip \circleA (-2,-2) rectangle (4,2);


An interesting example :

% Animate a set intersection operation.
% Standalone version contributed by Alexander Grahn
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}

\usepackage{fp}

% parameterized tikz graphics
\newcommand{\intersect}[1]{%
   \def\setA{(0,0) circle (1)}%
   \def\setB{(#1,0) circle (1)}%
   % define the bounding box
   \def\boundb{(-2,2) rectangle (4,-2)}%
   %
   \begin{tikzpicture}
     \draw \boundb;
     % intersection
     \begin{scope}
       \clip \setA;
       \fill[black!20] \setB;
     \end{scope}
     \begin{scope}[even odd rule]% first circle without the second
       \clip \setB \boundb;
       \fill[red!20] \setA;
     \end{scope}
     \begin{scope}[even odd rule]% first circle without the second
       \clip \setA \boundb;
       \fill[blue!20] \setB;
     \end{scope}
     \draw \setA;
     \draw \setB;
     \node at (-1,0) [left] {$A$};
     \node at (#1+1,0) [right] {$B$};
     \node at (4,2) [below left] {$A\cap B$};
   \end{tikzpicture}
}

\begin{document}

\begin{frame}
   \frametitle{Set intersection}
   \begin{center}

     \begin{animateinline}[autoplay,palindrome]{12}
       %first frame, xb=0.0
       \gdef\xb{0}% xb initial value
       \intersect{\xb}%
       %remaining frames, xb=0.1...2.1
       \whiledo{\lengthtest{\xb pt < 2.1pt}}{%
     	\newframe
     	\FPeval{xb}{\xb+0.1}% new xb
		\xdef\xb{\xb}% make \xb global
     	\intersect{\xb}%
       }%
     \end{animateinline}

   \end{center}
\end{frame}
\end{document}

Regards
Alain Matthes


More information about the MacOSX-TeX mailing list