7

How do you shift (0,0) to something like: (MYBOX.west)++(0.1,0)?

Here is a MnWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, calc}

\begin{document}
    \begin{tikzpicture}
        \node[rectangle, draw] at (0,0) (MYBOX) {Something};
        \begin{scope}[shift={$(MYBOX.east) + (0.1,0)$}]
            \draw[black] (0,0) -- ++(0, -1);
        \end{scope}
    \end{tikzpicture}
\end{document}
  • Do you need a special tikzlibrary for using $? – remus Sep 9 '13 at 12:12
  • Of course :) I still get this error: ! Package tikz Error: Cannot parse this coordinate. – remus Sep 9 '13 at 12:16
  • Sure. Just a sec. I'm using TikzEdt for building the figure. Let ma reconstruct the preamble. – remus Sep 9 '13 at 12:18
  • You can do shift=(MYBOX.east), shift={(.1,0)}. Though be aware, that shift does not shift the origin to the specified point but the whole coordinate system about that vector. – Qrrbrbirlbel Sep 9 '13 at 12:55
11

You can use syntax shift={($(MYBOX.west)+(0.1,0)$)} (which requires loading the calc library using \usetikzlibrary{calc}) for this:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, calc}

\begin{document}
    \begin{tikzpicture}
        \node[rectangle, draw] at (0,0) (MYBOX) {Something};
        \begin{scope}[shift={($(MYBOX.east) + (0.1,0)$)}]
            \draw[black] (0,0) -- ++(0, -1);
        \end{scope}
    \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.