Graphics, Figures & TablesSpreadtab Package - Autoround Key

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kurttodoroff
Posts: 27
Joined: Thu Feb 07, 2019 4:25 pm

Spreadtab Package - Autoround Key

Post by kurttodoroff »

I opened a document, after last editing it eleven years ago.

The LaTeX compile generated an error. I discovered that the Spreadtab package no longer supported STautoround.

I substituted the autoround key, as described in the documentation. They output does not display the decimal digits. Spreadtab does calculate the arithmetic operations, properly.

Code: Select all

\begin{center}
% \STautoround*{2}
\begin{spreadtab}[autoround=2]{{tabular}{|lrcr|}}
\hline
@\multicolumn{1}{|c}{\textbf{\textsc{Article}}} & 
@\multicolumn{1}{c}{\textbf{\textsc{Article Cost}}} & 
@\multicolumn{1}{c}{\textbf{\textsc{Quantity}}} & 
@\multicolumn{1}{c|}{\textbf{\textsc{Total Cost}}} \\
& & & \\
\hline
@\ruckus\ \zoneflex\ 7782 \wifi\ \AccessPoint\ & 2999.00*1.0 & 3 & b3*c3 \\
@901--7782--US01 & & & \\
& & & \\
\hline
@\ruckus\ \zonedirector\ 1106 \wifi\ \Controller\ & 1200.00*1.0 & 1 & b6*c6 \\
@(Primary \LAN\ \Controller) & & & \\
@901--1106--US00 & & & \\
& & & \\
\hline
@\ruckus\ Premium Support 1--Year & 240.00*.85*1.5*1.0 & 1 & b10*c10 \\
@(Primary \LAN\ \Controller) & & & \\
@801--1106--1000 & & & \\
& & & \\
\hline
@\NETGEAR\ FS116P ProSafe \Switch\ & 185.00 & 1 & b14*c14 \\
@16--Port 10/100 \POE\ (8--ports) & & & \\
& & & \\
\hline
@Materials & & & (50.00*4)+0+750.00 \\  %CCLLC=$50/D*4D  %CT=$750
& & & \\
\hline
@Labor & & & (90*1*4)+2500.00 \\  %CCLLC=$90/H*1H/D*4D  %CT=$2500
& & & \\
\hline
@\textbf{Total} & & & sum(d3:d19) \\
& & & \\
\hline
\end{spreadtab}
\end{center}
The Spreadtab documentation states that Spreadtab requires LaTeX2e after 2022-06-01, the Xstring package, the Simplekv package.

This document does not load the two packages. However, as I stated, Spreadtab does calculate the arithmetic operations, properly without them.

Does the Spreadtab autoround key require them? If not, have I made an error in the code?

Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10311
Joined: Mon Mar 10, 2008 9:44 pm

Re: Spreadtab Package - Autoround Key

Post by Stefan Kottwitz »

Hi Kurt,

the code is not compilable, so it cannot be tested or improved. Perhaps edit the post and complete it, so readers can test it.

Stefan
LaTeX.org admin
kurttodoroff
Posts: 27
Joined: Thu Feb 07, 2019 4:25 pm

Re: Spreadtab Package - Autoround Key

Post by kurttodoroff »

Hi, Stefan.

Try this.

Code: Select all

\begin{center}
% \STautoround*{2}
\begin{spreadtab}[autoround=2]{{tabular}{|lrcr|}}
\hline
@\multicolumn{1}{|c}{\textbf{\textsc{Article}}} & 
@\multicolumn{1}{c}{\textbf{\textsc{Article Cost}}} & 
@\multicolumn{1}{c}{\textbf{\textsc{Quantity}}} & 
@\multicolumn{1}{c|}{\textbf{\textsc{Total Cost}}} \\
& & & \\
\hline
@aaaaa & 2999.00*1.0 & 3 & b3*c3 \\
@11111 & & & \\
& & & \\
\hline
@bbbbb & 1200.00*1.0 & 1 & b6*c6 \\
@(Primary) & & & \\
@22222 & & & \\
& & & \\
\hline
@ccccc & 240.00*.85*1.5*1.0 & 1 & b10*c10 \\
@(Primary) & & & \\
@33333 & & & \\
& & & \\
\hline
@ddddd & 185.00 & 1 & b14*c14 \\
@44444 & & & \\
& & & \\
\hline
@Materials & & & (50.00*4)+0+750.00 \\  %CCLLC=$50/D*4D  %CT=$750
& & & \\
\hline
@Labor & & & (90*1*4)+2500.00 \\  %CCLLC=$90/H*1H/D*4D  %CT=$2500
& & & \\
\hline
@\textbf{Total} & & & sum(d3:d19) \\
& & & \\
\hline
\end{spreadtab}
\end{center}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10311
Joined: Mon Mar 10, 2008 9:44 pm

Re: Spreadtab Package - Autoround Key

Post by Stefan Kottwitz »

With STset;

Code: Select all

%!TEX lualatex
\documentclass{article}
\usepackage{spreadtab}
\begin{document}
\STset{autoround=2}
\begin{spreadtab}{{tabular}{|lrcr|}}
\hline
@Materials & & & (0.00*4)+0+750.0234 \\  %CCLLC=$50/D*4D  %CT=$750
\hline
\end{spreadtab}
\end{document}
Try the "Run LaTeX here" button.

Stefan
LaTeX.org admin
kurttodoroff
Posts: 27
Joined: Thu Feb 07, 2019 4:25 pm

Re: Spreadtab Package - Autoround Key

Post by kurttodoroff »

Hi, Stefan.

I am embarrassed. I erred.

This document contains two charts. The tabular environment created both charts. Both of them used spreadtab and \STautoround*{2}.

The first chart numbers produced no decimal values. The second chart numbers produced decimal values.

When LaTeX produced the error message, regarding the unsupported \STautoround*{2} command, after the first run, I used only the first chart to troubleshoot and repair. I should have used both charts.

I commented the \STautoround*{2} line, and then, added the [autoround=2] key to the next line. I reran LaTeX.

Of course, the numbers still did not display decimal values, because, there were none to display.

Moments ago, I modified the second chart with the [autoaround=2] key. It displayed decimal values, correctly.

So, my apologies for taking your time and research, unnecessarily.

That being said, does the Spreadtab package provide the ability to append ".00," when appropriate?

Thank you.
Post Reply