0

I want to make the arrows in the following code left, but it gives an error.

 \begin{tikzcd}
1 \arrow[rr,shift left,"\lambda"]
  \arrow[rr,shift right,swap,"\mu"]
&&
3 
\end{tikzcd}
  • 1
    That code works fine here, which error do you get? Do you mean that you want to do 1 &&\arrow[ll,shift left,"\lambda"] \arrow[ll,shift right,swap,"\mu"] 3? – Torbjørn T. Jun 19 '18 at 14:50
  • "ı think the culprit is a tikzcd arrow in cell" şeklinde bi hata alıyorum – tuce Jun 19 '18 at 14:53
  • I made some simple changes, but I did not correct the error – tuce Jun 19 '18 at 14:54
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Jun 19 '18 at 14:55
3

When you do \arrow[rr], that means to draw an arrow from the cell the \arrow is placed in, to the cell that is two columns right. r stands for "right", two rs mean two columns to the right. Similarly, l means left, u means up and d down. I'm assuming you tried something like

\begin{tikzcd}
1 \arrow[ll,shift left,"\lambda"]
  \arrow[ll,shift right,swap,"\mu"]
&&
3 
\end{tikzcd}

but that cannot work because the two arrows are placed in the first column, so there are no columns to the left. To use ll you have to move the arrows to the last column, i.e.

\begin{tikzcd}
1 && 3 
  \arrow[ll,shift left,"\lambda"]
  \arrow[ll,shift right,swap,"\mu"]
\end{tikzcd}

Another option is to add the leftarrow option to the arrows while keeping rr. This will move the arrow tip to the start of the line, instead of the end.

Unrelated note: As egreg mentioned in his comment below, using empty columns to add space is probably not the best approach, it would be better to modify the column sep. You can give a specific length (e.g. column sep=1cm) or use one of the predefined keys (tiny, small, scriptsize normal, large, huge) to set the separation between columns.

Complete example with both options for the arrows, and column sep=huge instead of the empty column:

enter image description here

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

\begin{document}
 \begin{tikzcd}[column sep=huge]
1 &
 \arrow[l,shift right,swap,"\lambda"]
 \arrow[l,shift left,"\mu"]
3  \\
1 
 \arrow[r,leftarrow,shift left,"\lambda"]
 \arrow[r,leftarrow,shift right,swap,"\mu"]
&
3 
\end{tikzcd}
\end{document}
  • It wasn't entirely clear what you wanted to do, or what you actually did, so I'm guessing a bit here. – Torbjørn T. Jun 19 '18 at 15:16
  • There is no need to double the number of columns; I believe it's cleaner to act on column sep. – egreg Jun 19 '18 at 15:17
  • @egreg True, can't argue with that. (I remember you said the same on the OPs previous question.) Will edit my answer in a bit. – Torbjørn T. Jun 19 '18 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.