[Tex/LaTex] Label a triangle

pstrickstechnical-drawing

How would I produce a triangle (with each side a different length) with labeled edges and angles? I'be managed to produce a triangle using pstricks, the code it

\begin{pspicture}(0,-1.34)(6.8,1.34)
\psline[linewidth=0.04](6.78,0.88)(0.0,1.32)(0.58,-1.32)(6.74,0.86)(6.74,0.86)(6.76,0.84)
\end{pspicture}

and the output is

enter image description here

How would I label the lines and the angles?

I've looked around at answers to similar questions and they all use tiks. I'm happy to start learning that if it makes the drawing easier.

Best Answer

What you are looking for is the tkz-euclide package. Look at the following example:

\documentclass[10pt]{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{angles,positioning,quotes,decorations.markings}

\begin{document}

\begin{tikzpicture}
\path (135:3) coordinate (A) (45:4) coordinate (B) (0:0) coordinate (C);
\draw (A)
-- (B) node [at start, left]{$A$} node [midway,above, sloped]{$m+n$}
-- (C) node [at start, right]{$B$} node [midway,below, sloped] {$2\sqrt{m n}$}
-- (A) node [at start, below]{$C$} node [midway, below, sloped] {$m-n$} -- cycle;
\draw 
pic[draw, angle radius=7.5mm,"$\theta$",angle eccentricity=.7] {angle = C--A--B}
pic[draw, angle radius=7.5mm,"$\phi$",angle eccentricity=.7] {angle = A--B--C}
pic[draw, angle radius=7.5mm,"$\beta$",angle eccentricity=.6] {angle = B--C--A};
\end{tikzpicture}

\end{document}

Which gives this triangle:

enter image description here

If you were to use PSTricks, you can do the same example like this:

\documentclass[border=12pt,12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(10,7)
    \pstGeonode[CurveType=polygon,PosAngle={180,-90,0}](1,4){A}(5,1){C}([offset=-7]{A}C){B}
    \pstMarkAngle[MarkAngleRadius=1,LabelSep=.7]{C}{A}{B}{$\theta$}
    \pstMarkAngle[MarkAngleRadius=1,LabelSep=.7]{A}{B}{C}{$\phi$}
    \pstMarkAngle[MarkAngleRadius=1,LabelSep=.6]{B}{C}{A}{$\beta$}
    \psset{shortput=nab,linestyle=none,nrot=:U}
    \pcline(A)(B)^{$m+n$}
    \pcline(A)(C)_{$m-n$}
    \pcline(C)(B)_{$2\sqrt{mn}$}
\end{pspicture}
\end{document}

Run in the sequence: LaTeX-DVI-PS-PDF to get the output:

enter image description here