1

I'm using spreadtab to calculate a single column of integers in a table. As in this sample I calculate sums by counting the lines manually.

Is there any possibility to count the lines programmaticaly so the b4can be updated automatically when Ii add some more row's?

\begin{spreadtab}{{tabular}{l|l}}
          & @ Foo      \\
@ one     & 5          \\
@ two     & 9          \\
@ three   & 13         \\ 
          & sum(b2:b4)    
\end{spreadtab}
Bernard
  • 271,350
novski
  • 1,039

1 Answers1

1

From spreadtab manual page 17

Rather than referring to a cell by its coordinates which are dificult to remember and change if you insert a row or column, it is sometimes more convenient to give a name to a cell and refer to it later by name. The macro function ‘tag()’ gives a name to the cell in which it is located.

\documentclass[12pt]{article}
\usepackage{spreadtab}

\begin{document}

\begin{spreadtab}{{tabular}{l|l}}
          & @ Foo       \\
@ one     & 5tag(start) \\
@ two     & 9           \\
@ three   & 13          \\ 
@ four    & 15tag(end)  \\
          & sum(cell(start):cell(end))    
\end{spreadtab}

\end{document}
Salim Bou
  • 17,021
  • 2
  • 31
  • 76