Graphics, Figures & TablesExcel maths in a table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
AJVergen
Posts: 1
Joined: Fri Apr 19, 2024 8:08 pm

Excel maths in a table

Post by AJVergen »

Hey, I'm new to LaTeX and trying to figure out some things for my university assignment.
I'm trying to create a table similar to those in Excel, where it would take the inputs of a certain predetermined list of cells and add them together in another cell.
This is my current code, using tabularray. I have tried using spreadtab, but it doesn't quite want to work and I don't know why.

Code: Select all

\begin{tblr}{colspec={|[1pt]X[1,l]|X[2,l]|X[2,l]|X[1,r]|[1pt]}, hline{1,2,Y,Z} = {1pt}, hline{3-X} = {solid}, row{1,Z} = {font=\bfseries}}

Weekday & Meal & Alternative & approx.cost\\
Monday & food & special food & 5 \\
Tuesday & food & special food & 4 \\
Wednesday & food & special food & 10 \\
Thursday & food & special food & 18 \\
Friday & food & special food & 12 \\
Saturday & food & special food & 5 \\
Sunday & food & special food & 9  \\
\hline[1pt]
\SetCell[c=3]{l} Total cost & 3-2 & 3-3 
        & \SetCell[c=1]{r}d2+d3+d4+d5+d6+d7+d8\\
\end{tblr}
Would love some help :D

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
Post Reply