我正在尝试创建两个表格并将它们放在一起。每个表格应缩小到绿色显示的矩形,同时保持纵横比。但是,情况似乎并非如此。用盲文替换表格似乎效果很好。
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\useoutertheme{miniframes}
\useinnertheme{inmargin}
\usepackage{adjustbox}
\usepackage{ragged2e}
% ========== Table packages ==========
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow}
% ========== Equations and math packages ==========
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\usepackage[defaultmathsizes, subdued, italic, symbolre, symbolmisc]{mathastext}
% BEGIN_FOLD
\MTDeclareVersion[it]{charter}{T1}{bch}{m}{n}
\AtBeginDocument{\MTversion*{charter}}
% END_FOLD
% Set margins
\newlength{\widthTextMarginLeftPageWide}
\setlength{\widthTextMarginLeftPageWide}{5mm}
\newlength{\widthTextMarginRightPageWide}
\setlength{\widthTextMarginRightPageWide}{5mm}
% Command to change margins for a page wide
\makeatletter
\newcommand{\framePageWide}{
\def\Gm@lmargin{\widthTextMarginLeftPageWide}%
\def\Gm@rmargin{\widthTextMarginRightPageWide}%
\textwidth=\dimexpr\paperwidth-\Gm@lmargin-\Gm@rmargin\relax
\hsize\textwidth
\columnwidth\textwidth
\hoffset=\dimexpr-\beamer@leftsidebar+\Gm@lmargin-\widthTextMarginLeftPageWide\relax
}
\makeatother
\begin{document}
\newcolumntype{q}[1]{>{\raggedright \arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{w}[1]{>{\centering \arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{e}[1]{>{\raggedleft \arraybackslash\hspace{0pt}}m{#1}}
{\framePageWide
\begin{frame}{Results}
\begin{adjustbox}{minipage={0.45\textwidth}, max totalsize={0.45\textwidth}{!}, cframe=SpringGreen3 0.3mm}
\begin{tabular}{w{2cm} @{\extracolsep{1mm}}|w{1.5cm} w{1.5cm} w{1.5cm}}
\toprule
\multirow{3}{=}{\centering System Size} & \multicolumn{3}{c}{Time Needed With Our Approach}
\\
& \multicolumn{3}{c}{(Extended Brown's Method)}
\\
\Xcline{2-4}{0.25mm}
& min & mean & max
\\
\Xhline{0.25mm}
200-bus & $3\times10^{-6}$ & $4.3\times10^{-6}$ & $5\times10^{-6}$
\\
2383-bus & $3\times10^{-6}$ & $3.8\times10^{-6}$ & $6\times10^{-6}$
\\
3120-bus & $3\times10^{-6}$ & $3.2\times10^{-6}$ & $4\times10^{-6}$
\\
\bottomrule
\end{tabular}
\end{adjustbox}
\hfill
\begin{adjustbox}{minipage={0.45\textwidth}, max totalsize={0.45\textwidth}{!}, cframe=SpringGreen3 0.3mm}
\begin{tabular}{w{2cm} @{\extracolsep{1mm}}|w{1.5cm} w{1.5cm} w{1.5cm}}
\toprule
\multirow{3}{=}{\centering System Size} & \multicolumn{3}{c}{Time Needed With}
\\
& \multicolumn{3}{c}{Conventional Brown's Method}
\\
\Xcline{2-4}{0.25mm}
& min & mean & max
\\
\Xhline{0.25mm}
200-bus & $0.089$ & $0.092$ & $0.1000$
\\
2383-bus & $163.8$ & $166.2$ & $172.5$
\\
3120-bus & $387.2$ & $398.8$ & $415.6$
\\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{frame}
}
\end{document}
答案1
我会重新设计您的表格如下:
- 删除第二个表的第一列
- 删除
\hfill
表之间的 - 使用包
S
中的列类型siunitx
- 用于桌子
tabularx
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\useoutertheme{miniframes}
\useinnertheme{inmargin}
\usepackage{siunitx}
\usepackage{ragged2e}
% ========== Table packages ==========
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{tabularx}
\newcommand\mcx[1]{\multicolumn{1}{>{\centering\arraybackslash}X}{#1}}
% ========== Equations and math packages ==========
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[defaultmathsizes, subdued, italic, symbolre, symbolmisc]{mathastext}
% BEGIN_FOLD
\MTDeclareVersion[it]{charter}{T1}{bch}{m}{n}
\AtBeginDocument{\MTversion*{charter}}
\begin{document}
\begin{frame}{Results}
\small
\begin{tabularx}{0.55\linewidth}{@{} p{3.8em}
S[table-format=1.0e1]
S[table-format=1.1e1]
S[table-format=1.0e1]
@{} }
\toprule
\multirow{3}{=}{\centering System Size}
& \multicolumn{3}{c}{\makecell{Time Needed\\
With Our Approach\\
(Extended Brown's Method)}} \\
\cmidrule(lr){2-4}
& \mcx{min} & \mcx{mean} & \mcx{max}
\\
\midrule
200-bus & 3e6 & 4.3e6 & 5e6 \\
2383-bus & 3e6 & 3.8e6 & 6e6 \\
3120-bus & 3e6 & 3.2e6 & 4e6 \\
\bottomrule
\end{tabularx}\begin{tabularx}{0.4\linewidth}{@{}
S[table-format=3.3]
S[table-format=3.3]
S[table-format=3.3]
@{} }
\toprule
\multicolumn{3}{c}{\makecell{Time Needed\\
With Conventional\\
Brown's Method}} \\
\cmidrule(lr){1-3}
\mcx{min} & \mcx{mean} & \mcx{max}
\\
\midrule
0.089 & 0.092 & 0.100 \\
163.8 & 166.2 & 172.5 \\
387.2 & 398.8 & 415.6 \\
\bottomrule
\end{tabularx}
\end{frame}
\end{document}
答案2
这是将两个表合并为一个表的另一个建议。它使用一个tabular*
环境,宽度设置为\textwidth
。包S
的列类型siunitx
用于格式化和对齐数字单元格。我还会让框架标题更具描述性。
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\useoutertheme{miniframes}
%\useinnertheme{inmargin}
\usepackage{ragged2e,booktabs,array}
\usepackage{amsmath,amssymb,siunitx}
\begin{document}
\begin{frame}{Times needed with extended and conventional Brown's methods}
\sisetup{exponent-product=\cdot}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
l S[table-format=1e-1]
S[table-format=1.1e-1]
S[table-format=1e-1]
*{3}{S[table-format=3.3]} }
\toprule
System Size & \multicolumn{6}{c}{Times needed with \dots} \\
\cmidrule{2-7}
& \multicolumn{3}{c}{Ext.\ Brown's Method}
& \multicolumn{3}{c}{Conv.\ Brown's Method}\\
& \multicolumn{3}{c}{(Our Method)}\\
\cmidrule{2-4} \cmidrule{5-7}
& {min} & {mean} & {max} & {min} & {mean} & {max} \\
\midrule
\phantom{2}200-bus
& 3e-6 & 4.3e-6 & 5e-6 & 0.089 & 0.092 & 0.100 \\
2383-bus & 3e-6 & 3.8e-6 & 6e-6 & 163.8 & 166.2 & 172.5 \\
3120-bus & 3e-6 & 3.2e-6 & 4e-6 & 387.2 & 398.8 & 415.6 \\
\bottomrule
\end{tabular*}
\end{frame}
\end{document}