I want to use numprint to add separators every three digits of a decimal representation of a rational BUT with an overline over the repeating digits.

For example, for the unitary fraction 1/42, I get:


without numprint and I want numprint spaces.

I mention that the number is constructed within pythontex concatenating integer part, irregular part and finally repeating part with overline.




from dvtDecimal import *


f = dvtDecimal(1, 42) 
print("$" + f.toTeX()[2] + "$")


and the python code looks like this: enter image description here

  • 2
    ...okay... so what does the input look like?
    – Werner
    Commented Jan 31, 2019 at 19:49
  • 1
    What's a "numprint space"? Please elaborate.
    – Mico
    Commented Jan 31, 2019 at 21:09
  • numprint is a package to separate digits. Maybe, I'd better put some LaTeX spaces \, every 3 digits directly in the python code instead... But as numprint is language sensitive, I thought it should be the first thing to try.
    – david
    Commented Jan 31, 2019 at 21:12
  • 1
    Why adding the Python code as an image? And where's it supposed to be used? I get ImportError: No module named dvtDecimal.
    – egreg
    Commented Jan 31, 2019 at 21:39


You must log in to answer this question.

Browse other questions tagged .