# Problem with custom width of nodes in TikZ

I'm in trouble with some nodes, I'd like to get your help.
I'm trying to set the text width of a node, but when I declare this parameter, there is something wrong. Maybe there's something missing in the preamble, I don't know.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}

\begin{document}
\begin{tikzpicture}

\tikz \draw (0,3) node[draw,rounded corners,align=left,text width=30mm]{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text text text};

\end{tikzpicture}

\end{document}

-

\tikz is a short version of the tikzpicture environment, for pictures with just one or two commands, you shouldn't put the former within the latter. Remove \tikz from your code, and it works.

In the manual (for version 2.10, dated October 25, 2010), the \tikz command is introduced in section 12.2.2 Creating a Picture Using a Command, on page 118.

I removed all the libraries in the below code, as none of them are necessary for this example.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\draw (0,3) node[draw,rounded corners,align=left,text width=30mm]{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text text text};

\end{tikzpicture}

\end{document}


You could remove the tikzpicture environment instead, which will produce the same output.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\tikz\draw (0,3) node[draw,rounded corners,align=left,text width=30mm]{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text text text};
\end{document}

-

The code

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (0,3) node[draw,rounded corners,align=left,text width=6cm]{\textbf{Title}\\
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text};
\end{tikzpicture}

\begin{tikzpicture}
\draw (0,3) node[draw,rounded corners,align=left,text width=3cm]{\textbf{Title}\\
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text
Text text text text text text};
\end{tikzpicture}

\end{document}


works in my computer and you can adjust the width. Does that help?

-
Thanks a lot, it also works. –  Isai Dec 30 '12 at 11:51