3

I'm trying to add a shadow with a faded edge to nodes. With the following document I only get a grey circle, with a hard edge, slightly below right of the node. This is a snippet form my code. What am I doing wrong?

\documentclass[a4paper,10pt]{article}

\usepackage{tikz}
\usetikzlibrary{shapes,fadings}

\begin{document}
\maketitle

\begin{center}
    \begin{tikzpicture}[scale=4, transform shape]
         \node[circle,fill=white,draw=black,thick,preaction={fill=black,opacity=.3,transform canvas={xshift=1mm,yshift=-1mm,path fading=circle with fuzzy edge 20 percent}}] (1) at (0,0) {1};
    \end{tikzpicture}
\end{center}
\end{document}
  • 1
    Please always provide full minimal documents not just snippets. Especially with TikZ/PGF which has many extra libraries. This way all what we have to do is Copy&Paste to run the example. Also you should state what exactly doesn't work. – Martin Scharrer Feb 05 '11 at 15:57
  • @MartinScharrer thanks for the advice, I updated the question. – Zoran Zaric Feb 05 '11 at 16:22
  • Thanks, but keep in mind that it is supposed to be a minimal example. Avoid all non-essential code, like title and author as well as unrated packages. – Martin Scharrer Feb 05 '11 at 16:44

1 Answers1

4

The path fading=circle with fuzzy edge 20 percent must be in the argument preaction but outside of the there included transform canvas:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\begin{document}
\begin{tikzpicture}[scale=4]
 \node[circle,fill=white,draw=black,thick,
       preaction={
         fill=black,opacity=.3,
         path fading=circle with fuzzy edge 20 percent,
         transform canvas={xshift=1mm,yshift=-1mm}
       }] (1) at (0,0) {1};
\end{tikzpicture}
\end{document}

Result:

(The fading isn't fully preserved by PDF->PNG and downscaling)

Result

Martin Scharrer
  • 262,582