4

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

3
  • 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 Jul 29 '17 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 – geekformoney Jul 29 '17 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. – CodesInChaos Jul 29 '17 at 21:19
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

2
  • very nice! to be better could have an option to change the marker square size too? EDIT: wait, I must read it again. – geekformoney Jul 29 '17 at 18:41
  • Perfect, first I thought the size parameter refered to the dot, not to the square side. – geekformoney Jul 29 '17 at 18:46
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

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.