8

I am trying to draw an arrow in a Tikz diagram but I would like it to be skewed as shown below.

enter image description here

I searched Google but couldn't find any info about how to skew objects in Tikz.

Is such a thing possible?

(For reference the image above was made in inkscape.)

8

You could try a canvas transformation but you'd have to recalculate all the coordinates which would probably be a nightmare.

Or...

You can slant arrow heads with the arrows.meta library in PGF 3.0. However, skewing the non-arrow head end needs be faked using another arrow tip. This won't work if the slanting is much greater that +/-0.5 (there will be a small gap) but this can be customized (see the manual for details).

\documentclass[tikz,border=0.125cm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[line width=4pt]
\draw [red!50!black, -Stealth] (0,0) -- (3,0);
\draw [green!50!black, -{Stealth[slant=-0.5]}] (0,1) -- (3,1);
\draw [blue!50!black, {Square[slant=-0.5,length=\the\pgflinewidth]}-{Stealth[slant=-0.5]}] (0,2) -- (3,2);
\end{tikzpicture}
\end{document}

enter image description here

  • This solution looks good but unfortunately I can't try it. It appears my PGF version is only 2.10 even though I just updated my LaTeX distribution (Miktex 2.9). Do know how I can update PGF? – Dan Feb 12 '14 at 20:41
  • @Dan pgf 3 is not included in tex distributions yet. you have to install it by your self. – user11232 Feb 12 '14 at 23:43
  • This solution works perfectly but note that it is necessary to specify the line thickness before the arrow styles so that the Square line end is the correct thickness. – Dan May 13 '14 at 11:23
1

This is a little bit of a work around, but if you install the Inkscape to TikZ exporter, you can create your arrow or any shape (as you normally would) and then you can save that file as a TikZ .tex file, which will give you the code for your arrow.

There's a step by step guide here. The three files you need to download are on the left hand side of the web page under the title Links. If you run into trouble with this, then upload the inkscape file of the arrow and I'll produce the code for you.

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.