0

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

Message Interface Control Document

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"}
\addelement{FooMsg,0,0,3,"Spare"}
\addelement{FooMsg,0,3,13,"Message Unique ID"}
\addelement{FooMsg,1,0,8,"Error ID"}
\addelement{FooMsg,1,8,8,"Module ID"}
\addelement{FooMsg,2,0,16,"Reserved"}
  • 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
1

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}
         \bitheader{0-15} \\
         \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:

bytefield example with normal fonts

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}
         \bitheader{0-15} \\
         \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}

bytefield example with \ttfamily and centering

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.