基于答案http://tex.stackexchange.com/a/304044/103076通过 wrtlprnft,我有以下代码
\documentclass[tikz,margin=1cm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzstyle{arrowed double line}=[
dashed, double distance between line centers=3pt,
postaction=decorate,
decoration={
markings,
mark=between positions 10pt and -10pt step 20pt with {
\arrow[thin,yshift= 1.5pt,xshift=.8pt]{>}
\arrow[thin,yshift=-1.5pt,xshift=.8pt]{<}
},
},
]
\draw[arrowed double line] (0,0) -- (1,2);
\end{tikzpicture}
\end{document}
结果是:
我对虚线之间的模糊横线感到不满。我甚至不知道 tikz 为什么决定画出它们。
有办法除掉它们吗?
提前感谢所有回复。
PS 同样的事情也发生在双实线的端点
答案1
你可以尝试这个:
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
[arrowed double line/.style={% \tikzstyle is deprecated
preaction={
draw=black,
dashed,
double distance between line centers=3pt,
line width=.4pt,
},
draw=white,
line width=3pt,
postaction={
decorate,
},
decoration={
markings,
mark=between positions 10pt and -10pt step 20pt with {
\arrow [thin,black,yshift= 1.5pt,xshift=.8pt]{>}
\arrow [thin,black,yshift=-1.5pt,xshift=.8pt]{<}
},
},
}]
\path[arrowed double line] (0,0) -- (1,2);
\end{tikzpicture}
\end{document}
编辑
如果要去除线条末端的痕迹,可以使用shorten
负尺寸来表示白线。显然,这需要小心一点,以免覆盖图片中已有的任何内容。
例如,
\begin{tikzpicture}
[arrowed double line/.style={% \tikzstyle is deprecated
preaction={
draw=black,
dashed,
double distance between line centers=3pt,
line width=.4pt,
shorten >=0pt,
shorten <=0pt,
},
draw=white,
line width=3pt,
shorten >=-.1pt,
shorten <=-.1pt,
postaction={
decorate,
},
decoration={
markings,
mark=between positions 10pt and -10pt step 20pt with {
\arrow [thin,black,yshift= 1.5pt,xshift=.8pt]{>}
\arrow [thin,black,yshift=-1.5pt,xshift=.8pt]{<}
},
},
}]
\path[arrowed double line] (0,0) -- (1,2);
\end{tikzpicture}
产生以下行结尾: