Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
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
add comment

1 Answer

up vote 4 down vote accepted

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

share|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
show 7 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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