2

Good evening, I'm porting a textbook of mine into Latex. I discovered the tkz-euclide package, which should greatly benefit me in making and adjusting figures. The first few figures I made worked well, with labels showing up right where they should have. But then I started having a some problems! Part of my problem - I thought - is that I need to create an exercise set with two columns. But then I pulled out a single picture into a new document with no other formatting. After typing in the following code:

\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
    \coordinate (A) at (0,2); \coordinate (B) at (0,0); \coordinate (C) at (2,0);
    \draw (A)--(B)--(C)--cycle;
    \tkzLabelAngle(A,B,C) {$\gamma$}% C,B,A 
    \tkzLabelAngle(B,C,A) {$\beta$}
\end{tikzpicture}
\end{document}

The output I received was this:

enter image description here

Obviously, I would like the Greek letters to be inside the triangle, not outside.

I realize there is a way to type their positioning in using normal tikz \node [right] at (0,0) {$\gamma$} but tkz-euclide should work more smoothly (especially with a few hundred figures to type in!). It's worth a shot to see what this community thinks, anyway. Thanks for your help!

9
  • 1. Your code above doesn't run; you need to have \usetkzobj{all} in the preamble. 2. There's no need to include tikz in your packages since tkz-euclide loads it automatically. 3. Use the option pos to place the labels where you want: \tkzLabelAngle[pos = .35](A,B,C) {$\gamma$}; \tkzLabelAngle[pos = .65](B,C,A) {$\beta$}; looks ok to me. You can find the documentation here – DJP Jun 7 '20 at 1:24
  • 2
    @DJP To the best of my knowledge one does no longer need to add \usetkzobj{all}. In fact, it will give rise to an error in the latest distributions. – user194703 Jun 7 '20 at 1:39
  • 1
    @DJP The labels are still outside with \tkzLabelAngle[pos = .35](A,B,C) {$\gamma$} \tkzLabelAngle[pos = .65](B,C,A) {$\beta$} on my updated TeXLive 2020 installation. (Note that after the tkz-euclide macros you do not need ;.) – user194703 Jun 7 '20 at 1:48
  • 1
    @DJP I think the link to the manual is good. I personally do not use tkz-euclide, not because there is something wrong with it, there isn't, but just because I am lazy and have not yet encountered a situation which required more than TikZ and its standard libraries (except for 3d stuff) so I am hesitant reading another manual. – user194703 Jun 7 '20 at 1:57
  • 1
    @DJP This can be done with the intersections library, too. – user194703 Jun 7 '20 at 2:05
2

You've made a lot of inaccuracies

1) no need to call TikZ, tkz-euclide works above TikZ and he loads it.

2) No need to add ";" with tkz-euclide, only if you want to use macros from TikZ.

3) When you want to work with an angle you need to give the points with anticlockwise direction. A,B,C and C,B,A are not the same.

\documentclass{standalone} 
\usepackage{tkz-euclide}

\begin{document} 
\begin{tikzpicture}
  \tkzDefPoints{0/2/A,0/0/B,2/0/C}
  \tkzDrawPolygon(A,B,C)
  \tkzLabelPoints(B,C)   \tkzLabelPoints[above](A)
  \tkzMarkAngles[mark=none,size=0.8](C,B,A A,C,B)
  \tkzLabelAngle[pos=1](C,B,A) {$\gamma$}
  \tkzLabelAngle[pos=1](A,C,B) {$\beta$}
\end{tikzpicture}
\end{document}

enter image description here

1
  • Now this is what I was looking for! I was able to quickly whip this together: ``` \documentclass{article} \usepackage{tkz-euclide} \begin{document} \begin{tikzpicture} \tkzDefPoints{0/2/A,0/0/B,2/0/C} \tkzDrawPolygon(A,B,C) \tkzLabelPoints[right](C) \tkzLabelPoints[left](A,B) \tkzLabelSegment[left](A,B) {2} \tkzLabelSegment[below](B,C) {2} \tkzLabelSegment(A,C) {$2\sqrt{2}$} \tkzMarkRightAngle(A,B,C) \tkzLabelAngle[pos=.5](B,A,C) {$\gamma$} \tkzLabelAngle[pos=.5](A,C,B) {$\alpha$} \end{tikzpicture} \end{document} ``` and produce [a picture it won't let me show :/ ] – josephgerth Jun 7 '20 at 18:22
2

Here is a plain TikZ version.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}
    \draw (0,2) coordinate (A) -- (0,0) coordinate (B) -- (2,0) coordinate (C)
     -- cycle;
    \draw[angle radius=7mm] pic ["$\gamma$", draw] {angle=C--B--A}
     pic ["$\beta$", draw,angle eccentricity=0.75] {angle=A--C--B};
\end{tikzpicture}
\end{document}

enter image description here

2
  • 2
    +1 for this less verbose code. – Money Sets You Free Jun 7 '20 at 3:02
  • This works; however, it doesn't work uniformly for all triangles. I found myself unhappy with where the labels showed up in other triangles, even after tweaking the angle eccentricity. It seems I should just go back to using nodes - I can get the labels precisely where I want them (at the cost of time). Surely there must be a more uniform and efficient way for labeling triangles? – josephgerth Jun 7 '20 at 14:20
2

A PSTricks solution only for fun purposes.

The following template is self-explanatory.

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-eucl}
\psset
{
    PointSymbol=none,
    PointName=none,
    MarkAngleRadius=1.5,% don't append unit here!
    LabelSep=1,% don't append unit here!
}
\begin{document}
\begin{pspicture}(6,8)
    \pstTriangle(1,1){A}(5,1){B}(1,7){C}
    \pstMarkAngle{C}{B}{A}{$\beta$}
    \pstRightAngle{B}{A}{C}
\end{pspicture}
\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.