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

I would like to use PSTricks to draw a line. However, I only have one point, but I know at which angle I want to draw the line, and how long I want it.

Is there some way to draw a line from a point (x,y) at a given angle, for a given length?

Are there any macro packages that would help me out here?

share|improve this question
The title may be better phrased as "In PSTricks, how to draw a line from a point at a given slope angle?" – xport Dec 25 '10 at 16:25

PSTricks has polar coordinates: see page 13 in the manual.


produces alt text

which will require that you move the coordinate system so that the origin is at the point you have.

Otherwise, you could use the more elaborate options of \SpecialCoor, listed at pp. 72. specifically the ([par]node) notation which describes

The position relative to node determined using the angle, nodesep and offset parameters. E.g., ([angle=45]A),

but requires that you define the current point you have as a named node (not so painful).




creates: alt text

share|improve this answer

it is possible to draw a vectorline which always starts at the last current point. It needs only one coordinate the other one is the current point. All points are internally saved as nodes, which can be used later.

alt text




 \psStartPoint[A](1,1)% nodes have the base name A

 \psStartPoint[B](1,1)\psset{markAngle}% nodes have the base name B


share|improve this answer
How to make a series of \psVectors enclosed by \pscustom still work? In my attempt, all the tails become at the same point rather than what they are supposed to be. – kiss my armpit Jul 18 '12 at 11:22
I do not really understand what you want to achieve. However, I cannot test anything in the next few weeks, I have no running TeX system – Herbert Jul 18 '12 at 14:23
Actually I want to use \psVectors inside the \pscustom for my answer here. But they do not work in \pscustom. As a replacement, I used \rlineto and it works. – kiss my armpit Jul 18 '12 at 14:34
there is absolutely no need for using \psVector inside a \pscustom ... – Herbert Aug 9 '12 at 10:35

you need to know a little bit of postscript language and reverse polish notation:

\def\Angle{45} % angles are in degrees
% define point A
% define point B 
\cnode*(! \Length\space \Angle\space cos mul \xA\space add \Length\space \Angle\space  sin mul \yA\space add){0pt}{B}%
% draw line
share|improve this answer
In TikZ, this is as simple as dropping into polar coordinates for some part of the path: \tikz \draw (0,0) -- (1,1) -- ++(canvas polar cs:angle=90,radius=1cm) -- +(1,0); or, concisely, \tikz \draw (0,0) -- (1,1) -- ++(90:1cm) -- +(1,0);. Is there not a similar way to use polar coordinates with PStricks that doesn't involve manually invoking cos and sin? – Sharpie Oct 7 '10 at 5:26
it is never bad to know a little bit more than the proposed "easy" techniques. – pluton Oct 7 '10 at 12:08

I think the simplest method is to use \SpecialCoor, polar coordinate form, and origin option as illustrated in the following example.


% draw a line from a point (1,2) at angle 45 degrees and of length 3 unit. 


alt text

Edit 1:

To make sure the line length is 3 cm, I draw a red circle of radius 3 cm.

alt text

share|improve this answer
I believe my answer is the simplest one. :-) – xport Dec 26 '10 at 19:49

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.