TikZ relative coordinate system

When I use the command below:

\draw (apex)+(1mm,0) -- node {\$h\$} (center)+(1mm,0);

where (apex) and (center) is predefined appropriately, then I have a problem where +(1mm, 0) is not applied to the (center) although it is applied well to (apex). How can I solve this problem?

• Please make your code compilable next time! How should we know what you consider appropriate predefinitions? To answer this, people either have to create a minimal example, because you didn't provide one, or post without testing. – cfr Feb 28 '17 at 0:49

The line is first drawn to (center), then +(1mm,0) causes a move-to operation to the right by 1 mm.

TikZ library calc helps:

\usetikzlibrary{calc}

\draw (apex) +(1mm, 0) -- node {\$h\$} (\$(center) + (1mm, 0)\$);
% or
\draw (\$(apex) + (1mm, 0)\$) -- node {\$h\$} (\$(center) + (1mm, 0)\$);

Also a solution without library calc is possible, e.g. by using a temporary coordinate:

\draw (center) +(1mm, 0) coordinate (tmp)
(apex) +(1mm, 0) -- node {\$h\$} (tmp);

You can use the shift option for the coordinates.

\draw ([shift={(1mm,0)}]apex) -- node {\$h\$} ([shift={(1mm,0)}]center);

or

\draw ([xshift=1mm]apex) -- node {\$h\$} ([xshift=1mm]center);