2

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.

8

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}

% https://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}
  • \ExtractCoordinate{F} ... it is very useful. – JardaFait Aug 14 '12 at 14:51
2

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

1

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$}; 

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.