Labelling arrows drawn to paths in tikz-cd
You can add a node at the second segment of the path.
\begin{tikzcd}
& K^n
\arrow[r, "L^A_B(F)"]
\arrow[dd, rounded corners,
to path={
-- ([xshift=-10ex]\tikztostart.west)
--node[left]{\scriptsize$L_C^A$} ([xshift=-10ex]\tikztotarget.west)
-- (\tikztotarget.west)}
]
& K^m
\arrow[dd, rounded corners,
to path={
-- ([xshift=10ex, "L^B_D"]\tikztostart.east)
--node[right]{\scriptsize$L_D^B$} ([xshift=10ex]\tikztotarget.east)
-- (\tikztotarget.east)}]
& \\
V
\arrow[rrr, "F"]
\arrow[ru, "C_A"]
\arrow[rd, "C_C"']
& & & W
\arrow[lu, "C_B"']
\arrow[ld, "C_D"] \\
& K^n
\arrow[r, "L^C_D(F)"]
& K^m &
\end{tikzcd}
Another option is to use \tikztonodes
in to path
and then use quotes to specify the labels. The labels specified using the quotes get stored into \tikztonodes
. This is much more useful if you want to use the same "tikz to path" to draw multiple paths.
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
&& K^n \arrow[r, "L^A_B(F)"]
\arrow[dd, rounded corners, "L_A^C"',
to path={
-- ([xshift=-10ex]\tikztostart.west)
-- ([xshift=-10ex]\tikztotarget.west)\tikztonodes % added \tikztonodes here
-- (\tikztotarget.west)
}]
& K^m
\arrow[dd,"L_D^B", rounded corners,
to path={
-- ([xshift=10ex]\tikztostart.east)
-- ([xshift=10ex]\tikztotarget.east)\tikztonodes
-- (\tikztotarget.east)
}] &
\\
&V \arrow[rrr, "F"] \arrow[ru, "C_A"] \arrow[rd, "C_C"'] & & & W \arrow[lu, "C_B"'] \arrow[ld, "C_D"] \\
&& K^n \arrow[r, "L^C_D(F)"] & K^m &
\end{tikzcd}
\end{document}
On encouragement by "Schrodinger's cat" I made a general key to do this. I called it "relay arrow" but if anyone has a better name, let me know. It works by saying e.g., \ar[ur, relay arrow=10pt]
.
This is strictly speaking not relevant to the question asked, but my hope is it might be useful to someone.
Here's the effect:
Code below:
\documentclass{article}
\usepackage{tikz-cd}
\tikzcdset{
relay arrow/.default = 10pt,
relay arrow/.style = {
rounded corners,
to path = {
\pgfextra{
\def\sourcecoordinate{\pgfpointanchor{\tikztostart}{center}}
\def\targetcoordinate{\pgfpointanchor{\tikztotarget}{center}}
\pgfmathanglebetweenpoints{\sourcecoordinate}{\targetcoordinate}
\edef\tempangle{\pgfmathresult}
\pgftransformrotate{\tempangle}
\pgfmathifthenelse{#1>0}{\tempangle+90}{\tempangle-90}
\pgfcoordinate{tempcoord}{\pgfpointanchor{\tikztostart}{\pgfmathresult}}
}
(tempcoord)
-- ([yshift=#1]tempcoord)
-- ([yshift=#1]tempcoord-|\tikztotarget.center)\tikztonodes
--(\tikztotarget)
}
}
}
\begin{document}
\begin{tikzcd}
& B\\
A \urar[relay arrow,"1"]\urar["2"]\urar[relay arrow=-25pt,"3"']&
\end{tikzcd}
\begin{tikzcd}
&& K^n \arrow[r, "L^A_B(F)"]
\arrow[dd, "L_A^C"', relay arrow=-10ex]
& K^m
\arrow[dd,"L_D^B", relay arrow=10ex] &
\\
&V \arrow[rrr, "F"] \arrow[ru, "C_A"] \arrow[rd, "C_C"'] & & & W \arrow[lu, "C_B"'] \arrow[ld, "C_D"] \\
&& K^n \arrow[r, "L^C_D(F)"] & K^m &
\end{tikzcd}
\end{document}