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.

I can not find a way to effectively identify coordinates of the point, if used in the command let in the draw path. My example:

  \draw[gray] let \p1=(D), \p2=(intersect), \p3=(C) in (\x1,\y2)
           -- +(-\x1,0) node[left, red]{$f(c)$} -- (\x1,\y2) node[above, red]{$F$}
           -- (\x3,\y2) node[right, red]{$E$};

Now I would like to create named coordinate for node with text $F$:

  \coordinate (F) at (\x1,\y2);

but with error. How I could I solve it? Thanks.

share|improve this question
    
Thank you very much. –  jafan Aug 14 '12 at 14:33
add comment

3 Answers

up vote 8 down vote accepted

You can just name the node ... (\x1,\y2) node[...] (F) {$F$} and then you have access to the node via (F), so you can do something like:

\draw (F) circle (5pt);

If you really need the x and y coordinates you can use the solution from Extract x, y coordinate of an arbitrary point in TikZ:

enter image description here

Code:

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

% http://tex.stackexchange.com/questions/33703/extract-x-y-coordinate-of-an-arbitrary-point-in-tikz/33706#33706
\newdimen\XCoord
\newdimen\YCoord
\newcommand*{\ExtractCoordinate}[1]{\path (#1); \pgfgetlastxy{\XCoord}{\YCoord};}%


\begin{document}
\begin{tikzpicture}
\coordinate (C) at (0,0);
\coordinate (D) at (2,0);
\coordinate (intersect) at (1,1);

  \draw[gray] let \p1=(D), \p2=(intersect), \p3=(C) in (\x1,\y2)
           -- +(-\x1,0) node[left, red]{$f(c)$} -- (\x1,\y2) node[above, red] (F) {$F$}
           -- (\x3,\y2) node[right, red]  {$E$};

\draw (F) circle (5pt);% can just use the node name

\ExtractCoordinate{F}
node [below] (F) {$(\XCoord,\YCoord)$}
\end{tikzpicture}
\end{document}
share|improve this answer
    
It is better. Thanks. –  jafan Aug 14 '12 at 14:38
    
\ExtractCoordinate{F} ... it is very useful. –  jafan Aug 14 '12 at 14:51
add comment

You can use the orthogonal intersections to avoid let operation, hence the calc library for such applications.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\coordinate (C) at (2cm,2cm);
\coordinate (D) at (-2cm,-3cm);
\coordinate (intersect) at (1cm,1cm);

\draw[thick,gray] (D |- intersect) coordinate (F) -- 
+([scale=-1]D|-{{(0,0)}}) node[left, red]{$f(c)$} -- 
(F) node[above, red] {$F$}--
(C|-intersect) node[right, red]  {$E$};

\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
add comment

Thanks to @Jake, the solution of my problem is trivial:

  \draw[gray] let \p1=(D), \p2=(intersect), \p3=(C) in (\x1,\y2)
              -- +(-\x1,0) node[left, red]{$f(c)$} 
              -- (\x1,\y2) node[above, red]{$F$} coordinate (F) at (\x1,\y2) 
              -- (\x3,\y2) node[right, red]{$E$}; 
share|improve this answer
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.