TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am drawing a database icon that is made of two cylinder shapes using TikZ. When I add a shadow, the shadows of the two cylinders overlap, and the shadow becomes darker in the overlapping area. The somewhat-MWE below illustrates the problem.

I have tried using transparency groups both within the definition of \dbicon and around the invocation of \dbicon. No luck. What am I doing wrong?


    \node[drop shadow,draw, cylinder, shape aspect=1.5, inner sep=0.3333em, 
    rotate=90, minimum width=1cm, minimum height=0.45cm] (cyl) at (0,#1) {};

  \node[inner sep=0pt] {



share|improve this question
I have redone your MWE, you should try to refrain from using any other class than the standard available classes. This ensures that people can easily compile your example. Remark, your nested \newcommand was not necessary, I have moved it out. – zeroth Feb 6 '12 at 14:01
Thank you. I wanted to keep dbpart invisible outside where it's used, that's the reason for the nesting. – krlmlr Feb 6 '12 at 14:03
As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. – Tobi Feb 6 '12 at 14:04
up vote 4 down vote accepted

The problem is that a shadow has a default opacity of 0.5 this means that overlapping regions will have increased color fill.

What you need to decide is whether this approach really is the right way of drawing that.

If you just want to remove the overlapping region then use:

    \node[drop shadow={opacity=1.0},draw, cylinder, shape aspect=1.5, inner sep=0.3333em, 
    rotate=90, minimum width=1cm, minimum height=0.45cm] (cyl) at (0,#1) {};

which will not do additional color on overlapping regions. You might need to adjust the colors afterwards. You can then add fill=gray!20!white in next to the group of the drop shadow.

enter image description here

However that will yield overlapping borders and shadow effects. In your case I think you are better fit with creating a custom node shape and adding different colors on top and sides, or add more space.

share|improve this answer
Thank you, this is exactly what I need. I have a workaround to deal with the overlapping; how to do is properly is the topic of my next question. – krlmlr Feb 6 '12 at 19:55

Your Answer


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.