我需要在表格中将(量级)条放在数字旁边。对于这项任务,我发现这个解决方案非常棒: 是否可以在表格中创建条形图?我已多次依赖过它。
不过,我现在遇到的问题是,我的数字太小了,我想把它们放大,这样读者就能更好地判断我的数字的大小。我试过使用更大的单位。英寸似乎是 Latex 中最大的单位,但这仍然不能给我足够大的条。
在解决方案链接中,user3573959 似乎遇到了同样的问题。但他的问题仍未得到解答。我尝试了几个地方来插入原始问题的原始发布者 (John) 提供的比例 - 但没有成功。在下面找到一个 MWE,旨在提供缩放比例的部分(根据 user3573959)目前已被注释掉。
任何帮助都将不胜感激。提前致谢!
\documentclass[t]{beamer}
\mode<presentation>
{
\usetheme{default}
\usecolortheme{default}
\usefonttheme{default}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{caption}[numbered]
}
%\pgfmathsetmacro{\len}{#1*5}
\def\mybar#1{%%
#1\% & {\color{lightgray}\rule{#1in}{8pt}}}
\begin{document}
\begin{frame}
\begin{block}
\tiny
\begin{tabular}{l|l|lll|lll}
Decade&Wordcount&\multicolumn{3}{|c|}{item01}&\multicolumn{3}{|c}{item02}\\
& & N & \multicolumn{2}{c|}{freq} & N & \multicolumn{2}{c}{freq} \\\hline
1800&119589&33 & \mybar{0.02759}&9 & \mybar{0.00753}\\
1810&154930&64 & \mybar{0.04131}&11 & \mybar{0.0071}\\
1820&85511&49 & \mybar{0.0573}&15 & \mybar{0.01754}\\
1830&164233&94 & \mybar{0.05724}&32 & \mybar{0.01948}\\
\end{tabular}
\end{block}
\end{frame}
\end{document}
答案1
\dimexpr
只需在您的定义中使用 \mybar
:
\documentclass[t]{beamer}
\mode<presentation>
{
\usetheme{default}
\usecolortheme{default}
\usefonttheme{default}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{caption}[numbered]
}
%\pgfmathsetmacro{\len}{#1*5}
\def\mybar#1{%%
#1\% & {\color{lightgray}\rule{\dimexpr#1in*14\relax}{8pt}}}
\begin{document}
\begin{frame}
\tiny
\begin{tabular}{l|l|lll|lll}
Decade&Wordcount&\multicolumn{3}{|c|}{item01}&\multicolumn{3}{|c}{item02}\\
& & N & \multicolumn{2}{c|}{freq} & N & \multicolumn{2}{c}{freq} \\\hline
1700&10097&6 & \mybar{0.05942}&2 & \mybar{0.01981}\\
1710&141251&43 & \mybar{0.03044}&3 & \mybar{0.00212}\\
1720&171035&47 & \mybar{0.02748}&16 & \mybar{0.00935}\\
1730&96002&17 & \mybar{0.01771}&19 & \mybar{0.01979}\\
1740&190771&64 & \mybar{0.03355}&3 & \mybar{0.00157}\\
1750&116881&67 & \mybar{0.05732}&4 & \mybar{0.00342}\\
1760&195612&66 & \mybar{0.03374}&9 & \mybar{0.0046}\\
1770&145412&66 & \mybar{0.04539}&16 & \mybar{0.011}\\
1780&189086&104 & \mybar{0.055}&8 & \mybar{0.00423}\\
1790&206106&89 & \mybar{0.04318}&22 & \mybar{0.01067}\\
1800&119589&33 & \mybar{0.02759}&9 & \mybar{0.00753}\\
1810&154930&64 & \mybar{0.04131}&11 & \mybar{0.0071}\\
1820&85511&49 & \mybar{0.0573}&15 & \mybar{0.01754}\\
1830&164233&94 & \mybar{0.05724}&32 & \mybar{0.01948}\\
1840&228263&101 & \mybar{0.04425}&36 & \mybar{0.01577}\\
1850&138121&78 & \mybar{0.05647}&18 & \mybar{0.01303}\\
1860&155562&78 & \mybar{0.05014}&21 & \mybar{0.0135}\\
1870&119327&72 & \mybar{0.06034}&24 & \mybar{0.02011}\\
1880&168688&64 & \mybar{0.03794}&7 & \mybar{0.00415}\\
1890&143624&72 & \mybar{0.05013}&24 & \mybar{0.01671}\\
1900&117377&52 & \mybar{0.0443}&10 & \mybar{0.00852}\\
1910&121755&76 & \mybar{0.06242}&13 & \mybar{0.01068}\\\hline
all: &3179233&1402&\mybar{0.0441}&322&\mybar{0.01013}\\
\end{tabular}
\end{frame}
\end{document}