2

Is there anyway to draw like this on Latex? Thank you 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.

2 Answers2

3

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}

enter image description here

2

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}

enter image description here

Bernard
  • 271,350