我正在尝试让这个密度测量表在这个投影仪框架上正确显示。这是我目前能做到的最好结果,但我无法缩小文本大小,以便所有文本都适合幻灯片。
\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}
我也尝试过使用 tabularx 和旧的表格环境,但没有成功。
答案1
您需要减小字体大小。此外,我会使用booktabs
水平规则和左侧来计算\tablcolsep
LaTeX 的大小。对于数量,我会使用siunitx
包::
\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}
答案2
通过对表格内容进行一些细微的重新设计,您可以轻松地将整个表格放入框架中,而无需减小字体大小:
\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}