8
\documentclass{standalone} 
\usepackage{standalone}
\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{tikz}
\usetikzlibrary{shapes, positioning}

\begin{document}
\begin{tikzpicture}
    \tikzstyle{every node}=[font=\scriptsize]
    \tikzstyle{apr}=[rectangle,
                     align=center,
                     text width = 3cm,
                     node distance = 1cm,
                     rectangle split, rectangle split parts=2,
                     draw, fill=white]

    \node(1) [apr]
        {
        \textbf{Lore Ipsum}\\ \textbf{Dolor}
        \nodepart{second} {$
                          \begin{aligned}
                          x = &\: 10 \\
                          y = &\: 20 \\
                          \dot{x} = &\: 0
                          \end{aligned}
                          $}
        };
    \node(4) [apr, right = of 1]
        {
        \textbf{Lore Ipsum}\\ \textbf{Stupid Descenders}
        \nodepart{second} {$
                          \begin{aligned}
                          x = &\: 10 \\
                          \dot{x} = &\: 0
                          \end{aligned}
                          $}
        };

\end{tikzpicture}
\end{document}

How can I make the tops of the nodes align instead of their centers?

Here is the image:

enter image description here

7

Result

Use appropiate anchor in the relatively positioned node, and specify the appropiate corner in the right = of ... option:

[...]
\node(4) [apr, right  = of 1.north east, anchor=north west]
[...]
  • 6
    Note that the order here is important. right = of ... sets the anchor to west so you need to override it by setting anchor=north west afterwards. Putting anchor=north west before right=of ... has no effect. – Loop Space Dec 12 '12 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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