2

In this working example, I used tabular{}, aligned{} and makecell{} to insert formatted text and multi-line equations in a table as shown. But upon inspection of the final output, the text and equations are not vertically aligned in each cell. Is there a way to vertically align the text and equations in each cell. I have searched the previous answers regarding vertical alignment and the solutions seem to differ depending on the contents of the cell, text, images, equations, graphics and the preferred choice of package to use. Is there a common solution?

\documentclass[table]{beamer}
\usetheme{Boadilla}

\usepackage{amsmath}
\usepackage{xcolor} 
\usepackage{makecell}
\usepackage{array}
\usepackage{mathtools}

\begin{document}

\begin{frame}{The Four Fourier Transforms}
    \begin{table}[]
    \setlength{\tabcolsep}{10pt} % Default value: 6pt
    \renewcommand{\arraystretch}{4.5} % Default value: 1
    \begin{center}
    \caption{\Large The Four Fourier Tranforms}
    \label{tab:table41}
    \begin{tabular}{| c | c |}
        \hline
        \makecell{ \textcolor{orange}{\Large Fourier Series} \\ {\Large for} \\ \textcolor{orange}{\Large Periodic, \textbf{Continuous-}}\\ \textcolor{orange}{\Large \textbf{Time} }{\Large Signals} } & 
        \makecell{ \textcolor{blue}{\Large Fourier Transform} \\ {\Large for} \\ \textcolor{blue}{\Large Aperiodic} \textcolor{orange}{\Large \textbf{Continuous-}}\\\textcolor{orange}{\Large \textbf{Time} }{\Large Signals} }\\
        \hline
        \makecell{ \textcolor{orange}{\Large Fourier Series} \\ {\Large for} \\ \textcolor{orange}{\Large Periodic }\textcolor{yellow}{\Large \textbf{Discrete-}}\\ \textcolor{yellow}{\Large \textbf{Time} }{\Large Signals} } & 
        \makecell{ \textcolor{blue}{\Large Fourier Transform} \\ {\Large for} \\ \textcolor{blue}{\Large Aperiodic} \textcolor{yellow}{\Large \textbf{Discrete-}}\\\textcolor{yellow}{\Large \textbf{Time} }{\Large Signals} }\\
        \hline
    \end{tabular}
    \end{center}
\end{table}
\end{frame}

\begin{frame}{The Four Fourier Transforms}
\begin{table}[]
    \setlength{\tabcolsep}{10pt} % Default value: 6pt
    \renewcommand{\arraystretch}{5.5} % Default value: 1
    \begin{center}
    \caption{\Large The Four Fourier Tranforms}
    \label{tab:table42}
    \begin{tabular}{| >{$}c<{$} | >{$}c<{$} |}
        \hline
        \begin{aligned}
            C_k & = \dfrac{1}{T}\int_{T_0}f(t)e^{-jk\omega_0 t}dt \\
            f(t) & = \sum_{k=-\infty}^{\infty}C_k e^{jk\omega_0 t}
        \end{aligned}
        &
        \begin{aligned}
            F(\omega) &=  \int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt
            \\
            f(t) &= \sum_{-\infty}^{\infty}F(\omega)e^{j\omega t}d\omega
        \end{aligned} \\
        \hline
        \begin{aligned}
            c_k &=  \dfrac{1}{N}x(n)e^{-j2\pi kn/N}dt
            \\
            x(n) &= \sum_{k=0}^{N-1}c_k e^{j2\pi kn/N}
        \end{aligned} 
        &
        \begin{aligned}
            X(\omega) &=  \sum_{n=-\infty}^{\infty}x(n)e^{-j\omega n}
            \\
            x(n) &= \dfrac{1}{2\pi}\int_{2\pi}X(\omega)e^{j\omega n}
        \end{aligned} \\
        \hline
    \end{tabular}
    \end{center}
\end{table}
\end{frame}
\end{document}

1 Answer 1

3
  • The cause of your problem is code line \renewcommand{\arraystretch}{4.5} % Default value: 1. Just dropout it.
  • The answer consider only second frame with table of equations.
  • beamer load xcolor and mathtools load amsmath, so there is no need to load them again.
  • Instead of tabular is used array inside math environment (for slightly shorter code)
  • For additional vertical space is employed makegapedcells defined in the makecell package:
\documentclass[table]{beamer}
\usetheme{Boadilla}

\usepackage{makecell}
\usepackage{mathtools}

\begin{document}
\begin{frame}
\frametitle{The Four Fourier Transforms}
    \begin{table}
    \setcellgapes{3pt}
    \makegapedcells
\caption{\Large The Four Fourier Transforms}
\label{tab:table42}
\vspace{-\abovedisplayskip}
    \[
\begin{array}{| c | c |}
        \hline
\begin{aligned}
C_k  & = \dfrac{1}{T}\int_{T_0}f(t)e^{-jk\omega_0 t}dt \\
f(t) & = \sum_{k=-\infty}^{\infty}C_k e^{jk\omega_0 t}
\end{aligned}
    &   \begin{aligned}
F(\omega) & =  \int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt\\
f(t)      & = \sum_{-\infty}^{\infty}F(\omega)e^{j\omega t}d\omega
        \end{aligned}   \\
        \hline
\begin{aligned}
c_k & =  \dfrac{1}{N}x(n)e^{-j2\pi kn/N}dt \\
x(n) & = \sum_{k=0}^{N-1}c_k e^{j2\pi kn/N}
\end{aligned}
    &   \begin{aligned}
X(\omega) & = \sum_{n=-\infty}^{\infty}x(n)e^{-j\omega n} \\
x(n)      & = \dfrac{1}{2\pi}\int_{2\pi}X(\omega)e^{j\omega n}
        \end{aligned} \\
    \hline
\end{array}
    \]
    \end{table}
\end{frame}
\end{document}

enter image description here

Addendum: instead display-math environment is used in-line, added is settings for \arraycolsep for more horizontal space around cells contents, defined are two new commands for nicer spacing parentheses after function f and x.

On beamer side is more consistent defined caption fonts:


\documentclass[table]{beamer}
\usetheme{Boadilla}
    \setbeamerfont{caption}{size=\large}  % <---

\usepackage{makecell}
\newcommand\ft{f\,(t)} % <---
\newcommand\xn{x\,[n]} % or if you more prefer x\left(n\right) <---

\begin{document}

\begin{frame}
\frametitle{The Four Fourier Transforms}
    \begin{table}
    \setcellgapes{3pt}
    \makegapedcells

\caption{The Four Fourier Transforms}
\label{tab:table42}
    $\setlength\arraycolsep{16pt} % <---
     \displaystyle 
\begin{array}{| c | c |}
        \hline
\begin{aligned}
C_k             & = \frac{1}{T}\int_{T_0} \ft e^{-jk\omega_0 t}dt \\
f\left(t\right) & = \sum_{k=-\infty}^{\infty}C_k e^{\,jk\omega_0 t}
\end{aligned}
    &   \begin{aligned}
F(\omega)   & =  \int_{-\infty}^{\infty} \ft e^{-j\omega t}dt\\
\ft         & = \sum_{-\infty}^{\infty}F(\omega) e^{\,j\omega t}d\omega
        \end{aligned}   \\
        \hline
\begin{aligned}
c_k & =  \frac{1}{N} \xn e^{-j2\pi kn/N}dt \\
\xn & = \sum_{k=0}^{N-1}c_k e^{\,j2\pi kn/N}
\end{aligned}
    &   \begin{aligned}
X(\omega) & = \sum_{n=-\infty}^{\infty}\xn e^{-j\omega n} \\
\xn       & = \frac{1}{2\pi}\int_{2\pi}X(\omega) e^{\,j\omega n}
        \end{aligned} \\
    \hline
\end{array}
    $
    \end{table}
\end{frame}
\end{document}

enter image description here

1
  • very helpful. Thanks a lot @Zarko.
    – Rhandley
    Commented Mar 10, 2020 at 8:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .