# TikZ: How to remove unwanted lines within an element? (something like TRIM)

In the following, i want only outer edges. I can use fill=white to remove unwanted circle portion. How to remove unwanted edges of rectangle?

\documentclass[a4paper]{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw[fill=white] (0,1) rectangle (3,2);
\end{tikzpicture}

\end{document}


When i have

  \begin{tikzpicture}
\draw[fill=white] (0,1) rectangle (3,2);
\end{tikzpicture}


the circle is not thick.

-

The usual solution is to \clip a path, but in this case you can simply draw the circle after and use fill=white with fill opacity=1. As you want only the outer edges you can "fill" in the rectangle afterwards making an adjustment for the width of the line:

## Code:

\documentclass[a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[ultra thick]
\draw (0,1) rectangle (3,2);
\draw [fill opacity=1, fill=white] (0,0) circle [radius=2cm];
\draw [draw=none,fill=white, fill opacity=1]
($(0,1)+(0.5\pgflinewidth,0.5\pgflinewidth)$) rectangle ($(3,2)-(0.5\pgflinewidth,0.5\pgflinewidth)$);
\end{tikzpicture}

-
I do not want the circle portion also. I want only outer edges. – sandu May 13 '14 at 4:54
@sandu: See updated solution. – Peter Grill May 13 '14 at 5:18

Here is a one-liner:

\documentclass[tikz,border=5pt]{standalone}

\begin{document}
\begin{tikzpicture}[ultra thick]
\draw[fill=olive!30] (3,2) -- (0,2) arc (-270:25:2cm) -| (3,2) --cycle;
\end{tikzpicture}
\end{document}


-

If I may, a clip method

Code

\documentclass[border=10pt]{standalone}%[a4paper]{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[ultra thick]