1

I have the following tikzpicture:

enter image description here

When printing (tested on two different printers), a line gets added:

enter image description here

Does anyone know how to avoid this? Here is my code:

\documentclass{article}
\usepackage{tikz, amssymb}
\begin{document}
\begin{tikzpicture}[scale=1.6]
\begin{scope}
\clip (-2.01,0) rectangle (2,2.41);
\draw[fill=gray!20] (-0.5,0.866) rectangle (0.5,2.5);
\foreach \u in {-1,...,0} {
%\draw[very thick] (\u,-1) rectangle (\u + 1,4);
\draw[very thick, fill=white] (\u+0.5,0) circle (0.5cm);
\draw[very thick] (\u+0.25,0) circle (0.25cm);
\draw[very thick] (\u+0.75,0) circle (0.25cm);
\draw[very thick] (\u+0.16666,0) circle (0.16666cm);
\draw[very thick] (\u+0.83333,0) circle (0.16666cm);
\draw[very thick] (\u+0.41666,0) circle (0.08333cm);
\draw[very thick] (\u+0.58333,0) circle (0.08333cm);
\draw[very thick] (\u+0.125,0) circle (0.125cm);
\draw[very thick] (\u+0.875,0) circle (0.125cm);
\draw[very thick] (\u+0.29166,0) circle (0.04166cm);
\draw[very thick] (\u+0.70833,0) circle (0.04166cm);
}
\end{scope}
\begin{scope}
\clip (-1,0.866) rectangle (1,1.1);
\draw[dashed, thick, fill=white] (0,0) circle (1cm);
\end{scope}
\draw[very thick] (-1,0) -- (1,0);
\draw[very thick] (-1,0.1) -- (-1,-0.1) node[below] {\small $-1$};
\draw[very thick] (0,0.1) -- (0,-0.1) node[below] {\small $0$};
\draw[very thick] (1,0.1) -- (1,-0.1) node[below] {\small $1$};
\node at (0,1.5) {$\mathfrak{F}$};
\end{tikzpicture}
\end{document}
Martin
  • 511
  • start the dashed part a little below such that they don't overlap on the bottom edge. More can be found here http://tex.stackexchange.com/questions/331951/tikz-why-is-a-line-visible-between-2-fitted-nodes-with-inner-outer-sep-0 – percusse Feb 12 '17 at 10:40

1 Answers1

2

The line is caused by some anti-alias feature of the PDF viewer. The dark area is overprinted by white, but some pixels are outside because of the anti-aliasing. I would just make the white area larger, e.g.:

\documentclass{article}
\usepackage{tikz, amssymb}
\begin{document}
\begin{tikzpicture}[scale=1.6]
\begin{scope}
  \clip (-2.01,0) rectangle (2,2.41);
  \draw[fill=gray!20] (-0.5,0.866) rectangle (0.5,2.5);
  \foreach \u in {-1,...,0} {
    %\draw[very thick] (\u,-1) rectangle (\u + 1,4);
    \draw[very thick, fill=white] (\u+0.5,0) circle (0.5cm);
    \draw[very thick]
      (\u+0.25,0) circle (0.25cm)
      (\u+0.75,0) circle (0.25cm)
      (\u+0.16666,0) circle (0.16666cm)
      (\u+0.83333,0) circle (0.16666cm)
      (\u+0.41666,0) circle (0.08333cm)
      (\u+0.58333,0) circle (0.08333cm)
      (\u+0.125,0) circle (0.125cm)
      (\u+0.875,0) circle (0.125cm)
      (\u+0.29166,0) circle (0.04166cm)
     (\u+0.70833,0) circle (0.04166cm)
  ;
}
\end{scope}
\begin{scope}
  \clip (-1, 0.8) rectangle (1, 1.1);
  \fill[white] circle (1cm);
  \clip (-1,0.866) rectangle (1,1.1);
  \draw[dashed, thick] (0,0) circle (1cm);
\end{scope}
\draw[very thick]
  (-1,0) -- (1,0)
  (-1,0.1) -- (-1,-0.1) node[below] {\small $-1$}
  (0,0.1) -- (0,-0.1) node[below] {\small $0$}
  (1,0.1) -- (1,-0.1) node[below] {\small $1$}
;
\node at (0,1.5) {$\mathfrak{F}$};
\end{tikzpicture}
\end{document}

Result

An alternative is clipping before the gray area is drawn.

Heiko Oberdiek
  • 271,626