# Labeling a line segment which indicates it is the sum of two smaller line segments

TikZ compiles the following code and renders a line segment with endpoints $A$ and $C$ and with a point $B$ between these endpoints. It also marks the length of $\overline{AB}$ as $x$ and the length of $\overline{BC}$ as $y$.

Above this diagram, I would like to have the length of $\overline{AC}$ marked as $z$. The following is a description of how it should be marked. A "|" should be drawn above the endpoints, a line with arrowheads between the two "|" should be drawn, and the letter "z" should be set in the middle of this line. (I think the overlay command is used to set the letter "z".)

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\begin{tikzpicture}
\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}
\path (150:4.5) coordinate (A) (150:1.5) coordinate (B) (0:0) coordinate (C);
\draw (A)
-- (B) node [midway, above]{$x$} -- (C) node [midway, above]{$y$}  -- (A) -- cycle;
\node[mydot,label={below left:$A$}] at (A) {};
\node[mydot,label={below left:$B$}] at (B) {};
\node[mydot,label={below left:$C$}] at (C) {};
\end{tikzpicture}

\end{document}

-

Something like

\draw[|<->|] ($(A)!5mm!90:(C)$)--node[fill=white] {$z$} ($(C)!5mm!-90:(A)$);


### Explanation

($(A)!5mm!90:(C)$) is a new coordinate placed at 5mm of (A) and forming an angle of 90 degrees respect to the line (A) -- (C) (It corresponds to the upper extreme).

## Full Code

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\begin{tikzpicture}
\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}
\path (150:4.5) coordinate (A) (150:1.5) coordinate (B) (0:0) coordinate (C);
\draw (A)
-- (B) node [midway, above]{$x$} -- (C) node [midway, above]{$y$}  -- (A) -- cycle;
\node[mydot,label={below left:$A$}] at (A) {};
\node[mydot,label={below left:$B$}] at (B) {};
\node[mydot,label={below left:$C$}] at (C) {};
\draw[|<->|] ($(A)!5mm!90:(C)$)--node[fill=white] {$z$} ($(C)!5mm!-90:(A)$);
\end{tikzpicture}

\end{document}

-
What does "$(A)!5mm!90:(C)$" instruct TikZ to draw? What is 5mm? How does this instruct TikZ to draw a line parallel to $\overline{AC}$? What does "($(C)!5mm!-90:(A)$)" instruct TikZ to draw? –  user60254 Aug 30 '14 at 17:47
@user60254 View Edit for some explanation. –  skpblack Aug 30 '14 at 18:00