Das Spreadtab-Paket Teil 4

Von Christian Tellechea, dem Autor von Spreadtab, habe ich als Kommentar zum dritten Teil noch einige Tipps bekommen, die ich mir sonst hätte mühsam zusammensuchen müssen. Da sein Beispiel im Kommentar aufgrund fehlender geschweifter Klammern nicht fehlerfrei durchlief, kommt hier eine bereinigte Version.

\documentclass{scrartcl}
\usepackage{spreadtab}
\usepackage{eurosym}
\usepackage{numprint}
\begin{document}
\STsetdecimalsep{,}% set the decimal separator to ,
\nprounddigits{2}% set the number of digit of the decimal part
\begin{spreadtab}[\STsavecell{\myresult}{d6}]{{tabular}{rrN{2}{2}N{2}{2}}}
@ Artikel & @ Anzahl & {@ Preis}& {@ Summe} \\ \hline
@Brot & 1.00 & :={2.00}\,\euro & :={[-1,0]*[-2,0]}\,\euro \\
@Butter & 2.00 & :={3.67}\,\euro & :={[-1,0]*[-2,0]}\,\euro  \\
@Milch & 3.00 & :={4.00}\,\euro & :={[-1,0]*[-2,0]}\,\euro \\
@Wein & 4.00 & :={5.00}\,\euro & :={[-1,0]*[-2,0]}\,\euro \\ \hline
 &     & {@Summe}     & :={sum(d1:[0,-1])}\,\euro  \\ \hline \hline
\end{spreadtab}
 
Die Gesamtsumme ist \numprint{\myresult}\,\euro.
 
\end{document}

Hinweis: Das Beispiel war fehlerhaft und hat ab D1 summiert, anstatt von D1. Im Quellcode hab ich es ausgetauscht, das richtige Ergebnis ist natürlich 41,34 Euro.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website