0

I want the marginal point of a line start to be positioned at a certain coordinate, not the center point (which seems to be default). Is there something similar to \draw[anchor=north] (0,0) -- (1,0); ?

Here is a snippet from my code. You can see the two extra extended lines wobble at margin points of the stack.

\begin{tikzpicture}[stack/.style={rectangle split, rectangle split horizontal,
 rectangle split parts=#1, draw, anchor=center}]
\node[stack=5] (stack) {
    \nodepart{one}$m_1$
    \nodepart{two}$m_2$
    \nodepart{three}$m_3$
    \nodepart{four}$m_4$
    \nodepart{five}$m_5$
};

\draw (stack.north east) to ++(.5cm, 0);
\draw (stack.south east) to ++(.5cm, 0);
\node[at=(stack.five east), right] {$\cdots$};
\end{tikzpicture}

line wobble

1

Setting outer sep=0pt in stack/.style.

tikz-rect-corner

See the explanation on Page 219 in the pgfmanual (Version 3.0.1a):

The default for this option is half the line width. When the default is used and when the background path is draw, the anchors will lie exactly on the “outside border” of the path (not on the path itself).

\documentclass{standalone}

\usepackage[]{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}[stack/.style={rectangle split, rectangle split horizontal,
 rectangle split parts=#1, draw, anchor=center, outer sep=0pt}]
\node[stack=5] (s) {
    \nodepart{one}$m_1$
    \nodepart{two}$m_2$
    \nodepart{three}$m_3$
    \nodepart{four}$m_4$
    \nodepart{five}$m_5$
};

\draw (s.north east) to ++(.5cm, 0);
\draw (s.south east) to ++(.5cm, 0);
\node[at=(s.five east), right] {$\cdots$};
\end{tikzpicture}
\end{document}

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.