TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a report in Latex and need to represent the CRC computation. So basically, I need to show the Paper-n-Pencil Method of Long Division in LaTeX.

Any idea how I can approach this problem ? Any good reference would be highly appreciated.

I plan to write similar thing in LaTeX.

CRC Computation

share|improve this question

migrated from stackoverflow.com Aug 28 '11 at 11:57

This question came from our site for professional and enthusiast programmers.

Did you ever figure this out? I am needing to do the exact same thing. – nw. Sep 20 '11 at 1:33
sorry, I couldn't do in latex atleast. I computed in the paper and developed it in inkscape – www.sapnaedu.in Sep 20 '11 at 12:31
OK, well I found somewhat of a solution, which I will post here for others' reference. It's not elegant (have to do the division by hand) but good enough for my purposes. – nw. Sep 20 '11 at 16:25
up vote 4 down vote accepted

Per this article, I ended up doing this:


\vbox{\hrule width#2\digitwidth}}}
10010 \\ \hline
1011110 \\
101 \\ \divrule{0}{7}
~~~111 \\
~~~101 \\ \divrule{3}{4}

You have to do the division by hand, then use '~'s for aligning the digits. For the little bars, do \divrule{startPosition}{length}.

Example output:
enter image description here

share|improve this answer
Thats so wonderful. I will try using the same approach. Thanks for sharing – www.sapnaedu.in Sep 20 '11 at 22:55

I've never used it myself, but you might try this package. It would likely require modification for binary, though.

There is also this post.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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