I want to create a table just like this. How do I go about it? Do I use tables? A combination of tables and tikz maybe?

- 47
-
1How to create a small cell with borders in the top corner of a cell in the table? , How to create transportation table like this, rectangle in corner of table and How to make tables with a small cell to the right inside another large cell? are a bout a somewhat similar-looking table. Probably you can make use of the answers to these questions. – leandriis May 24 '21 at 20:18
-
You can use Table Generator combined with a box around certain numbers. – Vinicius May 24 '21 at 20:08
1 Answers
Something like this? Observe: no TikZ code whatsoever.
\documentclass{article} % or some other suitable document class
\usepackage[]{geometry} % set page parameters suitably
\usepackage{array} % for "w" column type
\usepackage{calc} % for "\widthof" macro
\newcommand{\mycell}[2]{%
\begingroup
\setlength\tabcolsep{2pt}%
\begin{tabular}{ wr{\widthof{600}} c wr{\widthof{600}} }
& & \multicolumn{1}{|r|}{#1} \\
\cline{3-3}
#2 & &
\end{tabular}%
\endgroup}
\begin{document}
\begin{table}
\centering
\setlength\tabcolsep{5pt}
\setlength\extrarowheight{2pt}
\begin{tabular}{|c*{7}{|r}}
\hline
\multicolumn{1}{|c}{} & \multicolumn{6}{c}{Distribution centers} & \
\hline
sources & 3 & 4 & 5 & 6 & 7 & 8 & SUPPLY \
\hline
1 & \mycell{16}{} & \mycell{10}{} & \mycell{12}{300} & \mycell{100}{} & \mycell{100}{} & \mycell{100}{} & 300 \
\hline
2 & \mycell{15}{0} & \mycell{14}{300} & \mycell{17}{} & & & & 300 \
\hline
3 & \mycell{0}{600} & & & & & & 600 \
\hline
4 & \mycell{100}{} & & & & & & 600 \
\hline
5 & \mycell{100}{} & & & & & & 600 \
\hline
DEMAND & 600 & 600 & 600 & 200 & 100 & 300 & \
\hline
\end{tabular}
\caption{Final solution table}
\label{tab:fst}
\end{table}
\end{document}
- 506,678
