10

I am marking two angles of a cyclic quadrilateral on a TikZ diagram with "||". (I am doing this manually; I am not using the angles package.) It didn't look right. I drew the angle bisectors with a green line from the vertices of the two angles. One of the tick marks is drawn on it. If I put a % in front of the commands for tick marks that are drawn correctly and compile that code, the tick marks that had been drawn on the angle bisectors are now drawn correctly! Why is TikZ only drawing one tick mark correctly?!

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}


\begin{tikzpicture}

%A cyclic quadrilateral is drawn.
\path (-1.5,0) coordinate (A) (80:1.5) coordinate (B) (330:1.5) coordinate (C) (0,-1.5) coordinate (D);
%
%The quadrilateral and its diagonals are drawn.
\draw (A) -- (B) -- (C) -- (D) -- cycle;
\draw (A) -- (C);
\draw (B) -- (D);


%The labels for the vertices of the cyclic quadrilateral are typeset.
\draw let \p1=($(A)-(B)$), \n1={atan(\y1/\x1)} in node[anchor={0.5*(\n1+315)-180}, inner sep=0, font=\footnotesize] at ($(A) +({0.5*(\n1+315)}:0.15)$){\textit{A}};
\path let \p1=($(A)-(B)$), \n1={atan(\y1/\x1)}, \p2=($(B)-(C)$), \n2={atan(\y2/\x2)} in node[anchor={0.5*((\n1-180)+\n2)}, inner sep=0, font=\footnotesize] at ($(B) +({0.5*((\n1-180)+\n2)+180}:0.15)$){\textit{B}};
\path let \p1=($(B)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(C)-(D)$), \n2={atan(\y2/\x2)} in node[anchor={0.5*((\n1+180)+(\n2+180))}, inner sep=0, font=\footnotesize] at ($(C) +({0.5*((\n1+180)+(\n2+180))-180}:0.15)$){\textit{C}};
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(D) +(0,-0.15)$){\textit{D}};



%The angle-measure marks for \angle{CAD} and \angle{CBD} are drawn. Since they are congruent, they are marked with "||".
\draw[name path=arc_to_mark_angle_CAD, draw=blue] let \p1=($(A)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(A)-(D)$), \n2={atan(\y2/\x2)} in ($(A)!6mm!(C)$) arc (\n1:\n2:0.6);
\draw[green, dashed,  name path=a_ray_from_A_bisecting_angle_CAD] let \p1=($(A)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(A)-(D)$), \n2={atan(\y2/\x2)} in (A) -- ($(A) +({0.5*(\n1+\n2)}:2)$);
\coordinate[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_bisecting_angle_CAD}];
\coordinate (above_midpoint_on_arc_at_A) at ($(intersection-1)!1pt!-90:(A)$);
\path[name path=a_ray_from_A_through_the_above_midpoint_on_arc_at_A] (A) -- (above_midpoint_on_arc_at_A);
\coordinate[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_through_the_above_midpoint_on_arc_at_A, by={a_tick_mark_on_arc_at_A}}];
\draw[draw=blue] ($(a_tick_mark_on_arc_at_A)!-3pt!(A)$) -- ($(a_tick_mark_on_arc_at_A)!3pt!(A)$);
\coordinate (below_midpoint_on_arc_at_A) at ($(intersection-1)!1pt!90:(A)$);
\path[name path=a_ray_from_A_through_the_below_midpoint_on_arc_at_A] (A) -- (below_midpoint_on_arc_at_A);
\coordinate[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_through_the_below_midpoint_on_arc_at_A, by={another_tick_mark_on_arc_at_A}}];
\draw[draw=blue] ($(another_tick_mark_on_arc_at_A)!-3pt!(A)$) -- ($(another_tick_mark_on_arc_at_A)!3pt!(A)$);
%
%
\draw[name path=arc_to_mark_angle_CBD, draw=blue] let \p1=($(B)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(B)-(D)$), \n2={atan(\y2/\x2)} in ($(B)!6mm!(C)$) arc (\n1:{\n2-180}:0.6);
\draw[green, name path=a_ray_from_B_bisecting_angle_CBD] let \p1=($(B)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(B)-(D)$), \n2={atan(\y2/\x2)} in (B) -- ($(B) +({0.5*(\n1+(\n2-180))}:2)$);
\coordinate[name intersections={of=arc_to_mark_angle_CBD and a_ray_from_B_bisecting_angle_CBD}];
\coordinate (right_of_midpoint_on_arc_at_B) at ($(intersection-1)!1pt!-90:(B)$);
\path[name path=a_ray_from_B_through_the_right_of_midpoint_on_arc_at_B] (B) -- (right_of_midpoint_on_arc_at_B);
\coordinate[name intersections={of=arc_to_mark_angle_CBD and a_ray_from_B_through_the_right_of_midpoint_on_arc_at_B, by={a_tick_mark_on_arc_at_B}}];
\draw[draw=blue] ($(a_tick_mark_on_arc_at_B)!-3pt!(B)$) -- ($(a_tick_mark_on_arc_at_B)!3pt!(B)$);
\coordinate (left_of_midpoint_on_arc_at_B) at ($(intersection-1)!1pt!90:(B)$);
\path[name path=a_ray_from_B_through_the_left_of_midpoint_on_arc_at_B] (B) -- (left_of_midpoint_on_arc_at_B);
\coordinate[name intersections={of=arc_to_mark_angle_CBD and a_ray_from_B_through_the_left_of_midpoint_on_arc_at_B, by={a_tick_mark_on_arc_at_B}}];
\draw[draw=blue] ($(a_tick_mark_on_arc_at_B)!-3pt!(B)$) -- ($(a_tick_mark_on_arc_at_B)!3pt!(B)$);


\end{tikzpicture}

\end{document}

Screenshot

  • Can you please provide an image showing what you mean? For me both ticks are drawn on the bisector (for both the left vertical line is drawn on the bisector). – Skillmon Aug 16 '18 at 17:25
  • I guess you want something that looks like if you were to replace \coordinate (above_midpoint_on_arc_at_A) at ($(intersection-1)!1pt!-90:(A)$); with \coordinate (above_midpoint_on_arc_at_A) at ($(intersection-1)!0.6pt!-90:(A)$);? – Ruixi Zhang Aug 16 '18 at 17:30
  • I also don't understand the question. A bit off-topic: Why do you use \coordinate to get the intersections? \coordinate[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_bisecting_angle_CAD}]; \coordinate (above_midpoint_on_arc_at_A) at ($(intersection-1)!1pt!-90:(A)$); can be simplified to one \path[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_bisecting_angle_CAD}] coordinate (above_midpoint_on_arc_at_A) at ($(intersection-1)!1pt!-90:(A)$); and so on. – marmot Aug 16 '18 at 17:32
  • @marmot The blue tick marks should be drawn on both sides of the green angle bisectors. – A gal named Desire Aug 16 '18 at 17:53
  • Did you try what @RuixiZhang provided? This should do (it does work for me) – Skillmon Aug 16 '18 at 18:19
9

To me this looks like a tetrahedron. If you want to draw a 45 degree line on one of its faces, just choose the coordinate system such that the x and y directions are along two edges and the origin is at their intersection. Then you do not need any intersections nor a complicated calc syntax, and you can even adjust the viewing angles at will.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz-3dplot}
\begin{document}
\foreach \X in {0,5,...,355}
{\tdplotsetmaincoords{90+40*cos(\X)}{\X} 
\begin{tikzpicture}
\path[use as bounding box] (-3,-3) rectangle (3,3);
\begin{scope}[tdplot_main_coords]
%vertices of tetrahedron get defined
\path (1,1,1) coordinate (A) (-1,-1,1) coordinate (B) (-1,1,-1) coordinate (C)
(1,-1,-1) coordinate (D) (0,0,0) coordinate (O);
%
%The labels for the vertices of the tetrahedron are typeset.
\foreach \X in {A,B,C,D}
{\path (O) -- (\X) node[pos=1.4]{\textit{\X}};}
%angle{CAD} and \angle{CBD}
\begin{scope}[shift={(A)},x={(C)},y={(D)},transform shape]
 \draw[green] (0.175,0) arc(0:90:0.175);
 \draw[green,dashed] (0,0) -- (0.35,0.35);
 \draw[blue] (0.05,0.1) -- (0.15,0.2) (0.1,0.05) -- (0.2,0.15);
\end{scope}
\begin{scope}[shift={(B)},x={(C)},y={(D)}]
 \draw[green] (0.175,0) arc(0:90:0.175);
 \draw[green,dashed] (0,0) -- (0.35,0.35);
 \draw[blue] (0.05,0.1) -- (0.1,0.2) (0.1,0.05) -- (0.2,0.1);
\end{scope}
\end{scope}
%edges
\draw (A) -- (B) -- (C) -- (D) -- cycle;
\draw (A) -- (C);
\draw (B) -- (D);
\end{tikzpicture}
}
\end{document}

enter image description here

ANSWER TO YOUR QUESTION: You did not name an intersection, it got the name intersection-1, you were using it immediately, and everything went fine. Then you computed yet another intersection, which overwrote intersection-1. So when you were using intersection-1 for the second blue line, it was no longer the coordinate you thought it would be, and hence the second blue line(s) were off. Here is a minimally repaired code with annotations.

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}


\begin{tikzpicture}

%A cyclic quadrilateral is drawn.
\path (-1.5,0) coordinate (A) (80:1.5) coordinate (B) (330:1.5) coordinate (C) (0,-1.5) coordinate (D);
%
%The quadrilateral and its diagonals are drawn.
\draw (A) -- (B) -- (C) -- (D) -- cycle;
\draw (A) -- (C);
\draw (B) -- (D);


%The labels for the vertices of the cyclic quadrilateral are typeset.
\draw let \p1=($(A)-(B)$), \n1={atan(\y1/\x1)} in node[anchor={0.5*(\n1+315)-180}, inner sep=0, font=\footnotesize] at ($(A) +({0.5*(\n1+315)}:0.15)$){\textit{A}};
\path let \p1=($(A)-(B)$), \n1={atan(\y1/\x1)}, \p2=($(B)-(C)$), \n2={atan(\y2/\x2)} in node[anchor={0.5*((\n1-180)+\n2)}, inner sep=0, font=\footnotesize] at ($(B) +({0.5*((\n1-180)+\n2)+180}:0.15)$){\textit{B}};
\path let \p1=($(B)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(C)-(D)$), \n2={atan(\y2/\x2)} in node[anchor={0.5*((\n1+180)+(\n2+180))}, inner sep=0, font=\footnotesize] at ($(C) +({0.5*((\n1+180)+(\n2+180))-180}:0.15)$){\textit{C}};
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(D) +(0,-0.15)$){\textit{D}};



%The angle-measure marks for \angle{CAD} and \angle{CBD} are drawn. Since they are congruent, they are marked with "||".
\draw[name path=arc_to_mark_angle_CAD, draw=blue] let \p1=($(A)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(A)-(D)$), \n2={atan(\y2/\x2)} in ($(A)!6mm!(C)$) arc (\n1:\n2:0.6);
\draw[green, dashed,  name path=a_ray_from_A_bisecting_angle_CAD] let \p1=($(A)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(A)-(D)$), \n2={atan(\y2/\x2)} in (A) -- ($(A) +({0.5*(\n1+\n2)}:2)$);
\coordinate[name intersections={of=arc_to_mark_angle_CAD and
a_ray_from_A_bisecting_angle_CAD,by=aux-2}]; %<- give the intersection a name
\coordinate (above_midpoint_on_arc_at_A) at ($(aux-2)!1pt!-90:(A)$);
\path[name path=a_ray_from_A_through_the_above_midpoint_on_arc_at_A] (A) -- (above_midpoint_on_arc_at_A);
\coordinate[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_through_the_above_midpoint_on_arc_at_A, by={a_tick_mark_on_arc_at_A}}];
\draw[draw=blue] ($(a_tick_mark_on_arc_at_A)!-3pt!(A)$) -- ($(a_tick_mark_on_arc_at_A)!3pt!(A)$);
\coordinate (below_midpoint_on_arc_at_A) at ($(aux-2)!1pt!90:(A)$);
\path[name path=a_ray_from_A_through_the_below_midpoint_on_arc_at_A] (A) -- (below_midpoint_on_arc_at_A);
\coordinate[name intersections={of=arc_to_mark_angle_CAD and a_ray_from_A_through_the_below_midpoint_on_arc_at_A, by={another_tick_mark_on_arc_at_A}}];
\draw[draw=blue] ($(another_tick_mark_on_arc_at_A)!-3pt!(A)$) -- ($(another_tick_mark_on_arc_at_A)!3pt!(A)$);
%
%
\draw[name path=arc_to_mark_angle_CBD, draw=blue] let \p1=($(B)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(B)-(D)$), \n2={atan(\y2/\x2)} in ($(B)!6mm!(C)$) arc (\n1:{\n2-180}:0.6);
\draw[green, name path=a_ray_from_B_bisecting_angle_CBD] let \p1=($(B)-(C)$), \n1={atan(\y1/\x1)}, \p2=($(B)-(D)$), \n2={atan(\y2/\x2)} in (B) -- ($(B) +({0.5*(\n1+(\n2-180))}:2)$);
\coordinate[name intersections={of=arc_to_mark_angle_CBD and
a_ray_from_B_bisecting_angle_CBD,by=aux-1}]; %<- give the intersection a name
\coordinate (right_of_midpoint_on_arc_at_B) at ($(aux-1)!1pt!-90:(B)$);
\path[name path=a_ray_from_B_through_the_right_of_midpoint_on_arc_at_B] (B) -- (right_of_midpoint_on_arc_at_B);
\coordinate[name intersections={of=arc_to_mark_angle_CBD and
a_ray_from_B_through_the_right_of_midpoint_on_arc_at_B,
by={a_tick_mark_on_arc_at_B-1}}]; %<- this overwrites intersection-1

\draw[draw=blue] ($(a_tick_mark_on_arc_at_B-1)!-3pt!(B)$) --
($(a_tick_mark_on_arc_at_B-1)!3pt!(B)$);
% here you were using intersection-1 again but it got overwritten
\coordinate (left_of_midpoint_on_arc_at_B) at ($(aux-1)!1pt!90:(B)$);
\path[name path=a_ray_from_B_through_the_left_of_midpoint_on_arc_at_B] (B) -- (left_of_midpoint_on_arc_at_B);
\coordinate[name intersections={of=arc_to_mark_angle_CBD and
a_ray_from_B_through_the_left_of_midpoint_on_arc_at_B,
by={a_tick_mark_on_arc_at_B-2}}];
\draw[draw=blue] ($(a_tick_mark_on_arc_at_B-2)!3pt!(B)$) --
($(a_tick_mark_on_arc_at_B-2)!-3pt!(B)$);

\draw ($(D)!0.5!(C)$) circle (1pt);

\end{tikzpicture}

\end{document}

enter image description here

As you can see, the blue lines are on both sides now. Whether or not this is the most convenient way of achieving this is another question. Personally I like the upper part of my answer much better.

  • Can you tell me why my code is not drawing blue tick marks on both sides of the angle bisectors? – A gal named Desire Aug 16 '18 at 21:29
  • When you compile the code that I provided, do you see tick marks - blue line segments 6pt long - on both sides of the angle bisectors of \angle{CAD} and \angle{CBD}? – A gal named Desire Aug 16 '18 at 22:43
  • @AgalnamedDesire I made an update. Unfortunately, there are quite a few issues with your code. You can do things in a much simpler way, The bisector is just a path from (B) to ($(C)!0.5!(D)$), which you could just shorten. Your bisector is off, I think. – marmot Aug 16 '18 at 22:59
  • @AgalnamedDesire And the issue why you get shifted back is that you are using (intersection-1) and do another intersection later in which intersection-1 gets overwritten. I just gave your intersection-1 a name aux-1, and everything is fine. – marmot Aug 16 '18 at 23:07
  • 2
    You did make one erroneous comment in your response, which I am compelled to correct. The green lines in my diagram are the angle bisectors of the two angles. Angles bisectors are not necessarily medians. – A gal named Desire Aug 17 '18 at 12:23
1

Another method with tkz-euclide. It's possible to adapt the style with options from Tikz. For example you can create new mark.

\documentclass[a4paper]{article}
\usepackage{tkz-euclide}
\usetkzobj{all} 

\begin{document}    
\begin{tikzpicture}[scale=5]

    \tkzDefPoint(-1.5,0){A}
    \tkzDefPoint(80:1.5){B}
    \tkzDefPoint(330:1.5){C}
    \tkzDefPoint(0,-1.5){D}
    \tkzDefLine[bisector](C,B,D)\tkzGetPoint{b}
    \tkzDefLine[bisector](C,A,D)\tkzGetPoint{a}

    \tkzDrawPolygon(A,B,C,D)
    \tkzDrawSegments(A,C B,D) 
    \tkzDrawLine[green,dashed,add=0 and -0.2](A,a)
    \tkzDrawLine[green,add=0 and -0.2](B,b)
    \tkzMarkAngle[blue,thick,mark=||,size=.5 cm](D,B,C)
    \tkzMarkAngle[blue,thick,mark=||,size=.5 cm](D,A,C)

    \tkzLabelPoint[left](A){$A$}
    \tkzLabelPoint[above](B){$B$}
    \tkzLabelPoint[right](C){$C$}
    \tkzLabelPoint[below](D){$D$}

\end{tikzpicture}
 \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.