5

I'm trying to reproduce the following picture.

right-angle with dot in center

I've already searched, but I don't find with the dot in the center, and I have to reproduce this notation many times.

EDIT: here is what I got until now

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (0,3);
\coordinate (D) at ($(C)!(A)!(B)$);
\draw (A)node[below left]{$A$}--(B)node[below right]{$B$}--(C)node[above left]{$C$}--cycle;
\draw[dashed] (A)--(D)node[above right]{$D$};
%I didn't tried the right angle because of the dot
\end{tikzpicture}

EDIT2: here in Brasil we use this notation for right angles, not the empty rectangle

4
  • 2
    Instead of posting just an image can you post the code (in a compilable document) that you have to produce most of the image without the dot, and then people can help you with the dot.
    – Alan Munn
    Commented Jul 29, 2017 at 18:14
  • the problem is not exatly the dot, but the right angle symbol, whose difference is the dot. I'll edit the main post Commented Jul 29, 2017 at 18:18
  • Interesting. I've never seen a right angle symbol drawn like that, though it certainly makes sense that way. It has always been a quarter circle with a dot for me. Commented Jul 29, 2017 at 21:19
  • Though it's an old question: you can find it in the pgf-manual, Libraries, Angles
    – MS-SPO
    Commented Nov 28, 2023 at 15:02

5 Answers 5

11

You can define your own \dotMarkRightAngle as below. Four parameters need to be entered; size of the angle (square side) and three coordinates in parentheses (#2,#3,#4) taken clock-wise.

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{calc}
\begin{document}

\def\dotMarkRightAngle[size=#1](#2,#3,#4){%
 \draw ($(#3)!#1!(#2)$) -- 
       ($($(#3)!#1!(#2)$)!#1!90:(#2)$) --
       ($(#3)!#1!(#4)$);
 \path (#3) --node[circle,fill,inner sep=.5pt]{} ($($(#3)!#1!(#2)$)!#1!90:(#2)$);
}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (0,3);
\coordinate (D) at ($(C)!(A)!(B)$);
\draw (A)node[below left]{$A$}--(B)node[below right]{$B$}--(C)node[above left]{$C$}--cycle;
\draw[dashed] (A)--(D)node[above right]{$D$};
\dotMarkRightAngle[size=6pt](B,A,C);
\dotMarkRightAngle[size=6pt](A,D,B);
\end{tikzpicture}

\end{document}

enter image description here

Also, with tkz-euclide and using \tkzMarkRightAngle and \tkzLabelAngle.

\documentclass[border=2pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (0,3);
\coordinate (D) at ($(C)!(A)!(B)$);
\draw (A)node[below left]{$A$}--(B)node[below right]{$B$}--(C)node[above left]{$C$}--cycle;
\draw[dashed,draw=gray] (A)--(D)node[above right]{$D$};

\tkzMarkRightAngle(C,A,B)
\tkzLabelAngle[pos=.15](C,A,B){$\cdot$}

\tkzMarkRightAngle(A,D,B)
\tkzLabelAngle[pos=.15](A,D,B){$\cdot$}

\end{tikzpicture}

\end{document}

enter image description here

3
  • very nice! to be better could have an option to change the marker square size too? EDIT: wait, I must read it again. Commented Jul 29, 2017 at 18:41
  • Perfect, first I thought the size parameter refered to the dot, not to the square side. Commented Jul 29, 2017 at 18:46
  • 1
    usetkzobj{all} ? which version of tkz-euclide are you using? I removed this option a long time ago! Commented Nov 28, 2023 at 15:02
4

enter image description here

pure tikz:

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

\begin{document}
    \begin{tikzpicture}[
dotbox/.style = {draw, minimum size=3mm,
                 inner sep=0pt, outer sep=0pt,
                 anchor=#1,
                 label=center:$\cdot$},
node distance = 0pt
                    ]
\coordinate[label=below  left:$A$] (A) at (0,0);
\coordinate[label=below right:$B$] (B) at (4,0);
\coordinate[label=above  left:$C$] (C) at (0,3);
\coordinate[label=above right:$D$] (D) at ($(C)!(A)!(B)$);
\draw (A) --(B) --(C) -- cycle;
\draw[dashed] (A)--(D);
% angles
\node[dotbox=south west] at (A) {} ;
\path (D) -- node[pos=0,sloped,dotbox=north east] {} (A);
    \end{tikzpicture}
\end{document}
1

It is a bit late for this ;-) but in case it may interest someone, here is a way of producing a right angle symbol with MetaPost (with the required dot inside), heavily inspired by the macro designed by André Heck in his MetaPost tutorial, p. 47-48.

Notice that the turningnumber of the path (1 if counter-clockwise, -1 if not) ensures that the order in which the extremities endofa and endofb are given doesn't matter: the mark will be the same. Also, the coordinates of point D are not explicitly given, but computed by MetaPost itself via two implicit linear equations.

Included in a LuaLaTeX program, thanks to the luamplib package.

\RequirePackage{luatex85}
\documentclass[border=3mm]{standalone}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
    vardef mark_right_angle (expr common, endofa, endofb, mark_size) =
        save tn ; tn := turningnumber(common -- endofa -- endofb -- cycle) ;
        save t; transform t; 
        t = identity 
            zscaled (mark_size*unitvector((1+tn)*endofa + (1-tn)*endofb - 2*common)) 
            shifted common;
        z1 = (1, 0); z2 = (1, 1); z3 = (0, 1);
        save rangle; path rangle; 
        rangle = (origin -- z1 -- z2 -- z3 -- cycle) transformed t; 
        draw (z1 -- z2 -- z3) transformed t;
        drawdot center rangle withpen pencircle scaled 2bp;
    enddef ;
    beginfig(1);
        u = cm; pair A, B, C, D;
        mark_size := 2mm;
        A = origin; B = (4u, 0); C = (0, 3u);
        D = whatever[B,C]; (D-A) dotprod (B-C) = 0;
        label.lft(btex $A$ etex, A); label.rt(btex $B$ etex, B);
        label.lft(btex $C$ etex, C); label.urt(btex $D$ etex, D);
        draw A--B--C--cycle; draw A -- D dashed evenly;
        mark_right_angle(D, A, B, mark_size); 
        mark_right_angle(A, B, C, mark_size);
    endfig;
\end{mplibcode}
\end{document}

enter image description here

1

I’m a bit late to the party, but while searching for how to mark right angles, I’ve stumbled upon both your post here and the angles library from TikZ. This last one makes it very simple to achieve what you’ve asked:

\documentclass[tikz]{standalone}
\usetikzlibrary{angles,calc,quotes}

\begin{document}
\begin{tikzpicture}
    \coordinate (A) at (0,0);
    \coordinate (B) at (4,0);
    \coordinate (C) at (0,3);
    \coordinate (D) at ($(C)!(A)!(B)$);
    \draw (A)node[below left]{$A$}--(B)node[below right]{$B$}--(C)node[above left]{$C$}--cycle;
    \draw[dashed] (A)--(D)node[above right]{$D$};
    \pic ["$\cdot$",draw,angle radius=10,angle eccentricity=0.5] {right angle=A--D--B};
    \pic ["$\cdot$",draw,angle radius=10,angle eccentricity=0.5] {right angle=B--A--C};
\end{tikzpicture}
\end{document}

Of course you could define a style to avoid repeating part of the code. Also I’m using the quotes library here to type "$\cdot$" as the angle label, else the syntax is pic text=$\cdot$.

Output of above code

0

With tkz-elements and tkz-euclide. For an angle, I've used the German notation. Your notation is not very logical, as the usual notation already shows that the angle is right-angled.

% !TEX TS-program = lualatex
\documentclass[border=2pt]{standalone}
\usepackage{tkz-euclide,tkz-elements}
\begin{document}    
\begin{tkzelements}
   z.A      = point : new ( 0 , 0 )
   z.B      = point : new ( 4 , 0 )  
   z.C      = z.A   : north (3)
   L.BC     = line  : new ( z.B , z.C )
   z.D      = L.BC  : projection (z.A)
\end{tkzelements}

\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A,B,C)
\tkzDrawSegment[dashed,gray](A,D)
\tkzMarkRightAngle(C,A,B)
\tkzLabelAngle[pos=.15](B,A,C){$\cdot$}
%\tkzMarkRightAngle(A,D,B)
\tkzMarkRightAngle[german](A,D,B)
%\tkzLabelAngle[pos=.15](A,D,B){$\cdot$}
\tkzLabelPoints[below left](A)
\tkzLabelPoints[above left](C)
\tkzLabelPoints[below right](B)
\tkzLabelPoints[above right](D)
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .