# How does the shorten option work?

Many sample TikZ images use the shorten option in the tikzpicture options.

Even though I can figure out roughly how it works and what it is supposed to do by looking at many examples, I was surprised to discover that it is not really documented in the PGF 3.0.1 manual (at least, my many searches for shorten in the manual turn up only examples and style definitions containing it).

Can someone explain the syntax to me? And where is shorten allowed to appear?

(If my searching technique is poor and shorten is indeed documented in the PGF manual, I would be grateful for the reference.)

shorten < and shorten > are not directly described in the manual as far as I can see, but it looks like they are interfaces to \pgfsetshortenstart and \pgfsetshortenend respectively, which are documented in the end of section 99.3 Arrow Tips on a Path (manual for version 3.0.1a, dated 29 August 2015).

• shorten <= <length> reduces the length of the path by <length>, by moving the start point. For example shorten <=1cm will set the start of the drawn line to 1cm from the specified coordinate.
• shorten > is the same, for the end point.
• Using negative values will lengthen the line.

Note however that this only applies to straight lines. When the lines are not straight, the new endpoint is found on the tangential line, not along the actual path, as Qrrbrbirlbel says in a comment.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[very thick]
\draw[help lines] (0,0) grid (4,3);

\draw [blue,shorten <=0.5cm] (1,2.7) -- (3,2.7);
\draw [red,shorten >=0.5cm] (1,2.2) -- (3,2.2);

\draw [cyan,shorten <=-0.5cm] (1,1.7) -- (3,1.7);
\draw [shorten >=-0.5cm] (1,1.2) -- (3,1.2);

\draw [shorten >=0.5cm] (1,0) to[out=90,in=90] (3,0);
\draw [dotted] (1,0) to[out=90,in=90] (3,0);

\end{tikzpicture}
\end{document}


• Reducing/lengthening a path is only true for straight lines: \path[bend left=100] (0,0) edge (1,0) edge[thick, blue, shorten >=.5cm] node[pos=.75,circle,inner sep=0pt,fill=white] {} (1,0) (1,0) edge[line to,thin,red] ++(80:.5cm); It moves the start/end point on a tangential line. It also does not change the placement timers. – Qrrbrbirlbel May 24 '16 at 17:31
• @Qrrbrbirlbel Thanks, should have considered that as well. Will edit later. – Torbjørn T. May 24 '16 at 18:06
• Note that shorten< won't work - it's got to be shorten < (note the space). Tripped me up for a bit! – ASGM Aug 8 '19 at 19:53