2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
LaTeX-examples/tikz/right-triangle/right-triangle.tex
Martin Thoma 7740f0147f Remove trailing spaces
The commands

find . -type f -name '*.md' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

and

find . -type f -name '*.tex' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

were used to do so.
2015-10-14 14:25:34 +02:00

53 lines
1.8 KiB
TeX
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{shapes, calc, decorations}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\newcommand\XC{4}
\newcommand\ALPHA{30}
\newcommand\XB{{(\XC*(cos(\ALPHA)*cos(\ALPHA) - sin(\ALPHA)*sin(\ALPHA)) + \XC)*0.5}}
\newcommand\YB{{sqrt(cos(\ALPHA)*\XC*cos(\ALPHA)*\XC - (\XC*(cos(\ALPHA)*cos(\ALPHA) - sin(\ALPHA)*sin(\ALPHA)) + \XC)*0.5*(\XC*(cos(\ALPHA)*cos(\ALPHA) - sin(\ALPHA)*sin(\ALPHA)) + \XC)*0.5)}}
% Draw the triangle
\draw[fill=gray!10] (0, 0) coordinate (A)
-- (\XB,\YB) coordinate (C)
-- (\XC, 0) coordinate (B)
-- (0, 0);
% Draw nodes
\node at (A)[anchor=north] {A};
\node at (B)[anchor=north] {B};
\node at (C)[anchor=south] {C};
% Draw edge text
\node (c) at ($(A)!0.50!(B)$) [below,font=\tiny] {Hy­po­te­nu­se};
\node (b) at ($(A)!0.50!(C)$) [above,rotate=\ALPHA,font=\tiny]
{Ankathete zu Winkel $\alpha$};
\node (a) at ($(B)!0.35!(C)$) [above,rotate={\ALPHA-90},font=\tiny]
{\parbox{2cm}{Gegenkathete\\ zu Winkel $\alpha$}};
% draw alpha
\draw[fill=green!30] (0,0) -- (0:0.75cm) arc (0:\ALPHA:.75cm);
\coordinate[label=right:$\alpha$] (Alpha) at (0.25,0.15);
% draw beta
\begin{scope}[shift={(\XC, 0)}]
\draw[fill=red!30] (0,0) -- (-180:0.50cm) arc (180:{180-(90-\ALPHA)}:0.5cm);
\draw (150:0.35cm) node {$\beta$};
\end{scope}
% draw gamma
\begin{scope}[shift={(\XB, \YB)}]
\draw[fill=blue!30] (0,0) -- ({180+\ALPHA}:0.5cm) arc ({180+\ALPHA}:{180+\ALPHA+90}:0.5cm);
\draw (-0.1, -0.05) node[below] {$\gamma$};
\end{scope}
\end{tikzpicture}
\end{preview}
\end{document}