TransWikia.com

Labelling Angle Issues

TeX - LaTeX Asked on June 30, 2021

I am trying to label the angles of a triangle. I can’t figure out why my code is kicking the name to the outside. My apologies for any formatting issues; this is my first post here.

documentclass{article}
usepackage{tkz-euclide}
usetkzobj{all}
begin{document}
begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt}]
path
(80:5) node [dot,label=above left:A]{} coordinate (A)
(20:9) node[dot, label=right:B]{} coordinate (B)
(0:0) node[dot,label=below left:C]{} coordinate(C);

path coordinate (Q)at((C)!(A)!(B)) node at (Q)[]{} ;

draw[-] (A)--(C);
draw[-] (C)--(B);
draw[-] (A)--(B);
draw[purple!70!black] (A)--(Q);

tkzMarkRightAngle(A,Q,C);

draw[|<->|] ((P)!−7mm!90:(B))--node[fill=white,sloped] {x} ((B)!−7mm!−90:(P));
draw[|<->|] ((Q)!−4.9mm!90:(A))--node[fill=white] {10} ((A)!−3mm!−90:(Q));

tkzMarkAngle[size=0.75cm,color=black,label=α];
tkzMarkAngle[size=1cm,color=black,label=β];
tkzMarkRightAngle(B,A,C);
end{tikzpicture}
end{document}

I am trying to fit $beta$ inside the triangle instead of its current location.
enter image description here

3 Answers

After some efforting on your code, following output can be obtained.

documentclass[margin=3mm]{standalone}
usepackage{tkz-euclide}
usetikzlibrary{calc}
%usetkzobj{all}
begin{document}
begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt},>=stealth]
coordinate (C) at (0,0) ;
coordinate (A) at (80:5);
coordinate (B) at (20:9) ; 
node [dot] at (C) {};
node [dot] at (A) {};
node [dot] at (B) {};
draw[-] (A)node[above]{A}--(C)node[left]{C};
draw[-] (C)--(B)node[right]{B};
draw[-] (A)--(B);
coordinate (Q) at($(C)!(A)!(B)$) ;
tkzMarkRightAngle(A,Q,C);
draw[purple!70!black] (A)--(Q);
draw[|<->|] ($(Q)!-4.9mm!90:(A)$)--node[fill=white] {10} ($(A)!3mm!90:(Q)$);
draw[|<->|] ($(C)!-7mm!90:(B)$)--node[fill=white,sloped] {$x$} ($(B)!7mm!90:(C)$);
tkzMarkAngle[size=0.75,draw = black, fill = white, opacity=1](Q,C,A)
tkzLabelAngle[pos=1,font=scriptsize](Q,C,A){$alpha$}
tkzMarkAngle[size=0.75,draw = black, fill = white, opacity=1](A,B,Q)
tkzLabelAngle[pos=1,font=scriptsize](A,B,Q){$beta$}
tkzMarkRightAngle(B,A,C);

end{tikzpicture}
end{document}

enter image description here

Answered by user31034 on June 30, 2021

Using the code from Angle Label Issues, and commenting out the draw that uses the undefined coordinate P, I can reproduce the problem with TeX Live 2019 (on Overleaf)

I first thought it was just a matter of using tkzLabelAngle, but that gave initially the same, erroneous, result. Swapping the order of the coordinates, i.e. using (Q,B,A) instead of (A,B,Q) makes no difference either. In the new version of tkz-euclide, demonstrated in ferahfeza's answer, this works as expected, so if there was a bug, it has been fixed.

A workaround for the old version is to use a negative value for pos, in the options to tkzLabelAngle:

tkzMarkAngle[size=1cm,color=black](A,B,Q);  
tkzLabelAngle[pos=-1.2](Q,B,A){$beta$};  

enter image description here

documentclass{standalone}  
usepackage{tkz-euclide}  
usetkzobj{all}  
begin{document}  
begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt}]  
path  
  (80:5) node [dot,label=above left:$A$]{} coordinate (A)  
  (20:9) node[dot, label=right:$B$]{} coordinate (B)  
  (0:0) node[dot,label=below left:$C$]{} coordinate(C);  

path coordinate (Q)at($(C)!(A)!(B)$) node at (Q)[]{} ;  

 draw[-]  (A)--(C);  
 draw[-] (C)--(B);  
 draw[-] (A)--(B);  
 draw[purple!70!black] (A)--(Q);  

tkzMarkRightAngle(A,Q,C);  

%draw[|<->|] ($(P)!-7mm!90:(B)$)--node[fill=white,sloped] {$x$} ($(B)!-7mm!-90:(P)$);  
draw[|<->|] ($(Q)!-4.9mm!90:(A)$)--node[fill=white] {$10$} ($(A)!-3mm!-90:(Q)$);  

tkzMarkAngle[size=0.75cm,color=black,label=a](B,C,A);  
tkzMarkAngle[size=1cm,color=black](A,B,Q);  
tkzLabelAngle[pos=-1.2](Q,B,A){b};  
tkzMarkRightAngle(B,A,C);  
end{tikzpicture}  
end{document}  

Answered by Torbjørn T. on June 30, 2021

Using only pure tkz-euclide

enter image description here

documentclass{article} % or another class
usepackage{xcolor} % before tikz or tkz-euclide if necessary

usepackage{tkz-euclide} % no need to load TikZ

begin{document}
begin{tikzpicture}[scale=1.0]
    %define points A,B,C
    tkzDefPoint(0,0){C}
    tkzDefPoint(20:9){B}
    tkzDefPoint(80:5){A}
    %label point A,B,C
    tkzLabelPoints(B,C)
    tkzLabelPoints[above](A)
    %draw triangleABC
    tkzDrawPolygon[thick,fill=yellow!15](A,B,C)
    %get line orthogonal to base CB
    tkzDefPointsBy[projection=onto B--C](A){a}
    tkzDrawSegment[dashed, red](A,a)
    %marking right angles    
    tkzMarkRightAngle(A,a,C)    
    tkzMarkRightAngle(C,A,B)
    %drawing dimension 10
    tkzDrawSegment[style=red, dashed, dim={$10$,15pt,midway,font=scriptsize, rotate=90}](A,a) 
    %marking the angles
    tkzFillAngle[fill=blue!20, opacity=0.5](B,C,A)
    tkzLabelAngle[pos=1.25](B,C,A){$alpha$}
    tkzMarkAngle(B,C,A)
    tkzFillAngle[fill=red!20, opacity=0.5](A,B,C)
    tkzLabelAngle[pos=1.25](A,B,C){$beta$}
    tkzMarkAngle(A,B,C)
    
    
        tkzDrawPoints(A,B,C)

end{tikzpicture}
end{document}

Answered by js bibra on June 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP