2

I want to draw a triangle in TikZ that fades out and has no visible borders. As mentioned in How to draw a filled rectangle without a border using TikZ? using \fill instead of \draw should do the job. When I compile my picture to DVI (latex.exe), it does. But when I compile it as a PDF (pdflatex.exe), which is more important for me, the outlines of the triangle are visible. The code for my triangle is (the loaded tikzlibrarys are needed for other things in this project):

\documentclass[a4paper,draft=true,fontsize=12pt,captions=nooneline]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 

\usepackage{tikz}
\usetikzlibrary{shapes, positioning, fit, arrows, calc}

\begin{document}


\begin{tikzpicture}
\fill[top color=gray, bottom color=white] (-3,-3.5) -- (0,0) --
 (3,-3.5) -- cycle; 

\end{tikzpicture}

\end{document}

Screenshot of the object rendered as DVI. As wanted, no borders:

Screenshot of the object rendered as DVI. As wanted, no borders

Screenshot of the object rendered as PDF. Outline is visible:

Screenshot of the object rendered as PDF. Outline is visible

How can I get rid of those lines/borders also in the PDF? Any ideas, experiences?

1 Answers1

3

Using a \path instead of \fill guarantees the absence of line strokes.

\documentclass[a4paper,draft=true,fontsize=12pt,captions=nooneline]{scrbook}
\usepackage[T1]{fontenc}

\usepackage{tikz}
\usetikzlibrary{shapes, positioning, fit, arrows, calc}

\begin{document}

\begin{tikzpicture}
\path[top color=gray, bottom color=white] (-3,-3.5) -- (0,0) --
 (3,-3.5) -- cycle; 

\end{tikzpicture}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127