5
\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}

I receive this error

FP Evaluation results in multiple values!

Is there a trick that i can use to insert multiple values ?

David Carlisle
  • 757,742

2 Answers2

5

I am not sure if this is what you need, but you can treat those values as text entries:

\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}

enter image description here

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128
1

You can also adapt the solutions form divide table cells by a certain amount for this case. Here is the automated version which uses the r column type for the column where you don't want the factor applied and the R column type to apply the factor. The first table here uses {rrrr} and the second table uses {rrRR} columns.

enter image description here

Code:

\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}

Peter Grill
  • 223,288