1

I am new to tikz and I am struggling to be precise with the placement of my figures. Specifically, I was looking to have angle EDF be labeled with $\frac{x}{2}$ and angle ADF to have the "right angle" symbol. Also, I would like the line segment AB to be labeled with $\sqrt{1+t^2}$. Any help would be greatly appreciated! If there are any other reccomendations to make the image look better, maybe fix the arbitrary bold lines, I would also appreciate that! Here is my code for the figure:

\begin{figure}
\centering
\begin{tikzpicture}

  % Define coordinates
  \def\Radius{5}
  \path
    (-\Radius, 0) coordinate (A)
    -- coordinate (M)
    (\Radius, 0) coordinate (B)
    (M) +(60:\Radius) coordinate (C)
    +(120:\Radius) coordinate (D)
  ;

  % Draw semicircle
  \draw
    (B) arc(0:180:\Radius) -- cycle ;
  ;
  \draw (0,0) -- (0,5) ;
  \draw (-5,0) node[below=.333em]{$A$} node[right =4.0em, above left=0.01em]{$\frac{x}{2}$}
  -- (2.96,0) node[below = .333em]{$E$}
  -- (2.96,4) node[above right=.333em]{$D$}
  -- cycle;
\draw (0,0) node[anchor=north]{}
  -- (5,0) node[anchor=north]{}
  -- (2.96,4) node[above right=.05em]{} 
  -- cycle;

  \draw (0,0) -- (0,3) node[anchor = north east]{$B$};
  \draw(0,0) node[below=.333em]{$C$};
  \draw (5,0) node[below=.333em]{$F$};

\draw [black, thick] (-4,0) arc[start angle=0, end angle=37, radius=0.7cm];
    \draw [black, thick] (2.5,3.9) arc[start angle=270, end angle=360, radius=0.7cm]; 
        \filldraw [black] (0,0) circle (2pt);
        \filldraw [black] (-5,0) circle (2pt);
        \filldraw [black] (5,0) circle (2pt);
        \filldraw [black] (2.96,4) circle (2pt);
        \filldraw [black] (2.96,0) circle (2pt);
        \filldraw [black] (0,2.5) circle (2pt);
\end{tikzpicture}
\end{figure}
  • This post has been asked many times. There are many ways. one is \usepackage{tkz-euclide} and \tkzMarkAngle(E,D,F) for angle mark and \tkzLabelAngle[pos=1.2](E,D,F){$\alpha$} for its label. –  Apr 22 '20 at 20:14
  • 6
    Does this answer your question? Label angle with tikz –  Apr 22 '20 at 20:17
  • Yes! I Appreciate it. Are there any other resources to learn more on basics - advanced for tikz? I am brand new and it's been a headache to continuously rely on trial and error. –  Apr 22 '20 at 21:53
  • 1
    You could try and read the tikz manual it's a fairly good starting point – BambOo Apr 22 '20 at 23:21

1 Answers1

1

These are mainly off-topic suggestions as the answer is already given in C.F.G's comment. I find it very confusing to name the nodes differently from how they are labeled. So I'd suggest to place the dots and labels right at the node creation. Then you can use the calc library for computing intersections and the angles library for the angle marks. (One can slightly shorten the syntax using quotes but this can have side effects with babel, which can be fixed but then it might be better to just use pic text.)

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{angles,calc}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=1.5pt}]
  % Define coordinates
  \def\Radius{5}
  \path
    (-\Radius, 0) coordinate[dot,label=below:$A$] (A)
    -- (0,0) coordinate[dot,label=below:$M$] (M)
    (\Radius, 0) coordinate[dot,label=below:$B$] (B)
    (0,\Radius) coordinate (H)
    (M) +(54:\Radius) coordinate[dot,label=above:$D$] (D)
    (D|-M) coordinate[dot,label=below:$E$] (E)
    (intersection of A--D and M--H) coordinate[dot,label=above left:$C$] (C);
  % draw semicircle,
  \draw (B) arc[start angle=0,end angle=180,radius=\Radius];
  % draw  triangle and angle marks
  \draw
    (A) -- (B) -- (D) -- (A) (D) -- (M) -- (H)
    pic[draw,pic text={$\frac{x}{2}$},angle radius=1cm,angle eccentricity=1.25]{angle=M--A--C}
    pic[draw]{right angle=B--D--A};
%  
\end{tikzpicture}
\end{document}

enter image description here

  • I wish I could upvote your answer! I was looking for this! May I ask -- say I wanted to have a contour curve relating to contour integration, what would the command be to have arrows traversing the curve? Thanks! –  Apr 22 '20 at 21:52
  • 1
    @Allusion You can use decorations.markings for that. It allows you to switch to tangent space, and to draw arrows perpendicular to the tangent direction. If you want to have an explicit answer on this, please ask an explicit independent question. (BTW, you can accept answers by the clicking check mark on the left, but I do not want to push you to accept mine.) –  Apr 22 '20 at 21:55
  • Alright, thank you!, and of course I will click the check mark; this is the second time you have assisted me! Lastly, when I transfer the image into LaTeX it appears larger than desired, as in the radius/ the components in the image have too large of a span for the page I am working with. Any suggestions for how to fix this? –  Apr 22 '20 at 22:05
  • 1
    @Allusion You need to make sure that you load \usetikzlibrary{angles,calc} and then put the tikzpicture environment in your document. Unfortunately I do not know your document class, otherwise I'd had adjusted the code to fit in your document. This is why users often get asked to post a minimal working example (MWE). –  Apr 22 '20 at 22:12
  • 1
    I fixed it, I accidentally deleted my document class in exchange for latter you gave in your example. I am coding the images in their own file and then compiling them into the main tex file. So far it has been going well, with your assistance! Next time I will be sure to include a MWE! –  Apr 22 '20 at 22:29