我知道如何将调整大小的箭头尖端放在虚线的一端,但不能放在两端。见下图。
\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}
答案1
使用
between positions
:要添加多个装饰(在本例中为两端各一个),您可以使用:
mark=between positions 0 and 1 step 1 with {\arrow[line width=0.1mm, 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]{>}}
得出正确的箭头方向:
请注意,在这种情况下,尺寸并不完全符合要求。因此,您可以调整坐标来更改线的起始位置,或者使用某些方法(例如选项)
shorten
来调整线的长度。两个相同的商标:
或者,你可以使用通常的星际迷航解决方案反转极性” 其中一个商标,具体说明如下
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]{>}}
参考:
另一种选择是定义您自己的自定义箭头,您可能想要参考:
代码:
\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}