1

My question is basically equivalent to this solved one. I adapted that code as

\newcommand*{\po}{\mbox{\LARGE{$\mathrlap{\cdot}\ulcorner$}}}

with tikzcd \ar[dr, phantom, "\po", very near end] but it looks ugly

enter image description here

If I add \ before \cdot:

\newcommand*{\po}{\mbox{\LARGE{$\mathrlap{\ \cdot}\ulcorner$}}}

it becomes a bit better:

enter image description here

but still, the cdot is too low vertically; I want it to be in a better position relative to the ulcorner as that solved one. How to fix this? Thanks!

Lao-tzu
  • 333
  • Is the symbol part of the arrow or part of the node? Since you're already using TikZ, this symbol can be constructed entirely with lines and dots from TikZ. – Qrrbrbirlbel May 14 '23 at 11:22
  • I think it's kind of phantom arrow. Can you be more specific on the fix? I don't quite understand what you mean. – Lao-tzu May 14 '23 at 12:15

1 Answers1

1

I am still not quite sure what the logical meaning of the corner dot is but here are three ideas:

  1. An actual phantom arrow, i.e. a path that only has the arrow tips but no drawn line.

    For some variaty I'll define the Corner, the Corner Dot as well as the Dot Corner tip and also their TikZ-CD styles.

    The first diagram shows how they are used and how they look.

  2. A pic of a corner and a dot. It will be placed via a label at one of the four corners.

    It has two variants: dot corner and dot corner'. The former will be placed inside the cell of the TikZ matrix, the other one will be placed later. Both have their advantages and disadvantages.

  3. The pic placed along a path via the dot corner or dot corner* style.

    They look like 1. if they're placed directly at the start or the end but in fact they can placed along the whole path.

Code

\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 alsodot corner={#1}}]}, 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 alsodot corner={#1}}}} %%% 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}

Code (only idea 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}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
  • Say I want to use your 3rd diagram [dot corner'=north west], can you tell a clean way/code to realise it? – Lao-tzu Jun 19 '23 at 13:05
  • 1
    @Lao-tzu I've edited my answer to include comments so that it is clear which part of the preamble is necessary for which implementation. I've also added a separate document that only has the parts necessary for idea 2 including a dot corner' style for the \arrow/\ar macro if you, like me, don't like the |[…]| notation. – Qrrbrbirlbel Jun 19 '23 at 13:36
  • Thanks, this is the first time I saw |[…]|... – Lao-tzu Jun 19 '23 at 14:28
  • @Lao-tzu That's part of the matrix library/matrix of (math) nodes style. The usual […] can't be used because that would be &'s optional argument. – Qrrbrbirlbel Jun 19 '23 at 16:05