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

Short Question:

The short question can be stated as follows: Is there a way to perfectly align filled (but possibly not drawn) shapes that completely cover contiguous areas?

Consider the MWE:

    line width=.04pt,opacity=1}}
\tikzset{mmaB/.style={line width=0.01pt,fill=Back!#1,   
    \begin{scope}[transparency group]
    \draw[mmaF=50] (0,0) rectangle ++(2,2);
    \draw[mmaB=90] (1,1) rectangle ++(2,2);
    \draw[mmaB=90] (-1,-1) rectangle ++(2,2);
    \draw[mmaB=90] (-1,1) rectangle ++(2,2);
    \draw[mmaF=88] (2,-1) rectangle ++(2,2);
    \draw[mmaB=90] (1,-1) rectangle ++(2,2);            

Which produces:

Sample tikz polygons

If you look closely, there are little doubly drawn lines over the center reddish polygon. If you change draw=Back!#1 for draw=none in style mmaB, then you get little gaps instead of doubly drawn lines.

What makes this question hard is the fact that the order of the polygons is important. I can't simply group the mmaB style polygons into a scope with opacity=.5,transparency group. The reason is explained below, in the background story.

Background Story

Using Mathematica to compute polygons, I can draw things like this:

A drawing in tikz, produced with mathematica

For the curious, this is just some 10.000+ lines of simple tikz. Mathematica computes the 3D->2D conversion, and gives an ordered collection of plane tikz shapes to be filled with either style mmaF-for front facing polygon- or mmaB-for back facing polygon.

However, I am having trouble when mixing with opacity:

This time, with some semi transparent parts

Where you can see the grid lines. Problem: how to remove the grid lines in the semi-transparent part?

share|improve this question
up vote 2 down vote accepted

I'm not sure to understand the question (my english :) ) I use \path instead of \draw.

\tikzset{mmaB/.style={fill=Back!#1, opacity=.5}}
    \begin{scope}[transparency group]
    \path[mmaF=50] (0,0) rectangle ++(2,2);
    \path[mmaB=90] (1,1) rectangle ++(2,2);
    \path[mmaB=90] (-1,-1) rectangle ++(2,2);
    \path[mmaB=90] (-1,1) rectangle ++(2,2);
    \path[mmaF=88] (2,-1) rectangle ++(2,2);
    \path[mmaB=90] (1,-1) rectangle ++(2,2);            

enter image description here

share|improve this answer
thanks for the answer, but artifacts are still there, whether you use \path or \draw or \filldraw. The four yellowish pieces should neither leave gaps nor overdraw at the "frontier". – Koji Mar 13 '12 at 11:46
To be more specific: your answer leaves a small, but visible gap between the four yellow pieces. My example in the question above shows overdrawing. I would like to remove both kind of artifacts, if possible. – Koji Mar 13 '12 at 11:55
@Koji Ok I see the problem with acrobat reader but not with skim or preview on a mac with OS X. – Alain Matthes Mar 13 '12 at 12:36
I do see the problem with OS X's Preview, though I have to zoom in close enough. – Koji Mar 13 '12 at 12:40
The problem is important with acrobat with opacity =1 and .5 but seems to disappears with opacity =1 and 1. With skim the problem is important with opacity =1 and 1. If' you draw the borders, the lines are one above the other. Now there are perhaps a problem with the viewers. The problem depends of the zoom. – Alain Matthes Mar 13 '12 at 13:19

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.