跨示例对齐矩阵

跨示例对齐矩阵

我怎样才能对齐以下两个相同的块(由包含单词的行组成的块)?

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

\begin{document}

\begin{frame}

  \begin{exe}
    \ex
\[
\begin{matrix}
\begin{matrix}
Semantic\;type:\\ 
\texttt{expression}:\\ 
Semantic\; term:\\
\end{matrix}
\hspace{2cm}
\begin{matrix}
e\\
 \text{John}\\
 \operatorname{j}\\
\end{matrix}
\end{matrix}
\]

\ex
\[
\begin{matrix}
\begin{matrix}
Semantic\;type:\\ 
\texttt{expression}:\\ 
Semantic\; term:\\
\end{matrix}
\hspace{2cm}
\begin{matrix}
\cfrac{\ \operatorname{t}\ }{\ e\ }\\ 
\texttt{every linguist}\\ 
\cfrac{\ \operatorname{ev.ling(\lambda x.[\;])}\ }{\ x\ }\\
\end{matrix}
\end{matrix}
\]

\end{exe}


\end{frame}

 \end{document}

答案1

此解决方案强制 beamer 使用leqn方程式并使用\mathmakebox来将对齐矩阵居中。4cm 宽度可根据喜好进行调整。

\documentclass[11pt]{beamer}
\usetheme{Madrid} 
\makeatletter
\tagsleft@true
\makeatother
\usepackage{braket}
\usepackage{pgfpages}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{empheq}
\usepackage{multicol}
\usepackage{gb4e}

\begin{document}

\begin{frame}

\begin{align}
\begin{matrix}
Semantic\;type:\\ 
\texttt{expression}:\\ 
Semantic\; term:\\
\end{matrix}
&\mathmakebox[4cm]{\begin{matrix}
e\\
 \text{John}\\
 \operatorname{j}\\
\end{matrix}}
\\
\begin{matrix}
Semantic\;type:\\ 
\texttt{expression}:\\ 
Semantic\; term:\\
\end{matrix}
&
\mathmakebox[4cm]{\begin{matrix}
\cfrac{\ \operatorname{t}\ }{\ e\ }\\ 
\texttt{every linguist}\\ 
\cfrac{\ \operatorname{ev.ling(\lambda x.[\;])}\ }{\ x\ }\\
\end{matrix}}
\end{align}

\end{frame}

\end{document}

投影幻灯片

答案2

像这样:

在此处输入图片描述

仅使用表格:

\documentclass[11pt]{beamer}
\usetheme{Madrid}
\usepackage{empheq,
            nccmath} % for \mfrac
\usepackage{gb4e}
\usepackage{array}

\begin{document}

\begin{frame}%[fragile]
    \begin{exe}%\raggedright
    \ex
\begin{tabular}[t]{>{\raggedleft\arraybackslash}p{0.45\linewidth}
                   @{\qquad}
                   >{$}l<{$}
              }
Semantic type:          &   e           \\
\texttt{expression:}    &   $John$      \\
Semantic term:          &   \mathsf{j}

\end{tabular}

    \ex
\begin{tabular}[t]{>{\raggedleft\arraybackslash}p{0.45\linewidth}
                   @{\qquad}
                   >{$}l<{$}
              }
Semantic type:          &   \mfrac{\ \mathsf{t}\ }{e}   \\
\texttt{expression:}    &   $\texttt{every linguist}$   \\
Semantic term:          &   \mfrac{\ \mathsf{ev.ling}(\lambda x.[~])\ }
                                  {x}

\end{tabular}
    \end{exe}
\end{frame}
\end{document}

编辑:从你的评论可以猜测你喜欢这样的东西:

在此处输入图片描述

与第一个解决方案的区别在于删除了位置选项[t]并减小了表格中第一列的尺寸。同时还增加了之间的垂直空间\ex(示例)。

\documentclass[11pt]{beamer}
\usetheme{Madrid}
\usepackage{empheq,
            nccmath} % for \mfrac
\usepackage{gb4e}
\usepackage{array}

\begin{document}

\begin{frame}%[fragile]
    \begin{exe}%\raggedright
    \ex
\begin{tabular}{>{\raggedleft\arraybackslash}p{0.3\linewidth}
                   @{\qquad}
                   >{$}l<{$}
              }
Semantic type:          &   e           \\
\texttt{expression:}    &   $John$      \\
Semantic term:          &   \mathsf{j}

\end{tabular}
\bigskip

    \ex
\begin{tabular}{>{\raggedleft\arraybackslash}p{0.3\linewidth}
                   @{\qquad}
                   >{$}l<{$}
              }
Semantic type:          &   \mfrac{\ \mathsf{t}\ }{e}   \\
\texttt{expression:}    &   $\texttt{every linguist}$   \\
Semantic term:          &   \mfrac{\ \mathsf{ev.ling}(\lambda x.[~])\ }
                                  {x}

\end{tabular}
    \end{exe}
\end{frame}

相关内容