7

I've been trying for a while to get this to work out nicely, but I'm really struggling to avoid excess picture.

I want to draw $\triangle ABC$ given its side lengths: 7, 13, 14.

The code below produces the result, but too much. I don't want (a) the circles or (b) the image to zoom, re-center, blank-space, or whatever thinking that the circles are there. And I also don't want to by-hand define $\measuredangle G = 67.19^\circ$ either; yes it gets the answer, but it's against the spirit of the problem.

\documentclass{article}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes,shapes.geometric,intersections,through}
\begin{document}
\begin{tikzpicture}[scale=.5]
    \coordinate [label=below:$G$] (g) at (0,0);
    \coordinate [label=below:$O$] (o) at (14,0);

    \node (Circ1) at (g) [draw, circle through=($ (g) + (0:7) $)] {};
    \node (Circ2) at (o) [draw, circle through=($ (o) + (0:13) $)] {};
    \coordinate [label=above:$E$] (e) at (intersection 2 of Circ1 and Circ2);
    \draw (g) -- (e) -- (o) -- cycle;
\end{tikzpicture}
\end{document}

3 Answers 3

2

You can remove the draw command and ignore certain commands for the purpose of calculating the bounding box!

\documentclass{standalone}
\usepackage[english]{babel}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes,shapes.geometric,intersections,through}
\begin{document}
\begin{tikzpicture}[scale=.5]
    \coordinate [label=below:$G$] (g) at (0,0);
    \coordinate [label=below:$O$] (o) at (14,0);
    \begin{pgfinterruptboundingbox}
        \node (Circ1) at (g) [circle through=($ (g) + (0:7) $)] {};
        \node (Circ2) at (o) [circle through=($ (o) + (0:13) $)] {};
    \end{pgfinterruptboundingbox}
    \coordinate [label=above:$E$] (e) at (intersection 2 of Circ1 and Circ2);
    \draw (g) -- (e) -- (o) -- cycle;
\end{tikzpicture}
\end{document}

Output image: enter image description here

1
  • Thank you @lucky1928. I was not aware of the pgfinterruptboundingbox feature and it works exactly as I wanted. (I knew I could remove draw, but for the sake of picture I thought it would be helpful to see what's going wrong.) Thanks again!
    – D.J.
    Apr 8, 2016 at 18:38
6

You're loading tkz-euclide but you're not using it, so here's a version with it.

We can find the point E by using \tkzInterCC which does the same thing you did, but with one command. This finds two points, in our case they are E and E'. One is above, one is below, choose the one you prefer.

You can also draw the lengths which we know in this case, but they can be automatically calculated.

Output

Without lengths

enter image description here

With lengths

enter image description here

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}[scale=.5]
    \tkzDefPoint(0,0){G}
    \tkzDefPoint(14,0){O}

    \tkzInterCC[R](G,7cm)(O,13cm)
    \tkzGetPoints{E}{E'}
    \pgfresetboundingbox % removes white space

    \tkzDrawPolygon(G,E,O)
    \tkzLabelPoints[left](G)
    \tkzLabelPoints[above](E)
    \tkzLabelPoints[right](O)

    % lengths (automatic)
    \tkzCalcLength[cm](G,O)\tkzGetLength{GOl}
    \tkzCalcLength[cm](E,O)\tkzGetLength{EOl}
    \tkzCalcLength[cm](G,E)\tkzGetLength{GEl}

    \tkzLabelSegment[midway, sloped, below](G,O){$\pgfmathprintnumber\GOl$ cm};
    \tkzLabelSegment[midway, sloped, above right](E,O){$\pgfmathprintnumber\EOl$ cm};
    \tkzLabelSegment[midway, sloped, above left](G,E){$\pgfmathprintnumber\GEl$ cm};

\end{tikzpicture}
\end{document}
4
  • Thank you @Alenanno. I am not nearly as knowledgeable with tkz-euclide yet, and for some reason it seems less obvious to me so far. I have it loaded for when I've needed things -- but I really should spend the time to learn more. Thanks!
    – D.J.
    Apr 8, 2016 at 18:41
  • @D.J. No worries! I don't even know everything about it either. If you can understand some French (or understand the examples), you can check the documentation when you want to do something... Or browse this site!
    – Alenanno
    Apr 8, 2016 at 19:31
  • @Alenanno Possible \tkzLabelSegment[below,sloped,midway](G,O){$\pgfmathprintnumber\GOl$ cm}to avoid the mix of syntax Apr 8, 2016 at 21:36
  • @AlainMatthes thank you, wasn't sure how to do that. Will fix it as soon as possible.
    – Alenanno
    Apr 8, 2016 at 21:59
4

This question is exactly is the documentation

10.3.1 Construction of a triangle knowing the lengths of the sides

The circle with center B is big so it's possible to use only an arc.

\documentclass[margin=10pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}[scale=.5]
  \tkzDefPoint(0,0){A} \tkzDefPoint(14,0){B}
  \tkzDrawCircle[R,dashed](A,7 cm) \tkzDrawCircle[R,dashed](B,13 cm)
  \tkzInterCC[R](A,7 cm)(B,13 cm) \tkzGetPoints{C}{D}
  \tkzDrawPolygon(A,B,C)
  \tkzCompasss(A,C B,C)
  \tkzLabelSegment[below](A,B){$14$ cm}
  \tkzLabelSegment[above left](A,C){$7$ cm}
  \tkzLabelSegment[above right](B,C){$13$ cm}
  \tkzDrawPoints[color=red](C)
  \tkzDrawPoints[color=blue](A,B)
\end{tikzpicture}
\end{document}

A variant

\documentclass[margin=10pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}[scale=.5]
  \tkzDefPoint(0,0){A} \tkzDefPoint(14,0){B}
  \tkzInterCC[R](A,7 cm)(B,13 cm) \tkzGetPoints{C}{D}
  \tkzDrawPolygon(A,B,C)
  \tkzCompasss[length=3](A,C B,C)
  \tkzLabelSegment[below](A,B){$14$ cm}
  \tkzLabelSegment[above left](A,C){$7$ cm}
  \tkzLabelSegment[above right](B,C){$13$ cm}
  \tkzDrawPoints[color=red](C)
  \tkzDrawPoints[color=blue](A,B)
\end{tikzpicture}
\end{document}

enter image description here

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .