COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### TikZ and shading a rectangle

• Follow

Hello all,

I'm trying to create a rectangle with a color gradient. While using the
following code the rectangle gets a (blue) colored line at the left
side:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
(0,0) rectangle +(9cm,2cm);
(0,3cm) rectangle +(9cm,2cm);
\end{tikzpicture}
\end{document}

What is even more strange is that the line on the left changes as soon
as the color is modified to "blue!20" (the line gets wider).

I wouldn't expect a blue line at the left nor is it desired in my case.
Is it possible to create a rectangle with a color gradient without a
border at some side? At the moment I use a hack and create a white
rectangle in front of the left border. Something like this:

\draw[color=3Dwhite, fill=3Dwhite] (0,0) rectangle +(1mm,2cm);

But this is not really flexible and more like a hack. Even in the manual
of TikZ the issue arises, see manual version 2.0 on page 28. The
rectangle shading from yellow to black has at the top side a black line
which stands out because the yellow part starts there, too.

Is there some convenient/elegant solution outside?

Cheers,
Stefan


 0
Reply schulzef (10) 5/7/2010 3:20:36 PM

� (at) Fri, 07 May 2010 17:20:36 +0200,
Stefan Schulze Frielinghaus <schulzef@in.tum.de> �crivait (wrote):

> But this is not really flexible and more like a hack. Even in the manual
> of TikZ the issue arises, see manual version 2.0 on page 28. The
> rectangle shading from yellow to black has at the top side a black line
> which stands out because the yellow part starts there, too.
>
> Is there some convenient/elegant solution outside?

Don't use evince as pdf viewer...

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>

 0

On Fr, 2010-05-07 at 17:53 +0200, Paul Gaborit wrote:
[...]
> Don't use evince as pdf viewer...

I expected a lot of things but that my PDF viewer is the root of evil I
didn't ;-)

After a quick test, Xpdf displays both PDF files correctly. Thanks for

Regards,
Stefan


 0

2 Replies
1157 Views

Similiar Articles:

7/22/2012 12:02:39 PM