I am using the rescale
option that was suggested in the other posts in this forum to fit a table in beamer
. However, the contents of the table move out of the frame.
\documentclass{beamer}
\usepackage{adjustbox,lipsum}
\usepackage{graphicx}
\begin{document}
%%\begin{adjustbox}{max width=\textwidth}
\scalebox{0.7}{
\begin{table}[h!]
\centering
\caption{ }
\begin{tabular}{|c|c|c|c|c|c| }
\hline
Name & Name&Name&NameName&NameName\\
\hline
NameName&-&-&-&-\\
NameName&NameName B &NameName B &- &NameName B\\
NameName&NameName A&NameName A&NameName A&NameName A\\
NameName&NameName B &NameName &-&- \\
NameName&NameName C&NameName C&NameName C&-\\
NameName&-&NameName&-&-\\
NameName&-&NameName&-&\\
\hline
\end{tabular}
\end{table}
}
\end{document}
Could someone help me to identify what's wrong in syntax that I am using?
Best Answer
Some suggestions:
Don't forget to employ
frame
environments in abeamer
document.In a
beamer
document,table
andfigure
environments do not "float", in the LaTeX-specific sense. Hence, the main reason for usingtable
andfigure
environments -- to act as "wrappers" around the core material -- is gone. The general recommendation: don't usetable
andfigure
environments inbeamer
documents.For your document, get rid of the
begin{table}
and\end{table}
directives and place the argument of\caption
in the frame title.There's not much to say about the specific
tabular
environment at hand. (Obviously, the many instances of NameName will get replaced with something more relevant...) The usual tricks and tips for making tabular material fit inside the text block therefore do not appear to provide much traction. I suggest that you use, for the specific table at hand, a\resizebox
directive to make it fit inside the width of the text block.No need to load the
graphicx
package explicitly: In thebeamer
document class, this package is loaded automatically.Here, then, is how I would rewrite your code: