3

The following is an attempt to generate a commutative diagram with multiple arrows between nodes.

\documentclass[margin=10pt]{standalone}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}
 B \arrow[shift left]{r}{qBM}
   \arrow[shift right]{l}{qMB}
   \arrow[swap]{dr}{qBN}
   & M \arrow{d}{qMN} \\
   & N
\end{tikzcd}
\] 
\end{document}

Currently the code fails to compile, giving the error message l.7 I think the culprit is a tikzcd arrow in cell 1-1. \errmessage ...currentrow -\tikzcd@currentcolumn }. What am I doing wrong here?

  • \arrow[shift right]{l} is going to the left of B but there is no item there for it to reach to. – daleif Jan 7 '16 at 14:51
  • @daleif Actually, my intent is to display two arrows between elements B and M: one going to the left (i.e., qBM), the other going to the right (i.e., qMB). – Michael Gruenstaeudl Jan 7 '16 at 14:55
2

You can use <- for reversing the direction of the arrow; the diagonal arrow should be shifted for avoiding conflicts.

\documentclass[margin=10pt]{standalone}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[column sep=large]
 B \arrow[r,shift left,"qBM"]
   \arrow[r,<-,shift right,swap,"qMB"]
   \arrow[dr,shift right,swap,"qBN"]
   & M \arrow[d,"qMN"] \\
   & N
\end{tikzcd}

\end{document}

enter image description here

2

First of all, let's have a look on your errors. The first one tells you that there is some problem with an arrow in cell 1-1. This notation actually is easy to understand as it claims to see some problem in the first row and the first column. "cell 1-1". As you have three arrows here, you just can take out one by one in order to find the culprit one. TeXstudio marked the faulty one in red after I compiled first time. There is an arrow pointing to the left but there is nothing to point to on the left.

For your MWE I am getting a second error Bad math environment delimiter. \]. This happens because you are using \[ \] in a standalone class which makes no sense and is therefore not supported. There are other posts on this topic around here.

If you want to have an empty ended arrow to the left, it should be:

% arara: pdflatex

\documentclass[margin=10pt]{standalone}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}
    {} & B \arrow[shift left]{r}{qBM}
    \arrow[shift right]{l}{qMB}
    \arrow[swap]{dr}{qBN}
    & M \arrow{d}{qMN} \\
    & & N
\end{tikzcd}
\end{document}

enter image description here


I guess, you wanted something like:

% arara: pdflatex

\documentclass[margin=10pt]{standalone}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}[column sep=huge]
    B \arrow[shift left=.7]{r}{qBM} 
    \arrow[swap]{dr}{qBN}
    & M \arrow{d}{qMN} \arrow[shift left=.7]{l}{qMB} \\
    & N
\end{tikzcd}
\end{document}

enter image description here

  • I'd prefer {} to \null. – egreg Jan 7 '16 at 14:54
  • @LaRiFaRi Actually, this is not what I had in mind. My intent is to display two arrows between elements B and M: one going to the left (i.e., qBM), the other going to the right (i.e., qMB). – Michael Gruenstaeudl Jan 7 '16 at 14:56
  • @egreg will change this without any doubt but would be interested in the explanation. Thanks. – LaRiFaRi Jan 7 '16 at 14:57
  • @MichaelGruenstaeudl I thought so and already prepared the second half of my answer. – LaRiFaRi Jan 7 '16 at 14:57
  • @LaRiFaRi For one thing, \null is not a documented LaTeX command. – egreg Jan 7 '16 at 14:58

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.