What is the best way of including large tables in a beamer presentation?
- 89,023
- 26
- 255
- 291
- 471
-
Welcome to TeX.sx! Could you please be more specific about what you want to achieve. Maybe you can add a example of what you have tried. – Caramdir Dec 13 '11 at 22:13
-
1Possibly the question http://tex.stackexchange.com/questions/5067/shrinking-tables-for-presentations is of interest. – Caramdir Dec 13 '11 at 22:13
3 Answers
If you must include a large table in your presentation, you have a couple of options:
Construct the table as is necessary and resize it to fit within the actual
frameby scaling it down. This is easily obtainable via\resizebox{<width>}{<height>}{<stuff>}from thegraphicxpackage. In order to maintain the correct aspect ratio, specify the one length and make the other!. Here is a visualization:
\documentclass{beamer}% http://ctan.org/pkg/beamer \usepackage{graphicx}% http://ctan.org/pkg/graphicx \usepackage{booktabs}% http://ctan.org/pkg/booktabs \begin{document} \begin{frame} \frametitle{This is a frame with a table} \begin{tabular}{*{27}{l}} \toprule Stuff & A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z \\ \midrule One & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Two & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Three & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Four & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Five & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Six & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Seven & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ \bottomrule \end{tabular} \end{frame} \begin{frame} \frametitle{This is a frame with a table} \resizebox{\linewidth}{!}{% Resize table to fit within \linewidth horizontally \begin{tabular}{*{27}{l}} \toprule Stuff & A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z \\ \midrule One & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Two & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Three & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Four & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Five & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Six & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Seven & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ \bottomrule \end{tabular}} \end{frame} \end{document}You could break your table up into parts by only showing certain columns on certain slides. Another visualization:

\documentclass{beamer}% http://ctan.org/pkg/beamer \usepackage{booktabs}% http://ctan.org/pkg/booktabs \usepackage{array}% http://ctan.org/pkg/array \newsavebox{\mybox}% Store some content in a box \newcolumntype{G}{@{}>{\begin{lrbox}{\mybox}}l<{\end{lrbox}}@{}}% a column that Gobbles it's entries \begin{document} \begin{frame} \frametitle{This is a frame with a table} \begin{tabular}{*{14}{@{\hspace{2pt}}l@{\hspace{2pt}}}*{13}{G}} \toprule Stuff & A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z \\ \midrule One & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Two & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Three & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Four & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Five & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Six & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Seven & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ \bottomrule \end{tabular} \end{frame} \begin{frame} \frametitle{This is a frame with a table} \begin{tabular}{@{\hspace{2pt}}l@{\hspace{2pt}}*{13}{G}*{13}{@{\hspace{2pt}}l@{\hspace{2pt}}}} \toprule Stuff & A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z \\ \midrule One & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Two & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Three & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Four & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Five & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Six & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Seven & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ \bottomrule \end{tabular} \end{frame} \end{document}The advantage with an approach like this is that you code your entire table the way you want to, but selectively show the columns of interest. While row-removal from a table is easy (you either comment them out using
%, or delete them outright), column deletion is not that easy.Use
beamer's zooming capability. From thebeamerdocumentation on 11.3 Adding Anticipated zooming (p 109):Anticipated zooming is necessary when you have a very complicated graphic that you are not willing to simplify since, indeed, all the complex details merit an explanation. In this case, use the command
\framezoom. It allows you to specify that clicking on a certain area of a frame should zoom out this area. You can then explain the details. Clicking on the zoomed out picture will take you back to the original one.In the above description, "graphic" might just as well have read "object", since it pertains to tables as well.
For the sake of illustration, I've highlighted a couple of entries (in red
\alertfont) within the same table I've used before, this time also shrunk down using\resizeboxand then zoomed in on them using\framezoom.
\documentclass{beamer}% http://ctan.org/pkg/beamer \usepackage{graphicx}% http://ctan.org/pkg/graphicx \usepackage{booktabs}% http://ctan.org/pkg/booktabs \begin{document} \begin{frame} \frametitle{This is a frame with a table} \framezoom<1><2>[border=1](0pt,11mm)(4.5em,5ex) \resizebox{\linewidth}{!}{% Resize table to fit within \linewidth horizontally \begin{tabular}{*{27}{l}} \toprule Stuff & A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z \\ \midrule One & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Two & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Three & 1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ \alert{Four} & 26&25&24&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Five & 1&\alert{2}&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ Six & 26&25&\alert{24}&23&22&21&20&19&18&17&16&15&14&13&12&11&10&9&8&7&6&5&4&3&2&1 \\ Seven & \alert{1}&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16&17&18&19&20&21&22&23&24&25&26 \\ \bottomrule \end{tabular}} \end{frame} \end{document}In the above example, the border was inserted/kept for clarity. However, by default (if you remove the
border=<n>option), it will not be displayed.\framezoomhas the following syntax:\framezoom<button overlay spec><zoomed overlay spec>[<options>](<ulx>,uly>)(<zoom width>,<zoom depth>)As such, I requested a zoom of slide
<1>, upon clicking, to be typeset on slide<2>, adding an optional[border=1]of1pt. The zoomed location on slide<1>is at coordinate(<ulx>,<uly>)=(0pt,11mm)and spans an area of(<width>,<depth>)=(4.5em,5ex).
- 158,329
- 603,163
-
1Could anyone please explain the code that splits the table across slides (2nd option). What part of the code leads to the effect? – Heisenberg Dec 03 '14 at 02:46
-
1@Heisenberg: The column type
Gputs its contents in a box but never sets it. As such, the column entries (actually, the entire column) is gobbled/removed. You'll note 13l-columns followed by 13G-columns in the first table, but 13G-columns followed by 13l-columns in the second. So, in the first table, the latter 13 columns areGobbled, while in the second table, the first 13 columns areGobbled. – Werner Dec 03 '14 at 04:01 -
-
@adrCoder: Both. Tables in a presentation won't float, so it's similar to just a tabular. – Werner Sep 19 '15 at 20:29
-
For me it works on a
tabularbut not on atable. Is the command exactly the same or you have to define something differently? – AdrFinance Sep 19 '15 at 20:59 -
@adrCoder: You would still have a
tabularinside atable... so the usage should be similar. – Werner Sep 20 '15 at 00:03 -
@Werner : Yes the
tabularis inside thetablebut when I put the code above the table it doesn't work. Maybe it has something to do with the caption of the table? I will try removing it and check again.. or else I don't know why it is working for tabular but not for table – AdrFinance Sep 20 '15 at 07:25 -
The best way is not to include a large table in a presentation.
You show a slide for a minute or two. How many numbers could your audience read from it - while trying to listen to your talk? If your table is so large that it cannot fit a beamer page, it is probably too large for showing in a presenation.
You should consider changing formats: use a plot instead of a table to show the trends. An eye can see trends in a picture much better than in long columns of numbers.
- 38,129
-
14Your anwser is based on your experiences and does not offers a solution. Slides are typically written to be sefl-contained and informative at the same time, thus the need to include very large table. – Galois Theory Dec 16 '11 at 20:19
If you just need to reduce it a small amount, a simple option is to drop the font size down one level.
I had a figure that the header label went off the page by a character. Changing the table font size from \normal to \small improved this. Just be careful not to go too small. In this case, I was using the default beamer font size which is generously large. As @Boris points out, you should avoid showing extremely large tables.
- 587
- 1
- 7
- 18