[Tex/LaTex] Curved lines with tikz

arrow-curvechartstikz-arrows

Consider:

\documentclass[a4paper, 11pt]{article}

\usepackage[protrusion=true,expansion=true]{microtype} % Better typography
\usepackage{graphicx} % Required for including pictures
\usepackage{wrapfig} % Allows in-line images
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning}
\usetikzlibrary{calc,decorations.markings}
\usepackage{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc}

\tikzstyle{error} = [circle, draw, fill=red!20,
text width=4.0em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em]

\begin{document}

\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes

\node [block] (X1) {X1};
\node [block, below of=X1, node distance=3cm] (X2) {X2};
\node [block, below right = .25cm and 1.5cm of X1] (Y) {Y};
\node [error, right of = X1, node distance=3.7cm] (error) {error};
% Draw edges

\path [line] (X1) -- (X2);
%\path [line] (error) -- node {1}(X1);

\end{tikzpicture}
\end{document}

I'm looking for a way to draw a curved double headed arrow between X1 and X2 like this:

Enter image description here

Any suggestions?

Best Answer

I made the following:

  • Reduce your code example to minimal working example (MWE) by removing all not used libraries and packages.
  • Use recent syntax in definitions of used styles (\tikzstyle is deprecated).
  • For positioning of picture's elements use syntax determined by library positioning (observe difference between ...=of ... and ...=of ...).
  • For arrows between blocks I used option bend right:

    \documentclass[tikz, margin=3mm]{standalone}
    \usetikzlibrary{arrows.meta, calc, positioning}
    
    \tikzset{
    error/.style = {circle, draw, fill=red, align=center,
                    inner sep=0pt},
    block/.style = {rectangle, draw, fill=blue!20, rounded corners,
                    text width=5em, minimum height=4em, align=center},
            }
    
    \begin{document}
        \begin{tikzpicture}[
    node distance = 8mm and 12mm
                            ]
    % Place nodes
    \node [block] (X1) {X1};
    \node [block, below=of X1] (X2) {X2};
    \node [block, below right=of X1] (Y) {Y};
    \node [error, right=of X1] (error) {error};
    % Draw edges
    \draw [Latex-Latex] (X1.west) to[bend right=45] (X2.west);
    \end{tikzpicture}
    \end{document}
    

Enter image description here

Note: I didn't bother with exactly replicating the position of your nodes.

Related Question