I'm making documentation for data communication protocol and trying to make a table column which shows an offset of the message fields, calculated for each field (table row) and takes field width instead. For offset calculation I made a counter, which keeps current offset, and define new command:

{\thebytepos--\the\numexpr\value{bytepos} + #1 - 1\relax\addtocounter{bytepos}{#1}}%

I also define new column type, which should call my command for every item in the column:


For populating table I use next sample code:

  2 & Start mark   \\
  8 & Message data \\
  4 & Service info \\
  1 & Checksum     \\
  1 & End mark

It should be compiled as like as

   0-- 1 & Start mark   \\
   2-- 9 & Message data \\
  10--13 & Service info \\
  14     & Checksum     \\
  15     & End mark

But I gave “missing number, treated as zero” instead. After searching in network I found that numbers in LaTeX is something special, and it's looks like \usebox returns complete and glued box, not a text, which cannot be converted back to raw text.

How can I get raw text from every row? Or maybe my understanding is wrong and I missing something simple and important?


It is easier to manipulate count registers than boxes

enter image description here



  2 & Start mark   \\
  8 & Message data \\
  4 & Service info \\
  1 & Checksum     \\
  1 & End mark

| improve this answer | |

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.