# Line passing through the midpoints of a triangle

What i have done so far:

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{center}
\begin{tikzpicture}

\tkzDefPoint(2,3.5){A}
\tkzDefPoint(0,0){B}
\tkzDefPoint(4,0){C}

\tkzDrawSegments(A,B B,C A,C)
\tkzLabelPoints[above,yshift=0pt](A)
\tkzLabelPoints[left,yshift=4pt](B)
\tkzLabelPoints[right,yshift=4pt](C)

\tkzDefMidPoint(A,B) \tkzGetPoint{x}
\tkzDefLine[orthogonal=through x](A,B)

\tkzDefMidPoint(A,C) \tkzGetPoint{y}
\tkzDefLine[orthogonal=through y](A,C)

\tkzDrawLines(x,y)
\tkzLabelPoints[above,xshift=-2mm](x)
\tkzLabelPoints[above,xshift=2mm](y)
\end{tikzpicture}

\end{center}
\end{document}


Question: When you compile this, you will see that i successfully find two midpoints x and y of segment AB and AC respectively. The problem is the line passing through these two midpoints is slightly crossing both sides and i don't want this, i mean i am looking for only a segment between midpoints.

Simply replace \tkzDrawLines(x,y) with \tkzDrawSegment(x,y) to get this:
• @snehal No problem! Also, you don't need all the \tkzDefLines because the coordinates for the segment are already defined. :) – Alenanno Mar 23 '16 at 11:22