6

please look at below example:

\begin{center}
    \begin{tikzcd}
        x_1(k+1) \arrow{d}{x_1(k)} & \\
        x_2(k+1) \arrow{d}{x_2(k)} & x_4(k+1) \arrow{lu}{x_1(k)} \arrow{l}{x_2(k)} \arrow[loop right]{l}{x_4(k)} \\
        x_3(k+1) \arrow[ru, equal]{x_3(k)} & \\
    \end{tikzcd}
\end{center}

and output:

output

The problem is that I want to get arrows in two sides in that double line (between x_3(k+1) and x_4(k+1)). How can I do that?

2 Answers 2

13

Add the arrow and shift it. I'd give some more room to the diagram and change side for most of the labels.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\begin{equation*}
\begin{tikzcd}[row sep=3em,column sep=3em]
x_1(k+1) \arrow[d,swap,"x_1(k)"] & \\
x_2(k+1) \arrow[d,swap,"x_2(k)"] &
  x_4(k+1)
  \arrow[lu,swap,"x_1(k)"]
  \arrow[l,swap,"x_2(k)"]
  \arrow[l,loop right,"x_4(k)"]
  \arrow[dl,shift right]
 \\
x_3(k+1) \arrow[ru,shift right,swap,"x_3(k)"]
\end{tikzcd}
\end{equation*}

\end{document}

enter image description here

4
  • That is what I needed! In new document, everything is ok, but when I put it into my work, I'm getting several errors: linia 272: Argument of \language@active@arg" has an extra }. \end{tikzcd} linia 272: Paragraph ended before \language@active@arg" was complete. \end{tikzcd} linia 272: Paragraph ended before \pgfkeys@addpath was complete. \end{tikzcd} linia 272: Missing \endcsname inserted. \end{tikzcd} linia 272: Missing \endcsname inserted. \end{tikzcd} linia 272: Missing \endcsname inserted. \end{tikzcd} linia 272: Paragraph ended before \pgfkeys@splitter was complete. \end{tikzcd}
    – ktatar156
    Commented May 10, 2016 at 12:49
  • And it's compile, but without x_i(k) on the arrows.
    – ktatar156
    Commented May 10, 2016 at 12:54
  • @ktatar156 What language are you loading babel with?
    – egreg
    Commented May 10, 2016 at 13:46
  • @ktatar156 Add \usetikzlibrary{babel} after \usepackage{tikz-cd} and all should go well.
    – egreg
    Commented May 10, 2016 at 14:51
5

Is the Leftrightarrow arrow type what you're after?

\documentclass[tikz,border=4mm]{standalone}
\usepackage{tikz-cd}
\begin{document}
    \begin{tikzcd}
        x_1(k+1) \arrow{d}{x_1(k)} & \\
        x_2(k+1) \arrow{d}{x_2(k)} & x_4(k+1) \arrow{lu}{x_1(k)} \arrow{l}{x_2(k)} \arrow[loop right]{l}{x_4(k)} \\
        x_3(k+1) \arrow[ru, Leftrightarrow]{x_3(k)} & \\
    \end{tikzcd}
\end{document}

enter image description here

You must log in to answer this question.

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