Template for Messaging Interface Control Document

Is there a template that allows me to define a table for messaging interface control document that will look something like this:

I am looking for something that will allow me to specify the message by defining the elements within the message as something like this:

\makemessage{FooMsg,3,16,"Foo Message Definition"}

• Is there any news here? It is quite unlikely that something like that already exists. – Johannes_B Aug 2 '16 at 12:16
• I found nothing. Nor did I have the time to learn how to create my own. – Jerunh Aug 2 '16 at 14:28
• Added an answer that I think fulfils the question. – juandesant Jul 6 '18 at 13:32

I think you might be interested in the bytefield package. You can represent what you want as follows:

\documentclass{article}

\usepackage{bytefield}

\begin{document}

\begin{bytefield}[bitwidth=1.1em, endianness=big]{16}
\begin{rightwordgroup}{Word 0}
\bitbox{13}{Message Unique ID} & \bitbox{3}{Spare}
\end{rightwordgroup}\\
\begin{rightwordgroup}{Word 1}
\bitbox{8}{Module ID} & \bitbox{8}{Error ID}
\end{rightwordgroup}\\
\begin{rightwordgroup}{Word 2}
\bitbox{16}{Reserved}
\end{rightwordgroup}\\
\end{bytefield}

\end{document}


results in:

If you add boxformatting={\centering\small\ttfamily} to the parameters of the bytefield environment, you get something even more similar to what you require:

\documentclass{article}

\usepackage{bytefield}

\begin{document}
\begin{bytefield}[bitwidth=1.1em, endianness=big, boxformatting={\centering\small\ttfamily}]{16}
\begin{rightwordgroup}{Word 0}
\bitbox{13}{Message Unique ID} & \bitbox{3}{Spare}
\end{rightwordgroup}\\
\begin{rightwordgroup}{Word 1}
\bitbox{8}{Module ID} & \bitbox{8}{Error ID}
\end{rightwordgroup}\\
\begin{rightwordgroup}{Word 2}
\bitbox{16}{Reserved}
\end{rightwordgroup}\\
\end{bytefield}
\end{document}


• You can use this solution to create later some commands to do as you wanted. – juandesant Dec 26 '18 at 14:58