I am whole new to LaTeX, and everything keep mess up when I tried drawing this thing. Can you guys help me out. Thank you so much.
- 37,006
- 59
-
2Welcome to TeX.SE! Can you please show us the code you have tried so far? – Mensch Sep 29 '21 at 20:19
2 Answers
The \mybox macro first checks for a non-empty mandatory argument to set the color of the "box". It then uses a stack to set the optional argument of \mybox underneath of the boxed mandatory argument.
To create the whole unit, I use another stack, in which the label is set atop of 4 invocations of \mybox.
\documentclass{article}
\usepackage{stackengine,xcolor}
\newcommand\mybox[2][]{%
\ifx\relax#2\relax\def\bxcol{white}\else\def\bxcol{gray!50}\fi
\stackunder[2pt]{\fcolorbox{black}{\bxcol}{\vphantom{X}%
\makebox[1.2ex]{\textbf{#2}}}}{#1}%
\kern2pt\ignorespaces
}
\begin{document}
\stackon{\mybox[6]{}
\mybox[5]{}
\mybox[4]{}
\mybox{E}}{Type 4}
\end{document}
- 237,551
Here 's a way to it with basic tools (a tabular, xcolor and hhline):
\documentclass[12pt]{article}
\usepackage{array, hhline}
\usepackage[svgnames, table]{xcolor}
\setlength{\doublerulesep}{3pt}
\begin{document}
\begin{tabular}{|*{3}{wc{0.3cm}||} >{\rule[-0.2cm]{0pt}{\dimexpr0.3cm + 12pt}}wc{0.3cm}|}
\multicolumn{4}{c}{\bfseries Type 1}\
\hhline{|-||-||-||-|}
\cellcolor{Gainsboro}\bfseries E & & & \
\hhline{|-||-||-||-|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{\bfseries 6} & \multicolumn{1}{c}{\bfseries 5} & \multicolumn{1}{c}{\bfseries 4}
\end{tabular}
\end{document}
- 271,350

