I'm using the following beamer as a template:
And I already tried to center the table with \centering
, with \begin{center}
and {centering}
, \hspace
and no centering, the table always stays in the same position. I have no idea how to adjust this.
Packages
\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}
}
Table code:
\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}
Best Answer
The
shrink
option is evil. Don't use it!It will scale down the content without giving more horizontal space - amongst other problems this will mean that the right margin of the frame will appear bigger and you'll never be able to horizontally centre the content.
Also your table is too height for the frame and not too wide. Using adjustbox to rescale it to the textwidth won't do anything useful.
Instead choose a suitable font size so the table fits on the frame
Unrelated:
beamer automatically loads the
xcolor
package. You mustn't load it again with conflicting options. You can pass whatever xcolour option you like withxcolor={...}
as class optionsame for
graphicx
. Beamer automatically loads it, you musn't load it again with conflicting optionsyour code also wouldn't compile because the
adjustbox
package was missing. But as it didn't make much sense to use it anyway, you could simply not use it.don't load one and the same package multiple time, e.g.
multirow
you don't need to load
amsmath
andamssymb
. Beamer already loads themit does not make much sense to load the
float
package in a class which does not have a floating mechanism