This is taken more-or-less directly from the tkz-euclide
documentation (texdoc -s euclide
):
\documentclass[border=2mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\newcommand{\incenter}[4]{%
\begin{tikzpicture}
\tkzInit[xmax=5,ymax=4]
\tkzClip
\tkzDefPoint(0,0){#2} %% Put the coordinates here
\tkzDefPoint(5,1){#3} %% for the desired
\tkzDefPoint(1,4){#4} %% triangle.
\tkzDrawPolygon[color=red](#2,#3,#4)
\tkzInCenter(#2,#3,#4)
\tkzGetPoint{G}
\tkzDrawPoint(G)
\node[below] at (G) {#1};
\end{tikzpicture}
}
\begin{document}
\incenter{name}{a}{b}{c}
\end{document}
One more thing. If you want to specify an arbitrary triangle with \incenter
, then you could try this:
\documentclass[border=2mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\newcommand{\incenter}[2]{%
\begin{tikzpicture}
\foreach \x/\y [count=\i from 1] in {#2}{\tkzDefPoint(\x,\y){n-\i}}
\tkzInit[xmax=5,ymax=4]
\tkzClip
\tkzDrawPolygon[color=red](n-1,n-2,n-3)
\tkzInCenter(n-1,n-2,n-3)
\tkzGetPoint{G}
\tkzDrawPoint(G)
\node[below] at (G) {#1};
\end{tikzpicture}
}
\begin{document}
\incenter{Incenter!}{0/0.5,5/3,1/4}% {label}{x_1/y_1,x_2/y_2,x_3/y_3}
\end{document}
tkz-euclide
package.shapes.geometric
, I think. Buttkz-euclide
is probably the answer. (Unfortunately for me, much of the documentation is only available in French.)