I'd like to be able to draw lines in LaTeX by specifying an angle, rather than specifying it like so


Is this possible? I've looked at tikz and tikz-euclid. I've even tried installing tikz-euclid, but I couldn't even do that (I found these but couldn't find the .ins for tikz-euclid). And I'm not sure if that's what I want anyway.

What do I need to do to accomplish this?


You can read about it in the pgf manual, Section 13: Specifying Coordinates.

An example:


    % Draw a line at 30 degrees and of length 3
    \draw (0,0) -- (30:3cm);

You can also use the relative coordinates:

    % Draw the first line with absolute coordinates and the 
    % second with relative coordinates to the first line
    \draw (0,0) -- (30:3cm) -- ++(80:3cm);
  • 1
    This is like some kind of special magic. Thank you so much. – Pureferret Feb 8 '12 at 23:31
  • You're welcome, although I could not find, how to specify a relative angle to the previous line. If you find it, please post here. :) – gns-ank Feb 8 '12 at 23:42
  • 2
    As a note, this only works when the line originates at the origin. So the example is correct if it starts at (0,0) but if you were to write \draw (-2,0) -- (30:3cm); the line has the wrong angle. It points toward the end point it would have if it started at the origin. – Ian Durham Sep 29 '13 at 19:15
  • 10
    The point is that (30:3cm) defines a point in polar coordinates with respect to the origin. What want in this case is to use relative coordinates and to preceed the coordinate with ++. So, the command in your case is \draw (-2,0) -- ++(30:3cm); – gns-ank Sep 30 '13 at 12:24

Here is a very minimal example showing how this can be done using pstricks:

enter image description here

\usepackage{pstricks}% http://ctan.org/pkg/pstricks
  \psgrid % For reference; shows a coordinate grid
  \SpecialCoor % Allows for specifying polar coordinates (r;t)

\SpecialCoor adds a polar coordinate reference to the existing Cartesian (x,y)-coordinate specification. The difference is specified using (r;t) (r = length; t = angle) rather than (x,y). Measurements in the above MWE is in centimetres (default).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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