38

I use tkz-graph.sty from Altermundus. When I make an arrow from vertex A to vertex B, the arrow is too long: it goes from the center of A to the center of B. Can I shorten the arrow on both ends by a factor? In PSTricks, I used nodesep, but that doesn't work in a tikzpicture.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
Douglass
  • 501
  • 4
    Welcome to TeX&Co! I hope you enjoy your stay! If you post a MWE (Minimal Working Example) it would encourage people to change your code so that it works, rather than have to try to guess the setup you are interested in....(just some friendly advice) – Yossi Farjoun Nov 29 '10 at 21:20
  • 1
    Without an example it's hard to answer, but have you tried the anchors? Each node in TikZ has a set of anchors (refer to the excellent pgf manual), like "north", "west", "southeast" and so on. – Matten Nov 29 '10 at 22:10

1 Answers1

51

You can use the shorten > and shorten < options. For example

\documentclass{minimal}  
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \fill (0,0) circle (0.05);
  \fill (2,0) circle (0.05);
  \draw[shorten >=0.5cm,shorten <=1cm,->] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}

produces example.

However, there are few situations where you have to use that directly. Usually it is better to choose an anchor of the node (eg. mynode.east) and maybe set the inner sep and outer sep options of the nodes.

Maybe if you post an example of what you are trying to achieve, we can figure out what the best approach in that case is.

Caramdir
  • 89,023
  • 26
  • 255
  • 291