我有这张图表我之前的问题但我无法在每个圆圈中再添加一个圆圈。有什么建议吗?
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
shorten < = 1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
state/.append style = {draw=pink!30!black, fill=pink!30, minimum size=8mm},
sx+/.style = {xshift=1 mm},
sy+/.style = {yshift=1 mm},
sx-/.style = {xshift=-1 mm},
sy-/.style = {yshift=-1 mm},
]
\node[state] (A) {A};
\node[state] (B) [right=of A] {B};
\path[->] ([sy+] A.east) edge [] ([sy+] B.west)
([sy-] B.west) edge [] ([sy-] A.east);
\end{tikzpicture}
\end{document}
更准确地说,我需要每个圆圈变成
\begin{tikzpicture}[
shorten < = 1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
]
\coordinate (O) at (0,0);
\begin{scope}[xshift=0cm,scale=1]
\coordinate (0) at (0,0);
\draw[fill=blue!40] (O) circle (1.80);
\draw[fill=pink!70] (O) circle (1.00);
\end{scope}
\end{tikzpicture}
每个里面都有“A”和“B”。
答案1
使用双线实现:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
shorten < = 1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
state/.append style = {
% draw=pink!30!black,
double=blue!40!white,
double distance=3pt,
fill=pink!30,
minimum size=8mm,
},
sx+/.style = {xshift=1 mm},
sy+/.style = {yshift=1 mm},
sx-/.style = {xshift=-1 mm},
sy-/.style = {yshift=-1 mm},
]
\node[state] (A) {A};
\node[state] (B) [right=of A] {B};
\path[->] ([sy+] A.east) edge [] ([sy+] B.west)
([sy-] B.west) edge [] ([sy-] A.east);
\end{tikzpicture}
\end{document}
带有小 ( node font=\small
) 文字且圆圈内有数学符号:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
shorten < = 1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
state/.append style = {
% draw=pink!30!black,
double=blue!40!white,
double distance=3pt,
fill=pink!30,
minimum size=8mm,
node font=\small,
},
sx+/.style = {xshift=1 mm},
sy+/.style = {yshift=1 mm},
sx-/.style = {xshift=-1 mm},
sy-/.style = {yshift=-1 mm},
]
\node[state] (A) {Set $A$};
\node[state] (B) [right=of A] {Set $B$};
\path[->] ([sy+] A.east) edge [] ([sy+] B.west)
([sy-] B.west) edge [] ([sy-] A.east);
\end{tikzpicture}
\end{document}
蓝色部分写字
恕我直言,这相当丑陋,实现该功能的代码也是一样的。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
shorten < = 1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
state/.append style = {
% draw=pink!30!black,
% double=blue!40!white,
% double distance=3pt,
% fill=pink!30,
minimum size=8mm,
node font=\small,
},
sx+/.style = {xshift=1 mm},
sy+/.style = {yshift=1 mm},
sx-/.style = {xshift=-1 mm},
sy-/.style = {yshift=-1 mm},
]
\newcommand*{\StateNode}[3][]{%
% Draw blue circle in the final size
\node[state, fill=blue!40!white, #1] (#2) {\phantom{#3}};
% Draw smaller pink circle
\node[state, fill=pink!30, inner sep=-5pt] at (#2) {\phantom{#3}};
% Put the text on top
\node at (#2) {#3};
}
\StateNode{A}{Set $A$}
\StateNode[right=of A]{B}{Set $B$}
\path[->] ([sy+] A.east) edge [] ([sy+] B.west)
([sy-] B.west) edge [] ([sy-] A.east);
\end{tikzpicture}
\end{document}