我使用以下投影仪作为模板:
我已经尝试过使用 使表格居中\centering
,使用\begin{center}
和{centering}
以及\hspace
不居中,表格始终保持在同一位置。我不知道如何调整它。
套餐
\documentclass[fleqn]{beamer}
\usepackage[portuguese]{babel}
\usepackage[dvipsnames]{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{caption}
%\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{subcaption}
\usepackage{float}
\usepackage{svg}
\usepackage[demo]{graphicx}
\usepackage[font=tiny,labelfont=bf]{caption}
\usepackage[font=tiny,labelfont=bf]{subcaption}
\usepackage{mwe}
\usepackage{totcount}
\regtotcounter{section}
\usepackage{multido}
\usepackage{array,multirow}
\usepackage{dcolumn} % for 'D' column type
\newcolumntype{d}[2]{D{,}{,}{#1}} % align numbers on comma (decimal marker)
\usepackage[flushleft]{threeparttable}
% handy shortcut macros:
\newcommand\tnoteA{\tnote{\textasteriskcentered}}
\newcommand\tnoteB{\tnote{\textdagger}}
\newcommand\XX{$\times$}
\usepackage{amsmath} % for \smash[b] macro
\newcommand\mytab[1]{\smash[b]{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}}
% vertical separator macro
\newcommand{\vsep}{
\column{0.0\textwidth}
\begin{tikzpicture}
\draw[very thick,black!10] (0,0) -- (0,7.3);
\end{tikzpicture}
}
表格代码:
\begin{frame}[shrink=30]{32 amostras\slash ciclo}
\begin{table}[h]
\begin{threeparttable}
\begin{adjustbox}{\textwidth}
\begin{tabular}{| c | l d{1,6} *{10}{c} |}
\hline
Caso & \multicolumn{11}{c|}{32 amostras/ciclo} \\
\cline{2-12}
& Método
& \multicolumn{1}{c}{\mytab{Fechamento\\ da chave}}
& \multicolumn{8}{c}{Bloqueio do relé}
& Desempenho \\ %\cline{4-11}
& & & \multicolumn{8}{c}{Ângulo de carregamento} & \\ \cline{4-11}
& & & 0 & 1 & 5 & 10 & 15 & 30 & 45 & 60 & \\
\hline
\multirow{32}{*}{%
\begin{tabular}[c]{@{}c@{}} S\\O\\B\\ \\C\\A\\R\\G\\A \end{tabular}}
& \multirow{8}{*}{MPL}
& 0,2 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX &
\multirow{8}{*}{100\%} \\
& & 0,202083 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,204166 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,20625 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,208333 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,210416 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
\cline{2-12}
& \multirow{8}{*}{MFAAFO}
& 0,2 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX &
\multirow{8}{*}{100\%} \\
& & 0,202083 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,204166 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,20625 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,208333 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,210416 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
\cline{2-12}
& \multirow{8}{*}{MCSLFO}
& 0,2 & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA &
\multirow{8}{*}{54,16\%} \\
& & 0,202083 & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
& & 0,204166 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,20625 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,208333 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,210416 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
\cline{2-12}
& \multirow{8}{*}{MGMA}
& 0,2 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX &
\multirow{8}{*}{93,23\%} \\
& & 0,202083 & \XX & \XX & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
& & 0,204166 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,20625 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,208333 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,210416 & \XX & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
\hline
\end{tabular}
\end{adjustbox}
\smallskip
\small
\smallskip\small
Fonte: Autor
\end{threeparttable}
\end{table}
\end{frame}
答案1
这个shrink
选项很邪恶。不要使用它!
它会缩小内容而不提供更多的水平空间 - 除其他问题外,这意味着框架的右边距会显得更大,并且您将永远无法水平居中内容。
另外,您的表格对于框架来说太高,而宽度又不够。使用调整框将其重新缩放到文本宽度不会有任何用处。
而是选择合适的字体大小,以便表格适合框架
无关:
beamer 自动加载该
xcolor
包。您不能使用冲突的选项再次加载它。您可以将任何 xcolour 选项xcolor={...}
作为类选项传递同理
graphicx
。Beamer 会自动加载它,您不能使用冲突的选项再次加载它您的代码也无法编译,因为
adjustbox
缺少该包。但是由于使用它也没有多大意义,所以您可以不使用它。不要多次加载同一个包,例如
multirow
你不需要加载
amsmath
。Beameramssymb
已经加载它们了float
在没有浮动机制的类中加载包没有多大意义
\documentclass[fleqn,xcolor={dvipsnames},demo]{beamer}
\usepackage[portuguese]{babel}
%\usepackage[dvipsnames]{xcolor}
%\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage{graphicx}
%\usepackage{multirow}
\usepackage{caption}
%\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{subcaption}
%\usepackage{float}
\usepackage{svg}
%\usepackage[demo]{graphicx}
\usepackage[font=tiny,labelfont=bf]{caption}
\usepackage[font=tiny,labelfont=bf]{subcaption}
\usepackage{mwe}
\usepackage{totcount}
\regtotcounter{section}
\usepackage{multido}
%\usepackage{adjustbox}
\usepackage{array,multirow}
\usepackage{dcolumn} % for 'D' column type
\newcolumntype{d}[2]{D{,}{,}{#1}} % align numbers on comma (decimal marker)
\usepackage[flushleft]{threeparttable}
% handy shortcut macros:
\newcommand\tnoteA{\tnote{\textasteriskcentered}}
\newcommand\tnoteB{\tnote{\textdagger}}
\newcommand\XX{$\times$}
%\usepackage{amsmath} % for \smash[b] macro
\newcommand\mytab[1]{\smash[b]{\begin{tabular}[t]{@{}c@{}} #1 \end{tabular}}}
% vertical separator macro
\newcommand{\vsep}{
\column{0.0\textwidth}
\begin{tikzpicture}
\draw[very thick,black!10] (0,0) -- (0,7.3);
\end{tikzpicture}
}
\begin{document}
\begin{frame}{32 amostras\slash ciclo}
\begin{table}
% \centering
\begin{threeparttable}
%\begin{adjustbox}{\textwidth}
\Tiny
\begin{tabular}{| c | l d{1,6} *{10}{c} |}
\hline
Caso & \multicolumn{11}{c|}{32 amostras/ciclo} \\
\cline{2-12}
& Método
& \multicolumn{1}{c}{\mytab{Fechamento\\ da chave}}
& \multicolumn{8}{c}{Bloqueio do relé}
& Desempenho \\ %\cline{4-11}
& & & \multicolumn{8}{c}{Ângulo de carregamento} & \\ \cline{4-11}
& & & 0 & 1 & 5 & 10 & 15 & 30 & 45 & 60 & \\
\hline
\multirow{32}{*}{%
\begin{tabular}[c]{@{}c@{}} S\\O\\B\\ \\C\\A\\R\\G\\A \end{tabular}}
& \multirow{8}{*}{MPL}
& 0,2 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX &
\multirow{8}{*}{100\%} \\
& & 0,202083 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,204166 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,20625 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,208333 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,210416 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
\cline{2-12}
& \multirow{8}{*}{MFAAFO}
& 0,2 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX &
\multirow{8}{*}{100\%} \\
& & 0,202083 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,204166 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,20625 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,208333 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,210416 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
\cline{2-12}
& \multirow{8}{*}{MCSLFO}
& 0,2 & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA &
\multirow{8}{*}{54,16\%} \\
& & 0,202083 & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
& & 0,204166 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,20625 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,208333 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,210416 & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \XX\tnoteB & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
\cline{2-12}
& \multirow{8}{*}{MGMA}
& 0,2 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX &
\multirow{8}{*}{93,23\%} \\
& & 0,202083 & \XX & \XX & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
& & 0,204166 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,20625 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,208333 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,210416 & \XX & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \XX\tnoteA & \\
& & 0,2125 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
& & 0,214583 & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \XX & \\
\hline
\end{tabular}
%\end{adjustbox}
\smallskip
\small
\smallskip\tiny
Fonte: Autor
\end{threeparttable}
\end{table}
\end{frame}
\end{document}