我在 PGF/TikZ 3.0 中有这种箭头样式:
\tikzset{myline/.style={double distance=0.8pt, line width=0.4pt, -{>[length=2.5pt,width=4pt]}}}
它产生这样的结果:
如您所见,双线超出了箭头尖端。我该如何调整我的样式以缩短双线?当然,我希望箭头尖端保持在同一位置:
答案1
解决方案 2:decoration
这是使用\arrow
并缩短路径的解决方案。
\documentclass[varwidth,border=20]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}
\tikzset{
myline/.style={double distance=0.8pt, line width=0.4pt, -{>[length=2.5pt,width=4pt]}},
myline2/.style={shorten >= 1.4pt,
double distance=0.8pt, line width=0.4pt, postaction=decorate,
decoration={
markings,
mark=at position 1 with {\arrow{>[line width=0.4pt, length=2.5pt,width=4pt]}}
}
},
point/.style={insert path={node[circle, inner sep=.1pt, draw=red, ultra thin]{}}}
}
\begin{document}
\begin{tikzpicture}[transform canvas={scale=2}]
\draw[myline] (-.25,.1) to[bend left] (.25,.1) [point];
\draw[myline2] (-.25,-.1) to[bend right] (.25,-.1) [point];
\end{tikzpicture}
\end{document}
解决方案 1:decoration
这是使用移位的解决方案\arrow
。
\documentclass[varwidth,border=20]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}
\tikzset{
myline/.style={double distance=0.8pt, line width=0.4pt, -{>[length=2.5pt,width=4pt]}},
myline2/.style={
double distance=0.8pt, line width=0.4pt, postaction=decorate,
decoration={
markings,
mark=at position 1 with {\arrow[xshift=1.4pt]{>[line width=0.4pt, length=2.5pt,width=4pt]}}
}
},
point/.style={insert path={node[circle, inner sep=.1pt, draw=red, ultra thin]{}}}
}
\begin{document}
\begin{tikzpicture}[transform canvas={scale=2}]
\draw[myline] (-.25,.1) to[bend left] (.25,.1) [point];
\draw[myline2] (-.25,-.1) to[bend right] (.25,-.1) [point];
\end{tikzpicture}
\end{document}
答案2
您可以改用 Implies 箭头。或者在带有点的箭头前停止该行:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=2]
\tikzset{myline/.style={double distance=0.8pt, line width=0.4pt, -{>[length=2.5pt,width=4pt]}
}}
% axes
\draw[red](1,-1)--(1,1);
\draw[myline] (0,0) -- (1,0);
\draw[double distance=0.8pt, line width=0.4pt, -{.>[length=2.5pt,width=4pt]}] (0,0.2) -- (1,0.2);
\draw[double distance=0.8pt, line width=0.4pt, -{Implies[length=2.5pt,width=4pt]}] (0,0.4) -- (1,0.4);
\end{tikzpicture}
\end{document}