0

I recently discovered the spreadtab package since I needed some spreadsheets with some calculations.

I would like to produce a LaTeX file with the grades of my students, i. e. something like this (eight problems 10 points each and the total sum). However, I also would like to put dash - instead of zero if the student didn't write anything for this problem. But then the usual sum is not working. Is it possible to adjust this?

Here is a standard code (without dashes). Ideally, modified sum should simply avoid cells with -, so some sort of conditional summation should work.

\documentclass[a4paper,12pt]{article}

\usepackage[utf8]{inputenc} \usepackage{spreadtab}

\begin{document}

\begin{spreadtab}{{tabular}{|c|c|c|c|c|c|c|c|c|}} \hline @ 1 & @ 2 & @ 3 & @ 4 & @ 5 & @ 6 & @ 7 & @ 8 & @ $\sum$ \ \hline 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & sum(a2:h2) \ \hline \end{spreadtab}

\end{document}

richrow
  • 309

1 Answers1

1

Insert a @ before the dash.

aa

\documentclass[a4paper,12pt]{article}

\usepackage[utf8]{inputenc} \usepackage{spreadtab}

\begin{document}

\begin{spreadtab}{{tabular}{|c|c|c|c|c|c|c|c|c|}}
    \hline
    @ 1 & @ 2   & @ 3   & @ 4   & @ 5   & @ 6   & @ 7   & @ 8   & @ $\sum$  \\
    \hline
    10  & 10    & 10    & @ -   & 10    & 10    & 10    & 10    & sum(a2:h2) \\
    \hline
\end{spreadtab}

\end{document}

Simon Dispa
  • 39,141