1

How can I align the two identical blocks in the following (the blocks consisting of rows with words in)?

\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}
  • 2
    Unrelated: empheq already loads mathtools, which in turn loads amsmath. beamer automatically loads amssymb (and thus amsfonts) as well as color and graphicx. – campa Apr 10 at 14:11
2

This solution forces beamer to use leqn equations and uses \mathmakebox to center the aligned matrices. The 4cm width is adjustable to taste.

\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}

beamer slide

1

like this:

enter image description here

with using only tabular:

\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}

edit: from your comment can be gues that you like to have something like this:

enter image description here

difference to the first solution is in removed position option [t] and reduced size of the first column in tables. also in increased vertical space between \ex (examples).

\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}
  • Thanks. There are two issues with this, though. First, the blocks are too far away from the numbers (1) and (2). Second, the aligning of the blocks is not as in my examples, in which the top row and the bottom row are at the middle of the word in the middle row. – user65526 Apr 10 at 15:19
  • @user65526, your question is not clear. please clarify it with some sketch, what you like to have. so far we can only guess what should be align. you can make first column of tabula narrower if you like to have column context closer to qex number. – Zarko Apr 10 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.