Writing descriptions of columns of table
A solutions that, without too much code, does what's requested; the main trick is to reduce the \tabcolsep
(and the font size):
\begin{figure}
\centering\small\setlength{\tabcolsep}{1.45pt}
\begin{tabular}{|*{32}{c|}}
\multicolumn{32}{l}{Bit}\\
\multicolumn{8}{|c|}{\tiny 31\hfill 24}&
\multicolumn{8}{c|}{\tiny 23\hfill 16}&
\multicolumn{8}{c|}{\tiny 15\hfill 8}&
\multicolumn{8}{c|}{\tiny 7\hfill 0} \\
\hline
S &
E & E & E & E & E & E & E & E &
M & M & M & M & M & M & M & M &
M & M & M & M & M & M & M & M &
M & M & M & M & M & M & M \\
\hline
\multicolumn{1}{|c|}{}&
\multicolumn{8}{c|}{Wykładnik} &
\multicolumn{23}{c|}{Mantysa} \\
\cline{2-32}
\multicolumn{5}{|c}{Znak} & \multicolumn{27}{c}{}\\
\cline{1-5}
\end{tabular}
\caption{IEEE754}
\end{figure}
If cells are desired to have the same width, then I suggest some changes.
\documentclass{article}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\usepackage{array}
\begin{document}
\begin{figure}
\centering\small
{\sffamily
\newlength{\bitwidth}\settowidth{\bitwidth}{M}
\newcommand{\bitname}[1]{\makebox[\bitwidth]{#1}}
\newcommand{\bitrule}{\vrule height 6pt}
\setlength{\extrarowheight}{2pt}
\setlength{\tabcolsep}{1.1pt}
\begin{tabular}{|*{32}{c|}}
\multicolumn{32}{l}{Bit}\\
\multicolumn{8}{@{\bitrule}c@{\bitrule}}{\tiny\,31\hfill 24\,}&
\multicolumn{8}{@{}c@{\bitrule}}{\tiny\,23\hfill 16\,}&
\multicolumn{8}{@{}c@{\bitrule}}{\tiny\,15\hfill 8\,}&
\multicolumn{8}{@{}c@{\bitrule}}{\tiny\,7\hfill 0\,} \\
\hline
\bitname{S} &
\bitname{E} & \bitname{E} & \bitname{E} & \bitname{E} &
\bitname{E} & \bitname{E} & \bitname{E} & \bitname{E} &
M & M & M & M & M & M & M & M &
M & M & M & M & M & M & M & M &
M & M & M & M & M & M & M \\
\hline
\multicolumn{1}{|c|}{}&
\multicolumn{8}{c|}{Wykładnik} &
\multicolumn{23}{c|}{Mantysa} \\
\cline{2-32}
\multicolumn{5}{|c}{Znak} & \multicolumn{27}{c}{}\\
\cline{1-5}
\end{tabular}}
\caption{IEEE754}
\end{figure}
\end{document}
Since "M" is usually the widest character in a font, setting the "S" and the "E" so that they occupy as much space as an "M" is easy. I've modified slightly other aspects as indicated in comments.
If you need colors, you may use colortbl
or table
from xcolor
and more preferably tikz
. But this is a simple way with ordinary tabular:
\documentclass{article}
\usepackage{polski,array,fullpage}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{table}[htb]
\centering
\begin{tabular}{|*{32}{@{}>{\centering\arraybackslash}p{.4cm}@{}|} }
\multicolumn{32}{@{}l}{Bit}\\
\multicolumn{1}{|@{}c@{}}{31} &\multicolumn{6}{@{}r@{}}{}&\multicolumn{1}{@{}c@{}|}{24}&\multicolumn{1}{@{}c@{}}{23} &\multicolumn{6}{@{}r@{}}{}&\multicolumn{1}{@{}c@{}|}{16}&\multicolumn{1}{@{}c@{}}{15} &\multicolumn{6}{@{}r@{}}{}&\multicolumn{1}{@{}c@{}|}{8}&\multicolumn{1}{@{}c@{}}{7} &\multicolumn{5}{@{}r@{}}{}&\multicolumn{1}{@{}c@{}|}{1}&\multicolumn{1}{@{}c@{}|}{0}\\\hline
S & E & E & E & E & E & E & E & E & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M & M \\\hline
& \multicolumn{8}{c|}{Wykładnik} &\multicolumn{23}{c|}{Mantysa}\\\cline{2-32}
\multicolumn{6}{|c}{Znak} & \multicolumn{26}{c}{}\\ \cline{1-6}
\end{tabular}
\caption{IEEE754}
\end{table}
\listoffigures
\listoftables
\end{document}