1

I know this question has been asked heaps of time here, but I have already looked at quite a few answers and still for some reason I have not been able to get it to work. Below is my code and output:

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc,angles,quotes,positioning}

\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
% making the diagram
\draw (0,0) node (O) [black, below]{$O$}
-- (-2,2.5) node (C) [black, left]{$C$}
-- (3,4) node (D) [black, right] {$D$}
-- cycle;
\draw (-2,2.5)
-- (-2,4.5) node (B) [black,left] {$B$}
-- (3,6) node (A) [black, right] {$A$}
-- (3,4);
\draw (0,0)
-- (-2,4.5);
\draw (0,0)
-- (3,6);
% putting equal marks on sides AB and CD
\draw[decoration = {markings,mark=at position 0.5 with 
  {\draw(0,-5pt)--(0,5pt);}},postaction={decorate}] (-2,2.5)--(3,4);
  \draw[decoration = {markings,mark=at position 0.5 with 
  {\draw(0,-5pt)--(0,5pt);}},postaction={decorate}] (-2,4.5)--(3,6);
% (trying) to label vertex COD
pic["$60^\circ$",draw=black,<->,angle eccentricity=1.2,angle radius=1cm] {angle=C--O--D};
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

My desired output is below:

enter image description here

Addendum

Looking at the given answer I can now label angle COD, however when I use the exact same method to label AOD and BOC, infuriatingly it doesn't seem to work.

pic["$15^\circ$",draw=black,->,angle eccentricity=1.2,angle radius=1cm] {angle=B--O--C};
pic["$25^\circ$",draw=black,->,angle eccentricity=1,angle radius=1cm] {angle=A--O--D};

enter image description here

Thanks for any help!

1

COMPLETE EDIT: The problem with your code is that you're using nodes, which are extended objects, instead of coordinates. Once that is changed, your pic works fine.

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,backgrounds}
\usetikzlibrary{calc,angles,quotes,positioning}
\newcommand{\DrawArcAngle}[6][]{% just for emergencies
\pgfmathanglebetweenpoints{\pgfpointanchor{#3}{center}}{\pgfpointanchor{#2}{center}}
\xdef\angleA{\pgfmathresult}
\pgfmathanglebetweenpoints{\pgfpointanchor{#3}{center}}{\pgfpointanchor{#4}{center}}
\xdef\angleB{\pgfmathresult}
\draw[#1] ($(#3)+(\angleA:#5)$) arc [start angle=\angleA,end angle=\angleB,radius=#5]
#6;
}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
% making the diagram
\coordinate[label=below:$O$] (O) at (0,0);
\coordinate[label=left:$C$] (C) at (-2,2.5);
\coordinate[label=right:$D$] (D) at (3,4);
\coordinate[label=left:$B$] (B) at (-2,4.5);
\coordinate[label=right:$A$] (A) at (3,6);
\draw (O) -- (C) -- (D)-- cycle;
\draw (C) -- (B) -- (A)-- (D);
\draw (O)-- (B);
\draw (O) -- (A);
% putting equal marks on sides AB and CD
\draw[decoration = {markings,mark=at position 0.5 with 
  {\draw(0,-5pt)--(0,5pt);}},postaction={decorate}] (C)--(D);
  \draw[decoration = {markings,mark=at position 0.5 with 
  {\draw(0,-5pt)--(0,5pt);}},postaction={decorate}] (B)--(A);
%\DrawArcAngle[->,draw]{C}{O}{D}{1cm}{node[midway,above]{$60^\circ$}}
\draw (D)--(O)--(C)
pic["$60^\circ$",draw=black,<->,angle eccentricity=1.2,angle radius=1cm] {angle=D--O--C};
\draw (B)--(O)--(C)
pic["$15^\circ$",draw=black,<->,angle eccentricity=1.2,angle radius=1.8cm] {angle=B--O--C};
\draw (D)--(O)--(A)
pic["$25^\circ$",draw=black,<->,angle eccentricity=1.2,angle radius=2.4cm] {angle=D--O--A};
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

  • thank you for your answer. How would you go about labelling vertex BOC 15 degrees and AOD 25 degrees? I tried doing your method for those 2 vertexes and I got the same result as I got before – Nanoputian Feb 9 '18 at 5:00
  • 2
    @Nanoputian Just made an update. The angles show, but don't look too appealing because the picture is secretly 3D (or is it not?). (BTW, it is not recommended to extend the question afterwards. You may get more feedback if you ask a new question. This is a general remark, in this case it was easy to add these things.) – user121799 Feb 9 '18 at 5:08
  • thank you very much for your edit. Oh whoops, looks like I just forgot to add in the \draw for each one. Yes it is suppose to be a 3D diagram. Thanks for letting me know, I will keep that in mind for next time. – Nanoputian Feb 9 '18 at 6:27

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.