0

I have the following code which produces the boundary of a square with each side labeled with a certain kind of arrow. I want to fill the interior with a color, but when I add "fill=color" as an argument, there is no change at all in the resulting image. How can I get this to work?

\[
\begin{tikzcd}[
sep=2cm,
cells={shape=coordinate}
]
  \ar[draw=none,r, "{\tikz\node[rotate=270,inner sep=0pt] {\tikz\draw[->](0,0);};  }" description]
  \ar[dash,r] 
& 
{} 
\\
  \ar[draw=none,r, "{\tikz\node[rotate=270,inner sep=0pt] {\tikz\draw[->](0,0)     ;};  }" description] 
  \ar[draw=none,u, "{\tikz\node[inner sep=0pt] {\tikz\draw[->>](0,0) ;}; }" description] 
  \ar[dash,r] 
  \ar[dash,u] 
& 
{}
  \ar[draw=none,u, "{\tikz\node[inner sep=0pt] {\tikz\draw[->>](0,0) ;}; }" description]
    \ar[dash,u]  
\end{tikzcd}.
\] 
3
  • 1
    Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Jan 28, 2019 at 16:27
  • Unfortunately your code nests tikzpictures. Is there any reason why you want to use tikz-cd rather than just tikz?
    – user121799
    Jan 28, 2019 at 16:29
  • @marmot No, I am not attached to this code at all. I just want the desired image. Jan 28, 2019 at 16:34

1 Answer 1

2

This works with fills and does not nest tikzpictures.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[insert arrow/.style args={#1/#2}{postaction={decorate,
decoration={markings,mark=at position #1 with {\arrow{#2}}}}}]
 \draw[fill=blue!30,insert arrow/.list={0.125/>,0.37/>,0.38/>,0.625/<,0.87/<,0.88/<}] (0,0) -| ++ (2,2) -| cycle;
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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