答案1
我仍然不太确定角点的逻辑含义是什么,但这里有三个想法:
真正的幻影箭头,即只有箭头尖而没有绘制线的路径。
对于某些变化,我将定义角、角点以及点角提示以及它们的 TikZ-CD 样式。
第一张图显示了它们的用法和外观。
一个角和一个点的图片。它将通过标签放置在四个角之一处。
它有两种变体:
dot corner
和dot corner'
。前者将放置在 TikZ 矩阵的单元格内,另一个将放置在后面。两者都有其优点和缺点。dot corner
该图片通过或样式沿路径放置dot corner*
。如果它们直接放置在开始或结束处,它们看起来像 1。但实际上它们可以沿着整个路径放置。
代码
\documentclass{article}
\usepackage{tikz-cd}
%%% Idea 1 (arrow tips)
\tikzcdset{
only tips/.style={/pgf/tips=true, /tikz/draw=none},
Corner/.tip={Straight Barb[angle'=90, round]},
Corner Dot/.tip={Circle[length=+0pt +3, sep=+0pt +1.5] Corner[]},
Dot Corner/.tip={Corner[reversed, sep=+0pt +1.5] Circle[length=+0pt +3]},
rightcorner/.style={only tips, /tikz/arrows= -Corner},
leftcorner/.style={only tips, /tikz/arrows=Corner-},
leftrightcorner/.style={only tips, /tikz/arrows=Corner-Corner},
rightcornerdot/.style={only tips, /tikz/arrows= -Corner Dot},
leftcornerdot/.style={only tips, /tikz/arrows=Corner Dot-},
leftrightcornerdot/.style={only tips, /tikz/arrows=Corner Dot-Corner Dot},
rightdotcorner/.style={only tips, /tikz/arrows= -Dot Corner},
leftdotcorner/.style={only tips, /tikz/arrows=Dot Corner-},
leftrightdotcorner/.style={only tips, /tikz/arrows=Dot Corner-Dot Corner}}
%%% Idea 2
\tikzset{
pic/.is if=tikz@node@is@pic,
dot corner/.pic={% also Idea 3
\path[pic actions,draw=none,shade=none,-]
(-1.5\pgflinewidth,1.5\pgflinewidth) circle[radius=1.5\pgflinewidth];
\path[pic actions,fill=none,shade=none,-,line cap=round,line join=round]
(-7.5\pgflinewidth,0pt) |- (0pt,7.5\pgflinewidth);},
dot corner'/.code={\arrow[to path={node also[dot corner={#1}](\tikztostart)}]},
dot corner/.cd, .is choice,
north west/.style={label={[draw,fill,pic]north west:dot corner}},
south west/.style={label={[draw,fill,pic,yscale=-1]south west:dot corner}},
north east/.style={label={[draw,fill,pic,xscale=-1]north east:dot corner}},
south east/.style={label={[draw,fill,pic,xscale=-1,yscale=-1]south east:dot corner}}}
\tikzcdset{dot corner'/.style={to path={node also[dot corner={#1}](\tikztostart)}}}
%%% Idea 3
\tikzcdset{
/tikz/pics/dot corner*/.style={/tikz/sloped, /tikz/allow upside down,
/tikz/rotate=45, /tikz/draw, /tikz/fill, dot corner},
dot corner/.style ={path only, /tikz/every to/.append style={
edge node={pic[{draw,fill,#1}]{dot corner*}}}},
dot corner*/.style={path only, /tikz/every to/.append style={
edge node={pic[{draw,fill,xscale=-1,#1}]{dot corner*}}}}}
\begin{document}
\begin{tikzcd}[every matrix/.append style={label=below:Idea 1}]
A \rar[leftrightdotcorner] \dar[rightcorner]
& B \dar[leftrightcornerdot] \\
C \rar[rightcornerdot]
& D \ular[leftdotcorner]
\end{tikzcd}\quad
\begin{tikzcd}[every matrix/.append style={label=below:Idea 2 (inside cell)}]
|[dot corner=south east]| A \rar \dar
& B \dar \\
C \rar
& |[dot corner=north west]| D
\end{tikzcd}\quad
\begin{tikzcd}[every matrix/.append style={label=below:Idea 2 (later)}]
A \rar \dar \ar[dot corner'=south east]
& B \dar \\
C \rar
& |[dot corner'=north west]| D
\end{tikzcd}\quad
\begin{tikzcd}[every matrix/.append style={label=below:Idea 2/3}]
|[dot corner/.list={north west, north east, south west, south east}]| A \rar \dar
& B \dar \\
C \rar \urar[dot corner*=near start, dot corner=near end]
& |[dot corner'/.list={north west, north east, south west, south east}]|D
\end{tikzcd}
\end{document}
代码(仅限想法 2)
\documentclass{article}
\usepackage{tikz-cd}
\tikzset{
pic/.is if=tikz@node@is@pic,
dot corner/.pic={
\path[pic actions,draw=none,shade=none,-]
(-1.5\pgflinewidth,1.5\pgflinewidth) circle[radius=1.5\pgflinewidth];
\path[pic actions,fill=none,shade=none,-,line cap=round,line join=round]
(-7.5\pgflinewidth,0pt) |- (0pt,7.5\pgflinewidth);},
dot corner'/.code={\arrow[to path={node also[dot corner={#1}](\tikztostart)}]},
dot corner/.cd, .is choice,
north west/.style={label={[draw,fill,pic]north west:dot corner}},
south west/.style={label={[draw,fill,pic,yscale=-1]south west:dot corner}},
north east/.style={label={[draw,fill,pic,xscale=-1]north east:dot corner}},
south east/.style={label={[draw,fill,pic,xscale=-1,yscale=-1]south east:dot corner}}}
\tikzcdset{dot corner'/.style={to path={node also[dot corner={#1}](\tikztostart)}}}
\begin{document}
\begin{tikzcd}[every matrix/.append style={label=below:Idea 2 (inside cell)}]
|[dot corner=south east]| A \rar \dar
& B \dar \\
C \rar
& |[dot corner=north west]| D
\end{tikzcd}\quad
\begin{tikzcd}[every matrix/.append style={label=below:Idea 2 (later)}]
A \rar \dar \ar[dot corner'=south east]
& B \dar \\
C \rar
& |[dot corner'=north west]| D
\end{tikzcd}
\end{document}