0

I need to make a commutative diagram with arrows that are themselves marked as incoming or outgoing. After some fiddling I produced this command, which produces an acceptable shape:

\newcommand{\outgoingarrow}{\ooalign{$\longrightarrow$\!\!\!\!\!\scalebox{2.4}{\raisebox{-4.5pt}{$\widehat{}$}}}}

Arrow marked as outgoing.

Now I just need to use it in commutative diagrams. But it doesn't seem I can just use the shape in tikz-cd diagrams. I found this answer:

Custom arrow shapes in tikzcd

But it seems fairly cumbersome for a barely modified arrow shape like this. Isn't there some way I can get tikz-cd to simply recognize my modified arrow shape?

4
  • Can you show how the arrow should look, i.e. an image? While there is a way to use typeset text as a tip a lot can already be done with normal “real” tips. Commented Aug 16, 2023 at 19:45
  • @Qrrbrbirlbel I added a picture. Commented Aug 16, 2023 at 19:50
  • Should the “hat” be right before the usual tip or halfway a long the whole line? How does this mark it as incoming or outgoing? Isn't that the job of the > at the end? Commented Aug 16, 2023 at 19:54
  • It's supposed to be in the middle. It's not about denoting the source and target of the arrow but denoting that the arrow itself is an input or output of a higher cell. Commented Aug 16, 2023 at 20:03

2 Answers 2

2

I'm not sure if this is what you want, but you can use the marking option to place a symbol on an arrow.

enter image description here

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
A\arrow[r,"\uparrow"marking]\arrow[d] & B\arrow[d]\\
C\arrow[r,"\downarrow"marking] & D
\end{tikzcd}

\end{document}

Or you can use \wedge and \vee instead of \uparrow and \downarrow:

enter image description here

2

Let's start with something.

You can just place the \widehat like any other node along the path.

Here I define a hat key that does all this for you.

  • sloped, allow upside down and midway make sure that the “tip” follows the slope of the line and stays in the middle irregardless of other settings.
  • yscale and yshift just sacles and moves the hat around so that it looks good. This might need to be adjusted for other fonts.

You can use any symbol here of course and also rotate it however you need.

You can also use any TikZ drawing which is what I have done with the outgoing pic that is just drawing a orthogonal line to the path.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzcdset{
  tikzcd to small/.tip={tikzcd to[scale=.5, sep=+0pt +1]},
  edge node/.style={/tikz/every to/.append style={edge node={#1}}},
  /tikz/pics/outgoing/.style={
    /tikz/sloped, /tikz/allow upside down, code={
      \draw[pic actions] (0pt,0pt) -- (up:1ex);}},
  outgoing/.style={edge node={pic[-tikzcd to small,#1]{outgoing}}},
  outgoing'/.style={edge node={pic[-tikzcd to small,yscale=-1,#1]{outgoing}}},
  incoming/.style={edge node={pic[tikzcd to small-,#1]{outgoing}}},
  incoming'/.style={edge node={pic[tikzcd to small-,yscale=-1,#1]{outgoing}}},
  hat/.style={edge node={
    node[sloped, allow upside down, inner sep=+0pt, midway,
         yscale=2, yshift=-.6ex]{$\widehat{}$}}}}
\begin{document}
\begin{tikzcd}
A \rar[hat] & B \dlar[hat, bend left] \\
C \uar[outgoing'] \urar[incoming']
\end{tikzcd}
\end{document}

Output

enter image description here

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .