I've looked around and surprisingly haven't found a clear answer to this question. I have some boxes I'm drawing with tikz. I would like the text (in this case D
) for the bigbox
boxes to be in the bottom right, without having to do anything to give any coordinates on a case by case basis. Instead the text is appearing in the center of the box. I don't seem to have control over that except through putting a lot of white space before the text.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, decorations.markings,shapes,arrows,fit}
\tikzstyle{box}=[draw, minimum size=2em, text width=4.5em, text centered]
\tikzstyle{bigbox}=[draw, inner sep=20pt]
\begin{document}
\begin{tikzpicture}
\node[box] (A) at ( -2,1) {$A$};
\node[box] (B) at ( 1,1) {$B$};
\node[box] (C) at ( 4,1) {$C$};
\node[bigbox, fit=(A)(B)(C)] (D) {D};
\end{tikzpicture}
\end{document}
Best Answer
You can add a label and then shift it to inside like
in the definition of
bigbox
:and then say
bigbox=D
inFull code:
Edit
Response to the comments:
Here a
label
is drawn for the node withlabel={[shift={(-3ex,3ex)}]south east:#1}
which isshift
ed and#1
is the content of the label. For more, refer topgfmanual
. As for the complex content, I hope the following is complex enough :-)