The code below draws three nested rectangles. Then I want to add text by using a node. Somehow the coordinates of the rectangles are not in line with the coordinates of the nodes. To place some text in the largest rectangle, I would assume, that (0.5, -0.5) would do the job. But now the text is outside of the rectangle. But why? How can I put each paragraph in the upper left corner of each rectangle? Are there better ways to do it?
\documentclass[border=10]{standalone}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\def\xa{(0,0)} \def\ya{(15.0,-5)}
\def\xb{(5,-0.2)} \def\yb{(14.8,-4.8)}
\def\xc{(10,-0.4)} \def\yc{(14.6,-4.6)}
\begin{tikzpicture}
% Draw boxes
\draw \xa rectangle \ya ;
\draw \xb rectangle \yb;
\draw \xc rectangle \yc;
% DRAW LABELS
\node at (0.5,-0.5) [text width=4cm] {\tiny\lipsum[66]};
\node at (6,-2) [text width=4cm] {\tiny\lipsum[66]};
\node at (10,-2) [text width=4cm] {\tiny\lipsum[66]};
\end{tikzpicture}
\end{document}
Best Answer
like this?
for above image are used only nodes (this is more simple than draw rectangles and than nested nodes with text). text nodes are positioned relatively to each, drawing by use of library
fit
:note: font size is defined in node style. by this the baseline skip in node consider the selected font size.