如何按列对齐多个表格?

如何按列对齐多个表格?

在此处输入图片描述

我想把第三个表往下拉,这样就能和其他表对齐了。还有一个问题,就是第三个表的表头连在一起了。

\documentclass[usenames,dvipsnames]{beamer}
\usepackage{dcolumn}
\usefonttheme[onlymath]{serif}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[justification=centering]{caption}
\usetheme{Madrid}
\newcolumntype{2}{D{.}{}{2.0}}
\begin{document}
\begin{frame}
 \frametitle{GF(7)}
\setlength\doublerulesep{0pt}
\begin{columns}
\footnotesize
\setlength{\tabcolsep}{3.5pt}
\noindent
 \begin{column}{0.4\linewidth}
 \centering
  \begin{tabular}{r|*{7}{2}}
+ & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
\hline
0 & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
1 & 1 & 2 & 3 & 4 & 5 & 6 & 0\\
2 & 2 & 3 & 4 & 5 & 6 & 0 & 1\\
3 & 3 & 4 & 5 & 6 & 0 & 1 & 2\\
4 & 4 & 5 & 6 & 0 & 1 & 2 & 3\\
5 & 5 & 6 & 0 & 1 & 2 & 3 & 4\\
6 & 6 & 0 & 1 & 2 & 3 & 4 & 5\\
\end{tabular}
\captionof{table}{Addition modulo $7$}
\end{column}

 \begin{column}{0.4\linewidth}
 \centering
  \begin{tabular}{r|*{7}{2}}
x & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
\hline
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
1 & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
2 & 0 & 2 & 4 & 6 & 1 & 3 & 5\\
3 & 0 & 3 & 6 & 2 & 5 & 1 & 4\\
4 & 0 & 4 & 1 & 5 & 2 & 6 & 3\\
5 & 0 & 5 & 3 & 1 & 6 & 4 & 2\\
6 & 0 & 6 & 5 & 4 & 3 & 2 & 1\\
\end{tabular}
\captionof{table}{Multiplicative modulo $7$}
\end{column}

\begin{column}{0.2\linewidth}
\centering
 \begin{tabular}{r|*{2}{2}}
  w & -w & w^{-1}\\
  \hline
  0 & 0 & -\\
  1 & 6 & 1\\
  2 & 5 & 4\\
  3 & 4 & 5\\
  4 & 3 & 2\\
  5 & 2 & 3\\
  6 & 1 & 6\\
 \end{tabular}
\captionof{table}{Additive and Multiplicative inverse modulo $7$}
\end{column}
\end{columns}
\end{frame}

\end{document}  

答案1

\documentclass[usenames,dvipsnames]{beamer}
\usepackage{dcolumn}
\usefonttheme[onlymath]{serif}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[justification=centering]{caption}
\usetheme{Madrid}
\newcolumntype{2}{D{.}{}{2.0}}
\begin{document}
\begin{frame}
 \frametitle{GF(7)}
\setlength\doublerulesep{0pt}
\begin{columns}[T]
\footnotesize
\setlength{\tabcolsep}{3.5pt}
\noindent
 \begin{column}{0.4\linewidth}
 \centering
  \begin{tabular}{r|*{7}{2}}
+ & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
\hline
0 & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
1 & 1 & 2 & 3 & 4 & 5 & 6 & 0\\
2 & 2 & 3 & 4 & 5 & 6 & 0 & 1\\
3 & 3 & 4 & 5 & 6 & 0 & 1 & 2\\
4 & 4 & 5 & 6 & 0 & 1 & 2 & 3\\
5 & 5 & 6 & 0 & 1 & 2 & 3 & 4\\
6 & 6 & 0 & 1 & 2 & 3 & 4 & 5\\
\end{tabular}
\captionof{table}{Addition modulo $7$}
\end{column}

 \begin{column}{0.4\linewidth}
 \centering
  \begin{tabular}{r|*{7}{2}}
x & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
\hline
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
1 & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
2 & 0 & 2 & 4 & 6 & 1 & 3 & 5\\
3 & 0 & 3 & 6 & 2 & 5 & 1 & 4\\
4 & 0 & 4 & 1 & 5 & 2 & 6 & 3\\
5 & 0 & 5 & 3 & 1 & 6 & 4 & 2\\
6 & 0 & 6 & 5 & 4 & 3 & 2 & 1\\
\end{tabular}
\captionof{table}{Multiplicative modulo $7$}
\end{column}

\begin{column}{0.2\linewidth}
\centering
 \begin{tabular}{r|*{2}{2}}
  w & -w & w^{-1}\\
  \hline
  0 & 0 & -\\
  1 & 6 & 1\\
  2 & 5 & 4\\
  3 & 4 & 5\\
  4 & 3 & 2\\
  5 & 2 & 3\\
  6 & 1 & 6\\
 \end{tabular}
\captionof{table}{Additive and Multiplicative inverse modulo $7$}
\end{column}
\end{columns}
\end{frame}

\end{document}  

在此处输入图片描述

答案2

  • 我不会混淆caption包和beamer。beamer 有自己的caption机制
  • 在你的情况下,我宁愿使用标题\parbox(名称Table似乎没有提供信息
  • 用数字命名列类型不是一个明智的想法
  • 在你的情况下,你不需要dcolumn包和d

    \documentclass[usenames,dvipsnames]{beamer}
    \usefonttheme[onlymath]{serif}
    \usetheme{Madrid}
    \usepackage{amsmath}
    \usepackage{array}
    \newcolumntype{C}{>{$}c<{$}}
    
    \begin{document}
    \begin{frame}
    \frametitle{GF(7)}
    \begin{columns}[T]
        \footnotesize
        \setlength{\tabcolsep}{4.5pt}
    \begin{column}{0.35\linewidth}
     \centering
      \begin{tabular}{r|*{7}{C}}
    + & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
    \hline
    0 & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
    1 & 1 & 2 & 3 & 4 & 5 & 6 & 0\\
    2 & 2 & 3 & 4 & 5 & 6 & 0 & 1\\
    3 & 3 & 4 & 5 & 6 & 0 & 1 & 2\\
    4 & 4 & 5 & 6 & 0 & 1 & 2 & 3\\
    5 & 5 & 6 & 0 & 1 & 2 & 3 & 4\\
    6 & 6 & 0 & 1 & 2 & 3 & 4 & 5\\
    \end{tabular}\\[1ex]
    \parbox{\linewidth}{\centering
                        Addition modulo $7$}
    \end{column}
    
    \begin{column}{0.35\linewidth}
     \centering
      \begin{tabular}{r|*{7}{C}}
    x & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
    \hline
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
    1 & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
    2 & 0 & 2 & 4 & 6 & 1 & 3 & 5\\
    3 & 0 & 3 & 6 & 2 & 5 & 1 & 4\\
    4 & 0 & 4 & 1 & 5 & 2 & 6 & 3\\
    5 & 0 & 5 & 3 & 1 & 6 & 4 & 2\\
    6 & 0 & 6 & 5 & 4 & 3 & 2 & 1\\
    \end{tabular}\\[1ex]
    \parbox{\linewidth}{\centering
                        Multiplicative modulo $7$}
    \end{column}
    
    \begin{column}{0.3\linewidth}
    \centering
     \begin{tabular}{r|CC}
      w & -w & w^{-1}\\
      \hline
      0 & 0 & -\\
      1 & 6 & 1\\
      2 & 5 & 4\\
      3 & 4 & 5\\
      4 & 3 & 2\\
      5 & 2 & 3\\
      6 & 1 & 6\\
     \end{tabular}\\[1ex]
    \parbox{\linewidth}{\centering
                        Additive and Multiplicative inverse modulo $7$}
    \end{column}
    \end{columns}
    \end{frame}
    
    \end{document}
    

在此处输入图片描述

相关内容