Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following MWE shows what appears to be a piece of paper folded. I want to indicate that the angle between the dashed lines is right angled by adding a simple square at M, such that the missing edges of the square are parallel to MD and MD2.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
    \coordinate (A) at (0,2);   
    \coordinate (B) at (3,2);   
    \coordinate (C) at (3,0);   
    \coordinate (M) at (0.92,1.38);
    \coordinate (D) at (1.85,2.77);

    \draw[fill=white] (A)node{A}--(B)node{B}--(C)node{C}--cycle;

    \path (M) ++(0,0,2.3) coordinate (D2);
    \draw[fill=white,opacity=0.8](A)--(D2)--(C);

    \draw[dashed](D2)node{D2}--(M)node{M}--(D)node{D};

    \end{tikzpicture}

\end{document}

enter image description here

share|improve this question
add comment

3 Answers 3

up vote 5 down vote accepted
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\RightAngle}[4][5pt]{%
        \draw ($#3!#1!#2$)
        --($ #3!2!($($#3!#1!#2$)!.5!($#3!#1!#4$)$) $)
        --($#3!#1!#4$) ;
        }

\begin{document}

\begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
    \coordinate (A) at (0,2);
    \coordinate (B) at (3,2);
    \coordinate (C) at (3,0);
    \coordinate (M) at (0.92,1.38);
    \coordinate (D) at (1.85,2.77);

    \draw[fill=white] (A)node[left]{A}--(B)node[right]{B}--(C)node[below]{C}--cycle;

    \path (M) ++(0,0,2.3) coordinate (D2);
    \draw[fill=white,opacity=0.8](A)--(D2)--(C);

    \draw[dashed]
        (D2)node[above]{D2}--
        (M)node[left]{M}node[coordinate,pos=0.85](Mu){}--
        (D)node[right]{D}node[coordinate,pos=0.1](Md){};

    \RightAngle{(D2)}{(M)}{(D)}; 
    \RightAngle{(C)}{(B)}{(A)}; 
    \RightAngle{(M)}{(D2)}{(C)}; 
    \end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
This solution works best as it respects what you said as a comment elsewhere: the right angle is parallel to the edges. Many thanks. –  Geoff Mar 4 at 15:16
add comment

You can define a coordinate and draw the right angle sign:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
    \coordinate (A) at (0,2);
    \coordinate (B) at (3,2);
    \coordinate (C) at (3,0);
    \coordinate (M) at (0.92,1.38);
    \coordinate (D) at (1.85,2.77);

    \draw[fill=white] (A)node[left]{A}--(B)node[right]{B}--(C)node[below]{C}--cycle;

    \path (M) ++(0,0,2.3) coordinate (D2);
    \draw[fill=white,opacity=0.8](A)--(D2)--(C);

    \draw[dashed](D2)node[above]{D2}--(M)node[left]{M}node[coordinate,pos=0.85](Mu){}--(D)node[right]{D}
                                                node[coordinate,pos=0.1](Md){};
    \node[coordinate] (Muu) at (Mu-|Md) {};
    \draw ([yshift=-0.5]Mu) -- (Muu) -- (Md);       %%% here and coordinates in above line.
    \end{tikzpicture}

\end{document}

enter image description here

PS I have also changed the positions of other nodes for clarity.

share|improve this answer
    
IMHO it is not correct because lines of the rightangle mark must be paralelles to the sides of the angle ? –  Tarass Mar 3 at 6:27
    
@Tarass You can cheat always ;) –  Harish Kumar Mar 3 at 7:49
    
Touché !!!! ;-) –  Tarass Mar 3 at 8:39
add comment

If I understand you right, right angle can be defined using tkz-euclide package:

\documentclass{article}
\usepackage{tikz,tkz-euclide}
\usetkzobj{all}

    \begin{document}

    \begin{tikzpicture}[z={(0,1)},y={(1,0.6)},x={(3,-1)}]
        \coordinate (A) at (0,2);   
        \coordinate (B) at (3,2);   
        \coordinate (C) at (3,0);   
        \coordinate (M) at (0.92,1.38);
        \coordinate (D) at (1.85,2.77);

        \draw[fill=white] (A)node{A}--(B)node{B}--(C)node{C}--cycle;

        \path (M) ++(0,0,2.3) coordinate (D2);
        \draw[fill=white,opacity=0.8](A)--(D2)--(C);

        \draw[dashed](D2)node{D2}--(M)node [left] {M}--(D)node{D};

       \tkzMarkRightAngle(D2,M,D);

         \end{tikzpicture}

    \end{document}

enter image description here

share|improve this answer
add comment

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.