# TikZ picture overlaps with text (not wanted)

I am new to TikZ and I can't explain the following behavior when I compile this (with pdflatex or lualatex):

\documentclass[
fontsize=12pt,
DIV=calc,
%draft,
%parskip=half,
%final,
version=last,
open=right,
chapterprefix=true,
]{scrreprt}

\usepackage{tikz}
\usepackage{lipsum}

\begin{document}
\lipsum[1]

\begin{tikzpicture}
inner color=black,
outer color=yellow
]  circle (2.5cm);
\end{tikzpicture}

\lipsum[1]

\end{document}


The generated circle clearly overlaps with the "lipsum" paragraph above it. I have read (TikZ/PGF manual) that I can set a bounding box. Setting one solves the problem but this is not clean : if I add something to the picture, I have to manually resize the bounding box... Furthermore, this is not needed in other TikZ code. Can you explain this behavior? Do you have an idea to solve this problem automatically?

-
Remove the second \tikz and you are good to go. It starts a new tikzpicture inside another tikzpicture hence the bounding box calculation gets confused. –  percusse Jun 4 '12 at 17:02

You currently have

\begin{tikzpicture}
\tikz


which is causing the problem. If you just use

\begin{tikzpicture}
inner color=black,
outer color=yellow
]  circle (2.5cm);
\end{tikzpicture}


or else

\tikz \shade[ inner color=black, outer color=yellow]  circle (2.5cm);


then you'll see that it works as expected.

-
You have to finish your post with \fi :) –  percusse Jun 4 '12 at 17:04
So stupid of me. I should have read the manual more carefully instead of just jumping from place to place! Thanks percusse and cmhughes for your answers. –  Gael Jun 5 '12 at 7:56