5

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}

Petoetje59
  • 1,051

1 Answers1

5
  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}
Peter Grill
  • 223,288