# Avoiding blank line in every node (tikzpicture)

I created a box using

\tikzstyle{PBox}=[rectangle, rounded corners, fill=kopfzeile!10,
anchor=north, text=black, text width=\marginparwidth-2mm]
\put(-56,-150){\makebox(0,0)[bl]{\begin{tikzpicture}%
\node[PBox]{\small%
\singlespacing%
Wichtiger Hinweis!\\};
\end{tikzpicture}}}


I always get a blank line at the start of each PBox. How can I avoid this?

-
Can you please post complete, minimal code and not just snippets? –  Gonzalo Medina Nov 29 '11 at 23:15
I belive it is the \singlespacing that is doing adding the blank line. Once you post a complete compilable MWE we can investigate further. –  Peter Grill Nov 30 '11 at 0:27

You could set the single spacing in another way to avoid the blank line, use \setstretch{1} instead of \singlespace:

\documentclass{article}
\usepackage[doublespacing]{setspace}
\usepackage{tikz}
\tikzstyle{PBox}=[rectangle, rounded corners, fill=kopfzeile!10,
anchor=north, text=black, text width=\marginparwidth-2mm]
\begin{document}
\begin{picture}(20,20)
\put(-56,-150){\makebox(0,0)[bl]{\begin{tikzpicture}%
\node[PBox]{\small%
\setstretch{1}%
Wichtiger Hinweis!\\};
\end{tikzpicture}}}
\end{picture}
\end{document}


The reason is, that \singlespacing makes a vertical skip of one line, as you can see in the definition:

\newcommand{\singlespacing}{%
\setstretch {\setspace@singlespace}%  normally 1
\vskip \baselineskip  % Correction for coming into singlespace
}


Output:

-

First, It's preferable to post a complete compilable MWE. Secondly, you need to use an figure environment and you need to place \singlespacingoutsside the node

 \documentclass[11pt]{article}
\usepackage{xcolor,tikz}
\usepackage{setspace}

\begin{document}
\tikzstyle{PBox}=[rectangle, rounded corners, fill=blue!10,
anchor=north, text=black, text width=\marginparwidth-2mm]
\singlespacing
\setlength\unitlength{1mm}
\begin{picture}(0,0)
\put(-51,-150){\makebox(0,0)[bl]{%
\begin{tikzpicture}
\node[PBox] {\small Wichtiger Hinweis!\\};
\end{tikzpicture}
}%
}%
\end{picture}

\end{document}


-