pytexit icon indicating copy to clipboard operation
pytexit copied to clipboard

How to process mixed fraction using py2tex for correct printing

Open shashikulk opened this issue 2 years ago • 4 comments

I want to print a mixed fraction (say one and half 1 1/2 or two and three fifth 2 3/5) as a mixed fraction (and not as an improper fraction) in the latex output. But I am not able to figure out how to pass it to py2tex as input so that it is processed as a mixed fraction. Any pointers or help on this request is highly appreciated. Thanks

shashikulk avatar Mar 07 '23 09:03 shashikulk

What's your input ? Do you have 1.5 in Python and would like 1 + 1/2 in the Latex output ?

erwanp avatar Mar 07 '23 17:03 erwanp

My input is 3/2 (improper fraction). I can process it to separate out the whole part (which is 1 in this case) and proper fraction part (which is 1/2 in this case) if needed/easier for py2tex to handle. And in the Latex output, I would like to get 1 1/2 as per mixed fraction format as I need to eventually display/print it in that format in a Word document.

shashikulk avatar Mar 07 '23 17:03 shashikulk

That's really specific, py2tex cannot do this at the moment.

Maybe this can help : https://stackoverflow.com/questions/45915359/how-to-display-a-fraction-as-a-mixed-number-in-maxima

erwanp avatar Mar 07 '23 18:03 erwanp

Thanks for the pointer. For the time being, I have written a workaround code to handle my requirement.

shashikulk avatar Mar 08 '23 05:03 shashikulk