使用 tikz knots 包为绘图添加背景

使用 tikz knots 包为绘图添加背景

我无法为左侧图片添加背景,使其与右侧图片相匹配。以下是我目前所做的:

\documentclass[11pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{decorations.markings, arrows.meta,knots}
\begin{document}
\begin{tikzpicture}[pics/arrow/.style={code={%
  \draw[line width=0pt,{Computer Modern Rightarrow[line width=0.8pt,width=2ex,length=1ex]}-(-0.5ex,0) -- (0.5ex,0);}}, scale=0.5]
  \fill[gray!20!white] (0.25,1)circle(1.2); 
  \begin{knot}[clip width=10, clip radius=15pt, consider self intersections, end tolerance=3pt, fill=gray!20!white, fill opacity=0.5]
   \strand[thick] (0,0)
      to[out=up, in=down] (0,0.7) 
      to[out=up, in=left] (0.5,1.5)
      to[out=right, in=up]  pic[pos=0.5,sloped]{arrow}(1,1)
      to[out=down, in=right]  (0.5,0.5)
      to[out=left, in=down]  (0,1.3)
      to[out=up, in=down]  (0,2);
 \end{knot}
 %\fill[gray!20!white, opacity=0.5] (0.25,1)circle(1.2);
\end{tikzpicture}
= 
\begin{tikzpicture}[scale=0.4]
  \clip (0,0)circle(1.2);
  \fill[gray!20!white] (0,0)circle(1.2);
  \draw[thick, decoration={markings, mark=at position 0.2 with {\arrow{<}}},postaction {decorate}] (0,-1) --(0,1);
\end{tikzpicture}
\end{document}

在此处输入图片描述

如您所见,\begin{knot} 中的“填充”似乎没有任何效果。将 \fill 从顶部移到结点之后也不令人满意: 在此处输入图片描述

答案1

您可能正在寻找background color

\documentclass[11pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{decorations.markings, arrows.meta,knots}
\begin{document}
$\vcenter{\hbox{\begin{tikzpicture}[pics/arrow/.style={code={%
  \draw[line width=0pt,{Computer Modern Rightarrow[line
  width=0.8pt,width=2ex,length=1ex]}-] (-0.5ex,0) -- (0.5ex,0);}}, scale=0.5]
  \fill[gray!20!white] (0.25,1)circle[radius=1.2]; 
  \begin{knot}[clip width=10, clip radius=15pt, consider self intersections, end tolerance=3pt, 
  background color=gray!20!white%, fill opacity=0.5 %<- no effect
  ]
   \strand[thick] (0,0)
      to[out=up, in=down] (0,0.7) 
      to[out=up, in=left] (0.5,1.5)
      to[out=right, in=up]  pic[pos=0.5,sloped]{arrow}(1,1)
      to[out=down, in=right]  (0.5,0.5)
      to[out=left, in=down]  (0,1.3)
      to[out=up, in=down]  (0,2);
 \end{knot}
 %\fill[gray!20!white, opacity=0.5] (0.25,1)circle(1.2);
\end{tikzpicture}}}
= 
\vcenter{\hbox{\begin{tikzpicture}[scale=0.4]
  \clip (0,0)circle(1.2);
  \fill[gray!20!white] (0,0) circle[radius=1.2];
  \draw[thick, 
  decoration={markings, mark=at position 0.2 with {\arrow{<}}},
  postaction={decorate}] (0,-1) --(0,1);
\end{tikzpicture}}}$
\end{document}

在此处输入图片描述

相关内容