0

I need to label a left arrow in tikz, but it labels the left arrow automatically under the arrow, which looks ugly. How do I make it label above?

Codes:

\begin{tikzcd}
        X_{\overline{s}} \arrow[r,"\tilde{j}"]\arrow{d}
        & X_{\widetilde{S}} \arrow{d}
        & X_{\widetilde{\eta}} \arrow[l,"\tilde{i}"]\arrow{d}
        \\
        X_{s} \arrow[r,"j"]
        & X 
        & X_{\eta }\arrow[l, "i"]
\end{tikzcd}

image

3
  • 2
    Welcome to TeX.SE!
    – Mensch
    Jun 6, 2023 at 8:14
  • 1
    Welcome. In the future, please always provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    Jun 6, 2023 at 15:28
  • @SandyG Thanks for the guideline! I will do that
    – Yuan Yang
    Jun 7, 2023 at 19:35

2 Answers 2

6

Just add ' to the letter label that you want to put on top.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd,amssymb}


\begin{document}
\begin{tikzcd}
        X_{\overline{s}} \arrow[r,"\tilde{j}"]\arrow{d}
        & X_{\widetilde{S}} \arrow{d}
        & X_{\widetilde{\eta}} \arrow[l,"\tilde{i}"']\arrow{d}
        \\
        X_{s} \arrow[r,"j"]
        & X 
        & X_{\eta }\arrow[l, "i"']
\end{tikzcd}
\end{document}
2

Several ways:

  1. Add ' after the arrow label: \arrow[l, "i"']
  2. Add the swap option: \arrow[l, "i", swap]
  3. Draw the arrow from the previous cell pointing right, but with leftarrow: \arrow[r, "i", leftarrow]
  4. Same as 3 but using <-: \arrow[r, "i", <-]

You must log in to answer this question.

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