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.

How can I extract only the x or y part of a predefined coordinate?

For instance, let's say we have

\coordinate (A) at (1,2);

And I want to use the x part of (A) like this

\draw (x of A,3)--(0,0);

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

I'm not aware of any direct syntax to do that (though I would love to have one). You can however use the let operation (section 14.15 in the TikZ v2.10 manual):

\usetikzlibrary{calc}

[...]

\draw let \p1 = (A) in (\x1,3) -- (0,0); 
share|improve this answer
    
I thought at first that \pgfextractx should work with \coordinate, but it doesn't. –  Gonzalo Medina Mar 22 '11 at 2:19
2  
@Gonzalo: \newdimen\mydim, \pgfextractx\mydim{\pgfpointanchor{A}{center}}. –  Caramdir Mar 22 '11 at 2:59
    
thank you; \pgfpointanchor is what I didn't know. –  Gonzalo Medina Mar 22 '11 at 16:01
    
You should point out that this requires the calc tikzlibrary. –  Martin Scharrer May 24 '11 at 18:42
    
@Martin: Thanks. –  Caramdir May 24 '11 at 19:23
add comment

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.