3

I'm trying to get this table of density measurements to display properly on this beamer frame. This is the best I've been able to achieve so far, but I can't get the text size to shrink so all of the text fits on the slide.

\documentclass{beamer}

\begin{document} \begin{frame}

\begin{tabular}{300pt}{|l l|l l|l l|} \hline \multicolumn{2}{|c|}{Solids} & \multicolumn{2}{|c|}{Liquids} & \multicolumn{2}{|c|}{Gases}\ \hline Aluminum & 2.7 & Water (at $4^{\circ}$C) & 1.000 & Air & $1.29\times 10^{-3}$ \ \hline Brass & 8.44 & Blood & 1.05 & Carbon Dioxide & $1.98\times 10^{-3}$\ \hline Polystyrene & 0.10 & Sea Water & 1.025 & Carbon Monoxide & $1.25\times 10^{-3}$\ \hline Iron or Steel & 7.8 & Mercury & 13.6 & Hydrogen & $0.090\times 10^{-3}$\ \hline Ice & 0.917 & Ethyl Alcohol & 0.79 & Oxygen & $1.43\times 10^{-3}$\ \hline Bone & 1.7-2.0 & Olive Oil & 0.92 & Steam ($100^{\circ} C$) & $0.60\times 10^{-3}$\ \hline \end{tabular}

\end{frame} \end{document}

beamer slide

I've also tried using tabularx and good ol' tabular environments, but to no success.

  • Did you already try to reduce the font size, for example to \small? Probably, your table is then narrow enough to fit into the available space. – leandriis Jun 15 '21 at 06:10
  • 1
    What's the purpose of tabular* here? – leandriis Jun 15 '21 at 06:10
  • 2
    For a more inviting look of your table, you may want to consider getting rid of all vertical and most horizontal lines. – leandriis Jun 15 '21 at 06:11
  • 2
    If your table is still too wide, you could also use the corresponding chemical formulae instead of text, such as carbon monoxide. This should save you quite some space. Also, since all Gases in your table share the 10^-3, you could place this information in the column header and probably also add the missing units there, as well. – leandriis Jun 15 '21 at 06:13
  • @leandriis tabular* was to attempt to shrink the table into the text width. I tried your suggestions for the chemical formulae and the missing units, and it looks much better. Thank you! – Thomas Davis Jun 15 '21 at 06:43

2 Answers2

3

You need to reduce font size. Also I would use booktabs for horizontal rules and left to calculate \tablcolsep size to LaTeX. For quantities I would use siunitx package::

enter image description here

\documentclass{beamer}
\usepackage{booktabs}
\usepackage{siunitx}
\NewExpandableDocumentCommand\mcc{O{1}m}{\multicolumn{#1}{c}{#2}}

\begin{document} \begin{frame} \footnotesize \setlength\tabcolsep{0pt} \begin{tabular}{\linewidth}{@{\extracolsep{\fill}} {6}{l} } \toprule \mcc[2]{Solids} & \mcc[2]{Liquids} & \mcc[2]{Gases}\ \cmidrule{1-2} \cmidrule{3-4} \cmidrule{5-6} Aluminum & 2.7 & Water (at \qty{4}{\degreeCelsius}) & 1.000 & Air & \num{1.29e-3} \ Brass & 8.44 & Blood & 1.05 & Carbon Dioxide & \num{1.98e-3}\ Polystyrene & 0.10 & Sea Water & 1.025 & Carbon Monoxide & \num{1.25e-3}\ Iron or Steel & 7.8 & Mercury & 13.6 & Hydrogen & \num{0.09e-3} \ Ice & 0.917 & Ethyl Alcohol & 0.79 & Oxygen & \num{1.43e-3} \ Bone & 1.7-2.0 & Olive Oil & 0.92 & Steam \qty{100}{\degreeCelsius} & \num{0.60e-3}\ \bottomrule \end{tabular*}

\end{frame} \end{document}

Zarko
  • 296,517
1

With some minor redesigns of your table's contents, you can easily fit the whole table into a frame without decreasing the font size:

enter image description here

\documentclass{beamer}

\usepackage{siunitx} \usepackage{booktabs} \usepackage{chemformula}

\sisetup{range-phrase = --, per-mode=symbol}

\begin{document} \begin{frame}

{\setlength{\tabcolsep}{5.5pt} \begin{tabular}{@{}lS[table-format=1.3] l@{}S[table-format=2.3] lS[table-format=1.3]@{}} \toprule Solids & {$\rho$ } & Liquids & {$\rho$ } & Gases & {$\rho$ }\ & {(\unit{\kg\per\cubic\m})} & & {(\unit{\kg\per\cubic\m})} & & {(\unit{\g\per\cubic\m})} \ \cmidrule(r){1-2} \cmidrule(lr){3-4} \cmidrule(l){5-6} Aluminum & 2.7 & Water\textsuperscript{a} & 1.000 & Air & 1.29 \ Brass & 8.44 & Blood & 1.05 & \ch{CO2} & 1.98 \ Polystyrene & 0.10 & Sea Water & 1.025 & \ch{CO} & 1.25 \ Iron or Steel & 7.8 & Mercury & 13.6 & \ch{H2} & 0.090 \ Ice & 0.917 & Ethyl Alcohol & 0.79 & \ch{O2} & 1.43 \ Bone & {\numrange{1.7}{2.0}} & Olive Oil & 0.92 & Steam\textsuperscript{b} & 0.60 \ \bottomrule \multicolumn{6}{l}{\footnotesize \textsuperscript{a} \qty{4}{\degreeCelsius}, \quad \textsuperscript{b} \qty{100}{\degreeCelsius}} \end{tabular} } \end{frame} \end{document}

leandriis
  • 62,593