Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

\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}

enter image description here

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}
share|improve this answer
add comment

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?

share|improve this answer
    
Thanks a lot, it also works. –  Isai Dec 30 '12 at 11:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.