Uma longa mesa em beamer de látex
Eu tenho uma longa mesa como segue. Quero ajustar a mesa em uma única moldura.
Eu li a postagem neste site. Mas ainda não consigo alcançá-lo. Você poderia me ajudar?
\documentclass[mathserif]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usetheme{Berlin}
\usepackage{graphics}
\usepackage{times}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{longtable}
\graphicspath{{figures/}}
\usepackage{subfig}
\usepackage{hyperref}
\usepackage{cleveref}
\PassOptionsToPackage{force}{filehook}
\begin{document}
\begin{frame}[allowframebreaks]
\begin{table}[hbt!]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}\hline
$x$&$t$&$U_{{\it numeric}} \left( x,t \right) $&$U_{{\it exact}} \left( x,t \right) $&${\it Error}$&${\it Refsolution}$&${\it RefError}$\\ \hlin\hline
$0$&$0$&$ 0.7938824$&$1$&$ 0.2061176$&$ 1.0$&$ 0.0\, \mathrm{E}^{+00}$ \\ \hline
$0$&$ 0.2$&$ 1.006211$&$ 0.9955687$&$ 0.0106423$&$ 0.9902$&$ 5.400\, \mathrm{E}^{-03}$ \\ \hline
$0$&$ 0.4$&$ 0.9876852$&$ 0.9824309$&$ 0.0052543$&$ 0.9627$&$ 1.980\, \mathrm{E}^{-02}$ \\ \hline
$0$&$ 0.6$&$ 0.9503579$&$ 0.9610430$&$ 0.0106851$&$ 0.9235$&$ 3.750\, \mathrm{E}^{-02}$ \\ \hline
$0$&$ 0.8$&$ 0.8949527$&$ 0.9321290$&$ 0.0371763$&$ 0.8827$&$ 4.950\, \mathrm{E}^{-02}$ \\ \hline
$0$&$ 1.0$&$ 0.8224107$&$ 0.8966296$&$ 0.0742189$&$ 0.8542$&$ 4.250\, \mathrm{E}^{-02}$ \\ \hline
$ 0.5$&$0$&$ 1.009713$&$ 0.9845362$&$ 0.0251768$&$ 0.9845$&$ 0.0\, \mathrm{E}^{+00}$ \\ \hline
$ 0.5$&$ 0.2$&$ 0.9953282$&$ 0.9966049$&$ 0.0012767$&$ 0.9994$&$ 2.800\, \mathrm{E}^{-03}$ \\ \hline
$ 0.5$&$ 0.4$&$ 0.9988702$&$ 0.9999306$&$ 0.0010604$&$ 0.9946$&$ 5.300\, \mathrm{E}^{-03}$ \\ \hline
$ 0.5$&$ 0.6$&$ 0.9953922$&$ 0.9943961$&$ 0.0009961$&$ 0.9734$&$ 2.100\, \mathrm{E}^{-02}$ \\ \hline
$ 0.5$&$ 0.8$&$ 0.9850632$&$ 0.9801960$&$ 0.0048672$&$ 0.9459$&$ 3.430\, \mathrm{E}^{-02}$ \\ \hline
$ 0.5$&$ 1.0$&$ 0.9683171$&$ 0.9578230$&$ 0.0104941$&$ 0.9316$&$ 2.620\, \mathrm{E}^{-02}$ \\ \hline
$ 1.0$&$0$&$ 0.940015$&$ 0.9400148$&$ 0.0000002$&$ 0.9400$&$ 0.0\, \mathrm{E}^{+00}$ \\ \hline
$ 1.0$&$ 0.2$&$ 0.9671292$&$ 0.9671279$&$ 0.0000013$&$ 0.9775$&$ 1.040\, \mathrm{E}^{-02}$ \\ \hline
$ 1.0$&$ 0.4$&$ 0.9865112$&$ 0.9865114$&$ 0.0000002$&$ 0.9974$&$ 1.090\, \mathrm{E}^{-02}$ \\ \hline
$ 1.0$&$ 0.6$&$ 0.9975042$&$ 0.9975042$&$ 0.0$&$ 0.9974$&$ 1.0\, \mathrm{E}^{-04}$ \\ \hline
$ 1.0$&$ 0.8$&$ 0.9997222$&$ 0.9997222$&$ 0.0$&$ 0.9801$&$ 1.960\, \mathrm{E}^{-02}$ \\ \hline
$ 1.0$&$ 1.0$&$ 0.9930872$&$ 0.9930876$&$ 0.0000004$&$ 0.9556$&$ 3.750\, \mathrm{E}^{-02}$ \\ \hline
\end{tabular}
\end{center}
\end{table}
\end{frame}
\end{document}
Respostas
Como o material da tabela deve caber em um único quadro, acredito que você precise mudar para o \scriptsize
tamanho de fonte relativo.
Eu daria à mesa uma "aparência" mais aberta, eliminando todas as linhas verticais e usando muito menos linhas horizontais, mas bem espaçadas. Eu também usaria alguns dos mecanismos do siunitx
pacote para alinhar os números em seus respectivos marcadores decimais.

\documentclass[mathserif]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%% \usepackage{lmodern} % is overridden by 'times' package
\usepackage[english]{babel}
\usepackage{amsmath}
%%% \usepackage{amsfonts} % is loaded automatically by 'amssymb' package
\usepackage{amssymb}
\usepackage{graphicx}
\graphicspath{{figures/}}
%%% \usepackage{graphics} % don't load both 'graphicx' and 'graphics'
\usetheme{Berlin}
\usefonttheme{professionalfonts}
\usepackage{newtxtext,newtxmath}
\usepackage{booktabs,siunitx}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{subfig}
%%% \usepackage{hyperref} % is loaded automatically by 'beamer'
\usepackage{cleveref}
\PassOptionsToPackage{force}{filehook}
\begin{document}
\begin{frame}%[allowframebreaks]
\sisetup{group-digits=false}
%\begin{table}[hbt!]
%\begin{center}
\centering
\scriptsize
\begin{tabular}{@{}
*{2}{S[table-format=1.1]}
*{3}{S[table-format=1.7]}
S[table-format=1.4]
S[table-format=1.3e-1]
@{} }
\toprule
{$x$} & {$t$} & {$U_{\mathit{numeric}} ( x,t )$} & {$U_{\mathit{exact}} ( x,t )$}
& {$\mathit{Error}$} & {$\mathit{RefSolution}$} & {$\mathit{RefError}$} \\
\midrule
0 & 0 & 0.7938824 & 1 & 0.2061176 & 1.0 & 0.0e+00 \\
0 & 0.2 & 1.006211 & 0.9955687 & 0.0106423 & 0.9902 & 5.400e-03 \\
0 & 0.4 & 0.9876852 & 0.9824309 & 0.0052543 & 0.9627 & 1.980e-02 \\
0 & 0.6 & 0.9503579 & 0.9610430 & 0.0106851 & 0.9235 & 3.750e-02 \\
0 & 0.8 & 0.8949527 & 0.9321290 & 0.0371763 & 0.8827 & 4.950e-02 \\
0 & 1.0 & 0.8224107 & 0.8966296 & 0.0742189 & 0.8542 & 4.250e-02 \\
\addlinespace
0.5 & 0 & 1.009713 & 0.9845362 & 0.0251768 & 0.9845 & 0.0e+00 \\
0.5 & 0.2&0.9953282 & 0.9966049 & 0.0012767 & 0.9994 & 2.800e-03 \\
0.5 & 0.4&0.9988702 & 0.9999306 & 0.0010604 & 0.9946 & 5.300e-03 \\
0.5 & 0.6&0.9953922 & 0.9943961 & 0.0009961 & 0.9734 & 2.100e-02 \\
0.5 & 0.8&0.9850632 & 0.9801960 & 0.0048672 & 0.9459 & 3.430e-02 \\
0.5 & 1.0&0.9683171 & 0.9578230 & 0.0104941 & 0.9316 & 2.620e-02 \\
\addlinespace
1.0 & 0 &0.940015 & 0.9400148 & 0.0000002 & 0.9400 & 0.0e+00 \\
1.0 & 0.2&0.9671292 & 0.9671279 & 0.0000013 & 0.9775 & 1.040e-02 \\
1.0 & 0.4&0.9865112 & 0.9865114 & 0.0000002 & 0.9974 & 1.090e-02 \\
1.0 & 0.6&0.9975042 & 0.9975042 & 0.0 & 0.9974 & 1.0e-04 \\
1.0 & 0.8&0.9997222 & 0.9997222 & 0.0 & 0.9801 & 1.960e-02 \\
1.0 & 1.0&0.9930872 & 0.9930876 & 0.0000004 & 0.9556 & 3.750e-02 \\
\bottomrule
\end{tabular}
%\end{center}
%\end{table}
\end{frame}
\end{document}
longtable
no beamer não preserva todos os recursos existentes nas classes de documentos como estãoarticle
,book
etc. Consequentemente, você precisa inserir manualmente os cabeçalhos das colunas (se quiser) em cada slide do quadro.No seu MWE você usa
table
ambiente, o que pode significar que você realmente está interessado que a tabela se encaixe em umaframe
. Isso pode ser conseguido, se você reduzir o tamanho da fonte suficientemente como foi o @Mico em sua resposta.Caso goste de fontes maiores na tabela, você pode imitar
longtable
da seguinte forma:- mesa dividida em duas partes
- cada parte usa o
tabular
ambiente da tabela - em cada parte insira cabeçalhos de colunas
\documentclass[mathserif]{beamer}
\usetheme{Berlin}
\setbeamertemplate{frametitle continuation}%
{(\insertcontinuationcount)%
}% end frame title continuation
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage[english]{babel}
\usepackage{siunitx}
\begin{document}
\begin{frame}[allowframebreaks]
\frametitle{My longtable}
\sisetup{table-format=1.7,
tight-spacing=true}
\setlength\tabcolsep{3pt}
\setlength\extrarowheight{1pt}
\small
\begin{tabular}{|*{2}{S[table-format=1.1]|}
S|S|S|
S[table-format=1.3]|
S[table-format=1.3e-1]|}
\hline
{x} & {t} & {$U_{\mathrm{numeric}}(x,t)$}
& {$U_{\mathrm{exact}}(x,t)$}
& {Error}
& {Ref\textsubscript{solution}}
& {Ref\textsubscript{Error}} \\ \hline\hline
0 & 0 & 0.7938824 & 1 & 0.2061176 & 1.0 & 0.0 e0 \\ \hline
0 & 0.2 & 1.006211 & 0.9955687 & 0.0106423 & 0.9902 & 5.400 e-03 \\ \hline
0 & 0.4 & 0.9876852 & 0.9824309 & 0.0052543 & 0.9627 & 1.980 e-02 \\ \hline
0 & 0.6 & 0.9503579 & 0.9610430 & 0.0106851 & 0.9235 & 3.750 e-02 \\ \hline
0 & 0.8 & 0.8949527 & 0.9321290 & 0.0371763 & 0.8827 & 4.950 e-02 \\ \hline
0 & 1.0 & 0.8224107 & 0.8966296 & 0.0742189 & 0.8542 & 4.250 e-02 \\ \hline
0.5 & 0 & 1.009713 & 0.9845362 & 0.0251768 & 0.9845 & 0.0 E0 \\ \hline
0.5 & 0.2 & 0.9953282 & 0.9966049 & 0.0012767 & 0.9994 & 2.800 e-03 \\ \hline
0.5 & 0.4 & 0.9988702 & 0.9999306 & 0.0010604 & 0.9946 & 5.300 e-03 \\ \hline
\end{tabular}
%---------------------------------------------------------------%
\begin{tabular}{|*{2}{S[table-format=1.1]|}
S|S|S|
S[table-format=1.3]|
S[table-format=1.3,
table-figures-exponent=2]|}
\hline
{x} & {t} & {$U_{\mathrm{numeric}}(x,t)$}
& {$U_{\mathrm{exact}}(x,t)$}
& {Error}
& {Ref\textsubscript{solution}}
& {Ref\textsubscript{Error}} \\ \hline\hline
0.5 & 0.6 & 0.9953922 & 0.9943961 & 0.0009961 & 0.9734 & 2.100 e-02 \\ \hline
0.5 & 0.8 & 0.9850632 & 0.9801960 & 0.0048672 & 0.9459 & 3.430 e-02 \\ \hline
0.5 & 1.0 & 0.9683171 & 0.9578230 & 0.0104941 & 0.9316 & 2.620 e-02 \\ \hline
1.0 &0 & 0.940015 & 0.9400148 & 0.0000002 & 0.9400 & 0.0 e0 \\ \hline
1.0 & 0.2 & 0.9671292 & 0.9671279 & 0.0000013 & 0.9775 & 1.040 e-02 \\ \hline
1.0 & 0.4 & 0.9865112 & 0.9865114 & 0.0000002 & 0.9974 & 1.090 e-02 \\ \hline
1.0 & 0.6 & 0.9975042 & 0.9975042 & 0.0 & 0.9974 & 1.0 e-4 \\ \hline
1.0 & 0.8 & 0.9997222 & 0.9997222 & 0.0 & 0.9801 & 1.960 e-02 \\ \hline
1.0 & 1.0 & 0.9930872 & 0.9930876 & 0.0000004 & 0.9556 & 3.750 e-02 \\ \hline
\end{tabular}
\end{frame}
\end{document}
