TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to have coordinate of the square angle on the line (A)-|(B) without using the coordinates of A nor B.

\documentclass[margin=5pt]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\coordinate (A) at (2,4) ;
\coordinate (B) at (5,3) ;

\draw (A)-|(B) ;

\end{tikzpicture}
\end{document}
share|improve this question
up vote 6 down vote accepted

You can use (A -| B) to obtain the desired coordinate:

enter image description here

Code:

\documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\coordinate (A) at (2,4) ;
\coordinate (B) at (5,3) ;

\draw (A)-|(B) ;

\coordinate (X) at (A -| B);
\node [red] at (X) {x};
\end{tikzpicture}
\end{document}
share|improve this answer
    
I sully and uselessly tried ((A) -| (B)). Thank you ! – Tarass Mar 6 at 9:37
    
@Tarass: Yep, me too. I still do that and have to figure out why every time. Not sure why both styles don't work. – Peter Grill Mar 6 at 11:13

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.