Suppose I want to make a diagram using tikz, where an arrow is diagonal:
\begin{tikzcd}
A\ar[rd] & B \\
& C
\end{tikzcd}
and I have a label to put on this arrow. I want this label to have the same "inclination" as the arrow itself: how can one achieve this? I know of the option using rotate, but one doesn't necessarily know the angle over which the label should then be rotated. Thanks in advance!
Edit.
An example is the following diagram
I would like to align the labels with the arrows.
Best Answer
It seems that TikZ is not able to compute correctly the width of the sloped label; with
\mathclap
we make it zero width. It's your responsibility to look at the diagram and increase row or column separation so they fit, but this is true for every diagram with long labels, so not a real problem.I also add the version with the unsloped labels, which I prefer as it doesn't force readers to tilt their head in order to look at the labels.