The recommended way (see Section 4.2 here) to place pullback corners in tikz-cd
diagrams is using diagonal phantom arrows, as in
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{amssymb}
\begin{document}
\begin{tikzcd}
A \arrow[r]
\arrow[d]
\arrow[dr, phantom, "\lrcorner", very near start]
& B \arrow[d]
\\ C \arrow[r]
& D
\\
\end{tikzcd}
\end{document}
However, this isn't great when the diagram deviates too far from the square shape, eg because of long labels:
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{amssymb}
\begin{document}
\begin{tikzcd}
A \arrow[r]
\arrow[d]
\arrow[dr, phantom, "\lrcorner", very near start]
& B \arrow[d]
\\ CCCC\arrow[r]
& DDDD
\\
\end{tikzcd}
\end{document}
The problem is that the \lrcorner
is further from the left arrow than from the upper arrow.
I can adjust that manually with shift right
, but I wonder if there's a method that doesn't place the corner on an invisible diagonal of the rectangle, but rather at a fixed distance at a 45 degree angle from the center of the upper left corner?
This answer seems to do something like this, but with tikzpicture
instead of tikzcd
, and I don't know how to adapt it to tikzcd
.
Best Answer
You can place the
\lrcorner
symbol as alabel
for the node. You can set the angle and distance.