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 saw someone use this scripts to generate big arrows, but it seems quite tricky to me. And I also hope the arrow is not filled. Any good ideas?

\draw[
    -triangle 45,
    line width=1.0mm,
    postaction={draw, line width=0.25cm, shorten >=0.8cm, -}
] (2,-2) -- (2.5,-2);

Something like

------\
------/
share|improve this question
    
Does How to make an arrow bigger and change its color in TikZ? solve this issue? –  Peter Grill Mar 14 '13 at 3:43
    
No, I've seen that post before. –  Daniel Mar 14 '13 at 3:47
1  
@PeterGrill and this: Is it possible to change the size of an arrowhead in TikZ/PGF? –  Qrrbrbirlbel Mar 14 '13 at 4:09
add comment

1 Answer

up vote 4 down vote accepted

The code first draws a relatively short line of 0.5 mm length with a ridiculous big line width of 1.0 mm which looks like

enter image description here

(The line width is used to a part in the calculation of the arrow tip size. This is an often used trick to get big arrow tips.)

The actual line lies under the arrow tip that is so big that it totally hides the line, with an opacity=.5 setting we can see it (remember that the arrow itself contains of a line and a filled area, the filled area and the line create a darker triangle).

enter image description here

When this is done the same path is used again (postaction), but with different settings:

  • a line width of 2.5 mm instead of 1 mm,
  • no arrow (-), and
  • the > part (in this case the end lies at (2.5,-2) is shorten by the amount of 8 mm.

The draw mode is used in the “normal action” because it is explicitly used with \draw but the postaction does not inherit this setting, but only the path itself.

This creates

enter image description here

The actual addition line due to postaction can be best seen if we draw it in another color (or use again opacity); with draw=green we see that it acutally overlaps the arrow:

enter image description here

Observe what happens if I remove the shorten > option (or set it to 0pt):

enter image description here

Now, the actual end is at the tip of the arrow and with shorten >=0.8cm it is set 8 mm to the left. But as our line is only 5 mm long we actually get a reversed line of –3 mm length. The postaction does not know about our arrow anymore and can’t shorten the line as it does normally automatically.

Weird! This is probably not the most sufficient way to draw a big arrow. For these kinds of arrows we could have used the single arrow shape of the shapes.arrows library.

Your update implies (huh!) a totally different approach:

\tikz\draw[line width=1mm,-implies,double, double distance=1mm] (0,0) -- (1,0);

which produces

enter image description here

The double distance describes the distance between the doubled lines that are drawn with the usual line width (default: thin = .4pt, here 1mm).

What actually happens:

  • a line with the line width of 2 * 'line width' + 'inner distance' is drawn
  • a line with the line width of inner distance is drawn over it
  • (and the arrow actually shortens the line too but that's a totally different chapter, see above)

We can add opacity=.5 to highlight that again:

enter image description here

Code

Neither the arrow tip nor a post action updates the bounding box, which is the reason I had to use a relatively thick border of 6pt. This usually creates no problems in normal TikZ pictures.

\documentclass[tikz,border=6pt]{standalone}
\usetikzlibrary{arrows}
\tikzset{every picture/.append style={opacity=.5}}
\begin{document}
\tikz\draw[
    -triangle 45,
    line width=1.0mm,
    postaction={draw=green, line width=0.25cm, shorten >=0.0cm, -}
] (2,-2) -- (2.5,-2);
\tikz\draw[line width=1mm,-implies,double, double distance=1mm] (0,0) -- (1,0);
\end{document}
share|improve this answer
add comment

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.