下面第一个图的顶行的分数没有对齐(底部的分数也没有对齐),因为顶行的表达式在第二个图中。我该如何对齐它们?
\documentclass[11pt]{beamer}
\usepackage{pgfpages,amsmath,amssymb,mathtools,color, graphicx, amsfonts, braket}
\usepackage{subfig}
\usetheme{Madrid}
\usepackage{empheq}
\usepackage{multicol}
\begin{document}
\begin{frame}
\[
\begin{pmatrix}
\begin{matrix}
\begin{matrix}
\cfrac{\ \rho \ }{\ \alpha \ }\\ \\
\texttt{left-exp}\\ \\
\cfrac{\ \operatorname{f[\;])}\ }{\ x\ }\\
\end{matrix}
\hspace{2cm}
\begin{matrix}
\cfrac{\ \rho \ }{\ \alpha \to \beta\ }\\ \\
\texttt{right-exp}\\ \\
\cfrac{\ \operatorname{g[\;])}\ }{\ y\ }\\
\end{matrix}
\end{matrix}
\end{pmatrix}
=
\begin{matrix}
\cfrac{\ \rho\ }{\ \beta\ }\\
\text{left-exp right-exp}\\
\cfrac{\ \operatorname{f[g[\;]])}\ }{\ A x y\ }\\
\end{matrix}
\]
\[
\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}
答案1
不要尝试将顶部矩阵构建为单个向量的集合,而是使用选项卡式matrix
方法,以便在给定行中的单元格之间实现垂直对齐。
\documentclass[11pt]{beamer}
\usepackage{pgfpages,amsmath,amssymb,mathtools,color, graphicx, amsfonts, braket}
\usepackage{subfig}
\usetheme{Madrid}
\usepackage{empheq}
\usepackage{multicol}
\begin{document}
\begin{frame}
\[
\begin{pmatrix}
\begin{matrix}
\cfrac{\ \rho \ }{\ \alpha \ }&\kern15pt&\cfrac{\ \rho \ }{\ \alpha \to \beta\ }\\ &&\\
\texttt{left-exp}&&\texttt{right-exp}\\ &&\\
\cfrac{\ \operatorname{f[\;])}\ }{\ x\ }&&\cfrac{\ \operatorname{g[\;])}\ }{\ y\ }
\end{matrix}
\end{pmatrix}
=
\begin{matrix}
\cfrac{\ \rho\ }{\ \beta\ }\\ \\
\text{left-exp right-exp}\\ \\
\cfrac{\ \operatorname{f[g[\;]])}\ }{\ A x y\ }
\end{matrix}
\]
\[
\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}