如何使用 Beamer 中的列环境使长表适合

如何使用 Beamer 中的列环境使长表适合

我有一张长表,我想在 latex 中将其分成两列beamer。为此,我使用了 columns 环境,效果很好。问题是\resizebox(我通常会使用它beamer来使表格适合框架的边距)似乎不起作用。

因此,我想知道是否有一个命令可以用来使分割表的长度适合一个框架的两列。这是我的代码:

\RequirePackage{etex} 
\documentclass[10pt]{beamer}

\usetheme{Boadilla}
\usepackage{bm}
\usepackage{graphicx} 

\usepackage{xcolor}

\usepackage{color, colortbl}
\definecolor{LRed}{rgb}{1,.8,.8}
\definecolor{MRed}{rgb}{1,.6,.6}
\definecolor{HRed}{rgb}{1,.2,.2}

\usepackage[english]{babel}
\usepackage{csquotes}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}
\usepackage{fixltx2e}
\usepackage{wasysym}

\setbeamertemplate{caption}{\insertcaption}
\renewcommand\mathfamilydefault{\rmdefault}     
\definecolor{red1}{rgb}{1,0,0}
\definecolor{red2}{rgb}{0.93,0,0}
\definecolor{red3}{rgb}{0.8,0,0}
\definecolor{red4}{rgb}{0.54,0,0}

\usepackage{epstopdf}

\mode<presentation>
{
\usetheme[compress]{Berlin}
    \usecolortheme[named=red1]{structure}   
}

\begin{document}    
\begin{frame}
\begin{columns}[T] % align columns
    \begin{column}{.50\textwidth}
    \vspace{-0.5cm}
        \begin{table} [H]
        \footnotesize
            \begin{center}
            \scriptsize
            \resizebox{\textwidth}{!}{
                \begin{tabular}{l c c}
                \multirow{2}{*}{\textbf{Levels}}& \multicolumn{2}{c}{\textbf{(5)}}\\
                & \textbf{Mean} & \textbf{s.d.} \\
                \hline
                \multirow{2}{*}{AIRQ\_better}&.554***&.171***\\
                &(.021)&(.060)\\
                \multirow{2}{*}{AIRQ\_worse}&-.706***&.349***\\
                &(.025)&(.036)\\
                \multirow{2}{*}{TEMP\_warm}& .090***&.196***\\
                &(.012)&(.029)\\
                \multirow{2}{*}{COST\_low}&.365***&\\
                &(.020)&\\
                \multirow{2}{*}{COST\_high}& -.403***&\\
                &(.021)&\\
                \multirow{2}{*}{CONTR\_high}&.242***&.211***\\
                &(.019)&(.049)\\
                \multirow{2}{*}{CONTR\_low}&-.216***&.210***\\
                &(.019)&(.049)\\
                \multirow{2}{*}{NOISE\_in/out}&.191***&.033\\
                &(.023)&(.114)\\
                \multirow{2}{*}{NOISE\_out}&.046**&.007\\
                &(.023)&(.131)\\
                \multirow{2}{*}{NOISE\_none}&-.296***&.253***\\
                &(.025)&(.062)\\
                \multirow{2}{*}{AESTH\_in/out}&.215***&.174*\\
                &(.027)&(.104)\\
                \multirow{2}{*}{AESTH\_in}&.129***&.159\\   
                &(.027)&(.110)\\
                \end{tabular}
                }
            \end{center}
        \end{table} 
    \end{column}

    \begin{column}{.50\textwidth}
    \vspace{-0.5cm}
        \begin{table} [H]
        \footnotesize
            \begin{center}
            \scriptsize
            \resizebox{\textwidth}{!}{
                \begin{tabular}{l c c}
                \multirow{2}{*}{AESTH\_out}&.006&.159\\
                &(.027)&(.101)\\
                \multirow{2}{*}{AESTH\_out+in-}&-.237***&.072\\
                &(.028)&(.213)\\
                \multirow{2}{*}{SAV\_20}&-.457***&.225***\\
                &(.021)&(.050)\\
                \multirow{2}{*}{SAV\_80}&.479***&.304***\\
                &(.021)&(.037)\\
                \multirow{2}{*}{NONE}&-.769***&3.308***\\
                &(.074)&(.088)\\
                \multirow{2}{*}{TEMPwarm*SAV20}&-.052**&.001\\
                &(.022)&(.088)\\
                \multirow{2}{*}{Fem*AIRQbetter}&.042**&\\
                &(.018)&\\
                \multirow{2}{*}{Fem*AIRQworse}&-.065***&\\
                &(.020)&\\
                \multirow{2}{*}{Fem*CONTRhigh}&.047***&\\
                &(.018)&\\
                \multirow{2}{*}{Fem*CONTRlow}&-.057***&\\
                &(.019)&\\
                \multirow{2}{*}{Fem*NOISEin/out}&.054***&\\
                &(.021)&\\
                \multirow{2}{*}{Fem*NOISEnone}&-.089***&\\
                &(.023)&\\
                \multirow{2}{*}{Fem*AESTHin}&.045**&\\
                &(.022)&\\
                \end{tabular}
                }
            \end{center}
        \end{table} 
    \end{column}%
\end{columns}
\end{frame}
\end{document}

答案1

作为第一次迭代...看看以下解决方案是否最接近您要寻找的解决方案。表格尚未完成:

在此处输入图片描述

\documentclass{beamer}
\usetheme{Boadilla}
\setbeamertemplate{caption}{\insertcaption}
\renewcommand\mathfamilydefault{\rmdefault}

\mode<presentation>
{
\usetheme[compress]{Berlin}
%\usecolortheme[named=red1]{structure}
}

%\usepackage{bm}
%\usepackage{graphicx}

\usepackage[english]{babel}
\usepackage{csquotes}

%\usepackage{multicol}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand\theadfont{\bfseries}
%\usepackage{fixltx2e}
%\usepackage{wasysym}

%\definecolor{LRed}{rgb}{1,.8,.8}
%\definecolor{MRed}{rgb}{1,.6,.6}
%\definecolor{HRed}{rgb}{1,.2,.2}

%\definecolor{red1}{rgb}{1,0,0}
%\definecolor{red2}{rgb}{0.93,0,0}
%\definecolor{red3}{rgb}{0.8,0,0}
%\definecolor{red4}{rgb}{0.54,0,0}

%\usepackage{epstopdf}


\begin{document}
\begin{frame}
    \vspace{-0.5cm}
\begin{table}
    \small
    \centering
\begin{tabularx}{\textwidth}{X c c 
                        @{\hspace{2em}} 
                             X c c}
    &    \multicolumn{2}{c}{\textbf{(5)}}
        &    &  \multicolumn{2}{c}{\textbf{(5)}}                \\
    \cmidrule(lr){2-3}  \cmidrule(lr){5-6}
\thead{Levels}
    &   \thead{Mean} & \thead{s.d.}
        &   \thead{Levels}
            &   \thead{Mean} & \thead{s.d.} \\
    \cmidrule(r) {1-3}  \cmidrule(l){4-6}
\multirow{2}{*}{AIRQ\_better}           &   .554*** &   .171***
    &   \multirow{2}{*}{AESTH\_out}     &   .006    &   .159    \\
    &   (.021)  &   (.060)  &           &   (.027)  &   (.101)  \\
\multirow{2}{*}{AIRQ\_worse}            &  -.706*** &   .349***
    &   \multirow{2}{*}{AESTH\_out+in-} &  -.237*** &   .072    \\
    &   (.025)  &   (.036)  &           &   (.028)  &   (.213)  \\
\multirow{2}{*}{TEMP\_warm}             &   .090*** &   .196***
    &   \multirow{2}{*}{SAV\_20}        &  -.457*** &   .225*** \\
    &   (.012)  &   (.029)  &           &   (.021)  &   (.050)  \\
\multirow{2}{*}{COST\_low}              &   .365*** &
    &   \multirow{2}{*}{SAV\_80}        &   .479*** &   .304*** \\
    &   (.020)  &           &           &   (.021)  &   (.037)  \\
\multirow{2}{*}{COST\_high}             &  -.403*** &
    &   \multirow{2}{*}{NONE}           &  -.769*** &  3.308*** \\
    &   (.021)  &           &           &   (.074)  &   (.088)  \\
    \cmidrule[1pt](r) {1-3}  \cmidrule[1pt](l){4-6}
    \end{tabularx}
\end{table}
\end{frame}
\end{document}

相关内容