Inserting an array into a diagram

Suppose I have a diagram of this form:

\documentclass[11pt]{beamer}
\usepackage{pgfpages,amsmath,amssymb,mathtools,color, graphicx, amsfonts, braket}
\usepackage{subfig}
\usepackage{empheq}
\usepackage{multicol}

\begin{document}

\begin{frame}

$\begin{pmatrix} \begin{matrix} e \\ \text{John} \\ j \end{matrix} & \begin{pmatrix} e \to e \to t & e \\ \text{saw} & \text{Mary}\\ \operatorname{saw} & m \end{pmatrix} \end{pmatrix} = \begin{matrix} t\\ \text{John saw Mary}\\ \operatorname{saw}(j, m)\\ \end{matrix}$

\end{frame}
\end{document}


Suppose I want to insert the following diagram where the first e is in the diagram above (at the top left hand corner of that diagram, or suppose I want to insert it at any place in the top row of the above diagram)

\documentclass[11pt]{beamer}
\usepackage{pgfpages,amsmath,amssymb,mathtools,color, graphicx, amsfonts, braket}
\usepackage{subfig}
\usepackage{empheq}
\usepackage{multicol}

\begin{document}

\begin{frame}

$\begin{array}{c|c} A & B\\ \hline A & B\\ \hline \multicolumn{2}{c}{C} \end{array}$

\end{frame}

\end{document}


How can I do this? I tried to literally copy and paste the second diagram into the first diagram, but this produced the error 'bad math environment delimiter'.

• Just replace the e with the part from \begin{array} to \end{array} (inclusive). – egreg Apr 10 at 9:52
• @CarLaTeX Done. – egreg Apr 21 at 13:01

You just paste the array:

\documentclass{beamer}
$\begin{pmatrix} \begin{matrix} e \\ \text{John} \\ j \end{matrix} & \begin{pmatrix} \begin{array}{c|c} A & B\\ \hline A & B\\ \hline \multicolumn{2}{c}{C} \end{array} \to e \to t & e \\ \text{saw} & \text{Mary}\\ \operatorname{saw} & m \end{pmatrix} \end{pmatrix} = \begin{matrix} t\\ \text{John saw Mary}\\ \operatorname{saw}(j, m)\\ \end{matrix}$