# How to Mark Right Angle in Tikz [duplicate]

I consider this question unanswered as I would like a minimal example. The examples I've seen are for very complex shapes and I get lost in the immensity and complexity of the code. This question is different from the red square solution as I'd like to be able to have a certain compat in pfgplots. Also, I'd like to be able to put in exact values for a coordinate point (sqrt(75) for example). I get an error when I do that, but putting something in like 8.66 works just fine. This is not a duplicate, no more reporting it as one, please.

\documentclass[11pt]{exam}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{tikzpicture}
\draw (-5,0) -- (5,0);
\draw (0,0) -- (0,5);
\end{tikzpicture}

\end{document}


What would be the simplest way to mark 90 degrees on this diagram.

• \draw(.5,0)--(.5,.5)--(0,.5); Mar 4 '17 at 6:33
• I was hoping for more of a specific function for right angle marks instead of having one of size 0.5 all of the time. Because, what if the lines themselves are only about 0.5 long? I was hoping there's some sort of function in Tikz or pgf that scales the angle mark. Mar 4 '17 at 6:46
• I don't think there is any such macro present in TikZ, so one would have to create it. The tkz-euclide package defines a macro for marking the right angle between three named coordinates (see e.g. tex.stackexchange.com/a/154354/586), but that has a fixed default size, so you would have to change it manually for cases when it is not suitable. Mar 4 '17 at 8:12
• Regarding your edit, neither the compat setting for pgfplots nor the coordinate specification has any relevance for the question at hand I think. The coordinate specification is a different question altogether, and I think the compat setting would only be relevant if you're trying to mark angles inside an axis environment. Mar 4 '17 at 9:18

You can use also tkz-euclide:

\documentclass[11pt]{exam}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}
\coordinate (A) at (-5, 0) {};
\coordinate (B) at (5, 0) {};
\coordinate (C) at (0, 5) {};
\coordinate (0) at (0, 0) {};

% left angle
\tkzMarkRightAngle[draw=blue,size=.7](A,0,C);
\tkzLabelAngle[dist=.5](A,0,C){$\alpha$};

% right angle
\tkzMarkRightAngle[draw=red,size=.7](B,0,C);
\tkzLabelAngle[dist=.5](B,0,C){$\beta$};

% axis lines

\end{tikzpicture}
\end{document}


• I included all of that in the pre-amble, copy and pasted code in a blank new document... and I get errors. "undefined control sequence. \coordiante" Mar 4 '17 at 8:33
• that was a typo, yes I copied it right. I set pgf compat to a different version, is that why? Besides that, everything else is the same Mar 4 '17 at 8:37
• My preamble - \usepackage{amsmath} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{gensymb} \usepackage{tkz-euclide} \usetkzobj{all} Mar 4 '17 at 8:46
• @ZackaryCW The compat setting only applies to the pgfplots package, and that's not being used at all in any code here. \coordinate is defined by TikZ, and works only inside a tikzpicture environment. CarLaTeX's code works as it is presented. Mar 4 '17 at 8:49
• @ZackaryCW Even with your preamble my code works, I think the error is elsewhere, it is better if you post another question with a mwe that reproduces the error... Mar 4 '17 at 8:50

You can use perpendicular syntax. It saves typing the coordinate at corner.

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\draw (-5,0) -- (5,0);
\draw (0,0) -- (0,5);

\draw (-.3,0)|-(0,.3) (0,.5)-|(.5,0);
\end{tikzpicture}
\end{document}