Math & ScienceText on Side of a Triangle

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
3LeftsAndHome
Posts: 7
Joined: Wed Mar 24, 2010 4:10 am

Text on Side of a Triangle

Post by 3LeftsAndHome »

I need to make a circle that is exactly like the one on the first page of http://www.math.siu.edu/kocik/papers/metaptolemiana.pdf in Figure 1 (the right hand circle) here is all I could conjure up:

\documentclass[12pt]{amsart}
\usepackage{fullpage}
\usepackage{amsmath,tikz,fullpage,amsthm}
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}[bullet/.style={coordinate,after node path=
{(\tikzlastnode) node {$\scriptstyle \bullet$}}}, scale = 2]
\draw [densely dotted,black] (0,0) circle (1cm);
\draw [semithick,black] (-.87,-.5) -- (-.45,.9) -- (.87,-.5) -- cycle;
\coordinate[label=above:$A$] (A) at (-1.02,-.66);
\coordinate[label=above:$C$] (C) at (-.45,.92);
\coordinate[label=above:$B$] (B) at (1.00,-.66);
\end{tikzpicture}
\end{document}

I need help drawing the three altitudes (lines from vertices) and being able to add cos(x) to the sides of the triangle it does in the picture. I need help the most on what I underlined. I am not very knowledgeable in tikz. I just know the very very basics. The labeling of the vertices I googled. Or does anyone know of any program that I could make that circle appear that way and then it would convert it to Tikz/Latex ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Text on Side of a Triangle

Post by shadgrind »

Here's how I would do it, using projection modifiers to get the altitudes and their intersection:

Code: Select all

\documentclass[12pt]{amsart}
\usepackage{fullpage}
\usepackage{amsmath,tikz,fullpage,amsthm}
\usepackage{amssymb}
\usetikzlibrary{calc,intersections}
\begin{document}
\begin{tikzpicture}[bullet/.style={coordinate,after node path={(\tikzlastnode) node {$\scriptstyle \bullet$}}}, scale = 2]
 \draw [densely dotted,black] (0,0) circle (1cm);
 \coordinate[label=below left:$A$] (A) at (-.87,-.5);
 \coordinate[label=below right:$B$] (B) at (.87,-.5);
 \coordinate[label=above:$C$] (C) at (-.45,.9);
 \draw [semithick,black] (A) -- (B) -- (C) -- cycle;
 \path[name path=alta] (A) -- ($(B)!(A)!(C)$);
 \path[name path=altb] (B) -- ($(A)!(B)!(C)$);
 \draw[name intersections={of=alta and altb,by=x}] (A) -- (x) node[fill=white,pos=0.6,inner xsep=0pt,inner ysep=1.5pt,right=-7pt] {\small $\cos \alpha$};
 \draw (B) -- (x) node[fill=white,pos=0.5,inner xsep=0.5pt] {\small $\cos \beta$};
 \draw (C) -- (x) node[fill=white,pos=0.7,inner xsep=0pt,right=-7pt] {\small $\cos \gamma$};
\end{tikzpicture}
\end{document}
Note that if you needed the altitude from C you would use:

Code: Select all

\path[name path=altc] (C) -- ($(A)!(C)!(B)$);
I had to do some fiddling with the text placement so that the fill box around cos(alpha) doesn't clip the side AC as it does in the pdf you linked to. :)
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Text on Side of a Triangle

Post by localghost »

Just for notification. It is recommendable to replace the fullpage package with geometry for a much more flexible setup of paper and page dimensions.


Best regards and welcome to the board
Thorsten
3LeftsAndHome
Posts: 7
Joined: Wed Mar 24, 2010 4:10 am

Re: Text on Side of a Triangle

Post by 3LeftsAndHome »

Thank you so much for the helpful post. I cannot get my editor to output because of the intersections library. I get this error:

"c:\program files\miktex 2.7\tex\generic\pgf\modules\pgfmodulematrix.code.tex(5): Error: ! I can't find file `tikzlibraryintersections.code.tex'.
"c:\program files\miktex 2.7\tex\generic\pgf\modules\pgfmodulematrix.code.tex(5): Error: ! Emergency stop.
"c:\program files\miktex 2.7\tex\generic\pgf\modules\pgfmodulematrix.code.tex(1): Error: ! ==> Fatal error occurred, no output PDF file produced!

I found the file "tikzlibraryintersections.code.tex" online and downloaded it but I have no clue how to install this library. How do I get my editor to accept the intersections library?

Edit: Also how would I install a package? Say tkz-2d.sty?
Last edited by 3LeftsAndHome on Wed Mar 24, 2010 10:42 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Text on Side of a Triangle

Post by localghost »

The intersections library is part of the current CVS build of pgf/tikZ [1]. The complete package is available as a ZIP archive built according to the TeX Directory Structure (TDS) standard.

The current version also has a minimal support of intersections which is described in the manual (Section 12.2.4 - Intersection Coordinate Systems, p. 109ff).

[1] TikZ and PGF builds
3LeftsAndHome
Posts: 7
Joined: Wed Mar 24, 2010 4:10 am

Re: Text on Side of a Triangle

Post by 3LeftsAndHome »

I downloaded the latest build now what do I do? I found an install file but it's not and .exe file. Thank you so much for your help.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Text on Side of a Triangle

Post by localghost »

The CVS build is not necessary here. Just use polar coordinates for easier composition of the figure.

Code: Select all

\documentclass{minimal}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}[scale=2]
    \draw[densely dotted] (0,0) circle (1cm);
    \coordinate[label=below left:$A$] (A) at (215:1cm);
    \coordinate[label=below right:$B$] (B) at (325:1cm);
    \coordinate[label=above:$C$] (C) at (110:1cm);
    \draw[semithick] (A) -- (B) -- (C) -- cycle;
  \end{tikzpicture}
\end{document}
3LeftsAndHome
Posts: 7
Joined: Wed Mar 24, 2010 4:10 am

Re: Text on Side of a Triangle

Post by 3LeftsAndHome »

Thank you, but could you link me to a guide or website that show's how to update to the newest build so I can use the intersection library because I have no clue even what to search on how to update.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Text on Side of a Triangle

Post by localghost »

My second reply contains the links to all necessary documentation. The rest is up to you. Follow the instructions and you will get a ready-to-use installation of the CVS build. Especially for your LaTeX distribution you should read the MiKTeX 2.7 Manual.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Re: Text on Side of a Triangle

Post by shadgrind »

I'm afraid I can't help with MiKTeX, I've never used it. The links that localghost gave should help. Anyway, this is how the figure looks with the code I gave, just to give you an idea:
Attachments
cosTriangle.png
cosTriangle.png (5.7 KiB) Viewed 7520 times
Post Reply