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.

is there a simple idiom (one not using the calc library) to specify a Tikz coordinate relative to a node?

Something like \coordinate (x) [right=of A]; instead of \node (x) [draw=none, right=of A]{};?

Thanks

share|improve this question
    
Where do you want the coordinate to end up? Nodes come equipped with a whole slew of anchors, would one of them do? (A.east) seems a reasonable one in this case. –  Loop Space May 24 '12 at 19:06
3  
\coordinate[right=of A] (x) ; is fine but not \coordinate (x) [right=of A]; –  Alain Matthes May 24 '12 at 19:10
    
@AndrewStacey The advantage of doing [right=of A] instead of (A.east), as you suggest, is that I can change the node distance and have the coordinate repositioned, or I can say directly things like [right=30mm of A]. Also a coordinate has no space, that's why I had to put [draw=none ... above. –  Mário May 24 '12 at 21:48

1 Answer 1

up vote 10 down vote accepted
\documentclass{article} 
\usepackage {tikz}
\usetikzlibrary{positioning}

\begin{document} 

  \begin{tikzpicture}
    \node (A){A};
    \coordinate  (x) [right=of A]; 
    \coordinate[right=of A]  (y) ;
    \draw (x) -- ++(1,1);
    \draw[red] (y) -- ++(1,1); 
  \end{tikzpicture}

\end{document} 

enter image description here

remark the problem is similar with

  \node  (x) {} [right= of A]; 
  instead of   \node[right= of A]  (x) {} ;
  but \node (x) [right= of A]  {} ; is valable
share|improve this answer
    
Your solution worked! Thank you –  Mário May 24 '12 at 21:44

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.