I wish I had the images I used last time I discussed this, but I can't find them.
Here's a 30 second mspaint mockup:
http://images.dakkadakka.com/gallery/2010/4/9/96978_md-.png Firing through infantry units gives cover, firing
over them does not. The
inat faq has a pretty nice model view example of how to determine which situation you're in (
RB.22A.02).
But it's much narrower field than you'd at first think, and a few inches either way make the difference rather quickly.
Remember that if even a smidge of the targets leg is obscured then it gets cover, and at that point you're probably shooting through the intervening unit and not over it (and hence gaps give cover and you're screwed).
The effect applies in reverse as well, it's often nearly impossible to shoot over screening infantry units (even ones as short as grots) if they're close to what they're screening and at any real range.
Model sizes, elevation, distance to target... tons of factors come into play.
It really just comes down to getting down to model level and checking during the game, but if you want to be safe keep your infantry as close to the tank as you can.