1

I would like to place the symbol of the universe set (E) on the left side and the sets A and B in the middle of the rectangle with the set B with a white area (as in the attached figure).

enter image description here

My code is as follows:

\documentclass[10pt, a4paper, serif, xcolor = {divpsnames, svgnames}]{beamer}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
    \centering
        \begin{tikzpicture}
            \begin{scope}[shift = {(3cm, -5cm)}, fill opacity = 0.5]
                \draw[fill = Green!70!white] (5, -2) rectangle (-2, 2) node [below right] {\textbf{$E$}};
                \draw[fill = white, draw = black] (0, 0) circle (1.7);
                \draw[fill = Green!70!white, draw = black] (-.5, 0) circle (1);

                    \node at (1.4, 0) (C) {\textbf{$B$}};
                    \node at (.2, 0) (D) {\textbf{$A$}};
            \end{scope}
        \end{tikzpicture}
            \caption{Representação da relação $A \subset B$.}
                \label{fig3}
\end{figure}

\end{document}

Thank you in advance!

1 Answer 1

2

Your code more or less achieves what you want, doesn't it? There are some improvements that can be made, though:

  1. One should always put things in frames when working in the presentation mode of beamer.
  2. One can use even odd rule to avoid overpainting fills, in particular when you use a nontrivial fill opacity.
  3. Set the text opacity to 1.
  4. \textbf{...} does not affect math expressions inside. You can use \boldsymbol (or \boldmath).

Result:

\documentclass[10pt, a4paper, serif, xcolor = {divpsnames, svgnames}]{beamer}
\usepackage{tikz}
\usepackage{amssymb}
\begin{document}
\begin{frame}[t]
\frametitle{A Venn diagram}
\begin{figure}
\centering
\begin{tikzpicture}
  \begin{scope}[fill opacity = 0.5,text opacity=1]
   \draw[fill = Green!70!white,even odd rule] (3.5, -2) rectangle (-3.5, 2) 
    node [below right=1ex] {$\boldsymbol{E}$}
    (0, 0) circle[radius=1.7];
   \draw[fill = white, draw = black,even odd rule] (0, 0) circle[radius=1.7]
    (-.2, 0) circle[radius=1];
   \draw[fill = Green!70!white, draw = black] (-.2, 0) circle[radius=1];

   \node at (1.4, 0) (C) {$\boldsymbol{B}$};
   \node at (.2, 0) (D) {$\boldsymbol{A}$};
  \end{scope}
\end{tikzpicture}
\caption{Representa\c{c}\~ao da rela\c{c}\~ao $A \subset B$.}
\label{fig3}
\end{figure}
\end{frame}
\end{document}

enter image description here

Or with the E on the other side.

\documentclass[10pt, a4paper, serif, xcolor = {divpsnames, svgnames}]{beamer}
\usepackage{tikz}
\usepackage{amssymb}
\begin{document}
\begin{frame}[t]
\frametitle{A Venn diagram}
\begin{figure}
\centering
\begin{tikzpicture}
  \begin{scope}[fill opacity = 0.5,text opacity=1]
   \draw[fill = Green!70!white,even odd rule] (-3.5, -2) rectangle (3.5, 2) 
    node[below left=1ex] {$\boldsymbol{E}$} (0, 0) circle[radius=1.7];
   \draw[fill = white, draw = black,even odd rule] (0, 0) circle[radius=1.7]
    (-.2, 0) circle[radius=1];
   \draw[fill = Green!70!white, draw = black] (-.2, 0) circle[radius=1];

   \node at (1.4, 0) (C) {$\boldsymbol{B}$};
   \node at (.2, 0) (D) {$\boldsymbol{A}$};
  \end{scope}
\end{tikzpicture}
\caption{Representa\c{c}\~ao da rela\c{c}\~ao $A \subset B$.}
\label{fig3}
\end{figure}
\end{frame}
\end{document}

enter image description here

3
  • Thank you @Schrödinger's cat! It worked! One more question: how do I place the E symbol in the upper right corner of the rectangle (as in the attached figure)? Feb 29, 2020 at 15:46
  • @AlexandreLoures Use \draw[fill = Green!70!white,even odd rule] (-3.5, -2) rectangle (3.5, 2) node [below left=1ex] {$\boldsymbol{E}$} (0, 0) circle[radius=1.7];.
    – user194703
    Feb 29, 2020 at 15:48
  • Thank you @Schrödinger's cat! For me, with this command the symbol is outside the rectangle, but I can solve it with the following command: \node at (3.1, 1.7) (E) {$E$}; Mar 1, 2020 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .