### Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 4 guests

## Drawing similar right triangles

Add tags Information and discussion about graphics, figures & tables in LaTeX documents.

### Drawing similar right triangles

I am trying to recreate the following picture
triangle.gif (1.28 KiB) Viewed 3728 times

I have been able to use the TikZ package to create something similar. However with how powerful the package is I am having trouble sorting through the documentation to find out how to do simple things. The hardest part i am finding is getting the label to show the length of each segment, especially when it stretches over several "parts", also an easy way to show the right angle symbol.
Code: Select all  •  Open in writeLaTeX
\begin{tikzpicture}\draw (0,0) node[anchor=north east]{A}-- (1,3)node[anchor=south]{B} -- (10,0)node[anchor=north]{C}-- (0,0);\draw (1,3)--(1,0)node[anchor=north]{D};\end{tikzpicture}

Edit by localghost: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.
Last edited by Mikerada6 on Wed Feb 9th, 2011, edited 1 time in total.

Posts: 42
Joined: Fri Oct 17th, 2008

### Re: Drawing similar right triangles

Is it necessarily that you use TikZ? If not, Here is an alternative to create images for LaTeX purposes, which I prefer over TikZ.
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Frits

Posts: 169
Joined: Wed Feb 2nd, 2011

### Re: Drawing similar right triangles

You can use the tkz-2d package with TikZ to draw the right angles. Here's an example, using the coordinates in your code snippet:

Code: Select all  •  Open in writeLaTeX
\documentclass{article}\usepackage{tikz,tkz-2d}\begin{document}\begin{tikzpicture} \coordinate[label=below left:$A$] (A) at (0,0); \coordinate[label=below right:$B$] (B) at (10,0); \coordinate[label=above:$C$] (C) at (1,3); \coordinate[label=below:$D$] (D) at (1,0); \draw (A) -- (C) -- (B) -- cycle; \draw (C) -- (D) node[right,midway] {$m$}; \draw[latex-latex,shift={(0,-0.6)}] (1,0) -- (10,0) node[below,midway] {$a$ units}; \draw[latex-latex,shift={(0,-1.2)}] (0,0) -- (10,0) node[below,midway] {$b$ units}; \tkzRightAngle (A/C/B, C/D/B);\end{tikzpicture}\end{document}

Here's a pic of what it looks like:
Attachments
tikztest2.png (3.27 KiB) Viewed 3714 times
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2

Posts: 140
Joined: Thu Jul 16th, 2009

### Re: Drawing similar right triangles

thank you very much. that simple example will help me create many of the figures I need to create my geometry lesson plans. Thank you again.

Posts: 42
Joined: Fri Oct 17th, 2008

### Re: Drawing similar right triangles

I am having trouble installing the TKZ-2d package. I am running Windows and TexNicCenter

The documentation is confusing and I am not aware what "sudo texhash" means on a windows machine. To my knowledge that is a Linux command

Posts: 42
Joined: Fri Oct 17th, 2008

### Re: Drawing similar right triangles

It's not Linux specific, but sudo is Unix-specific and texhash TeXlive specific. The equivalent for MikTeX would be refreshing the file name database(FNDB) in the MikTeX package manager.

frabjous

Posts: 2065
Joined: Fri Mar 6th, 2009
Location: Amherst, MA

### Re: Drawing similar right triangles

Mikerada6 wrote:I am having trouble installing the TKZ-2d package. I am running Windows and TexNicCenter […]

The »tkz-2d« package is superseded by the tkz-euclide package. So you should find this with the package manager. And the syntax for the right angle symbol has slightly changed. Unfortunately there's only a French version of the manual at the moment.

Thorsten
LaTeX Community Moderator

¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

localghost
Site Moderator

Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany

### Re: Drawing similar right triangles

frabjous wrote:It's not Linux specific, but sudo is Unix-specific and texhash TeXlive specific. The equivalent for MikTeX would be refreshing the file name database(FNDB) in the MikTeX package manager.

And if you also like to use the command line tool for maintaining MikTeX, take a look here.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
Montag

Posts: 340
Joined: Wed Jul 15th, 2009

### Re: Drawing similar right triangles

If you want to use tkz-euclide instead of tkz-2d, you need TikZ 2.10 installed. Also, make sure you remove the tkz-2d package then update the filename database, or you may encounter problems with conflicting tkz-base.sty files. Using tkz-euclide, the code looks like this:
Code: Select all  •  Open in writeLaTeX
\documentclass{article}\usepackage{tkz-euclide}\usetkzobj{all}\begin{document}\begin{tikzpicture} \coordinate[label=below left:$A$] (A) at (0,0); \coordinate[label=below right:$B$] (B) at (10,0); \coordinate[label=above:$C$] (C) at (1,3); \coordinate[label=below:$D$] (D) at (1,0); \draw (A) -- (C) -- (B) -- cycle; \draw (C) -- (D) node[right,midway] {$m$}; \draw[latex-latex,shift={(0,-0.6)}] (1,0) -- (10,0) node[below,midway] {$a$ units}; \draw[latex-latex,shift={(0,-1.2)}] (0,0) -- (10,0) node[below,midway] {$b$ units}; \tkzMarkRightAngle (A,C,B); \tkzMarkRightAngle (C,D,B);\end{tikzpicture}\end{document}

Note that tkz-euclide automatically loads tikz.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2