# How to label angles in a right triangle?

I am trying to label the two angles in a right triangle and got the following code from this post link. In this code, only the right angle is indicated. Looking at several posts on the subject, I am not able to label the other two angles.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[scale=1.25]
\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);

\draw
(A) --
node[above] {$a$} (B) --
node[right] {$c$} (C) --
node[below] {$b$} (A);

\draw
(1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,A,B);% gives error :undefined control sequence
\end{tikzpicture}
\end{document}


Learning from the manual is difficult, unless one already knows quite a lot. I would appreciate if someone can add for me the lines that would label the two sides of this triangle. This will serve me a lot of learning. Greetings of the season.

Thank you all who spent precious time and effort to look at my problem. Having failed to avoid tikz-euclid, I have gone through geogebra and got what I wanted, attached here and the code (in case it may be useful to someone esle)

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}

\begin{document}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\definecolor{uuuuuu}
{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\definecolor{qqqqff}{rgb}{0.,0.,1.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle
45,x=1.0cm,y=1.0cm]
\draw[color=black] (-4.,0.) -- (0.,0.);
draw[color=black] (0.,0.) -- (0.,3.);
\clip(-4.,-0.4) rectangle (0.4,3.4);
\draw [shift={(-4.,0.)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (0.:0.6) arc (0.:36.86989764584402:0.6) -- cycle;
\draw[color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0.,0.4242640687119284) -- (-0.4242640687119284,0.42426406871192845) -- (-0.4242640687119284,0.) -- (0.,0.) -- cycle;
\draw (0.,3.)-- (-4.,0.);
\draw (-4.,0.)-- (0.,0.);
\draw (0.,0.)-- (0.,3.);
\draw[color=qqwuqq] (-3.58,0.16) node {$\theta$};
\draw[color=qqwuqq] (0.34,0.33);
\end{tikzpicture}
\end{document}


Thank you very much

• That code does not compile for me. Does it really work for you? Please specify which answer you based your code on. There are many many many! – cfr Jan 1 '17 at 22:43
• OK, I see that is the question but it is hidden in a comment in the code. Better to clearly mention the error so people know that's what you want help with! – cfr Jan 1 '17 at 23:02
• As your latest edit is essentially an answer to the question as I understand it, I'd suggest posting it as an answer instead, makes it easier for other people who see this post to determine where the question stops and the answers begin. (Answering ones own question is perfectly fine.) – Torbjørn T. Jan 2 '17 at 11:35
• clicking on "answer your own question" was not giving me anything, that is why I posted an edit. Sorry for the incovenience. – Zilore Mumba Jan 2 '17 at 16:58
• Have you seen my another answer below? You can vote it, if you prefer. – Sebastiano Jan 2 '17 at 17:16

You are almost there. You just need to add

\usepackage{tkz-euclide}
\usetkzobj{all}


to the preamble.

\documentclass[border=10pt,tikz]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[scale=1.25]
\coordinate [label=left:$C$] (C) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (A) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (C) -- node[above] {$a$} (B) -- node[right] {$c$} (A) -- node[below] {$b$} (C);
\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,B)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\end{tikzpicture}
\end{document}


# EDIT

In a comment you mentioned wanting to avoid tkz-euclide. I actually only used this because the code you posted originally required it. If you wish to mark angles using plain TikZ (insofar as there is such a thing), you might use the angles and quotes libraries, which are part of PGF/TikZ itself.

For example:

\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}[
my angle/.style={
every pic quotes/.append style={text=cyan},
draw=cyan,
}]
\coordinate [label=left:$C$] (C) at (-1.5,-1);
\coordinate [label=right:$A$] (A) at (1.5,-1);
\coordinate [label=above:$B$] (B) at (1.5,1);
\draw (C) -- node[above] {$a$} (B) -- node[right] {$c$} (A) -- node[below] {$b$} (C);
\draw (A) +(-.25,0) |- +(0,.25);
\pic [my angle, "$\alpha$"] {angle=A--C--B};
\pic [my angle, "$\beta$"] {angle=C--B--A};
\end{tikzpicture}
\end{document}


• Very good. I have forgotten to add \tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A). – Sebastiano Jan 1 '17 at 23:03
• @Sebastiano I didn't add it. It was there already. I don't understand your answer, to be honest, as I'm not clear why you think the command needs to be patched. – cfr Jan 1 '17 at 23:05
• Thanks @sebastian, this is really beautiful and that is what I was looking for. – Zilore Mumba Jan 2 '17 at 22:07
• @ZiloreMumba Sorry, but this very nice work it is of the specialist cfr. – Sebastiano Jan 2 '17 at 22:10

A PSTricks solution using the pst-eucl package:

\documentclass{article}

\usepackage{pst-eucl}
\newcommand*\Label[3]{%
\pcline[linestyle = none, offset = 6pt](#1)(#2)
\ncput{#3}}

\begin{document}

\begin{pspicture}(-0.43,-0.35)(5.35,3.4) % boundry found manually
\pstTriangle[PointSymbol = none](0,0){A}(5,3){B}(5,0){C}
\pstRightAngle{B}{C}{A}
\pstMarkAngle[LabelSep = 0.6]{C}{A}{B}{$\alpha$}
\pstMarkAngle[LabelSep = 0.67]{A}{B}{C}{$\beta$}
\Label{A}{B}{$c$}
\Label{B}{C}{$a$}
\Label{C}{A}{$b$}
\end{pspicture}

\end{document}


• @cfr, firstly my apologies for not commenting code which did not work and hence my question not being clear. The tikz solution works for me in a standalone document. But this is part of a large document, and in my large document "\usepackage{tkz-euclide}" gives me the error "no \begin{document}". I am using a lot of options in the tikz library, so I do not know where the conflict comes from. I have been avoiding using euclide altogether. The pst-eucl solution by Svend gives "undefined control sequence" on line 11 (pstTriangle[PointSymbol=...). Could it help if I post the whole tikzlibrary? – Zilore Mumba Jan 2 '17 at 4:43
• Further comment: removing all "\usepackage{tikz} and \usetikzlibrary" still gives "missing \begin{document}" with "\usepackage{tikz-euclide}" uncommented. – Zilore Mumba Jan 2 '17 at 5:11
• @cfr and Sebastiano, I have marked both solutions are correct and useful because they work as standalone on my system but am not able to use the package tikz-euclide, so am looking for a solution which is purely tikz, for my larger document. pstricks does not work at all. – Zilore Mumba Jan 2 '17 at 7:34
• @ZiloreMumba For PSTricks, you have to compile using either latex --> dvips --> ps2pdf or xelatex. Are you doing that? – Svend Tveskæg Jan 2 '17 at 13:21
• @ZiloreMumba You cannot ping other people in a conversation they are not part of. So neither Sebastiano or I receive notification that you've left comments addressing us here. You cannot mark more than one answer as correct. You cannot ping more than one person at once. – cfr Jan 2 '17 at 16:47

Now is correct, without errors!

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tkz-euclide}
\usetkzobj{all}

\usepackage{etoolbox}
\makeatletter

\begin{document}
\begin{tikzpicture}[scale=1.25]
\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);

\draw
(A) --
node[above] {$a$} (B) --
node[right] {$c$} (C) --
node[below] {$b$} (A);

\draw
(1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,A,B);
\end{tikzpicture}
\end{document}


For the second question you can use a grid.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle
45,x=1.0cm,y=1.0cm]
\draw[step=1cm,gray,very thin] (-4,-4) grid (4,4);
\draw[color=black] (-4.,0.) -- (0.,0.);
draw[color=black] (0.,0.) -- (0.,3.);
\clip(-4.,-0.4) rectangle (0.4,3.4);
\draw [shift={(-4.,0.)},color=gray,fill=darkgray,fill opacity=0.1] (0,0) -- (0.:0.6) arc (0.:36.9:0.6) -- cycle;
\draw[color=gray,fill=darkgray,fill opacity=0.1] (0.,0.42) -- (-0.42,0.42) -- (-0.42,0.) -- (0.,0.) -- cycle;
\draw (0.,3.)-- (-4.,0.);
\draw (-4.,0.)-- (0.,0.);
\draw (0.,0.)-- (0.,3.);
\draw[color=gray] (-3.2,0.4) node {\large $\theta$};
\draw[color=gray] (0.34,0.33);
\end{tikzpicture}
\end{document}