\begin{spreadtab}{{tabular}{rrrr}}
\toprule
& @A & @B & @C \\
\midrule
1 & 33 122 & 133/\Factor & 156/\Factor \\
2 & 66 112 & 135/\Factor & 155/\Factor \\
3 & 77 150 & 139/\Factor & 158/\Factor \\
4 & 55 145 & 135/\Factor & 159/\Factor \\
5 & 44 150 & 130/\Factor & 200/\Factor \\
\bottomrule
\end{spreadtab}
我收到此错误
FP 评估结果有多个值!
是否有一个技巧可以用来插入多个值?
答案1
我不确定这是否是您所需要的,但您可以将这些值视为文本条目:
\documentclass{article}
\usepackage{numprint}
\usepackage{booktabs}
\usepackage{spreadtab}
\newcommand\Factor{105}
\begin{document}
\renewcommand\STprintnum[1]{\numprint{#1}}
\nprounddigits{3}
\begin{spreadtab}{{tabular}{rrrr}}
\toprule
& @A & @B & @C \\
\midrule
1 & @33 122 & 133/\Factor & 156/\Factor \\
2 & @66 112 & 135/\Factor & 155/\Factor \\
3 & @77 150 & 139/\Factor & 158/\Factor \\
4 & @55 145 & 135/\Factor & 159/\Factor \\
5 & @44 150 & 130/\Factor & 200/\Factor \\
\bottomrule
\end{spreadtab}
\end{document}
答案2
您还可以调整解决方案形式按一定量划分表格单元格对于这种情况。这是自动版本,它使用r
您不想应用因子的列的列类型和R
应用因子的列类型。这里的第一个表使用{rrrr}
,第二个表使用{rrRR}
列。
代码:
\documentclass{article}
\usepackage{booktabs}
\usepackage{collcell}
\usepackage{pgf}
\usepackage{etoolbox}
\usepackage{letltxmacro}
\newcommand{\Factor}{105}%
\newcommand{\FactorCell}[1]{%
\iftoggle{DoneWithHeader}{%
\pgfmathsetmacro{\ComputedValue}{#1/\Factor}%
\pgfmathprintnumber[precision=3]{\ComputedValue}%
}{%
#1% Still working on header
}%
}%
\newtoggle{DoneWithHeader}%
\togglefalse{DoneWithHeader}%
\newcommand*{\StartingHeader}{\global\togglefalse{DoneWithHeader}}%
\newcommand*{\DoneWithHeader}{\global\toggletrue{DoneWithHeader}}%
\LetLtxMacro\OldTopRule\toprule
\def\toprule{\StartingHeader\noexpand\OldTopRule}
\LetLtxMacro\OldMidRule\midrule
\def\midrule{\DoneWithHeader\noexpand\OldMidRule}
\newcolumntype{R}{>{\collectcell\FactorCell}r<{\endcollectcell}}
\begin{document}
\begin{tabular}{rrrr}
\toprule
& A & B & C \\
\midrule
1 & 33 122 & 133 & 156 \\
2 & 66 112 & 135 & 155 \\
3 & 77 150 & 139 & 158 \\
4 & 55 145 & 135 & 159 \\
5 & 44 150 & 130 & 200 \\
\bottomrule
\end{tabular}%
\hspace{2.0ex}
\begin{tabular}{rrRR}
\toprule
& A & B & C \\
\midrule
1 & 33 122 & 133 & 156 \\
2 & 66 112 & 135 & 155 \\
3 & 77 150 & 139 & 158 \\
4 & 55 145 & 135 & 159 \\
5 & 44 150 & 130 & 200 \\
\bottomrule
\end{tabular}%
\end{document}