erwanp / pytexit

Convert a Python expression to a LaTeX formula
https://pytexit.readthedocs.io/
Other
114 stars 31 forks source link

How to process mixed fraction using py2tex for correct printing #62

Open shashikulk opened 1 year ago

shashikulk commented 1 year ago

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

erwanp commented 1 year ago

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

shashikulk commented 1 year ago

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.

erwanp commented 1 year ago

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

shashikulk commented 1 year ago

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