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 know how to put a resized arrow tip at one end of a dashed line, but not at both ends. See the image below.

\documentclass[pdftex,12pt,a4paper,english,dutch,leqno]{article}
\usepackage[top=1cm,right=1cm,bottom=1cm,left=1.5cm,noheadfoot]{geometry}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings,patterns,calc}

\begin{document}

{\begin{tikzpicture}[>=angle 60]

\draw[<->,line width=0.15mm,dashed,dash pattern=on 1mm off 0.5mm] (0,0.5)--(5,0.5) node[right] {Default arrows are too small};

\draw[line width=0.15mm,dashed,dash pattern=on 1mm off 0.5mm,decoration={markings,mark=at position 1 with {\arrow[line width=0.1mm,scale=1.5]{>}}},postaction={decorate}] (0,0)--(5,0) node[right] {How to put arrows like this at both ends ?};

\end{tikzpicture}

\end{document}

share|improve this question
    
Try mark=between positions 0 and 1 step 1. –  Peter Grill Oct 16 '12 at 16:21
1  
decoration={markings,mark=at position 0 with {\arrow[line width=0.1mm,scale=1.5]{<}},mark=at position 1 with {\arrow[line width=0.1mm,scale=1.5]{>}}},postaction={decorate} –  Alain Matthes Oct 16 '12 at 16:22
    
@AlainMatthes: Hmmm, your solution is better. You want to add that as an answer, and I will delete mine. For some reason, i took me a while to see how your solution would reverse the arrow tip!! –  Peter Grill Oct 16 '12 at 18:21
    
@PeterGrill You can add the little modification in your answer. –  Alain Matthes Oct 16 '12 at 20:36
    
@AlainMatthes: Done. But your solution ended up producing a longer arrow, so I left mine as well. –  Peter Grill Oct 16 '12 at 22:11

1 Answer 1

up vote 3 down vote accepted
  1. Use between positions:

    To add multiple decorations, in this case one either end, you could use:

    mark=between positions 0 and 1 step 1 with {\arrow[line width=0.1mm, scale=1.5]{>}}
    

    enter image description here

    which isn't quite the desired result since the markings are not intended to be the same at both positions.

  2. Two distinct marks:

    As Alain Matthes commented, you can apply two different markings with the direction of the arrow reversed:

    mark=at position 0 with {\arrow[line width=0.1mm, scale=1.5]{<}},
    mark=at position 1 with {\arrow[line width=0.1mm, scale=1.5]{>}}
    

    which yields the correct arrow directions:

    enter image description here

    Note that in this case the size was not quite what was desired. So you could either adjust the coordinates to change the starting position of the line, or use some method such as the shorten option to adjust the length of the line.

  3. Two identical marks:

    Alternatively, you can use the usual Star Trek solution of "reversing the polarity " of one of the marks by specifying scale=-1.5:

    mark=at position 0 with {\arrow[line width=0.1mm, scale=-1.5]{>}},
    mark=at position 1 with {\arrow[line width=0.1mm, scale= 1.5]{>}}
    

    enter image description here

References:

Another option would be to define your own custom arrow for which you might want to refer to:

Code:

\documentclass{article}
\usepackage[top=1cm,right=1cm,bottom=1cm,left=1.5cm,noheadfoot]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings,patterns,calc}

\begin{document}

\begin{tikzpicture}[>=angle 60]

\draw[<->,line width=0.15mm,dashed,dash pattern=on 1mm off 0.5mm] (0,0.5)--(5,0.5) 
        node[right] {Default arrows are too small};

\draw[line width=0.15mm,dashed,dash pattern=on 1mm off 0.5mm,
      decoration={markings,
          mark=at position 0 with {\arrow[line width=0.1mm, scale=-1.5]{>}},
          mark=at position 1 with {\arrow[line width=0.1mm, scale= 1.5]{>}}
        },
      postaction={decorate}
    ] 
    (0,0)--(5,0) node[right] {Here is how to put arrows like this at both ends};

\end{tikzpicture}

\end{document}
share|improve this answer
    
Thx, works like a charm. –  Petoetje59 Oct 16 '12 at 17:39

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.