Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.)

share|improve this question

2 Answers 2

up vote 7 down vote accepted

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

share|improve this answer
    
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 at 20:41
    
@Dan pgf 3 is not included in tex distributions yet. you have to install it by your self. –  Harish Kumar Feb 12 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 at 11:23

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.

share|improve this answer

Your Answer

 
discard

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.