TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Assume that we have two coordinates (a) and (b). I want to draw a line which is a parallel translation of the line which connects (a) and (b).

I would like to have something like \drawparallel{a}{b}{dist} which will draw a line parallel to the one connecting (a) and (b) at (signed!) distance dist.

I tried many things both based on \newcommand and on \tikzset but could not make it work.

Edit: To make it clearer, I want the the four points (two of the original line segment, and two of its translated copy) will form a rectangle.

share|improve this question
What's parallel? Is \draw ([xshit=dist]a)--([xhsift=dist]b); enough? – Ignasi May 31 '13 at 10:52
@Ignasi: Actually no. With your solution the four points (two of the original curve and two of the translated one) form (in general) a parallelogram. I want them to form a rectangle. – Dror May 31 '13 at 11:35
You can use this one but without the connecting lines tex.stackexchange.com/questions/55068/… – percusse May 31 '13 at 11:57
up vote 3 down vote accepted

Indeed, as pointed out by @percusse, Jake's answer solved my problem. In particular, I added the following

        to path=%
        -- ($(\tikztotarget)!($(\tikztostart)!#1!90:(\tikztotarget)$)!90:(\tikztostart)$)


\draw (a) -- (b);
\draw (a) to[ncbar=1] (b);

yielded the right result.

enter image description here

share|improve this answer
It is simpler to specify the end of the parallel path as ($(\tikztotarget)!#1!270:(\tikztostart)$) – Andrew Swann Jun 5 '13 at 12:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.