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.

How can a node be positioned at the center/edge of a part in a multipart node using relative positioning?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[align=center,draw,shape=rectangle split,rectangle split horizontal,rectangle split parts=3, text width=2cm] (A) at (1.5,3) 
{one\nodepart{two}two\nodepart{three}three};
\node[draw,shape=circle] (E) at (2.7,1) {$E$};
\node[draw,shape=circle] (C) at (3.7,1) {$C$};
\end{tikzpicture}
\end{document}

This is the desired result:

enter image description here

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You mean like this?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[align=center,draw,shape=rectangle split,rectangle split horizontal,rectangle split parts=3, text width=2cm] (A) at (1.5,3) 
{$m$\nodepart{two}$0 \ldots 0$\nodepart{three}$r$};
\node[draw,shape=circle] (E) [below=of A.two split south] {$E$};
\node[draw,shape=circle] (C) [below=of A.three south] {$C$};
\end{tikzpicture}
\end{document}

The TikZ manual version 2.10, page 453 displays the anchors for the vertical split rectangle. You have to reinterpret for the horizontal version.

share|improve this answer
    
not quite, I edited the code to make it more copy-pasteable. The E node should be horizontally aligned with (but appear below) the separator line separating partnode two and three. and C should horizontally be at the center of partnode three and also appear below (same y-coord as E) –  Mish Jun 4 '12 at 19:47
    
I edited my answer. I hope it's ok now. :) –  Count Zero Jun 4 '12 at 19:56
    
thank you so much, I didn't know about the split option. –  Mish Jun 4 '12 at 20:02
    
@Mish: don't forget to upvote the answer (using the up arrow)- this gives Count Zero 10 reputation points, and is the best way to say thanks :) Also remember to upvote other answers that you find helpful on the site –  cmhughes Jun 4 '12 at 20:08
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.