# Words don't wrap inside redefined \marginpar{}

I have tried to play with a MWE from @cmhughes in this topic, and discovered that words inside \marginpar do not wrap like they should. Here is a MWE:

\documentclass[12pt,openany,oneside,a4paper]{report}
\usepackage{tikz}
\usepackage{lipsum}

\let\oldmarginpar\marginpar
\renewcommand{\marginpar}[2][rectangle,draw,fill=black, text=white ,rounded corners]{
\oldmarginpar{
\scriptsize \tikz \node at (0,0) [#1]{#2};}
}

\begin{document}
\lipsum[1]
\marginpar{margin text here, but it doesnt wrap like it should!!!}

\lipsum[2]
\end{document}


I also discovered that if I put for example $$m = 0$$ inside \marginpar{} it wont go into a new line like it should.

-
 It seems there are some questions where you didn't accept any of the given answers. Please go back and look if your problem is solved. Your future questions are much more likely to receive more attention if your accept rate is high. For this problem maybe you need to use a parbox. – canaaerus Aug 24 '12 at 13:04

Use text width in the option for node. (I used text width= 2cm, here which you can change for your requirement.)

\documentclass[12pt,openany,oneside,a4paper]{report}
\usepackage{tikz}
\usepackage{lipsum}

\let\oldmarginpar\marginpar
\renewcommand{\marginpar}[2][rectangle,draw,fill=black, text=white,text width= 2cm,rounded corners]{
\oldmarginpar{
\scriptsize \tikz \node at (0,0) [#1]{#2};}
}

\begin{document}
\lipsum[1]
\marginpar{margin text here, but it doesnt wrap like it should!!!}

\lipsum[2]
\end{document}


-