我想将宇宙集合(E)的符号放在左侧,将集合 A 和 B 放在矩形的中间,其中集合 B 带有白色区域(如附图所示)。
我的代码如下:
\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}
先感谢您!
答案1
您的代码或多或少实现了您想要的功能,不是吗?不过,还可以进行一些改进:
- 在投影机的演示模式下工作时,应该始终将事物放在框架中。
- 可以用来
even odd rule
避免过度填充,特别是当您使用非平凡的时fill opacity
。 - 设置
text opacity
为 1。 \textbf{...}
不影响里面的数学表达式。你可以使用\boldsymbol
(或\boldmath
)。
结果:
\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}
或者另一侧有 E。
\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}