Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\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 ?

share|improve this question
    
Can you please explain why do you want to have multiple values in one cell? A description of your goal could be useful. –  Gonzalo Medina Jul 31 '12 at 6:14
    
i need to display feature numbers selected by feature selection algorithm on one column. and the amount of features can vary –  user581544 Jul 31 '12 at 6:19
    
Related Question: divide table cells by a certain amount. –  Peter Grill Jul 31 '12 at 8:30
add comment

2 Answers

up vote 4 down vote accepted

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

share|improve this answer
add comment

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.