答案1
好吧,它并不完美,但也许这可以让你开始:
Latex
基本上,我只是用后面跟着制作了一个箭头Triangle
,然后用它作为箭头线上的装饰(用白色绘制)。
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.markings}
\tikzset{mytip/.tip={Latex[{color=black, fill=white, length=5mm, width=1.5mm, sep=-.9mm}]Triangle[color=black, fill=white]},
myarrow/.style={white, decoration={transform={xshift=2.75mm}, markings, mark=at position .5 with {\arrow{mytip}}}, postaction=decorate}
}
\begin{document}
\begin{tikzcd}[arrows={myarrow}]
K\arrow[dr]\\
\Omega\arrow[u]\arrow[r] & k
\end{tikzcd}
\end{document}
答案2
我相信,您的第二个草图更容易实现。
主意:
- 获取路径的长度。(这仅允许一个段,即一条直线或一条曲线。)
- 使用该长度设置第二个箭头的长度。
不幸的是,当Triangle
尖端变得太尖时,头部会被斜切,但箭头尖端定义不会考虑到这一点,并会调整绘图,这就是我line join=round
在这里为两个部分使用的原因。
不过,PGF 仍然使用长度计算,就好像尖角会被斜切一样。
由于我没心情做数学运算来调整丢失的长度,所以我只使用 1.1 的系数将第二个尖端拉伸到大约所需的长度。在这个例子中,这对于直线来说效果很好,但对于曲线路径(使用)则不太好。但这也是我使用(通过)强制不绘制(剩余)线bending
的部分原因。draw=none
\tikz@mode@drawfalse
代码
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations,bending}
\usepackage{tikz-cd}
\makeatletter
\tikzset{
ararrow/.default={open}{open},
ararrow/.code 2 args={%
\tikz@addoption{%
\pgfset{tips=true}% draw tips even if the path isn't.
\pgfgetpath\currentpath
\pgfprocessround{\currentpath}{\currentpath}%
\pgf@decorate@parsesoftpath{\currentpath}{\currentpath}%
\pgfsetarrowsend{%. % dot not really needed when no line is drawn
Triangle[
length=1.1*(\pgf@decorate@totalpathlength-4pt+.5*\the\pgflinewidth),
line join=round,#1]
Triangle[angle'=60,length=+4pt,line join=round,#2]}%
\tikz@mode@drawfalse % disable drawing of path
}
},
ararrow **/.style={ararrow={}{}}, ararrow oo/.style={ararrow={open}{open}},
ararrow *o/.style={ararrow={}{open}}, ararrow o*/.style={ararrow={open}{}},
}
\makeatother
\begin{document}
\begin{tikzcd}[/tikz/arrows={[bend]}]
K \drar[ararrow o*] \ar[dr, ararrow **, controls={+(1.5,0.5) and +(1,0.8)}] \\
\Omega \rar[ararrow] \uar[ararrow o*] & k
\end{tikzcd}
\end{document}
输出
答案3
您可以创建自己的自定义装饰。通过以下操作,您可以使用选项自定义箭头的外观,如下图所示。
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations}
\newlength{\tailarrowtiplength}
\setlength{\tailarrowtiplength}{1em}
\newlength{\tailarrowtipwidth}
\newlength{\tailarrowtailwidth}
\newlength{\tailarrowjointwidth}
\pgfdeclaredecoration{tail arrow decoration}{initial}{
\state{initial}[width=\pgfdecoratedpathlength, next state=final] {
\pgfpathlineto{\pgfpoint{0pt}{0.5\tailarrowtailwidth}}
\pgfpathlineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-1\tailarrowtiplength}{0.5\tailarrowjointwidth}}}
\pgfpathlineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-1\tailarrowtiplength}{0.5\tailarrowtipwidth}}}
\pgfpathlineto{\pgfpointdecoratedpathlast}
\pgfpathlineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-1\tailarrowtiplength}{-0.5\tailarrowtipwidth}}}
\pgfpathlineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-1\tailarrowtiplength}{-0.5\tailarrowjointwidth}}}
\pgfpathlineto{\pgfpoint{0pt}{-0.5\tailarrowtailwidth}}
\pgfpathclose
}
\state{final} {
\pgfpathmoveto{\pgfpointdecoratedpathlast}
}
}
\tikzset{
tail arrow tip length/.code={
\setlength{\tailarrowtiplength}{#1}
},
tail arrow tip width/.code={
\setlength{\tailarrowtipwidth}{#1}
},
tail arrow tail width/.code={
\setlength{\tailarrowtailwidth}{#1}
},
tail arrow joint width/.code={
\setlength{\tailarrowjointwidth}{#1}
},
tail arrow tip length/.default={ 2em },
tail arrow tip width/.default={ 2em },
tail arrow tail width/.default={ 1em },
tail arrow joint width/.default={ .2em },
tail arrow/.style={
tail arrow tip length,
tail arrow tip width,
tail arrow tail width,
tail arrow joint width,
decorate,
decoration={tail arrow decoration}
}
}
\begin{document}
\begin{tikzpicture}
\draw[tail arrow, tail arrow tip width=4em, tail arrow tip length=1em, tail arrow joint width=0.5em] (0,-1) -- (5,-2);
\draw[tail arrow] (0,0) -- (5,0);
% description of options
\draw[|-|, red] ([shift={(-2em,-1.5em)}]5,0) -- ([shift={(0em,-1.5em)}]5,0) node[below, midway, font=\ttfamily\scriptsize, align=center] {tail arrow \\ tip length};
\draw[|-|, red] ([shift={(0.5em,-1em)}]5,0) -- ([shift={(0.5em,1em)}]5,0) node[right, midway, font=\ttfamily\scriptsize, align=left] {tail arrow \\ tip width};
\draw[|-|, red] ([shift={(-2.5em,-0.1em)}]5,0) -- ([shift={(-2.5em,0.1em)}]5,0) node[above left, pos=0, font=\ttfamily\scriptsize, align=right] {tail arrow \\ joint width};
\draw[|-|, red] ([shift={(-0.5em,-0.5em)}]0,0) -- ([shift={(-0.5em,0.5em)}]0,0) node[left, midway, font=\ttfamily\scriptsize, align=right] {tail arrow \\ tail width};
\end{tikzpicture}
\end{document}
应用于tikzcd
上下文中,你可以执行以下操作:
\documentclass[border=10pt]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{decorations}
% [above definitions]
\begin{document}
\begin{tikzcd}[arrows={tail arrow, tail arrow tip width=.75em, tail arrow tail width=.5em, tail arrow tip length=1em}]
K\arrow[dr]\arrow[d]\\
\Omega\arrow[r] & k
\end{tikzcd}
\end{document}