Quiero agregar algunos números en 3 lugares del programa Venn. Pero no sé cómo hacer eso.
\documentclass{letter}
\usepackage[english]{babel}
\usepackage{tikz}
\def\secondcircle{(210:1.75cm) circle (2.5cm)}
\def\thirdcircle{(330:1.75cm) circle (2.5cm)}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip \secondcircle;
\fill[cyan] \thirdcircle;
\end{scope}
\draw \secondcircle node [text=black,below left] {$B$};
\draw \thirdcircle node [text=black,below right] {$C$};
\end{tikzpicture}
\end{document}
Respuesta1
Según su código tikz, este intento define dos nombres internos llamados B y C para los dos círculos y los usa como puntos de referencia donde puede usar muchas habilidades para colocar su texto. Por ejemplo, above, below, left, right= xx cm of reference points
. above right/left, below right/left= xx cm of reference
también están a tu disposición. Necesitas \tikzlibrary{positioning}
.
Código:
\documentclass{letter}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}
\def\secondcircle{(210:1.75cm) circle (2.5cm)}
\def\thirdcircle{(330:1.75cm) circle (2.5cm)}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip \secondcircle;
\fill[cyan] \thirdcircle;
\end{scope}
\draw \secondcircle node(B) [text=black,below left] {$B$};
\draw \thirdcircle node (C)[text=black,below right] {$C$};
\node[left= 1cm of B]{1};
\node[right= 1cm of C]{4};
\node[right= 1.2 cm of B]{23};
\end{tikzpicture}
\end{document}
Respuesta2
Aquí hay una forma de hacerlo usando PSTricks:
\documentclass{article}
\usepackage{pstricks}
\newcommand*\circB{\pscircle(2,2){2}}
\newcommand*\circC{\pscircle(4,2){2}}
\begin{document}
\begin{pspicture}(6,4)
\begin{psclip}{\circB}
\psset{fillstyle = solid, fillcolor = blue!60}
\circC
\end{psclip}
\circB
\circC
\rput(1.1,2){$B$}
\rput(4.9,2){$C$}
\rput(3,2){$1,2,3,4$}
\end{pspicture}
\bigskip
\begin{pspicture}(6,4)
\begin{psclip}{}
\psset{fillstyle = solid, fillcolor = blue!60}
\circB
\psset{fillcolor = white}
\circC
\end{psclip}
\circB
\circC
\rput(1.1,2){$B$}
\rput(4.9,2){$C$}
\rput(3,2){$1,2,3,4$}
\end{pspicture}
\end{document}
Respuesta3
Puede utilizar la calc
biblioteca para calcular las posiciones relativas de los nodos, comoaquí:
\documentclass{letter}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{calc}
\def\secondcircle{(210:1.75cm) circle (2.5cm)}
\def\thirdcircle{(330:1.75cm) circle (2.5cm)}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip \secondcircle;
\fill[cyan] \thirdcircle;
\end{scope}
\draw \secondcircle node [text=black,below left] (B) {$B$};
\draw \thirdcircle node [text=black,below right] (C) {$C$};
\node at ($(B)!-0.25!(C)$) {1};
\node at ($(B)!0.5!(C)$) {2,3};
\node at ($(B)!1.25!(C)+(0,.5cm)$) {4};
\end{tikzpicture}
\end{document}
Respuesta4
La stackinset
macro permite superponer texto (o gráficos) a una imagen existente. Los insertos se pueden anidar. La ubicación del recuadro se especifica en las dimensiones de la figura, en relación con la izquierda/centro/derecha y la parte superior/centro/abajo de la imagen subyacente. En este caso, especifiqué desplazamientos relativos al centro-centro de la imagen.
En este caso, las inserciones son en modo texto, pero se pueden configurar en modo matemático, \parbox
es o cualquier cosa, en realidad.
\documentclass{letter}
\usepackage[english]{babel}
\usepackage{stackengine}
\usepackage{tikz}
\def\secondcircle{(210:1.75cm) circle (2.5cm)}
\def\thirdcircle{(330:1.75cm) circle (2.5cm)}
\begin{document}
\stackinset{c}{-2.2cm}{c}{-.25cm}{1}{%
\stackinset{c}{}{c}{}{234}{%
\stackinset{c}{2cm}{c}{0.5cm}{5}{%
\begin{tikzpicture}
\begin{scope}
\clip \secondcircle;
\fill[cyan] \thirdcircle;
\end{scope}
\draw \secondcircle node [text=black,below left] {$B$};
\draw \thirdcircle node [text=black,below right] {$C$};
\end{tikzpicture}%
}}}
\end{document}