# Tikzcd question on arrow labels

I tried to draw a commutative diagram of this form:

The code and link to it on https://tikzcd.yichuanshen.de/ are these one:

\begin{tikzcd} u_i \arrow["?"', loop, distance=2em, in=125, out=55] \arrow[rr, "{(g^{-1}u_i,g^{-1})}", bend left, shift left] & & g^{-1}u_ig \arrow[ll, "{(u_i g,g)}", bend left] \arrow["{(u,v)}"', loop, distance=2em, in=125, out=55] \end{tikzcd}

However, when I plug this code into Overleaf, it produces this picture with arrow labels shifted:

What am I doing wrong?

• Hi and welcome. Please give a fully compilable code. Aug 15, 2020 at 19:58
• Please change the title of your question as it is called labels and not "names" and make it clear that it is about placing labels in the middle. This will allow search engines to index your question well and those who will have the same problem to find a solution. Say for example "How to center the labels on the arrows on Tikz-cd" or any other formulation (sorry I'm not English speaking, so I don't express myself very well). Translated with www.DeepL.com/Translator (free version) Aug 15, 2020 at 20:50

## 1 Answer

I've marked the changes with %<-- in the code.

\documentclass[tikz, border=5mm]{standalone}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd} u_i
\arrow["?"', loop, distance=2em, in=125, out=55]
\arrow[rr, "{(g^{-1}u_i,g^{-1})}"{anchor=south},% <-- add anchor
bend left] &  &
g^{-1}u_ig
\arrow[ll, "{(u_i g,g)}"{anchor=north},% <-- add anchor
bend left]
\arrow["{(u,v)}"', loop, distance=2em, in=125, out=55]
\end{tikzcd}
\end{document}

• Wow, thank you very much! (Sorry for my code style, it was produced by that site) Aug 15, 2020 at 20:18
• No problem, the TikZ manual has more than 1300 pages, so it is difficult to read it completely. AND tikz-cd includes the options of Tikz, so knowing TikZ helps to understand its variations. Aug 15, 2020 at 20:21
• My compliments for your 20k of reputation. Aug 15, 2020 at 20:35
• @Sebastiano Thank you. Only 60 points left and you're up to 30,000! Aug 15, 2020 at 20:43
• @AndréC Really 29,940 ahahhah. But for me not is important the votes..For me, friendship, respect, cooperation, sincerity and mutual help are important to make this world a little better. Aug 15, 2020 at 21:09