How make paragraph in TikZ. I use \parbox with \node
\node {\parbox[5cm]{text}};
but i need more options, alignment center or left or right, similar to text box. All in TikZ.
thanks.
How make paragraph in TikZ. I use \parbox with \node
\node {\parbox[5cm]{text}};
but i need more options, alignment center or left or right, similar to text box. All in TikZ.
thanks.
There are some differences between TikZ versions.
With TikZ/pgf 2.10 use the alignment options given by Torbjorn: align=left etc. as options to \node. This doesn't work with TikZ 2.00. Example:
\node[text width=3cm,align=right] {your text};
With TikZ/pgf 2.00 or below use text options to \node such as text centered, text ragged or text badly ragged. Example:
\tikz \draw (0,0) node[text width=3cm,text ragged] {your text}
You may always use the vertical alignment options of \parbox and horizontal alignment declarations within the box.
Syntax: \parbox[position][height][inner-pos]{width}{text}
Example: \node{\parbox[t][6cm][c][5cm]{\centering your text}};
See section 16.4 in the TikZ manual. For example:
\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum} % for creating dummy text
\begin{document}
\begin{tikzpicture}
\node [text width=5cm,align=left] {\lipsum[1]};
\end{tikzpicture}
\end{document}
Other alignment options are center and right (naturally), as well as flush left, flush center and flush right, in which no hyphenation will occur, and justify.
text justified, and just use \. Example:\node[text width=2cm,text justified] {Test\\text and more text};– Stefan Kottwitz Dec 29 '10 at 15:12