# multiline cells and arrow placement in xymatrix

Is there a way to use a multiline environment in a cell of an \xymatrix?

I am trying to produce something that looks like this:

$\left\{ \begin{gathered}\text{text 1}\\ \text{text 2}\\ A=B \end{gathered} \right\} \rightleftarrows\left\{ \begin{gathered}\text{some text here}\\ \text{and here} \end{gathered} \right\} ,$


,

Only I was hoping to get slightly longer curved arrows. I attempted to use \xymatrix but this causes two problems: (1) I get an error message when I try to include multiline environments (e.g. \gathered) in the cells, and (2) the arrow ends get positioned above/below the cell content, rather than to its side:

$\xymatrix{\left\{ \text{text}\right\} \ar@/^{1pc}/[r] & \ar@/^{1pc}/[l]\left\{ \text{more text}\right\} }$


Any suggestions? Thanks!

• What if you try the Bmatrix environment in the place of gathered? Also did you really put gathered within ? – Bernard May 28 '18 at 8:56

The trick is to brace the complex objects:

\documentclass{article}
\usepackage{amsmath}
\usepackage[all,cmtip]{xy}

\begin{document}

$\xymatrix{ {\begin{Bmatrix}\text{text a}\\\text{text b}\end{Bmatrix}} \ar@/^{1pc}/[r] & {\begin{Bmatrix}\text{text a}\\\text{text b}\\\text{text c}\end{Bmatrix}} \ar@/^{1pc}/[l] }$

\end{document}


Coherently with the tag assigned by the user I propose two alternatives; the first with xy package and the second with tikz-cd.

FIRST OPTION:

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage[all]{xy}
\begin{document}

\xymatrix@C=3pc{{\left\{\begin{aligned}
\text{text a}\\
\text{text b}
\end{aligned}\right\}
} \ar@/^{1.5pc}/[r] & \ar@/^{1.5pc}/[l]{\left\{\begin{aligned}
\text{text a}\\
\text{text b}\\
\text{text c}\\
\end{aligned}\right\}
}}
\end{document}


SECOND OPTION: Is there also a chance to get the same result using the package tikz-cd

\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd}
\usepackage{amsmath}
\begin{document}
\begin{tikzcd}
\left\{\begin{array}{lr} \text{text a} \\    \text{text b} \\     \end{array}\right\}   \arrow[r, bend left=15] & \left\{\begin{array}{lr} \text{text a} \\    \text{text b} \\    \text{text c} \\ \end{array}\right\} \arrow[l, bend left=15]
\end{tikzcd}
\end{document}


Remake of the second example in the @Sebastiano answer:

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

\begin{document}
{\setlength\tabcolsep{0pt}
\renewcommand\arraystretch{0.84}
\begin{tikzcd}[bend angle=20]
\left\{\begin{tabular}{lr}
text a\\ text b
\end{tabular}\right\}    \arrow[r, bend left]
&    \left\{\begin{tabular}{lr}
text a\\ text b\\ text c
\end{tabular}\right\}   \arrow[l, bend left]
\end{tikzcd}
}
\end{document}


• Great dear friend :-). Best nice answer. – Sebastiano May 29 at 21:12