Inspiration
Number of two-digit numbers not containing the digit ‘8’.
Code
- The standaloneclass can’t be used with\caption.
- *{8}{c}means 8- c.
- >{\columncolor{cyan}}cgives the column color. It- \usepackage[table]{xcolor}.
- \rowcolor{cyan}overrides the column colors.
- \cellcolor{white}overrides the above two commands. It has to be carried out one-by-one without any fancy package.
- \multicolumn{n}{<alignment>}{content}defines a multi-column cell.
- \multirow{n}{*}{content}defines a multi-row cell. It- \usepackage{multirow}. It can’t contain- \multicolumn.
- \cline{i-j}draws a horizontal line above the row from column- ito column- j.
- No fancy way of coloring multirow cells without fancy packages.
- \multirow{-9}at the last row creates a cell spanning nine rows from bottom to above, so that its content won’t be covered by colors of former rows.
- \rotatebox[origin=[clr]]{angle}{content}: rotate- contentby- angleanticlockwise with- [clr]as the rotation center.
\documentclass[12pt]{article}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Sample \LaTeX{} multirow table}
\vspace*{1ex}
\label{multiprogram}
\begin{tabular}{|c|c|*{8}{c}>{\columncolor{cyan}}cc|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{}} & \multicolumn{10}{c|}{unit digit} \\\cline{3-12}
\multicolumn{2}{|c|}{} & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\\hline
& 1 & &  &  &  &  &  &  &  &  &  \\
& 2 & &  &  &  &  &  &  &  &  &  \\
& 3 & &  &  &  &  &  &  &  &  &  \\
& 4 & &  &  &  &  &  &  &  &  &  \\
& 5 & &  &  &  &  &  &  &  &  &  \\
& 6 & &  &  &  &  &  &  &  &  &  \\
& 7 & &  &  &  &  &  &  &  &  &  \\
\rowcolor{cyan} \cellcolor{white}
& 8 & &  &  &  &  &  &  &  &  &  \\
\multirow{-9}{*}{\rotatebox[origin=c]{90}{tens digit}}
& 9 & &  &  &  &  &  &  &  &  &  \\\hline
\end{tabular}
\end{table}
\end{document}
Result:
[Read More]