5

This is my first time posting in this site

So I have the following code:

 \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}
  \begin{centering}
    \begin{tikzpicture}[->, >=stealth',shorten >=1pt,auto, main node/.style={rectangle,fill=lightgray!10,draw, minimum size=1cm, minimum width=2.875cm, minimum height=1cm, node distance=5cm}, t_object node/.style={circle,fill=lightgray!10, draw, node distance=2cm}]

      \node[main node, rectangle split, rectangle split parts=4] (t_object)
      at (0,0) {\quad \ Object $o_{1}$ \nodepart{second}\quad Old Versions$_{}$
        \nodepart{third} \quad Latest Version$_{}$
      \nodepart{fourth}\quad Lock};

           % object O1
      \node[t_object node] (O1_0) [right of=t_object, above of=t_object, node distance=4cm] {$v: 5$};
      \node[t_object node] (O1_1) [below of=O1_0] {$v: 11$};
      \node[t_object node] (O1_2) [below of=O1_1] {$v: 13$};
      \node[t_object node] (O1_3) [below of=O1_2] {$v: 29$};

      \path (t_object.second) edge [dashed] node [above, sloped, ->] {} (O1_0);
      \path (t_object.second) edge [dashed] node [above, sloped, ->] {} (O1_1);
      \path (t_object.second) edge [dashed] node [above, sloped, ->] {} (O1_2);
      \path (t_object.third) edge node [above, sloped, ->] {} (O1_3);


      %\path (C) edge node[below, sloped, ->] {} (O1_1);
      %\path (B) edge node[below, sloped, ->] {} (O1_0);

    \end{tikzpicture}
  \end{centering}
\end{figure}




\end{document}

which creates:

enter image description here

Of course, this is not what I want to do, i want the arrows to start form the right part of the rectangle, not the left.

Any ideas how to do it?

  • Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Mar 22 '12 at 1:17
10

You could use

\path (t_object.second east) edge [d...

which gives

enter image description here

 \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}
  \begin{centering}
    \begin{tikzpicture}[->, >=stealth',shorten >=1pt,auto, main node/.style={rectangle,fill=lightgray!10,draw, minimum size=1cm, minimum width=2.875cm, minimum height=1cm, node distance=5cm}, t_object node/.style={circle,fill=lightgray!10, draw, node distance=2cm}]

      \node[main node, rectangle split, rectangle split parts=4] (t_object)
      at (0,0) {\quad \ Object $o_{1}$ \nodepart{second}\quad Old Versions$_{}$
        \nodepart{third} \quad Latest Version$_{}$
      \nodepart{fourth}\quad Lock};

           % object O1
      \node[t_object node] (O1_0) [right of=t_object, above of=t_object, node distance=4cm] {$v: 5$};
      \node[t_object node] (O1_1) [below of=O1_0] {$v: 11$};
      \node[t_object node] (O1_2) [below of=O1_1] {$v: 13$};
      \node[t_object node] (O1_3) [below of=O1_2] {$v: 29$};

      \path (t_object.second east) edge [dashed] node [above, sloped, ->] {} (O1_0);
      \path (t_object.second east) edge [dashed] node [above, sloped, ->] {} (O1_1);
      \path (t_object.second east) edge [dashed] node [above, sloped, ->] {} (O1_2);
      \path (t_object.third east) edge node [above, sloped, ->] {} (O1_3);


      %\path (C) edge node[below, sloped, ->] {} (O1_1);
      %\path (B) edge node[below, sloped, ->] {} (O1_0);

    \end{tikzpicture}
  \end{centering}
\end{figure}




\end{document}
| improve this answer | |

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.