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?




    \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};
  • 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 5 '11 at 15:57
  • @MartinScharrer thanks for the advice, I updated the question. – Zoran Zaric Feb 5 '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 5 '11 at 16:44

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

         path fading=circle with fuzzy edge 20 percent,
         transform canvas={xshift=1mm,yshift=-1mm}
       }] (1) at (0,0) {1};


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


| improve this answer | |
  • @MartinScharrer If I compile your code I only get the node without a shadow. – Zoran Zaric Feb 5 '11 at 16:12
  • 1
    @Zoran: That's funny, it works on my PC. I just tested it again. However it only works with pdflatex, with DVI/PS output I get no shading but the shadow is black. Could you post your flavor and version of latex and tikz please. – Martin Scharrer Feb 5 '11 at 16:43
  • 1
    @Zoran: Thats the latex version I was talking about (the executable, not the format which is LaTeX2e). The TikZ version can be printed by adding \listfiles just above \begin{document}. – Martin Scharrer Feb 5 '11 at 16:53
  • 3
    @Zoran: Which pdf viewer are you using? – Caramdir Feb 5 '11 at 17:05
  • 1
    @MartinScharrer: I'm using Evince. – Zoran Zaric Feb 5 '11 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.