I don't want to display the modulo symbol, I want to programmatically calculate n modulo 3 and display the result.
migrated from stackoverflow.com Nov 11 '11 at 0:54
|
You can also use
The code that appears in the link posted in a comment, there are some spurious blank spaces producing an undesired indentation of the first line; here's a corrected version:
|
|||||||||||
|
|
There are several nice answers using different packages. I'd like to note that TeX uses integer arithmetics, so it is easy to program the standard formula a-(a/b)*b, where / means integer division. Plain TeX solution:
LaTeX solution:
|
||||
|
|
|
The
Since the result is stored in Similar functionality in terms of mathematical functions is provided with |
|||||||||||
|
|
The "expandable" version, using e-TeX's
|
|||
|
|
|
Another solution is to use pgfmath
|
|||
|
|
|
LaTeX3 (the
|
|||
|
|
|
You can use the
|
|||||
|


