Mark 90 degree angle in tikz in german convention

I'd do it with an arc and a circle.

The command \rechterWinkel takes three arguments:

  • the point of the angle,
  • the start angle, and
  • the arc's radius (you probably want to have same-size right angles, then I suggest to hard-code the radius directly and just use two parameters).

Hard-coded radius

\newcommand*{\rechterWinkelRadius}{.5cm}
\newcommand*{\rechterWinkel}[2]{% #1 = point, #2 = start angle
   \draw[shift={(#2:\rechterWinkelRadius)}] (#1) arc[start angle=#2, delta angle=90, radius = \rechterWinkelRadius];
   \fill[shift={(#2+45:\rechterWinkelRadius/2)}] (#1) circle[radius=1.25\pgflinewidth];
}

Code

\documentclass{article}

\usepackage{tikz}

\newcommand*{\rechterWinkel}[3]{% #1 = point, #2 = start angle, #3 = radius
   \draw[shift={(#2:#3)}] (#1) arc[start angle=#2, delta angle=90, radius = #3];
   \fill[shift={(#2+45:#3/2)}] (#1) circle[radius=1.25\pgflinewidth];
}
\begin{document}

\begin{tikzpicture}
   \coordinate (O) at (0,0); %
   \coordinate (A) at (1,1); %
   \coordinate (B) at (1,-1); %

   \draw (O) -- (A); %
   \draw (O) -- (B); %

   \rechterWinkel{0,0}{-45}{.5}
\end{tikzpicture}
\end{document}

Output

enter image description here


TiKZ 3.0 introduces angles and quotes libraries which simplifies this task.

A command like

\draw pic[draw] {angle=A--O--C};

will draw a sector line between line A--O and O--C with center at O and anticlockwise. Sector radius is 5mm by default but can be changed with angle radius parameter.

This sector line can be labelled with label or with new quotes syntax. The label is placed with certain angle eccentricity (default = 0.6) which is a factor to be applied to angle radius.

Next example is similar to student's code but using angle pic.

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

\begin{document}

\begin{tikzpicture}
   \coordinate[label=below left:O] (O) at (0,0); %
   \coordinate[label=above right:A] (A) at (1,1); %
   \coordinate[label=below right:B] (B) at (1,-1); %
   \coordinate[label=above left:C] (C) at (-1,1);

   \draw (C) -- (B); %
   \draw (O) -- (A); %

   \draw pic["$\cdot$", draw] {angle=B--O--A}
         pic["$\cdot$", draw, angle radius=3mm, angle eccentricity=.25] {angle=A--O--C};
\end{tikzpicture}
\end{document}

enter image description here


I have found a solution which uses tkz-euclide and used Herbert's answer to

Defining a macro in LaTeX with an optional parameter in round brackets

to define the optional argument of the macro.

Code

\documentclass{article}


\usepackage{tkz-euclide}
\usetkzobj{all}

%see: https://tex.stackexchange.com/a/12893/4011
\makeatletter
\def\rechterWinkel{\@ifnextchar[\rechterWinkel@i\rechterWinkel@ii}
\def\rechterWinkel@i[#1](#2,#3,#4){%
  \pgfmathsetmacro{\pos@A}{0.5*#1}
  \pgfmathsetmacro{\pos@B}{0.25*#1}
   \tkzMarkAngle[size=\pos@A](#2,#3,#4)
   \tkzLabelAngle[pos=\pos@B](#2,#3,#4){\tikz \fill (0,0) circle (0.6pt);}
}% 
\def\rechterWinkel@ii(#1,#2,#3){%  
\rechterWinkel@i[1](#1,#2,#3)
}% 
\makeatother

\begin{document}

\begin{tikzpicture}
   \coordinate (O) at (0,0); %
   \coordinate (A) at (1,1); %
   \coordinate (B) at (1,-1); %
   \coordinate (C) at (-1,1);

   \draw (O) -- (A); %
   \draw (O) -- (B); %
   \draw (O) -- (C); %

   \rechterWinkel(B,O,A)
   \rechterWinkel[0.5](A,O,C)
\end{tikzpicture}
\end{document}

Output

output

Tags:

Angle

Tikz Pgf